mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 00:23:35 +08:00
POSIX: added hrt_queue for handling fast periodic events
The workqueues measure time in ticks which is typically 10ms. Some interrupt events in Nuttx occur at about 1ms so a more granular workqueue is needed for POSIX. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -625,10 +625,10 @@ ACCELSIM::ioctl(device::file_t *filp, int cmd, unsigned long arg)
|
||||
bool want_start = (_call_accel_interval == 0);
|
||||
|
||||
/* convert hz to hrt interval via microseconds */
|
||||
unsigned ticks = 1000000 / arg;
|
||||
unsigned period = 1000000 / arg;
|
||||
|
||||
/* check against maximum sane rate */
|
||||
if (ticks < 500)
|
||||
if (period < 500)
|
||||
return -EINVAL;
|
||||
|
||||
/* adjust filters */
|
||||
@@ -636,7 +636,7 @@ ACCELSIM::ioctl(device::file_t *filp, int cmd, unsigned long arg)
|
||||
|
||||
/* update interval for next measurement */
|
||||
/* XXX this is a bit shady, but no other way to adjust... */
|
||||
_accel_call.period = _call_accel_interval = ticks;
|
||||
_accel_call.period = _call_accel_interval = period;
|
||||
|
||||
/* if we need to start the poll state machine, do it */
|
||||
if (want_start)
|
||||
@@ -749,15 +749,15 @@ ACCELSIM::mag_ioctl(device::file_t *filp, int cmd, unsigned long arg)
|
||||
bool want_start = (_call_mag_interval == 0);
|
||||
|
||||
/* convert hz to hrt interval via microseconds */
|
||||
unsigned ticks = 1000000 / arg;
|
||||
unsigned period = 1000000 / arg;
|
||||
|
||||
/* check against maximum sane rate */
|
||||
if (ticks < 1000)
|
||||
/* check against maximum sane rate (1ms) */
|
||||
if (period < 1000)
|
||||
return -EINVAL;
|
||||
|
||||
/* update interval for next measurement */
|
||||
/* XXX this is a bit shady, but no other way to adjust... */
|
||||
_mag_call.period = _call_mag_interval = ticks;
|
||||
_mag_call.period = _call_mag_interval = period;
|
||||
|
||||
/* if we need to start the poll state machine, do it */
|
||||
if (want_start)
|
||||
|
||||
Reference in New Issue
Block a user