drivers: convert to using newly introduced integer sized types

Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2017-04-21 10:03:20 -05:00
commit ccad5bf3e3
231 changed files with 3200 additions and 3200 deletions

View file

@ -22,7 +22,7 @@ static inline int lsm9ds0_gyro_power_ctrl(struct device *dev, int power,
{
struct lsm9ds0_gyro_data *data = dev->driver_data;
const struct lsm9ds0_gyro_config *config = dev->config->config_info;
uint8_t state = (power << LSM9DS0_GYRO_SHIFT_CTRL_REG1_G_PD) |
u8_t state = (power << LSM9DS0_GYRO_SHIFT_CTRL_REG1_G_PD) |
(x_en << LSM9DS0_GYRO_SHIFT_CTRL_REG1_G_XEN) |
(y_en << LSM9DS0_GYRO_SHIFT_CTRL_REG1_G_YEN) |
(z_en << LSM9DS0_GYRO_SHIFT_CTRL_REG1_G_ZEN);
@ -36,7 +36,7 @@ static inline int lsm9ds0_gyro_power_ctrl(struct device *dev, int power,
state);
}
static int lsm9ds0_gyro_set_fs_raw(struct device *dev, uint8_t fs)
static int lsm9ds0_gyro_set_fs_raw(struct device *dev, u8_t fs)
{
struct lsm9ds0_gyro_data *data = dev->driver_data;
const struct lsm9ds0_gyro_config *config = dev->config->config_info;
@ -58,7 +58,7 @@ static int lsm9ds0_gyro_set_fs_raw(struct device *dev, uint8_t fs)
#if defined(CONFIG_LSM9DS0_GYRO_FULLSCALE_RUNTIME)
static const struct {
int fs;
uint8_t reg_val;
u8_t reg_val;
} lsm9ds0_gyro_fs_table[] = { {245, 0},
{500, 1},
{2000, 2} };
@ -77,7 +77,7 @@ static int lsm9ds0_gyro_set_fs(struct device *dev, int fs)
}
#endif
static inline int lsm9ds0_gyro_set_odr_raw(struct device *dev, uint8_t odr)
static inline int lsm9ds0_gyro_set_odr_raw(struct device *dev, u8_t odr)
{
struct lsm9ds0_gyro_data *data = dev->driver_data;
const struct lsm9ds0_gyro_config *config = dev->config->config_info;
@ -91,7 +91,7 @@ static inline int lsm9ds0_gyro_set_odr_raw(struct device *dev, uint8_t odr)
#if defined(CONFIG_LSM9DS0_GYRO_SAMPLING_RATE_RUNTIME)
static const struct {
int freq;
uint8_t reg_val;
u8_t reg_val;
} lsm9ds0_gyro_samp_freq_table[] = { {95, 0},
{190, 1},
{380, 2},
@ -118,7 +118,7 @@ static int lsm9ds0_gyro_sample_fetch(struct device *dev,
{
struct lsm9ds0_gyro_data *data = dev->driver_data;
const struct lsm9ds0_gyro_config *config = dev->config->config_info;
uint8_t x_l, x_h, y_l, y_h, z_l, z_h;
u8_t x_l, x_h, y_l, y_h, z_l, z_h;
__ASSERT_NO_MSG(chan == SENSOR_CHAN_ALL ||
chan == SENSOR_CHAN_GYRO_XYZ);
@ -139,9 +139,9 @@ static int lsm9ds0_gyro_sample_fetch(struct device *dev,
return -EIO;
}
data->sample_x = (int16_t)((uint16_t)(x_l) | ((uint16_t)(x_h) << 8));
data->sample_y = (int16_t)((uint16_t)(y_l) | ((uint16_t)(y_h) << 8));
data->sample_z = (int16_t)((uint16_t)(z_l) | ((uint16_t)(z_h) << 8));
data->sample_x = (s16_t)((u16_t)(x_l) | ((u16_t)(x_h) << 8));
data->sample_y = (s16_t)((u16_t)(y_l) | ((u16_t)(y_h) << 8));
data->sample_z = (s16_t)((u16_t)(z_l) | ((u16_t)(z_h) << 8));
#if defined(CONFIG_LSM9DS0_GYRO_FULLSCALE_RUNTIME)
data->sample_fs = data->fs;
@ -156,8 +156,8 @@ static inline void lsm9ds0_gyro_convert(struct sensor_value *val, int raw_val,
double dval;
dval = (double)(raw_val) * numerator / 1000.0 * DEG2RAD;
val->val1 = (int32_t)dval;
val->val2 = ((int32_t)(dval * 1000000)) % 1000000;
val->val1 = (s32_t)dval;
val->val2 = ((s32_t)(dval * 1000000)) % 1000000;
}
static inline int lsm9ds0_gyro_get_channel(enum sensor_channel chan,
@ -258,7 +258,7 @@ static int lsm9ds0_gyro_init_chip(struct device *dev)
{
struct lsm9ds0_gyro_data *data = dev->driver_data;
const struct lsm9ds0_gyro_config *config = dev->config->config_info;
uint8_t chip_id;
u8_t chip_id;
if (lsm9ds0_gyro_power_ctrl(dev, 0, 0, 0, 0) < 0) {
SYS_LOG_DBG("failed to power off device");

View file

@ -213,11 +213,11 @@
struct lsm9ds0_gyro_config {
char *i2c_master_dev_name;
uint16_t i2c_slave_addr;
u16_t i2c_slave_addr;
#if CONFIG_LSM9DS0_GYRO_TRIGGER_DRDY
char *gpio_drdy_dev_name;
uint8_t gpio_drdy_int_pin;
u8_t gpio_drdy_int_pin;
#endif
};
@ -240,8 +240,8 @@ struct lsm9ds0_gyro_data {
int sample_x, sample_y, sample_z;
#if defined(CONFIG_LSM9DS0_GYRO_FULLSCALE_RUNTIME)
uint8_t sample_fs;
uint8_t fs;
u8_t sample_fs;
u8_t fs;
#endif
};

View file

@ -25,7 +25,7 @@ int lsm9ds0_gyro_trigger_set(struct device *dev,
struct lsm9ds0_gyro_data *data = dev->driver_data;
const struct lsm9ds0_gyro_config * const config =
dev->config->config_info;
uint8_t state;
u8_t state;
if (trig->type == SENSOR_TRIG_DATA_READY) {
gpio_pin_disable_callback(data->gpio_drdy,
@ -58,7 +58,7 @@ int lsm9ds0_gyro_trigger_set(struct device *dev,
}
static void lsm9ds0_gyro_gpio_drdy_callback(struct device *dev,
struct gpio_callback *cb, uint32_t pins)
struct gpio_callback *cb, u32_t pins)
{
struct lsm9ds0_gyro_data *data =
CONTAINER_OF(cb, struct lsm9ds0_gyro_data, gpio_cb);