nuttx/uorb: change unsigned long to uint32 to fix size issue
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
abbd9c7da9
commit
b17c074a18
@ -45,7 +45,7 @@
|
||||
struct bmi160_odr_s
|
||||
{
|
||||
uint8_t regval; /* the data of register */
|
||||
unsigned long odr; /* the unit is us */
|
||||
uint32_t odr; /* the unit is us */
|
||||
};
|
||||
|
||||
/* Device struct */
|
||||
@ -57,7 +57,7 @@ struct bmi160_dev_uorb_s
|
||||
struct sensor_lowerhalf_s lower; /* Lower half sensor driver. */
|
||||
|
||||
struct work_s work; /* Interrupt handler worker. */
|
||||
unsigned long interval; /* Sensor acquisition interval. */
|
||||
uint32_t interval; /* Sensor acquisition interval. */
|
||||
|
||||
struct bmi160_dev_s dev;
|
||||
};
|
||||
@ -77,10 +77,10 @@ static void bmi160_gyro_enable(FAR struct bmi160_dev_uorb_s *priv,
|
||||
|
||||
static int bmi160_set_accel_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us);
|
||||
FAR uint32_t *period_us);
|
||||
static int bmi160_set_gyro_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us);
|
||||
FAR uint32_t *period_us);
|
||||
static int bmi160_accel_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
bool enable);
|
||||
@ -92,7 +92,7 @@ static int bmi160_gyro_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
|
||||
static void bmi160_accel_worker(FAR void *arg);
|
||||
static void bmi160_gyro_worker(FAR void *arg);
|
||||
static int bmi160_findodr(unsigned long time,
|
||||
static int bmi160_findodr(uint32_t time,
|
||||
FAR const struct bmi160_odr_s *odr_s,
|
||||
int len);
|
||||
|
||||
@ -159,7 +159,7 @@ static const struct bmi160_odr_s g_bmi160_accel_odr[] =
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int bmi160_findodr(unsigned long time,
|
||||
static int bmi160_findodr(uint32_t time,
|
||||
FAR const struct bmi160_odr_s *odr_s,
|
||||
int len)
|
||||
{
|
||||
@ -304,7 +304,7 @@ static void bmi160_gyro_enable(FAR struct bmi160_dev_uorb_s *priv,
|
||||
|
||||
static int bmi160_set_accel_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us)
|
||||
FAR uint32_t *period_us)
|
||||
{
|
||||
FAR struct bmi160_dev_uorb_s *priv = (FAR struct bmi160_dev_uorb_s *)lower;
|
||||
int num;
|
||||
@ -351,7 +351,7 @@ static int bmi160_set_accel_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
|
||||
static int bmi160_set_gyro_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us)
|
||||
FAR uint32_t *period_us)
|
||||
{
|
||||
FAR struct bmi160_dev_uorb_s *priv = (FAR struct bmi160_dev_uorb_s *)lower;
|
||||
int num;
|
||||
|
@ -54,8 +54,8 @@ struct fakesensor_s
|
||||
|
||||
int type;
|
||||
struct file data;
|
||||
unsigned long interval;
|
||||
unsigned long batch;
|
||||
uint32_t interval;
|
||||
uint32_t batch;
|
||||
int raw_start;
|
||||
FAR const char *file_path;
|
||||
sem_t wakeup;
|
||||
@ -70,15 +70,15 @@ static int fakesensor_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool enable);
|
||||
static int fakesensor_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us);
|
||||
FAR uint32_t *period_us);
|
||||
static int fakesensor_batch(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *latency_us);
|
||||
FAR uint32_t *latency_us);
|
||||
static int fakegps_activate(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool sw);
|
||||
static int fakegps_set_interval(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us);
|
||||
FAR uint32_t *period_us);
|
||||
static void fakesensor_push_event(FAR struct fakesensor_s *sensor,
|
||||
uint64_t event_timestamp);
|
||||
static int fakesensor_thread(int argc, char** argv);
|
||||
@ -141,7 +141,7 @@ static int fakesensor_read_csv_header(FAR struct fakesensor_s *sensor)
|
||||
fakesensor_read_csv_line(&sensor->data, buffer, sizeof(buffer), 0);
|
||||
if (sensor->interval == 0)
|
||||
{
|
||||
sscanf(buffer, "interval:%lu\n", &sensor->interval);
|
||||
sscanf(buffer, "interval:%"PRIu32"\n", &sensor->interval);
|
||||
sensor->interval *= 1000;
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ static int fakegps_activate(FAR struct gps_lowerhalf_s *lower,
|
||||
|
||||
static int fakesensor_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us)
|
||||
FAR uint32_t *period_us)
|
||||
{
|
||||
FAR struct fakesensor_s *sensor = container_of(lower,
|
||||
struct fakesensor_s, lower);
|
||||
@ -250,18 +250,18 @@ static int fakesensor_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
|
||||
static int fakegps_set_interval(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us)
|
||||
FAR uint32_t *period_us)
|
||||
{
|
||||
return fakesensor_set_interval((FAR void *)lower, filep, period_us);
|
||||
}
|
||||
|
||||
static int fakesensor_batch(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *latency_us)
|
||||
FAR uint32_t *latency_us)
|
||||
{
|
||||
FAR struct fakesensor_s *sensor = container_of(lower,
|
||||
struct fakesensor_s, lower);
|
||||
unsigned long max_latency = sensor->lower.nbuffer * sensor->interval;
|
||||
uint32_t max_latency = sensor->lower.nbuffer * sensor->interval;
|
||||
if (*latency_us > max_latency)
|
||||
{
|
||||
*latency_us = max_latency;
|
||||
|
@ -97,7 +97,7 @@ static int gps_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool enable);
|
||||
static int gps_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *interval);
|
||||
FAR uint32_t *interval);
|
||||
static int gps_control(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep, int cmd, unsigned long arg);
|
||||
|
||||
@ -163,7 +163,7 @@ static int gps_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
|
||||
static int gps_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *interval)
|
||||
FAR uint32_t *interval)
|
||||
{
|
||||
FAR struct gps_sensor_s *dev = (FAR struct gps_sensor_s *)lower;
|
||||
FAR struct gps_upperhalf_s *upper = dev->upper;
|
||||
@ -350,7 +350,7 @@ static int gps_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
if (upper->lower->ops->set_interval != NULL)
|
||||
{
|
||||
ret = upper->lower->ops->set_interval(upper->lower, filep,
|
||||
(FAR unsigned long *)(uintptr_t)arg);
|
||||
(FAR uint32_t *)(uintptr_t)arg);
|
||||
}
|
||||
}
|
||||
else if (upper->lower->ops->control != NULL)
|
||||
|
@ -49,7 +49,7 @@
|
||||
#define ROUND_DOWN(x, y) (((x) / (y)) * (y))
|
||||
#define DEVNAME_FMT "/dev/uorb/sensor_%s%s%d"
|
||||
#define DEVNAME_UNCAL "_uncal"
|
||||
#define TIMING_BUF_ESIZE (sizeof(unsigned long))
|
||||
#define TIMING_BUF_ESIZE (sizeof(uint32_t))
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@ -70,7 +70,7 @@ struct sensor_axis_map_s
|
||||
|
||||
struct sensor_meta_s
|
||||
{
|
||||
unsigned long esize;
|
||||
size_t esize;
|
||||
FAR char *name;
|
||||
};
|
||||
|
||||
@ -227,13 +227,13 @@ static void sensor_unlock(FAR void *priv)
|
||||
static int sensor_update_interval(FAR struct file *filep,
|
||||
FAR struct sensor_upperhalf_s *upper,
|
||||
FAR struct sensor_user_s *user,
|
||||
unsigned long interval)
|
||||
uint32_t interval)
|
||||
{
|
||||
FAR struct sensor_lowerhalf_s *lower = upper->lower;
|
||||
FAR struct sensor_user_s *tmp;
|
||||
unsigned long min_interval = interval;
|
||||
unsigned long min_latency = interval != ULONG_MAX ?
|
||||
user->state.latency : ULONG_MAX;
|
||||
uint32_t min_interval = interval;
|
||||
uint32_t min_latency = interval != UINT32_MAX ?
|
||||
user->state.latency : UINT32_MAX;
|
||||
int ret = 0;
|
||||
|
||||
if (interval == user->state.interval)
|
||||
@ -243,7 +243,7 @@ static int sensor_update_interval(FAR struct file *filep,
|
||||
|
||||
list_for_every_entry(&upper->userlist, tmp, struct sensor_user_s, node)
|
||||
{
|
||||
if (tmp == user || tmp->state.interval == ULONG_MAX)
|
||||
if (tmp == user || tmp->state.interval == UINT32_MAX)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -261,10 +261,10 @@ static int sensor_update_interval(FAR struct file *filep,
|
||||
|
||||
if (lower->ops->set_interval)
|
||||
{
|
||||
if (min_interval != ULONG_MAX &&
|
||||
if (min_interval != UINT32_MAX &&
|
||||
min_interval != upper->state.min_interval)
|
||||
{
|
||||
unsigned long expected_interval = min_interval;
|
||||
uint32_t expected_interval = min_interval;
|
||||
ret = lower->ops->set_interval(lower, filep, &min_interval);
|
||||
if (ret < 0)
|
||||
{
|
||||
@ -276,7 +276,7 @@ static int sensor_update_interval(FAR struct file *filep,
|
||||
}
|
||||
}
|
||||
|
||||
if (min_latency == ULONG_MAX)
|
||||
if (min_latency == UINT32_MAX)
|
||||
{
|
||||
min_latency = 0;
|
||||
}
|
||||
@ -302,11 +302,11 @@ static int sensor_update_interval(FAR struct file *filep,
|
||||
static int sensor_update_latency(FAR struct file *filep,
|
||||
FAR struct sensor_upperhalf_s *upper,
|
||||
FAR struct sensor_user_s *user,
|
||||
unsigned long latency)
|
||||
uint32_t latency)
|
||||
{
|
||||
FAR struct sensor_lowerhalf_s *lower = upper->lower;
|
||||
FAR struct sensor_user_s *tmp;
|
||||
unsigned long min_latency = latency;
|
||||
uint32_t min_latency = latency;
|
||||
int ret = 0;
|
||||
|
||||
if (latency == user->state.latency)
|
||||
@ -314,7 +314,7 @@ static int sensor_update_latency(FAR struct file *filep,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (user->state.interval == ULONG_MAX)
|
||||
if (user->state.interval == UINT32_MAX)
|
||||
{
|
||||
user->state.latency = latency;
|
||||
return 0;
|
||||
@ -327,7 +327,7 @@ static int sensor_update_latency(FAR struct file *filep,
|
||||
|
||||
list_for_every_entry(&upper->userlist, tmp, struct sensor_user_s, node)
|
||||
{
|
||||
if (tmp == user || tmp->state.interval == ULONG_MAX)
|
||||
if (tmp == user || tmp->state.interval == UINT32_MAX)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -339,7 +339,7 @@ static int sensor_update_latency(FAR struct file *filep,
|
||||
}
|
||||
|
||||
update:
|
||||
if (min_latency == ULONG_MAX)
|
||||
if (min_latency == UINT32_MAX)
|
||||
{
|
||||
min_latency = 0;
|
||||
}
|
||||
@ -368,8 +368,8 @@ update:
|
||||
static void sensor_generate_timing(FAR struct sensor_upperhalf_s *upper,
|
||||
unsigned long nums)
|
||||
{
|
||||
unsigned long interval = upper->state.min_interval != ULONG_MAX ?
|
||||
upper->state.min_interval : 1;
|
||||
uint32_t interval = upper->state.min_interval != UINT32_MAX ?
|
||||
upper->state.min_interval : 1;
|
||||
while (nums-- > 0)
|
||||
{
|
||||
upper->state.generation += interval;
|
||||
@ -387,7 +387,7 @@ static bool sensor_is_updated(FAR struct sensor_upperhalf_s *upper,
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (user->state.interval == ULONG_MAX)
|
||||
else if (user->state.interval == UINT32_MAX)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -409,7 +409,7 @@ static bool sensor_is_updated(FAR struct sensor_upperhalf_s *upper,
|
||||
static void sensor_catch_up(FAR struct sensor_upperhalf_s *upper,
|
||||
FAR struct sensor_user_s *user)
|
||||
{
|
||||
unsigned long generation;
|
||||
uint32_t generation;
|
||||
long delta;
|
||||
|
||||
circbuf_peek(&upper->timing, &generation, TIMING_BUF_ESIZE);
|
||||
@ -417,7 +417,7 @@ static void sensor_catch_up(FAR struct sensor_upperhalf_s *upper,
|
||||
if (delta > 0)
|
||||
{
|
||||
user->bufferpos = upper->timing.tail / TIMING_BUF_ESIZE;
|
||||
if (user->state.interval == ULONG_MAX)
|
||||
if (user->state.interval == UINT32_MAX)
|
||||
{
|
||||
user->state.generation = generation - 1;
|
||||
}
|
||||
@ -434,7 +434,7 @@ static ssize_t sensor_do_samples(FAR struct sensor_upperhalf_s *upper,
|
||||
FAR struct sensor_user_s *user,
|
||||
FAR char *buffer, size_t len)
|
||||
{
|
||||
unsigned long generation;
|
||||
uint32_t generation;
|
||||
ssize_t ret = 0;
|
||||
size_t nums;
|
||||
size_t pos;
|
||||
@ -451,7 +451,7 @@ static ssize_t sensor_do_samples(FAR struct sensor_upperhalf_s *upper,
|
||||
|
||||
/* Take samples continuously */
|
||||
|
||||
if (user->state.interval == ULONG_MAX)
|
||||
if (user->state.interval == UINT32_MAX)
|
||||
{
|
||||
ret = circbuf_peekat(&upper->buffer,
|
||||
user->bufferpos * upper->state.esize,
|
||||
@ -485,7 +485,7 @@ static ssize_t sensor_do_samples(FAR struct sensor_upperhalf_s *upper,
|
||||
&generation, TIMING_BUF_ESIZE);
|
||||
while (pos++ != end)
|
||||
{
|
||||
unsigned long next_generation;
|
||||
uint32_t next_generation;
|
||||
long delta;
|
||||
|
||||
if (pos * TIMING_BUF_ESIZE == upper->timing.head)
|
||||
@ -617,7 +617,7 @@ static int sensor_open(FAR struct file *filep)
|
||||
user->bufferpos = upper->timing.head / TIMING_BUF_ESIZE;
|
||||
}
|
||||
|
||||
user->state.interval = ULONG_MAX;
|
||||
user->state.interval = UINT32_MAX;
|
||||
user->state.esize = upper->state.esize;
|
||||
nxsem_init(&user->buffersem, 0, 0);
|
||||
list_add_tail(&upper->userlist, &user->node);
|
||||
@ -676,8 +676,8 @@ static int sensor_close(FAR struct file *filep)
|
||||
}
|
||||
|
||||
list_delete(&user->node);
|
||||
sensor_update_latency(filep, upper, user, ULONG_MAX);
|
||||
sensor_update_interval(filep, upper, user, ULONG_MAX);
|
||||
sensor_update_latency(filep, upper, user, UINT32_MAX);
|
||||
sensor_update_interval(filep, upper, user, UINT32_MAX);
|
||||
nxsem_destroy(&user->buffersem);
|
||||
|
||||
/* The user is closed, notify to other users */
|
||||
@ -767,6 +767,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR struct sensor_upperhalf_s *upper = inode->i_private;
|
||||
FAR struct sensor_lowerhalf_s *lower = upper->lower;
|
||||
FAR struct sensor_user_s *user = filep->f_priv;
|
||||
uint32_t arg1 = (uint32_t)arg;
|
||||
int ret = 0;
|
||||
|
||||
sninfo("cmd=%x arg=%08lx\n", cmd, arg);
|
||||
@ -796,7 +797,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
nxrmutex_lock(&upper->lock);
|
||||
ret = sensor_update_interval(filep, upper, user,
|
||||
arg ? arg : ULONG_MAX);
|
||||
arg1 ? arg1 : UINT32_MAX);
|
||||
nxrmutex_unlock(&upper->lock);
|
||||
}
|
||||
break;
|
||||
@ -804,7 +805,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
case SNIOC_BATCH:
|
||||
{
|
||||
nxrmutex_lock(&upper->lock);
|
||||
ret = sensor_update_latency(filep, upper, user, arg);
|
||||
ret = sensor_update_latency(filep, upper, user, arg1);
|
||||
nxrmutex_unlock(&upper->lock);
|
||||
}
|
||||
break;
|
||||
@ -848,7 +849,7 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
case SNIOC_SET_USERPRIV:
|
||||
{
|
||||
nxrmutex_lock(&upper->lock);
|
||||
upper->state.priv = (FAR void *)(uintptr_t)arg;
|
||||
upper->state.priv = (uint64_t)arg;
|
||||
nxrmutex_unlock(&upper->lock);
|
||||
}
|
||||
break;
|
||||
@ -858,10 +859,10 @@ static int sensor_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
nxrmutex_lock(&upper->lock);
|
||||
if (!circbuf_is_init(&upper->buffer))
|
||||
{
|
||||
if (arg >= lower->nbuffer)
|
||||
if (arg1 >= lower->nbuffer)
|
||||
{
|
||||
lower->nbuffer = arg;
|
||||
upper->state.nbuffer = arg;
|
||||
lower->nbuffer = arg1;
|
||||
upper->state.nbuffer = arg1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1222,7 +1223,7 @@ int sensor_register(FAR struct sensor_lowerhalf_s *lower, int devno)
|
||||
****************************************************************************/
|
||||
|
||||
int sensor_custom_register(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR const char *path, unsigned long esize)
|
||||
FAR const char *path, size_t esize)
|
||||
{
|
||||
FAR struct sensor_upperhalf_s *upper;
|
||||
int ret = -EINVAL;
|
||||
@ -1248,7 +1249,7 @@ int sensor_custom_register(FAR struct sensor_lowerhalf_s *lower,
|
||||
|
||||
list_initialize(&upper->userlist);
|
||||
upper->state.esize = esize;
|
||||
upper->state.min_interval = ULONG_MAX;
|
||||
upper->state.min_interval = UINT32_MAX;
|
||||
if (lower->ops->activate)
|
||||
{
|
||||
upper->state.nadvertisers = 1;
|
||||
|
@ -49,10 +49,10 @@
|
||||
#define SENSOR_RPMSG_IOCTL 7
|
||||
#define SENSOR_RPMSG_IOCTL_ACK 8
|
||||
|
||||
#define SENSOR_RPMSG_FUNCTION(name, cmd, arg1, arg2, size, wait) \
|
||||
#define SENSOR_RPMSG_FUNCTION(name, cmd, arg1, arg2, size, wait, type) \
|
||||
static int sensor_rpmsg_##name(FAR struct sensor_lowerhalf_s *lower, \
|
||||
FAR struct file *filep, \
|
||||
unsigned long arg1) \
|
||||
type arg1) \
|
||||
{ \
|
||||
FAR struct sensor_rpmsg_dev_s *dev = lower->priv; \
|
||||
FAR struct sensor_lowerhalf_s *drv = dev->drv; \
|
||||
@ -203,10 +203,10 @@ static int sensor_rpmsg_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
bool enable);
|
||||
static int sensor_rpmsg_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us);
|
||||
FAR uint32_t *period_us);
|
||||
static int sensor_rpmsg_batch(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *latency_us);
|
||||
FAR uint32_t *latency_us);
|
||||
static int sensor_rpmsg_flush(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep);
|
||||
static int sensor_rpmsg_selftest(FAR struct sensor_lowerhalf_s *lower,
|
||||
@ -501,13 +501,13 @@ sensor_rpmsg_alloc_proxy(FAR struct sensor_rpmsg_dev_s *dev,
|
||||
|
||||
/* sync interval and latency */
|
||||
|
||||
if (state.min_interval != ULONG_MAX)
|
||||
if (state.min_interval != UINT32_MAX)
|
||||
{
|
||||
sensor_rpmsg_ioctl(dev, SNIOC_SET_INTERVAL, state.min_interval,
|
||||
0, false);
|
||||
}
|
||||
|
||||
if (state.min_latency != ULONG_MAX)
|
||||
if (state.min_latency != UINT32_MAX)
|
||||
{
|
||||
sensor_rpmsg_ioctl(dev, SNIOC_BATCH, state.min_latency, 0, false);
|
||||
}
|
||||
@ -694,12 +694,15 @@ static int sensor_rpmsg_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
}
|
||||
|
||||
SENSOR_RPMSG_FUNCTION(set_interval, SNIOC_SET_INTERVAL,
|
||||
*interval, interval, 0, false)
|
||||
SENSOR_RPMSG_FUNCTION(batch, SNIOC_BATCH, *latency, latency, 0, false)
|
||||
SENSOR_RPMSG_FUNCTION(selftest, SNIOC_SELFTEST, arg, arg, 0, true)
|
||||
*interval, interval, 0, false, uint32_t)
|
||||
SENSOR_RPMSG_FUNCTION(batch, SNIOC_BATCH, *latency, latency, 0,
|
||||
false, uint32_t)
|
||||
SENSOR_RPMSG_FUNCTION(selftest, SNIOC_SELFTEST, arg, arg, 0,
|
||||
true, unsigned long)
|
||||
SENSOR_RPMSG_FUNCTION(set_calibvalue, SNIOC_SET_CALIBVALUE,
|
||||
arg, arg, 256, true)
|
||||
SENSOR_RPMSG_FUNCTION(calibrate, SNIOC_CALIBRATE, arg, arg, 256, true)
|
||||
arg, arg, 256, true, unsigned long)
|
||||
SENSOR_RPMSG_FUNCTION(calibrate, SNIOC_CALIBRATE, arg, arg, 256,
|
||||
true, unsigned long)
|
||||
|
||||
static int sensor_rpmsg_flush(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep)
|
||||
@ -797,7 +800,7 @@ static void sensor_rpmsg_push_event_one(FAR struct sensor_rpmsg_dev_s *dev,
|
||||
return;
|
||||
}
|
||||
|
||||
if (state.interval == ULONG_MAX)
|
||||
if (state.interval == UINT32_MAX)
|
||||
{
|
||||
state.interval = 0;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@
|
||||
struct wtgahrs2_sensor_s
|
||||
{
|
||||
struct sensor_lowerhalf_s lower;
|
||||
unsigned long interval;
|
||||
uint32_t interval;
|
||||
uint64_t last_update;
|
||||
bool enable;
|
||||
};
|
||||
@ -100,7 +100,7 @@ static int wtgahrs2_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep, bool sw);
|
||||
static int wtgahrs2_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *interval);
|
||||
FAR uint32_t *interval);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@ -108,7 +108,7 @@ static int wtgahrs2_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
|
||||
/* in microseconds */
|
||||
|
||||
static const unsigned long g_wtgahrs2_interval[] =
|
||||
static const uint32_t g_wtgahrs2_interval[] =
|
||||
{
|
||||
10000000, /* 0.1 hz */
|
||||
2000000, /* 0.5 hz */
|
||||
@ -166,7 +166,7 @@ static int wtgahrs2_activate(FAR struct sensor_lowerhalf_s *lower,
|
||||
|
||||
static int wtgahrs2_set_interval(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *interval)
|
||||
FAR uint32_t *interval)
|
||||
{
|
||||
FAR struct wtgahrs2_sensor_s *dev = (FAR struct wtgahrs2_sensor_s *)lower;
|
||||
int idx = 0;
|
||||
|
@ -88,7 +88,7 @@ struct gps_ops_s
|
||||
|
||||
CODE int (*set_interval)(FAR struct gps_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us);
|
||||
FAR uint32_t *period_us);
|
||||
|
||||
/**************************************************************************
|
||||
* Name: control
|
||||
|
@ -270,7 +270,7 @@ struct sensor_ops_s
|
||||
|
||||
CODE int (*set_interval)(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *period_us);
|
||||
FAR uint32_t *period_us);
|
||||
|
||||
/**************************************************************************
|
||||
* Name: batch
|
||||
@ -316,7 +316,7 @@ struct sensor_ops_s
|
||||
|
||||
CODE int (*batch)(FAR struct sensor_lowerhalf_s *lower,
|
||||
FAR struct file *filep,
|
||||
FAR unsigned long *latency_us);
|
||||
FAR uint32_t *latency_us);
|
||||
|
||||
/**************************************************************************
|
||||
* Name: fetch
|
||||
@ -528,7 +528,7 @@ struct sensor_lowerhalf_s
|
||||
* struct sensor_xxx.
|
||||
*/
|
||||
|
||||
unsigned long nbuffer;
|
||||
uint32_t nbuffer;
|
||||
|
||||
/* The uncalibrated use to describe whether the sensor event is
|
||||
* uncalibrated. True is uncalibrated data, false is calibrated data,
|
||||
@ -691,7 +691,7 @@ int sensor_register(FAR struct sensor_lowerhalf_s *dev, int devno);
|
||||
****************************************************************************/
|
||||
|
||||
int sensor_custom_register(FAR struct sensor_lowerhalf_s *dev,
|
||||
FAR const char *path, unsigned long esize);
|
||||
FAR const char *path, size_t esize);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sensor_unregister
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <nuttx/sensors/ioctl.h>
|
||||
|
||||
@ -621,24 +622,24 @@ struct sensor_force /* Type: Force */
|
||||
|
||||
struct sensor_state_s
|
||||
{
|
||||
unsigned long esize; /* The element size of circular buffer */
|
||||
unsigned long nbuffer; /* The number of events that the circular buffer can hold */
|
||||
unsigned long min_latency; /* The minimum batch latency for sensor, in us */
|
||||
unsigned long min_interval; /* The minimum subscription interval for sensor, in us */
|
||||
unsigned long nsubscribers; /* The number of subcribers */
|
||||
unsigned long nadvertisers; /* The number of advertisers */
|
||||
unsigned long generation; /* The recent generation of circular buffer */
|
||||
FAR void *priv; /* The pointer to private data of userspace user */
|
||||
uint32_t esize; /* The element size of circular buffer */
|
||||
uint32_t nbuffer; /* The number of events that the circular buffer can hold */
|
||||
uint32_t min_latency; /* The minimum batch latency for sensor, in us */
|
||||
uint32_t min_interval; /* The minimum subscription interval for sensor, in us */
|
||||
uint32_t nsubscribers; /* The number of subcribers */
|
||||
uint32_t nadvertisers; /* The number of advertisers */
|
||||
uint32_t generation; /* The recent generation of circular buffer */
|
||||
uint64_t priv; /* The pointer to private data of userspace user */
|
||||
};
|
||||
|
||||
/* This structure describes the state for the sensor user */
|
||||
|
||||
struct sensor_ustate_s
|
||||
{
|
||||
unsigned long esize; /* The element size of circular buffer */
|
||||
unsigned long latency; /* The batch latency for user, in us */
|
||||
unsigned long interval; /* The subscription interval for user, in us */
|
||||
unsigned long generation; /* The recent generation of circular buffer */
|
||||
uint32_t esize; /* The element size of circular buffer */
|
||||
uint32_t latency; /* The batch latency for user, in us */
|
||||
uint32_t interval; /* The subscription interval for user, in us */
|
||||
uint64_t generation; /* The recent generation of circular buffer */
|
||||
};
|
||||
|
||||
/* This structure describes the register info for the user sensor */
|
||||
@ -646,15 +647,15 @@ struct sensor_ustate_s
|
||||
#ifdef CONFIG_USENSOR
|
||||
struct sensor_reginfo_s
|
||||
{
|
||||
FAR const char *path; /* The path of user sensor */
|
||||
unsigned long esize; /* The element size of user sensor */
|
||||
unsigned long nbuffer; /* The number of queue buffered elements */
|
||||
char path[NAME_MAX]; /* The path of user sensor */
|
||||
uint32_t esize; /* The element size of user sensor */
|
||||
uint32_t nbuffer; /* The number of queue buffered elements */
|
||||
|
||||
/* The flag is used to indicate that the validity of sensor data
|
||||
* is persistent.
|
||||
*/
|
||||
|
||||
bool persist;
|
||||
int persist;
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -662,7 +663,7 @@ struct sensor_reginfo_s
|
||||
|
||||
struct sensor_ioctl_s
|
||||
{
|
||||
size_t len; /* The length of argument of ioctl */
|
||||
uint32_t len; /* The length of argument of ioctl */
|
||||
char data[1]; /* The argument buf of ioctl */
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user