Fix nxstyle warning

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-12-31 03:06:56 +08:00 committed by Abdelatif Guettouche
parent 0defe43282
commit c647faa117
4 changed files with 146 additions and 97 deletions

View File

@ -113,6 +113,7 @@ struct stm32_lowerhalf_s
/**************************************************************************** /****************************************************************************
* Private Function Prototypes * Private Function Prototypes
****************************************************************************/ ****************************************************************************/
/* Prototypes for static methods in struct rtc_ops_s */ /* Prototypes for static methods in struct rtc_ops_s */
static int stm32_rdtime(FAR struct rtc_lowerhalf_s *lower, static int stm32_rdtime(FAR struct rtc_lowerhalf_s *lower,
@ -141,6 +142,7 @@ static int stm32_cancelperiodic(FAR struct rtc_lowerhalf_s *lower, int id);
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
/* STM32 RTC driver operations */ /* STM32 RTC driver operations */
static const struct rtc_ops_s g_rtc_ops = static const struct rtc_ops_s g_rtc_ops =
@ -786,8 +788,9 @@ static int stm32_rdalarm(FAR struct rtc_lowerhalf_s *lower,
* Name: stm32_periodic_callback * Name: stm32_periodic_callback
* *
* Description: * Description:
* This is the function that is called from the RTC driver when the periodic * This is the function that is called from the RTC driver when the
* wakeup goes off. It just invokes the upper half drivers callback. * periodic wakeup goes off. It just invokes the upper half drivers
* callback.
* *
* Input Parameters: * Input Parameters:
* None * None

View File

@ -367,7 +367,8 @@ static int adt7320_close(FAR struct file *filep)
* Name: adt7320_read * Name: adt7320_read
****************************************************************************/ ****************************************************************************/
static ssize_t adt7320_read(FAR struct file *filep, FAR char *buffer, size_t buflen) static ssize_t adt7320_read(FAR struct file *filep,
FAR char *buffer, size_t buflen)
{ {
FAR struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
FAR struct adt7320_dev_s *priv = inode->i_private; FAR struct adt7320_dev_s *priv = inode->i_private;
@ -524,7 +525,8 @@ static int adt7320_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* Write to the critical temperature register. Arg: b16_t value */ /* Write to the critical temperature register. Arg: b16_t value */
case SNIOC_WRITETCRIT: case SNIOC_WRITETCRIT:
adt7320_write_reg16(priv, ADT7320_TCRIT_REG, b16tob8((b16_t)arg) >> 1); adt7320_write_reg16(priv, ADT7320_TCRIT_REG,
b16tob8((b16_t)arg) >> 1);
break; break;
/* Read the hysteresis temperature register. Arg: b16_t* */ /* Read the hysteresis temperature register. Arg: b16_t* */
@ -560,7 +562,8 @@ static int adt7320_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* Write to the low temperature register. Arg: b16_t value */ /* Write to the low temperature register. Arg: b16_t value */
case SNIOC_WRITETLOW: case SNIOC_WRITETLOW:
adt7320_write_reg16(priv, ADT7320_TLOW_REG, b16tob8((b16_t)arg) >> 1); adt7320_write_reg16(priv, ADT7320_TLOW_REG,
b16tob8((b16_t)arg) >> 1);
break; break;
/* Read the high temperature register. Arg: b16_t* pointer */ /* Read the high temperature register. Arg: b16_t* pointer */
@ -578,7 +581,8 @@ static int adt7320_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* Write to the high temperature register. Arg: b16_t value */ /* Write to the high temperature register. Arg: b16_t value */
case SNIOC_WRITETHIGH: case SNIOC_WRITETHIGH:
adt7320_write_reg16(priv, ADT7320_THIGH_REG, b16tob8((b16_t)arg) >> 1); adt7320_write_reg16(priv, ADT7320_THIGH_REG,
b16tob8((b16_t)arg) >> 1);
break; break;
default: default:
@ -602,7 +606,7 @@ static int adt7320_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
* *
* Input Parameters: * Input Parameters:
* devpath - The full path to the driver to register. E.g., "/dev/temp0" * devpath - The full path to the driver to register. E.g., "/dev/temp0"
* spi - An instance of the SPI interface to use to communicate with ADT7320 * spi - An instance of the SPI bus to use to communicate with ADT7320
* spidev - The SPI device number used to select the correct CS line * spidev - The SPI device number used to select the correct CS line
* *
* Returned Value: * Returned Value:
@ -610,7 +614,8 @@ static int adt7320_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
* *
****************************************************************************/ ****************************************************************************/
int adt7320_register(FAR const char *devpath, FAR struct spi_dev_s *spi, int spidev) int adt7320_register(FAR const char *devpath,
FAR struct spi_dev_s *spi, int spidev)
{ {
FAR struct adt7320_dev_s *priv; FAR struct adt7320_dev_s *priv;
int ret; int ret;
@ -621,7 +626,7 @@ int adt7320_register(FAR const char *devpath, FAR struct spi_dev_s *spi, int spi
/* Initialize the ADT7320 device structure */ /* Initialize the ADT7320 device structure */
priv = (FAR struct adt7320_dev_s *)kmm_malloc(sizeof(struct adt7320_dev_s)); priv = kmm_malloc(sizeof(struct adt7320_dev_s));
if (priv == NULL) if (priv == NULL)
{ {
snerr("ERROR: Failed to allocate instance\n"); snerr("ERROR: Failed to allocate instance\n");

View File

@ -32,7 +32,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
*****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Included Files * Included Files
@ -114,17 +114,17 @@ static off_t adxl372_seek(FAR struct file *filep, off_t offset,
static int adxl372_ioctl(FAR struct file *filep, int cmd, static int adxl372_ioctl(FAR struct file *filep, int cmd,
unsigned long arg); unsigned long arg);
static int adxl372_dvr_open(FAR void *instance_handle, int32_t arg); static int adxl372_dvr_open(FAR void *instance, int32_t arg);
static int adxl372_dvr_close(FAR void *instance_handle, int32_t arg); static int adxl372_dvr_close(FAR void *instance, int32_t arg);
static ssize_t adxl372_dvr_read(FAR void *instance_handle, static ssize_t adxl372_dvr_read(FAR void *instance,
FAR char *buffer, size_t buflen); FAR char *buffer, size_t buflen);
static ssize_t adxl372_dvr_write(FAR void *instance_handle, static ssize_t adxl372_dvr_write(FAR void *instance,
FAR const char *buffer, size_t buflen); FAR const char *buffer, size_t buflen);
static off_t adxl372_dvr_seek(FAR void *instance_handle, off_t offset, static off_t adxl372_dvr_seek(FAR void *instance, off_t offset,
int whence); int whence);
static int adxl372_dvr_ioctl(FAR void *instance_handle, int cmd, static int adxl372_dvr_ioctl(FAR void *instance, int cmd,
unsigned long arg); unsigned long arg);
static void adxl372_dvr_exchange(FAR void *instance_handle, static void adxl372_dvr_exchange(FAR void *instance,
FAR const void *txbuffer, FAR const void *txbuffer,
FAR void *rxbuffer, size_t nwords); FAR void *rxbuffer, size_t nwords);
@ -231,7 +231,9 @@ static uint8_t adxl372_read_register(FAR struct adxl372_dev_s *dev,
{ {
uint8_t reg_data; uint8_t reg_data;
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -261,16 +263,18 @@ static uint8_t adxl372_read_register(FAR struct adxl372_dev_s *dev,
return reg_data; return reg_data;
} }
/****************************************************************************** /****************************************************************************
* Name: adxl372_read_registerblk * Name: adxl372_read_registerblk
******************************************************************************/ ****************************************************************************/
static void adxl372_read_registerblk(FAR struct adxl372_dev_s *dev, static void adxl372_read_registerblk(FAR struct adxl372_dev_s *dev,
uint8_t reg_addr, uint8_t reg_addr,
FAR uint8_t *reg_data, FAR uint8_t *reg_data,
uint8_t xfercnt) uint8_t xfercnt)
{ {
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -308,7 +312,9 @@ static void adxl372_read_registerblk(FAR struct adxl372_dev_s *dev,
static void adxl372_write_register(FAR struct adxl372_dev_s *dev, static void adxl372_write_register(FAR struct adxl372_dev_s *dev,
uint8_t reg_addr, uint8_t reg_data) uint8_t reg_addr, uint8_t reg_data)
{ {
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -345,7 +351,9 @@ static void adxl372_write_registerblk(FAR struct adxl372_dev_s *dev,
FAR uint8_t *reg_data, FAR uint8_t *reg_data,
uint8_t xfercnt) uint8_t xfercnt)
{ {
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -448,9 +456,9 @@ static uint32_t adxl372_read_id(FAR struct adxl372_dev_s *dev)
* Name: adxl372_dvr_open * Name: adxl372_dvr_open
****************************************************************************/ ****************************************************************************/
static int adxl372_dvr_open(FAR void *instance_handle, int32_t arg) static int adxl372_dvr_open(FAR void *instance, int32_t arg)
{ {
FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance_handle; FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance;
FAR struct adxl372_reg_pair_s *initp; FAR struct adxl372_reg_pair_s *initp;
uint32_t pnpid; uint32_t pnpid;
int sz; int sz;
@ -541,9 +549,9 @@ static int adxl372_dvr_open(FAR void *instance_handle, int32_t arg)
* Name: adxl372_dvr_close * Name: adxl372_dvr_close
****************************************************************************/ ****************************************************************************/
static int adxl372_dvr_close(FAR void *instance_handle, int32_t arg) static int adxl372_dvr_close(FAR void *instance, int32_t arg)
{ {
FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance_handle; FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance;
DEBUGASSERT(priv != NULL); DEBUGASSERT(priv != NULL);
UNUSED(arg); UNUSED(arg);
@ -562,15 +570,16 @@ static int adxl372_dvr_close(FAR void *instance_handle, int32_t arg)
* Name: adxl372_dvr_read * Name: adxl372_dvr_read
****************************************************************************/ ****************************************************************************/
static ssize_t adxl372_dvr_read(FAR void *instance_handle, FAR char *buffer, static ssize_t adxl372_dvr_read(FAR void *instance, FAR char *buffer,
size_t buflen) size_t buflen)
{ {
FAR struct adxl372_dev_s *priv = ((FAR struct adxl372_dev_s *)instance_handle); FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance;
union union
{ {
int16_t d16; int16_t d16;
char d8[2]; char d8[2];
} un; } un;
FAR char *p1; FAR char *p1;
FAR char *p2; FAR char *p2;
int i; int i;
@ -602,10 +611,10 @@ static ssize_t adxl372_dvr_read(FAR void *instance_handle, FAR char *buffer,
* Name: adxl372_dvr_write * Name: adxl372_dvr_write
****************************************************************************/ ****************************************************************************/
static ssize_t adxl372_dvr_write(FAR void *instance_handle, static ssize_t adxl372_dvr_write(FAR void *instance,
FAR const char *buffer, size_t buflen) FAR const char *buffer, size_t buflen)
{ {
FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance_handle; FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance;
DEBUGASSERT(priv != NULL); DEBUGASSERT(priv != NULL);
@ -624,11 +633,11 @@ static ssize_t adxl372_dvr_write(FAR void *instance_handle,
* Name: adxl372_dvr_seek * Name: adxl372_dvr_seek
****************************************************************************/ ****************************************************************************/
static off_t adxl372_dvr_seek(FAR void *instance_handle, off_t offset, static off_t adxl372_dvr_seek(FAR void *instance, off_t offset,
int whence) int whence)
{ {
off_t reg; off_t reg;
FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance_handle; FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance;
DEBUGASSERT(priv != NULL); DEBUGASSERT(priv != NULL);
@ -668,7 +677,7 @@ static off_t adxl372_dvr_seek(FAR void *instance_handle, off_t offset,
* Name: adxl372_dvr_ioctl * Name: adxl372_dvr_ioctl
****************************************************************************/ ****************************************************************************/
static int adxl372_dvr_ioctl(FAR void *instance_handle, int cmd, static int adxl372_dvr_ioctl(FAR void *instance, int cmd,
unsigned long arg) unsigned long arg)
{ {
int ret = OK; int ret = OK;
@ -693,7 +702,7 @@ static int adxl372_dvr_ioctl(FAR void *instance_handle, int cmd,
* Exchange a block of data on SPI using DMA * Exchange a block of data on SPI using DMA
* *
* Input Parameters: * Input Parameters:
* instance_handle - Pointer to struct adxl372_dev_s. * instance - Pointer to struct adxl372_dev_s.
* txbuffer - A pointer to the buffer of data to be sent * txbuffer - A pointer to the buffer of data to be sent
* rxbuffer - A pointer to a buffer in which to receive data * rxbuffer - A pointer to a buffer in which to receive data
* nwords - the length of data to be exchanged in units of words. * nwords - the length of data to be exchanged in units of words.
@ -707,14 +716,16 @@ static int adxl372_dvr_ioctl(FAR void *instance_handle, int cmd,
* *
****************************************************************************/ ****************************************************************************/
static void adxl372_dvr_exchange(FAR void *instance_handle, static void adxl372_dvr_exchange(FAR void *instance,
FAR const void *txbuffer, FAR const void *txbuffer,
FAR void *rxbuffer, size_t nwords) FAR void *rxbuffer, size_t nwords)
{ {
FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance_handle; FAR struct adxl372_dev_s *priv = (FAR struct adxl372_dev_s *)instance;
FAR struct spi_dev_s *spi = priv->spi; FAR struct spi_dev_s *spi = priv->spi;
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(spi, true); SPI_LOCK(spi, true);
@ -852,7 +863,7 @@ int adxl372_register(FAR const char *devpath,
/* Initialize the ADXL372 accelerometer device structure. */ /* Initialize the ADXL372 accelerometer device structure. */
priv = (FAR struct adxl372_dev_s *)kmm_malloc(sizeof(struct adxl372_dev_s)); priv = kmm_malloc(sizeof(struct adxl372_dev_s));
if (priv == NULL) if (priv == NULL)
{ {
snerr("ERROR: Failed to allocate accelerometer instance\n"); snerr("ERROR: Failed to allocate accelerometer instance\n");

View File

@ -241,56 +241,63 @@ static struct lsm330_dev_s *g_lsm330g_list = NULL;
static struct lsm330_reg_pair_s g_default_lsm330_aclcr_values[] = static struct lsm330_reg_pair_s g_default_lsm330_aclcr_values[] =
{ {
/* CR5 ODR[3:0] BDU ZEN YEN XEN */ /* CR5 ODR[3:0] BDU ZEN YEN XEN
/* 0000=Off 0 0 0 0=all disabled */ * 0000=Off 0 0 0 0=all disabled
*/
{ {
.addr = LSM330_ACL_CTRL_REG5, .addr = LSM330_ACL_CTRL_REG5,
.value = 0x00 .value = 0x00
}, },
/* CR6 BW[2:1] FSCALE[2:0] - - SIM */ /* CR6 BW[2:1] FSCALE[2:0] - - SIM
/* 00=800Hz 10 0=16g 0 0 0=4-wire */ * 00=800Hz 10 0=16g 0 0 0=4-wire
*/
{ {
.addr = LSM330_ACL_CTRL_REG6, .addr = LSM330_ACL_CTRL_REG6,
.value = 0x20 .value = 0x20
}, },
/* CR7 BOOT FIFO_EN WTM_EN ADD_INC P1_MTY P1_WTM P1_OVR WTM_EN*/ /* CR7 BOOT FIFO_EN WTM_EN ADD_INC P1_MTY P1_WTM P1_OVR WTM_EN
/* 0 0 0 1 0 0 0 0 */ * 0 0 0 1 0 0 0 0
*/
{ {
.addr = LSM330_ACL_CTRL_REG7, .addr = LSM330_ACL_CTRL_REG7,
.value = 0x10 .value = 0x10
}, },
/* CR2 HYST1 - SM1_PIN - - SM1_EN */ /* CR2 HYST1 - SM1_PIN - - SM1_EN
/* 000 0 0 0 0 0 */ * 000 0 0 0 0 0
*/
{ {
.addr = LSM330_ACL_CTRL_REG2, .addr = LSM330_ACL_CTRL_REG2,
.value = 0x00 .value = 0x00
}, },
/* CR3 HYST2 - SM2_PIN - - SM2_EN */ /* CR3 HYST2 - SM2_PIN - - SM2_EN
/* 000 0 0 0 0 0 */ * 000 0 0 0 0 0
*/
{ {
.addr = LSM330_ACL_CTRL_REG3, .addr = LSM330_ACL_CTRL_REG3,
.value = 0x00 .value = 0x00
}, },
/* CR4 DR_EN IEA IEL INT2_EN INT1_EN VFILT STRT */ /* CR4 DR_EN IEA IEL INT2_EN INT1_EN VFILT STRT
/* 1 1 0 0 0 0 0 */ * 1 1 0 0 0 0 0
*/
{ {
.addr = LSM330_ACL_CTRL_REG4, .addr = LSM330_ACL_CTRL_REG4,
.value = 0xc0 .value = 0xc0
}, },
/* CR5 ODR[3:0] BDU ZEN YEN XEN */ /* CR5 ODR[3:0] BDU ZEN YEN XEN
/* 1001=1600Hz 1 1 1 1=all enabled */ * 1001=1600Hz 1 1 1 1=all enabled
*/
{ {
.addr = LSM330_ACL_CTRL_REG5, .addr = LSM330_ACL_CTRL_REG5,
@ -311,40 +318,45 @@ static struct lsm330_reg_pair_s g_default_lsm330_aclcr_values[] =
static struct lsm330_reg_pair_s g_default_lsm330_gyrocr_values[] = static struct lsm330_reg_pair_s g_default_lsm330_gyrocr_values[] =
{ {
/* CR1 DR[1:0] BW[1:0] PD Zen Xen Yen */ /* CR1 DR[1:0] BW[1:0] PD Zen Xen Yen
/* 1 1=760Hz 1 1=100Hz 1 1 1 1 */ * 1 1=760Hz 1 1=100Hz 1 1 1 1
*/
{ {
.addr = LSM330_GYRO_CTRL_REG1, .addr = LSM330_GYRO_CTRL_REG1,
.value = 0xff .value = 0xff
}, },
/* CR2 EXTRen LVLen HPM[1:0] HPCF[3:0] */ /* CR2 EXTRen LVLen HPM[1:0] HPCF[3:0]
/* 0 0 00=Normal xxxx Default */ * 0 0 00=Normal xxxx Default
*/
{ {
.addr = LSM330_GYRO_CTRL_REG2, .addr = LSM330_GYRO_CTRL_REG2,
.value = 0x00 .value = 0x00
}, },
/* CR3 I1_Int1 I1_Boot H_Lactive PP_OD I2_DRDY I2_WTM I2_ORun I2_Empty */ /* CR3 I1_Int1 I1_Boot H_Lactive PP_OD I2_DRDY I2_WTM I2_ORun I2_Empty
/* 0 0 0 0 0 0 0 0 */ * 0 0 0 0 0 0 0 0
*/
{ {
.addr = LSM330_GYRO_CTRL_REG3, .addr = LSM330_GYRO_CTRL_REG3,
.value = 0x00 .value = 0x00
}, },
/* CR4 BDU BLE FS[1:0] 0 0 0 SIM */ /* CR4 BDU BLE FS[1:0] 0 0 0 SIM
/* 1 0 01=500dps 0 0 0 0=4-wire */ * 1 0 01=500dps 0 0 0 0=4-wire
*/
{ {
.addr = LSM330_GYRO_CTRL_REG4, .addr = LSM330_GYRO_CTRL_REG4,
.value = 0x90 .value = 0x90
}, },
/* CR5 BOOT FIFO_EN - HPen INT1_Sel[1:0] Out_Sel[1:0] */ /* CR5 BOOT FIFO_EN - HPen INT1_Sel[1:0] Out_Sel[1:0]
/* 0 0 0 0 00=LPF1 00=LPF1 */ * 0 0 0 0 00=LPF1 00=LPF1
*/
{ {
.addr = LSM330_GYRO_CTRL_REG5, .addr = LSM330_GYRO_CTRL_REG5,
@ -352,7 +364,7 @@ static struct lsm330_reg_pair_s g_default_lsm330_gyrocr_values[] =
} }
}; };
/****************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
@ -365,7 +377,9 @@ static uint8_t lsm330_read_register(FAR struct lsm330_dev_s *dev,
{ {
uint8_t reg_data; uint8_t reg_data;
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -396,16 +410,18 @@ static uint8_t lsm330_read_register(FAR struct lsm330_dev_s *dev,
return reg_data; return reg_data;
} }
/****************************************************************************** /****************************************************************************
* Name: lsm330_read_acl_registerblk * Name: lsm330_read_acl_registerblk
******************************************************************************/ ****************************************************************************/
static void lsm330_read_acl_registerblk(FAR struct lsm330_dev_s *dev, static void lsm330_read_acl_registerblk(FAR struct lsm330_dev_s *dev,
uint8_t reg_addr, uint8_t reg_addr,
FAR uint8_t *reg_data, FAR uint8_t *reg_data,
uint8_t xfercnt) uint8_t xfercnt)
{ {
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -438,16 +454,18 @@ static void lsm330_read_acl_registerblk(FAR struct lsm330_dev_s *dev,
SPI_LOCK(dev->spi, false); SPI_LOCK(dev->spi, false);
} }
/****************************************************************************** /****************************************************************************
* Name: lsm330_read_gyro_registerblk * Name: lsm330_read_gyro_registerblk
******************************************************************************/ ****************************************************************************/
static void lsm330_read_gyro_registerblk(FAR struct lsm330_dev_s *dev, static void lsm330_read_gyro_registerblk(FAR struct lsm330_dev_s *dev,
uint8_t reg_addr, uint8_t reg_addr,
FAR uint8_t *reg_data, FAR uint8_t *reg_data,
uint8_t xfercnt) uint8_t xfercnt)
{ {
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -489,7 +507,9 @@ static void lsm330_write_register(FAR struct lsm330_dev_s *dev,
uint8_t reg_addr, uint8_t reg_addr,
uint8_t reg_data) uint8_t reg_data)
{ {
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -528,7 +548,9 @@ static void lsm330_write_acl_registerblk(FAR struct lsm330_dev_s *dev,
FAR uint8_t *reg_data, FAR uint8_t *reg_data,
uint8_t xfercnt) uint8_t xfercnt)
{ {
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -570,7 +592,9 @@ static void lsm330_write_gyro_registerblk(FAR struct lsm330_dev_s *dev,
FAR uint8_t *reg_data, FAR uint8_t *reg_data,
uint8_t xfercnt) uint8_t xfercnt)
{ {
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(dev->spi, true); SPI_LOCK(dev->spi, true);
@ -685,8 +709,8 @@ static int lsm330acl_dvr_open(FAR void *instance_handle, int32_t arg)
{ {
/* Made info log level to permit open being used as a device probe. */ /* Made info log level to permit open being used as a device probe. */
snwarn("INFO: " snwarn("INFO: Device ID (0x%02X) "
"Device ID (0x%02X) does not match expected LSM330 Acl ID (0x%02).\n", "does not match expected LSM330 Acl ID (0x%02).\n",
reg_content, LSM330_ACL_IDREG_VALUE); reg_content, LSM330_ACL_IDREG_VALUE);
priv->readonly = true; priv->readonly = true;
@ -775,10 +799,12 @@ static int lsm330gyro_dvr_open(FAR void *instance_handle, int32_t arg)
if (reg_content != LSM330_GYRO_IDREG_VALUE) if (reg_content != LSM330_GYRO_IDREG_VALUE)
{ {
/* Made warning log level to permit open being used as a device probe. */ /* Made warning log level to permit open being used as
* a device probe.
*/
snwarn("INFO: " snwarn("INFO: Device ID (0x%02X) "
"Device ID (0x%02X) does not match expected LSM330 Gyro ID (0x%02).\n", "does not match expected LSM330 Gyro ID (0x%02).\n",
reg_content, LSM330_GYRO_IDREG_VALUE); reg_content, LSM330_GYRO_IDREG_VALUE);
priv->readonly = true; priv->readonly = true;
@ -834,7 +860,7 @@ static int lsm330gyro_dvr_open(FAR void *instance_handle, int32_t arg)
/**************************************************************************** /****************************************************************************
* Name: lsm330acl_dvr_close * Name: lsm330acl_dvr_close
******************************************************************************/ ****************************************************************************/
static int lsm330acl_dvr_close(FAR void *instance_handle, int32_t arg) static int lsm330acl_dvr_close(FAR void *instance_handle, int32_t arg)
{ {
@ -855,7 +881,7 @@ static int lsm330acl_dvr_close(FAR void *instance_handle, int32_t arg)
/**************************************************************************** /****************************************************************************
* Name: lsm330gyro_dvr_close * Name: lsm330gyro_dvr_close
******************************************************************************/ ****************************************************************************/
static int lsm330gyro_dvr_close(FAR void *instance_handle, int32_t arg) static int lsm330gyro_dvr_close(FAR void *instance_handle, int32_t arg)
{ {
@ -896,8 +922,8 @@ static ssize_t lsm330acl_dvr_read(FAR void *instance_handle,
* Name: lsm330gyro_dvr_read * Name: lsm330gyro_dvr_read
****************************************************************************/ ****************************************************************************/
static ssize_t lsm330gyro_dvr_read(FAR void *instance_handle, FAR char *buffer, static ssize_t lsm330gyro_dvr_read(FAR void *instance_handle,
size_t buflen) FAR char *buffer, size_t buflen)
{ {
FAR struct lsm330_dev_s *priv = (FAR struct lsm330_dev_s *)instance_handle; FAR struct lsm330_dev_s *priv = (FAR struct lsm330_dev_s *)instance_handle;
@ -954,7 +980,8 @@ static ssize_t lsm330gyro_dvr_write(FAR void *instance_handle,
* Name: lsm330acl_dvr_seek * Name: lsm330acl_dvr_seek
****************************************************************************/ ****************************************************************************/
static off_t lsm330acl_dvr_seek(FAR void *instance_handle, off_t offset, int whence) static off_t lsm330acl_dvr_seek(FAR void *instance_handle,
off_t offset, int whence)
{ {
FAR struct lsm330_dev_s *priv = (FAR struct lsm330_dev_s *)instance_handle; FAR struct lsm330_dev_s *priv = (FAR struct lsm330_dev_s *)instance_handle;
off_t reg; off_t reg;
@ -1078,7 +1105,7 @@ static int lsm330_dvr_ioctl(FAR void *instance_handle, int cmd,
* Returned Value: * Returned Value:
* None * None
* *
******************************************************************************/ ****************************************************************************/
static void lsm330_dvr_exchange(FAR void *instance_handle, static void lsm330_dvr_exchange(FAR void *instance_handle,
FAR const void *txbuffer, FAR const void *txbuffer,
@ -1089,7 +1116,9 @@ static void lsm330_dvr_exchange(FAR void *instance_handle,
sninfo("In lsm330_dvr_exchange: Handle=0x%08X\n", instance_handle); sninfo("In lsm330_dvr_exchange: Handle=0x%08X\n", instance_handle);
/* Lock the SPI bus so that only one device can access it at the same time */ /* Lock the SPI bus so that only one device can access it
* at the same time
*/
SPI_LOCK(spi, true); SPI_LOCK(spi, true);
@ -1241,7 +1270,8 @@ static off_t lsm330acl_seek(FAR struct file *filep, off_t offset, int whence)
* Name: lsm330gyro_seek * Name: lsm330gyro_seek
****************************************************************************/ ****************************************************************************/
static off_t lsm330gyro_seek(FAR struct file *filep, off_t offset, int whence) static off_t lsm330gyro_seek(FAR struct file *filep,
off_t offset, int whence)
{ {
FAR struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
FAR struct lsm330_dev_s *priv = inode->i_private; FAR struct lsm330_dev_s *priv = inode->i_private;