Commit Graph

686 Commits

Author SHA1 Message Date
Ralf Ramsauer 530d3230df Linux: Scheduler: don't ignore return values
Several return values in the constructor of the scheduler were ignored
before, while they should be respected.

I found that bug while strac'ing ardupilot as it failed at some later
point.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
2016-11-03 17:27:37 -03:00
Lucas De Marchi 2b5f9fdd6b AP_HAL_Linux: teardown scheduler threads 2016-11-02 16:28:20 -02:00
Lucas De Marchi 89420e4b2d AP_HAL_Linux: add signal handler for normal termination
This allows to terminate the flight stack nicely, ensuring it returns 0
so init system can check by return code if it terminated nicely or if it
was due to a crash.
2016-11-02 16:28:20 -02:00
Lucas De Marchi fa540429f9 AP_HAL_Linux: allow to teardown bus threads
Add code to teardown all bus threads. This can be called while exiting
to wait for threads to finalize.
2016-11-02 16:28:20 -02:00
Lucas De Marchi 312a27dd20 AP_HAL: RCInput: rename deinit() to teardown() 2016-11-02 16:28:20 -02:00
Lucas De Marchi 89599f7bea AP_HAL_Linux: add unit tests for Thread implementations 2016-11-02 16:28:20 -02:00
Lucas De Marchi 992abd170d AP_HAL_Linux: allow to join threads 2016-11-02 16:28:20 -02:00
Lucas De Marchi 3b2de6de46 AP_HAL_Linux: allow PeriodicThread to stop
This takes the simplest approach of just waiting for the next time we
will process events.
2016-11-02 16:28:20 -02:00
Lucas De Marchi 20650e14b7 AP_HAL_Linux: allow PollerThread to stop 2016-11-02 16:28:20 -02:00
Lucas De Marchi da65a5c349 AP_HAL_Linux: allow to wakeup pollable
This allows to wakeup the thread that is sleeping on Poller::poll()
[ which in our case is an epoll_wait() call ]. This is usually achieved
by using a special signal and using the pwait() variant of the sleeping
function (or using signalfd). However integrating the signal in the
Thread class is more complex than simply use the eventfd syscall which
can serve our needs.
2016-11-02 16:28:20 -02:00
Lucas De Marchi efe819e21e AP_HAL_Linux: Poller: allow to fail constructor 2016-11-02 16:28:20 -02:00
Lucas De Marchi e5003c3116 AP_HAL_Linux: Poller: add some documentation 2016-11-02 16:28:20 -02:00
Lucas De Marchi da821e69eb AP_HAL_Linux: Thread: allow to use Thread from stack
Up until now we rely on Thread objects and variants thereof to be allocated
on heap or embedded in another object that's zero'ed on initialization.
However sometimes it's convenient to be able to use them on stack as
will be the case when writting unit tests.

Initialize all relevant fields to allow them to be used on stack. While
at it, prefer C++11 initialization on Poller since it's only setting the
default (invalid) value.
2016-11-02 16:28:20 -02:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02:00
hiro2233 cdfd057690 AP_HAL_LINUX: Added urus macro RCInput_RPI 2016-10-27 11:51:53 -02:00
hiro2233 cae0c11720 AP_HAL_Linux: Added URUS Macro to Util_RPI 2016-10-27 11:51:32 -02:00
hiro2233 37877f1530 AP_HAL_Linux: Added URUS macro to Scheduler 2016-10-27 11:51:32 -02:00
hiro2233 7000124f6a AP_HAL_Linux: Added URUS Macro for GPIO_RPI and UtilRPI 2016-10-27 11:51:32 -02:00
hiro2233 a7b79dc0e2 AP_HAL_Linux: GPIO_RPI: Added URUS Macro. 2016-10-27 11:51:32 -02:00
Lucas De Marchi 473add51f7 AP_HAL_Linux: RPIOUARTDriver: remove dma mention
There's no dma going on here, it's just a normal SPI transfer.
2016-10-27 10:35:01 -03:00
Lucas De Marchi d60b4842b6 AP_HAL_Linux: reduce scope of dummy buffer 2016-10-27 10:35:01 -03:00
Lucas De Marchi 76f1e4243a AP_HAL_Linux: remove double assignment
_dma_packet_tx.crc is already assigned below, we don't neet to set it to
0 before. While at it move the assignment to .crc up and fix coding
style.
2016-10-27 10:35:01 -03:00
Lucas De Marchi c898b28962 AP_HAL_Linux: use MIN where possible 2016-10-27 10:35:01 -03:00
Murilo Belluzzo c7a65a026c AP_HAL_PX4: UARTDriver: Make use of ByteBuffer class
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.

