25 Commits

Author SHA1 Message Date
Lorenz Meier
c0a6635400 Lock VDEV table to prevent concurrent access 2015-11-02 10:51:53 +01:00
Lorenz Meier
fe216b5c5f Device: Fixed code style 2015-10-19 13:15:22 +02:00
Lorenz Meier
c1c235edb2 Merge branch 'cmake-2' into cmake-2-pthread 2015-09-20 10:34:03 +02:00
Lorenz Meier
76508ab5b5 Device:: Move to POSIX semaphore abstraction 2015-09-20 00:27:41 +02:00
Mark Charlebois
7d2ba97511 Fixed poll timeout bug
The SIGCONT signal was being ignored by the HRT queue thread so the
usleep was not waking up early to process new work.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-09-16 15:24:58 -07:00
tumbili
50a5fb94ad fix logic in posix access function 2015-09-03 09:56:07 +02:00
Mark Charlebois
14bf8bb277 POSIX: Critical fix for vdev_posix
Last fix for vdev_posix.cpp introduced a sleep from within
a HRT work item callback which blocks the HRT queue.

The code in uORBDevices_posix.cpp that handles message
throttling was commented out for posix. The code was re-enabled
and now seems to work.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-06-30 12:08:42 -07:00
Mark Charlebois
da2ac877f8 POSIX: Changed px4_poll to use hrt_work queue
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>
2015-06-29 19:08:06 -07:00
tumbili
7043869237 VDev:
- increase max number of devices to 200
- increase max number of file descriptors to 200
- add warning if number of file descriptor exceeds max value
2015-06-23 18:32:40 +02:00
Lorenz Meier
27cec4a977 VDev POSIX: Fix non-POSIX conformant return value handling 2015-06-19 11:52:07 -07:00
Mark Charlebois
f985a48fbc Created px4_access to handle check of virtual files
uORBManager_posix.cpp did a stat to see if a file exists but the
file is actually a virtual file. Using stat was incorrect because
it required a stat buffer that was never used. The POSIX access
function is a better choice so I created a px4_access version to
handle virtual files.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-06-03 16:22:14 -07:00
Mark Charlebois
6343b2c56f px4_poll fix - was sleeping for usec instead of ms
There was a conversion error in the timeout (in ms)
passed in and the ts.tv_nsec field of the struct timeval.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-29 13:26:29 -07:00
Mark Charlebois
ffdc9d629c POSIX: Improved logging
The warnx and warn calls map to PX4_WARN.
Calls to errx or err genrtate a compile error.

The px4_log.h file implements a new log format:

For DEBUG and INFO:
<level> <msg>

For ERROR and WARN:
<level> <msg> (file filepath line linenum)

The verbosity can be changed by setting the macro to use
either linux_log or linux_log_verbose in px4_log.h

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-19 09:19:24 -07:00
Mark Charlebois
2f434eb395 POSIX: fixups for px4_log.h change
After merge from qurt branch, fixups for posix build

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-11 16:14:06 -07:00
Mark Charlebois
a99f916bdf POSIX: Changed px4_debug.h to px4_log.h
Also changed use of printf to PX4_WARN or PX4_INFO in posix and
qurt tests.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-11 16:04:39 -07:00
Mark Charlebois
99822038f3 POSIX: Fixed px4_open code to not create a file when opening a device
The code to created a virtual file was preventing the creation of
device nodes.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-07 10:50:23 -07:00
Mark Charlebois
5e2af2b227 POSIX: fixed return values to be posix compliant
px4_read, px4_write, and px4_opctl were not returning the correct
value on error. They were returning -errno vs -1.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-07 09:38:03 -07:00
Mark Charlebois
6db77dc8bb Experimental virtual file support
QuRT does not have a filesystem, so creating a virtual filesystem
that could be implemented as an in-memory file or a remote file
over fastRPC.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-06 22:12:45 -07:00
Mark Charlebois
d913ec8dc9 Changed device::px4_device_handle_t to device::file_t
This change allowed the _posix.cpp file changes to be merged
back into the original files.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-24 17:49:35 -07:00
Mark Charlebois
3336fce1f4 QuRT and POSIX changes
Partial commit of the changes for QuRT and related changes for POSIX

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-24 00:52:44 -07:00
Mark Charlebois
d2f0572ce6 Linux: added builtins to show devices and topics
list_devices will list virtual devices starting with "/dev/".
list_topics will list topics ("/obj/")

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:37:50 -07:00
Mark Charlebois
bba26c3430 Linux: enabled commander module
The commander module now compiles for Linux.

state_machine_helper_linux.cpp iterates over the virtual devices vs
all devices under /dev as per NuttX when disabling publishing.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:37:50 -07:00
Mark Charlebois
f0312d2da0 Linux: Added commands to show threads and devices
The list_tasks and list_devices commands will show
lists of running px4 threads and created virtual device nodes.

The list_builtins command was removes and the list of commands
will be shown if return is pressed.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:47 -07:00
Mark Charlebois
ccd18929fc Linux: changed CDev to VDev for virtual device implementation
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>
2015-04-20 11:34:12 -07:00
Mark Charlebois
8c8f57b5b4 Fixed std::isfinite vs isfinite differences
Added PX4_ISFINITE(x) to px4_defines.h to handle the differences on
NuttX and Linux.

This change also picked up some file renaming for virtual character devices

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00