GCC requires a declaration of a static inline function prior to its
definition when strict-prototypes warning is enabled.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
QuRT's pthread_cancel implementation is lacking, and causes px4_poll to
always wait for the maximumn timeout. A cleaner implementation is provided
that uses the HRT work queue for posix targets.
In the future the posix code should be rtefactiored so that qurt (and other)
implementations that are duplicated, use the posix implementation.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The addition of the hrt workqueue required adding some additional files to
unittests/CMakeLists.txt
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
There is a race condition for the accel and mag polling rates.
Whichever one gets set first, the other will be uninitialized.
Set the mag polling rate to 1ms if uninitilized.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
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>
GCC was more picky about prototypes for inlines being required.
The generate_listener.py script used incorrect printf formats and
was casting %f params to float, but printf casts all %f params to
double per the spec.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The HRT call processing normally happens via HW timer interrupt
handler. Since the POSIX port has no ISR handling, the HP work
queue is used.
Instead of irq_save() and irq_restore() calls to disable/enable
interrupts, a mutex is used to protect each queue.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The getopt command uses global variables and is not thread safe.
Created a minimal px4_getopt version that supports options with
or without an arg, and random placement of options on the command line.
This version modifies the order of the args in argv as does the
POSIX version of getopt.
This assumes that argv[0] is the program name. Nuttx may not support
that properly in task_spawn.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
To avoid confusion when a real device and a virtual device is
being used, changed CDev to VDev for Linux.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
this device ID identifies a specific device via the tuple of (bus, bus
type, address, devtype). This allows device specific configuration
data to be stored along with a device ID, so the code can know when
the user has changed device configuration (such as removing an
external compass), and either invalidate the device configuration or
force the user to re-calibrate
Make the Device destructor public and virtual, so that arbitrary devices can be deleted. Likewise for classes that derive from it.
Make Device::init public so that arbitrary devices can be initialised after being returned by factories.