Although the exchange opens opportunities for improvement and
simplification of this class.
2016-10-27 14:23:43 +11:00
Lucas De Marchi 26650049c0 AP_HAL_Linux: UARTDriver: fix writting/reading with failures
When the buffer wraps and we do it in 2 steps, we can't actually do the
second part if it fails or if we wrote less bytes than we intended,
otherwise we will corrupt the data being sent.
2016-10-27 14:23:42 +11:00
Murilo Belluzzo ce81c45f80 AP_HAL_Linux: UARTDriver: Make use of ByteBuffer class
This patch replaces the 'old style' ringbuffer by the ByteBuffer class.
An effort was made to keep the exchange as close as possible from a
drop-in replacement to minimize the risk of introducing bugs.

Although the exchange opens opportunities for improvement and
simplification of this class.
2016-10-27 14:23:42 +11:00
Lucas De Marchi 539b727e5e AP_HAL_Linux: Remove misleading constant
The constant passed to cflag is BOTHER, meaning the actual baud is set
in the other specific members.  Don't define B* constants as they are
misleading here and this is why it doesn't work with e.g.
cfset[io]speed()... that function expect a B* constant which in Linux
is not the speed, but an index to an array with speeds.
2016-10-25 16:55:33 +11:00
Martin Evans 6f6112d7c2 AP_HAL_Linux: Add setting for GPIO for Dark board
Just like other RPI-based boards.
2016-10-24 10:00:24 -02:00
Martin Evans d2d3119b66 AP_HAL_Linux: PCA9685: Add quinary address 2016-10-24 10:00:06 -02:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Julien Beraud 20dcd6e082 RCOutput_Bebop: fix motor order
Accidentally pushed in commit 298f7bffb9
The order of the motors shouldn't have been changed on version 5 because
it is specific to older versions of the ESC controller firmware
2016-10-17 20:55:49 +11:00
Andrew Tridgell 33bff3c79c HAL_Linux: fixed transmitter failsafe with SBUS RCInput 2016-10-17 06:53:33 +11:00
Andrew Tridgell 110355f14e HAL_Linux: fixed SRXL and DSM
fixed default decoder state and fixed mic-recognition of SRXL as DSM
2016-10-16 21:31:37 +11:00
Andrew Tridgell e9633553fb HAL_Linux: update for changed SRXL API 2016-10-16 19:05:19 +11:00
Andrew Tridgell 03f9496549 HAL_Linux: lock onto a single decoder on the 115200 port 2016-10-16 19:05:19 +11:00
Andrew Tridgell 513156a4cc HAL_Linux: make 115200 R/C decoders return a bool 2016-10-16 19:05:19 +11:00
Andrew Tridgell 710d08da6d HAL_Linux: support SRXL R/C input 2016-10-16 19:05:19 +11:00
Andrew Tridgell 7f09d20e3b HAL_Linux: implement cork and push for remaining RCOutput backends 2016-10-13 10:00:04 +11:00
Andrew Tridgell c8179a0887 HAL_Linux: implement cork/push for RCOutput_AioPRU 2016-10-13 10:00:04 +11:00
Andrew Tridgell 0640b6539c HAL_Linux: implement cork()/push() for Raspilot 2016-10-13 10:00:04 +11:00
Andrew Tridgell a80eea5de4 HAL_Linux: implement cork()/push() for HAL_Linux RCOutput_Sysfs 2016-10-13 10:00:04 +11:00
Andrew Tridgell 0cd3054a4c HAL_Linux: document the Disco PWM pinout 2016-10-12 21:41:49 +11:00
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Andrew Tridgell 3eb8b5e99f HAL_Linux: added RCInput_Multi
this allows for multiple RCInput methods on one board. On Disco it
combines RCInput_115200 with RCInput_SBUS
2016-09-21 10:33:15 -03:00
Andrew Tridgell 5909552f67 HAL_Linux: added RCInput_115200
this is a RCInput module for multiple R/C uart protocols running at
115200 baud 8-bit. We can decode multiple protocols in parallel with
this module, relying on frame timing and CRCs to get the right
protocol
2016-09-21 10:33:15 -03:00
Andrew Tridgell e913b9a8f7 HAL_Linux: fixed incorrect include 2016-09-21 10:33:15 -03:00
Andrew Tridgell a4c1bc3fd3 HAL_Linux: avoiding setting the SPI mode on every transfer
This was causing the Disco kernel to print a debug message on every
SPI transfer, which makes for a very noisy kernel and large kernel logs
2016-09-17 00:35:00 -03:00
William Liu b1a62d6c8e AP_HAL_Linux: RCOutput_Bebop: fixed potential deadlock 2016-09-09 09:59:17 -07:00
Gustavo Jose de Sousa 025082b280 AP_HAL_Linux: add port to Intel Aero
Contributions from:
 - Gustavo Jose de Sousa <gustavo.sousa@intel.com>
 - José Roberto de Souza <jose.souza@intel.com>
 - Lucas De Marchi <lucas.demarchi@intel.com>
 - Patrick J.P <patrick.pereira@intel.com>
2016-09-03 01:03:07 -03:00
Patrick J.P c32dc3bc37 AP_HAL_Linux: Add AeroIO communication module
Signed-off-by: Patrick J.P <patrick.pereira@intel.com>
2016-09-03 01:03:07 -03:00