Commit Graph

974 Commits

Author SHA1 Message Date
mirkix 8d7000db2c AP_HAL_Linux: fix typo 2018-01-09 12:54:03 -08:00
mirkix 9b6a826b49 AP_HAL_linux: add new board PocketPilot 2017-12-27 16:01:55 +00:00
mirkix eecd8fcfa6 AP_HAL_Linux: Add VOLTAGE_SCALING for BeagleBone Blue 2017-12-19 09:17:06 +11:00
mirkix 26f3a62db7 AP_HAL_Linux: remove BBBmini from RCInput_PRU.cpp 2017-12-14 12:40:37 -08:00
HeBin 0e1ce2a7fd AP_HAL_Linux: add Robsense PhenixPro Devkit Board support 2017-11-22 10:10:21 -08:00
Georgii Staroselskii 56534b34c5 AP_HAL_Linux: use GPIO_Sysfs for Navio
/boot/config.txt: dtoverlay=navio-rgb should be disabled for this thing
to work, though.
2017-11-17 09:20:55 -08:00
Georgii Staroselskii 5254ee03c2 AP_HAL_Linux: use GPIO_Sysfs for Edge 2017-11-17 09:18:36 -08:00
Georgii Staroselskii 8fcd30c611 AP_HAL_Linux: use GPIO_Sysfs for Navio 2 2017-11-17 09:18:35 -08:00
alexshirley 8058fdf093 AP_HAL_Linux: combine ppm and sbus on ocpoc_zynq
Removes compile-time selection of RCInput driver for ocpoc_zynq.
PPM and SBUS input are now colocated on the ocpoc board, and it
only needs to run RCInput_ZYNQ. Pulse input is also inverted
to accommodate SBUS input, which has no effect on PPM input.
2017-11-01 10:28:40 -07:00
Lucas De Marchi cbb9dcc2a1 AP_HAL_Linux: Storage: use define from HAL for directory 2017-10-30 16:57:37 -07:00
Georgii Staroselskii 79c14a92a9 AP_HAL_Linux: adapt Heat_Pwm for Edge 2017-10-20 13:03:08 -07:00
Georgii Staroselskii 4e6fab228c AP_HAL_Linux: add SPI devices for Edge 2017-10-20 13:03:08 -07:00
Staroselskii Georgii 3ade179700 AP_HAL_Linux: make use of RCInput_Navio2 in Edge 2017-10-20 13:03:08 -07:00
Staroselskii Georgii 2a99bb0c95 AP_HAL: use Raspberry Pi GPIO and Util classes for Edge
As it's a yet another Raspberry Pi based board, we may reuse the code.
2017-10-20 13:03:08 -07:00
Staroselskii Georgii 2a7e8d66ee AP_HAL_Linux: add Edge support
Just some usual boilerplate code.
2017-10-20 13:03:08 -07:00
Georgii Staroselskii 2dd68243a2 AP_HAL: add Edge support 2017-10-20 13:03:08 -07:00
Georgii Staroselskii d214a36e0a AP_HAL_Linux: reset duty cycle before setting period
On kernels 4.7+ duty_cycle should always be less than period.
Otherways, we'll get a EINVAL.

It makes sense to set duty_cycle to 0, as
duty_cycle doesn't really make sense without a proper period.

A proper way to handle these errors might be to call pwm_adjust_config
in every pwmchip backend but it's unrealistic to hope that all vendors
will do it quickly.
2017-10-17 13:28:34 -07:00
Lucas De Marchi 4d5aed1d69 AP_HAL_Linux: UARTDevice: never be the controlling terminal
If we are the controlling terminal for a tty device we will receive a
SIGHUP when the device disappears. Currently what happens is that we
simply stop the whole process. We don't want to fall off the sky due
to a bad device. This can happen for any reason, but it's more likely
if the UART is behind a USB connection.
2017-10-02 11:05:09 -07:00
Lucas De Marchi 5ebc8c2cb3 AP_HAL_Linux: ToneAlarm: ifdef out bogus message
These messages are only valid in a small subset of Linux boards (those
based on BBB and variants).  The ToneAlarm class should actually be
split allowing different implementations, but for now let's just disable
the message.
2017-09-28 09:00:26 -07:00
Aaron Wang Shi 6a82e3aecd AP_HAL_Linux: Add debug message in RCInput_RPI _timer_tick() 2017-09-25 21:11:56 -07:00
Aaron Wang Shi ccde7cfdd4 AP_HAL_Linux: Restart RCInput_RPI DMA sampling if it stops 2017-09-25 21:10:54 -07:00
Lucas De Marchi 3847825fba AP_HAL_Linux: make Aero use Tap ESC
This allows controlling the motors from Linux on Intel Aero RTF given
the right FPGA firmware is in place.
2017-09-21 07:59:20 -07:00
Peter Barker 044cac42e8 AP_HAL_Linux: make in_main_thread const and override 2017-09-19 09:40:11 +10:00
Lucas De Marchi 7ba82ff23a AP_HAL_Linux: remove raspilot
It's not being sold, there are just a few (different) engineering
samples built and there are no plans for this to go forward for people
that were pushing it.
2017-09-12 15:06:19 -07:00
Francisco Ferreira 4398be2275 AP_HAL_Linux: remove URUS 2017-09-11 10:04:11 -07:00
davidaroyer 7d2e44862f AP_HAL_Linux: add support for Aerotenna OcPoC-Zynq hardware 2017-09-08 07:30:49 -07:00
Georgii Staroselskii e79fc893fa AP_HAL_Linux: HAL_Linux_Class: delay SPIUARTDriver static initialization
There's an implicit (apart from the name) dependency between SPI and
SPIUARTDriver which results in a crush on a restart or a shutdown.

By moving the initialization we're making sure that all objects are
deleted in the right order.
2017-09-08 07:26:54 -07:00
Georgii Staroselskii 226eeeb738 AP_HAL_Linux: RCOutput_Sysfs: fix deleting _pwm_channels array
delete [] should be called rather than delete.
2017-09-08 07:26:54 -07:00
Georgii Staroselskii f6858821a6 AP_HAL_Linux: PWM_Sysfs: remove unneeded free() in ~PWM_Sysfs_Base
_export_path and _duty_path will have been already long time gone by the
time dtors kick in.

Probably better to use OwnPtr around those. But it's better to be done
in a separate PR.
2017-09-08 07:26:54 -07:00
Lucas De Marchi 66a1e420cb AP_HAL_Linux: RCInput_SoloLink: better name to first field
Checking the time on the tcpdump capture, it matches the first fields
from the data:

$ tshark -n -c 4 -r  ~/tmp/solo/rc.pcap
    1   0.000000     10.1.1.1 → 10.1.1.10    UDP 68 5005 → 5005 Len=26
    2   0.019976     10.1.1.1 → 10.1.1.10    UDP 68 5005 → 5005 Len=26
    3   0.040046     10.1.1.1 → 10.1.1.10    UDP 68 5005 → 5005 Len=26
    4   0.059961     10.1.1.1 → 10.1.1.10    UDP 68 5005 → 5005 Len=26

From the previous commit (first 2 packets):

     5fa8 f441 3414 0500 73d7  dc05 dc05 dc05 db05 e803 e803 e803 f401
     73f6 f441 3414 0500 74d7  dc05 dc05 dc05 db05 e803 e803 e803 f401

0x0005143441f45fa8 - 0x0005143441f4f673 = 0x4E14 = 19988 (usec)

Which seems to approximately match for the other packets as well. We are
not using the field since we rather get the time when we receive it, but
at least use a better name.
2017-08-17 12:04:27 -07:00
Lucas De Marchi 373d41fd6e AP_HAL_Linux: switch aero to RCInput_SoloLink 2017-08-17 12:04:27 -07:00
Lucas De Marchi 79b004cf6a AP_HAL_Linux: add prototype for handling SoloLink
This allows to use a Solo controller to control Linux-based flight
controllers. The protocol has been derived by analyzing a tcpdump
trace: some fields are ignored. Example trace of RC data (obtained
with `tshark -T fields -e data -n -c 5 -r  rc.pcap`

 unkonwn              seq   ch1  ch2  ch3  ...                ch8
 5fa8 f441 3414 0500 73d7  dc05 dc05 dc05 db05 e803 e803 e803 f401
 73f6 f441 3414 0500 74d7  dc05 dc05 dc05 db05 e803 e803 e803 f401
 dc44 f541 3414 0500 75d7  dc05 dc05 dc05 db05 e803 e803 e803 f401
 bc92 f541 3414 0500 76d7  dc05 dc05 dc05 db05 e803 e803 e803 f401
 dfe0 f541 3414 0500 77d7  dc05 dc05 dc05 db05 e803 e803 e803 f401
2017-08-17 12:04:27 -07:00
Peter Barker 23d91c93c8 AP_HAL_Linux: correct compilation warning
../../../libraries/AP_HAL_Linux/RCInput_RPI.cpp:129:35: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
         ::read(file, &pageInfo, 8);
2017-08-17 11:28:36 +01:00
Lucas De Marchi 5ea1784838 global: remove AP_HAL::in_timerprocess()
This is not used and in the only places it would make sense would be
internally to the scheduler so remove it.
2017-08-03 20:25:14 -07:00
Lucas De Marchi 93a558ce5c AP_HAL_Linux: do not call delay callbacks on other threads
If a thread other than the main one calls Scheduler::delay() we could
end up triggering the call of delay callbacks. Those should only ever
happen on the main thread.
2017-08-03 20:24:57 -07:00
Lucas De Marchi c170c2a847 AP_HAL_Linux: remove register_timer_process with extra arg
This is not used anymore.
2017-08-02 08:00:53 -07:00
Lucas De Marchi 0a158f6d3f AP_HAL_Linux: remove support for timesliced timer
This has long been replaced by the bus per thread scheme.
2017-08-02 08:00:53 -07:00
Siddharth Bharat Purohit d1e0f9733e HAL_Linux: use correct datatype for time conversion 2017-07-13 18:23:00 -07:00
Andrew Tridgell 9868ffe13b HAL_Linux: support receiver based RSSI 2017-07-03 11:22:21 +10:00
Lucas De Marchi ee0f46e3aa AP_HAL_Linux: RCInput_RPI: ignore unwanted signals
We are setting a termination handler for some signals which are of not
interest.  Just ignore them.  Ignoring SIGWINCH allows for example to
run on a screen and change the window size later without killing
ardupilot.
2017-05-23 09:09:51 +10:00
Lucas De Marchi e803045d1f AP_HAL_Linux: Scheduler: increase stack for scheduler threads
RPI-based boards that use RCInput_RPI need more stack space otherwise we
end up with stack corruption. This leads to crash particularly when also
using GPIO_RPI since it may change what that driver is poking on memory.

This increases stack size to 1M which is overkill for most of other
boards with a more controllable stack usage. However this exposes that
on multiple different HWs a single point for stack size decision may not
be the best.  This can be improved in future.
2017-05-23 09:09:51 +10:00
Peter Barker c78f3b9e78 AP_HAL_Linux: use HAL_SEMAPHORE_BLOCK_FOREVER macro 2017-05-08 10:23:03 +09:00
Andrew Tridgell 279c1b9d9c AP_HAL_Linux: rename macros to avoid conflicts
these macros were also defined in NuttX in clock.h
2017-05-06 15:21:14 +10:00
Peter Barker 5a02219642 AP_HAL_Linux: use HAL_SEMAPHORE_BLOCK_FOREVER 2017-05-01 15:05:51 +01:00
Andrew Tridgell 9b297ef5a1 HAL_Linux: fixed nested cork/push
don't generate extra pulse sets if we nest
2017-05-01 14:32:18 +10:00
Lucas De Marchi 875538ccb5 AP_HAL_Linux: examples: small fixes to BusTest
- Fix char allocation
  - Fix coding style
  - Fix accessing dev->bus_type(): it's a function
2017-04-19 01:13:40 -07:00
hiro2233 0d1d430600 AP_HAL_Linux:examples: Example to test device bus with the new APM API. 2017-04-19 01:05:12 -07:00
hiro2233 be06c1e8ed AP_HAL_Linux:SPIDevice: Add functions to get possible spi registered device 2017-04-19 01:05:12 -07:00
Lucas De Marchi 16c1bc1b0e AP_HAL_Linux: Util: fix coding style for pointers 2017-04-19 00:19:40 -07:00
Lucas De Marchi 9aa2a3938c AP_HAL_Linux: Util: make get_custom_log_directory const override final
While at it, add final and override to mark this as being the overriden
final implementation of this method.

Thanks to Phillip Khandeliants (@khandeliants) for reporting.
2017-04-19 00:19:22 -07:00
Lucas De Marchi 008e631147 AP_HAL_Linux: Util: fix overriden function signature
While at it, add final and override to mark this as being the overriden
final implementation of this method.

Thanks to Phillip Khandeliants (@khandeliants) for reporting.
2017-04-18 23:57:54 -07:00
Lucas De Marchi 6f952fe3dd AP_HAL_Linux: fix checking wrong value for pthread function
Thanks to Phillip Khandeliants (@khandeliants) for reporting.
2017-04-18 23:57:54 -07:00
Pierre Kancir 8d357983ee AP_HAL_LINUX: example fix travis warning
missing function declaration
implicit cast
some style fix
2017-04-13 19:56:16 +01:00
davidaroyer 512cd11125 AP_HAL_Linux: RCOutput_ZYNQ: check for valid channel 2017-04-11 12:10:33 +01:00
Eugene Shamaev 7831a85f1c AP_HAL_Linux: definitions for CAN bus 2017-04-10 22:38:12 +01:00
mirkix 9e1345453f AP_HAL_Linux: BBBmini remove onboard OpticalFlow 2017-03-07 22:48:48 -08:00
Lucas De Marchi 32d208dbe8 AP_HAL_Linux: move check for _split_transfers
This is likely not true, so allow not to check the other conditions.
Also remove comment since this is going to be added to the method.
2017-02-23 22:38:15 -08:00
Andrew Tridgell a2e445cf24 HAL_Linux: implement set_split_transfers() API for I2C 2017-02-23 22:38:15 -08:00
murata eb4d8963d0 AP_HAL_Linux: Change from magic number 0 to definition name. 2017-02-18 14:12:36 +00:00
murata 30bbe7abb6 AP_HAL_Linux: Unify from print or println to printf. 2017-01-27 18:20:22 +11:00
mirkix 6d99bb0937 AP_HAL_Linux: Add BeagleBone Blue to GPIO_BBB 2017-01-26 23:15:52 -08:00
mirkix 954267fc22 AP_HAL_Linux: Add BeagleBone Blue to RCInput_AioPRU 2017-01-26 23:15:52 -08:00
mirkix d16ab890e8 AP_HAL_Linux: Add BealgeBone Blue 2017-01-26 23:15:52 -08:00
mirkix ad7e21b860 AP_HAL_Linux: fix compiler warning in AnalogIn_IIO 2017-01-26 23:05:46 -08:00
Mathieu OTHACEHE 7c96f8e6a2 AP_HAL_Linux: rename APM to ardupilot.
This rename should have happened here:
fdb2a9c99b but was forgotten.
2017-01-25 16:57:47 +00:00
Julien Beraud 710875d3b9 OpticalFlow_Onboard: remove gyro cb
Not used anymore
2017-01-23 21:23:16 +11:00
Julien Beraud 59404f686d OpticalFlow_Onboard: add gyro integration support
Integrate the gyro values pushed by the inertial sensor backend using
bias values sent by EKF.
Use the unblocking RingBuffer to avoid locking the callers.
2017-01-23 21:23:16 +11:00
Lucas De Marchi c27c414e5a AP_HAL_Linux: Led_Sysfs: small fixes
- avoid trying to close fd when it's -1

  - Keep includes sorted

  - AP_HAL::panic() doesn't need \n terminator

  - %u requires unsigned type

  - #pragma once is the first thing on a header
2017-01-19 08:56:32 -08:00
Mathieu OTHACEHE 7d4d14a409 AP_HAL_Linux: add Led_Sysfs class.
Add a class to control leds via linux sysfs API.
2017-01-19 08:24:47 -08:00
Julien Beraud 0d4ca03dcd AP_HAL_Linux: init SPIDevice speed by default
Else a speed of 0 will be sent at each transfer.
Behaviour has changed when introducing SPIDevice
2017-01-16 10:23:47 -08:00
Lucas De Marchi 5472bc4de1 Global: change Device::PeriodicCb signature
Remove bool return as it's never being used and not supported on PX4.
2017-01-14 10:03:54 +11:00
Lucas De Marchi b910f230fb AP_HAL_Linux: RCInput: replace volatile with atomic 2017-01-11 11:25:00 +11:00
Andrew Tridgell 0a18f5e7b2 HAL_Linux: fixed a bug in RCInput::new_input
when a library called read() it would clear the new input flag, which
would cause new_input() in the main loop to return false. This could
trigger a false RC failsafe.
2017-01-09 21:47:19 -08:00
Lucas De Marchi b0ddf81687 Remove stdbool.h include for C++ sources
This header is not needed in our C++ sources.
2016-12-16 11:38:52 -08:00
Ivan Smirnov d4d35bdcbd AP_HAL_Linux: Scheduler: added _timer_tick for uartD 2016-12-07 10:25:00 -08:00
Lucas De Marchi f9b0f9164a AP_HAL_Linux: add TODO to AnalogIn_Raspilot
This is especially bad for raspilot since it has a spi bus shared for
all the peripherals.
2016-11-21 18:11:31 -02:00
Andrew Tridgell 6f82ec0642 HAL_Linux: convert RASPilot drivers to thread per bus 2016-11-21 18:04:10 -02:00
Lucas De Marchi 504de3ea9e AP_HAL_Linux: RCInput_RPI: fix whitespaces
Also add/change some minor coding style issues, reducing scope of
variables.
2016-11-19 14:05:22 -02:00
Lucas De Marchi aadc1643fc AP_HAL_Linux: reduce speed of MPU* devices
After introducing the temperature check we are resetting the fifo
several times due to difference in temperature.
2016-11-19 14:05:22 -02:00
Lucas De Marchi 8d3361cef4 AP_HAL_Linux: RCInput_RPI: fix using Util class on constructor
Program received signal SIGSEGV, Segmentation fault.
0x000b8760 in Linux::UtilRPI::get_rpi_version() const ()
(gdb) bt
 #0  0x000b8760 in Linux::UtilRPI::get_rpi_version() const ()
 #1  0x000b57ac in Linux::RCInput_RPI::RCInput_RPI() ()
 #2  0x0000acfc in _GLOBAL__sub_I__ZN9HAL_LinuxC2Ev ()
 #3  0x000e1600 in __libc_csu_init ()
 #4  0x76cad228 in __libc_start_main (main=0x7efff774, argc=1994186752,
     argv=0x76cad228 <__libc_start_main+168>, init=0xe15b4 <__libc_csu_init>,
     fini=0xe1614 <__libc_csu_fini>, rtld_fini=0x76fdf464 <_dl_fini>,
     stack_end=0x7efff774) at libc-start.c:246
 #5  0x0000afa4 in _start ()
2016-11-19 14:05:22 -02:00
Peter Barker cf5ed25c9e AP_HAL_Linux: do not attempt realtime when compiling Replay 2016-11-16 22:25:18 -02:00
Julien Beraud ac3f49b06f RPIOUART_Driver: fix warning
cast PKT_MAX_REGS to uint32_t to be able to compare without a warning
2016-11-16 17:37:15 -02:00
Lucas De Marchi c1647b13eb AP_HAL_Linux: fix leaking strings 2016-11-09 11:44:05 -03:00
Andrew Tridgell 4cf6dd1818 HAL_Linux: removed panic on bad SPI device 2016-11-09 17:08:11 +11:00
Andrew Tridgell a6ac02b61f HAL_Linux: implement device IDs for I2C and SPI 2016-11-09 17:08:04 +11:00
Mathieu OTHACEHE 60ba91aead Disco: add buzzer support
Use ToneAlarm class to handle Disco buzzer.
2016-11-07 18:02:21 -03:00
Mathieu OTHACEHE 0fa441a8a5 PWM_Sysfs: add an init method to do hal dependent stuff.
When PWM_Sysfs_Base constructor is called, global variable hal may not
have been initialized resulting in NULL dereferencing error.

Move hal dependent stuff from contructor to init method.
2016-11-07 14:59:31 -02:00
Lucas De Marchi 490841a814 AP_HAL_Linux: add O_CLOEXEC in places missing it
By opening with O_CLOEXEC we make sure we don't leak the file descriptor
when we are exec'ing or calling out subprograms. Right now we currently
don't do it so there's no harm, but it's good practice in Linux to have
it.
2016-11-07 12:37:30 -03:00
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
Ralf Ramsauer 71212942da AP_HAL: AP_HAL_Linux: align I2CDevice::read_registers_multiple()
25c7e8b changed the logic of transfer(). Align
I2CDevice::read_registers_multiple() in the same way.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
2016-08-31 00:18:50 -03:00
Ralf Ramsauer 5b81920737 AP_HAL: AP_HAL_Linux: add comment to I2CDevice::transfer()
If I2CDevice::transfer() has to do nothing it returns false. This can be
misleading, as this might feel contradictory.

Let's spend a comment on that.

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
2016-08-29 15:20:14 -03:00
Ralf Ramsauer 25c7e8bf60 AP_HAL: AP_HAL_Linux: perfect I2CDevice::transfer()
According to man 3 ioctl, ioctl returns other values than -1 on success.
So loop while ioctl returns -1.

Furthermore, there is no necessity to initialise r with -EINVAL,

Signed-off-by: Ralf Ramsauer <ralf.ramsauer@othr.de>
2016-08-29 15:20:14 -03:00
Lucas De Marchi 833f565f09 AP_HAL_Linux: prefix threads with ap
This makes it consistent with bus threads and easier to grep from a `ps`
call.
2016-08-29 10:27:36 -03:00
Lucas De Marchi e1ab44f4a3 Global: remove get_fd() from Device API
This was there for compatibility with I2CDriver and SPIDriver. We don't
use them anymore so we can remove the compat method.
2016-08-29 10:27:36 -03:00
Murilo Belluzzo 077e03678f Global: Adapt Stream class to be used with Ringbuffer 2016-08-03 01:44:02 -03:00
Lucas De Marchi 8541d5339d AP_HAL_Linux: Implement threaded SPI 2016-07-30 00:55:27 -03:00
Lucas De Marchi ea0595c7ac AP_HAL_Linux: SPIDevice: move implementation to outside
As we add methods, it's becoming too complex to be implemented together
with the declaration.
2016-07-30 00:55:27 -03:00
Lucas De Marchi 590539f674 AP_HAL_Linux: implement threaded I2C 2016-07-30 00:55:27 -03:00
Lucas De Marchi 11ddbb8fb8 AP_HAL_Linux: add PollerThread
This is the infrastructure needed by both SPIDevice and I2CDevice to
start a poller thread per bus.
2016-07-30 00:55:27 -03:00
Lucas De Marchi 7d451ac876 AP_HAL_Linux: allow to check if thread is running 2016-07-30 00:55:27 -03:00
Lucas De Marchi eca6f45b68 AP_HAL_Linux: remove unused part of Poller infra
We aren't going to use all the poller infra for now and we need it's
behavior a little bit different for what we are going to use:

    - Do not use any "fair" time for each ready fd since we don't want
      to set a timeout
    - Allow to set the fd on Pollable after constructing it since we are
      likely to embed Pollable inside other structs and just later be
      able to open an fd.
    - Let caller use the epoll flags directly - this is not in AP_HAL,
      so there's no need to abstract them
2016-07-30 00:55:27 -03:00
Leandro Pereira 0f865a019a AP_HAL_Linux: Add Pollable/Poller
Add system's polling infrastructure to be notified whenever a
file descriptor is ready to be read from or written to.

Adds a few classes:
  * Poller, as an interface to epoll()
  * Pollable, as an interface to a file descriptor
2016-07-30 00:55:27 -03:00
Lucas De Marchi eaa1c39a15 AP_HAL_Linux: update Device interface 2016-07-30 00:55:27 -03:00
Lucas De Marchi 8e5aba8653 AP_HAL_Linux: I2CDevice: move implementation to outside
As we add methods, it's becoming too complex to be implemented together
with the declaration.
2016-07-30 00:55:27 -03:00
Lucas De Marchi 7b39f3d0a7 AP_HAL_Linux: do not warn for empty table
../../libraries/AP_HAL_Linux/SPIDevice.cpp: In member function ‘virtual AP_HAL::OwnPtr<AP_HAL::SPIDevice> Linux::SPIDeviceManager::get_device(const char*)’:
../../libraries/AP_HAL_Linux/SPIDevice.cpp:337:27: warning: comparison is always false due to limited range of data type [-Wtype-limits]
     for (uint8_t i = 0; i < _n_device_desc; i++) {
                         ~~^~~~~~~~~~~~~~~~

Define a dummy device to remove warning.
2016-07-30 00:03:23 -03:00
Lucas De Marchi f37a560295 AP_HAL_Linux: remove private headers
This centralized private header encourages centralizing things on
umbrella headers that are a pain to maintain. Force each part of
AP_HAL_Linux to include what is used.
2016-07-29 20:29:46 -03:00
Lucas De Marchi e8f71a5bd2 AP_HAL_Linux: change define and members visibility
Make some member variables protected to follow what we do in other
places (and there's no reason to be private).

Move defines to .cpp to reduce their visibility.
2016-07-29 20:27:12 -03:00
Lucas De Marchi f36e8d9c05 AP_HAL_Linux: remove AP_HAL_Linux_Namespace header
This centralized namespace header encourages centralizing things on
umbrella headers that are a pain to maintain. Force each part of
AP_HAL_Linux to include what is used.

While at it, do some whitespace cleanups and minor changes to adhere to
coding style.
2016-07-29 20:25:03 -03:00
Lucas De Marchi b044fac4b6 AP_HAL_Linux: rename variable to follow I2CDevice convention 2016-07-29 15:01:15 -03:00
Lucas De Marchi 7b140da6d1 AP_HAL_Linux: remove SPIDriver
SPIDevice now controls all accesses to SPI bus.
2016-07-29 15:01:15 -03:00
Lucas De Marchi 945556bbc3 AP_HAL_Linux: remove id for SPIDevice_Ublox and RASPIO 2016-07-29 15:01:15 -03:00
Lucas De Marchi 065592e7df AP_HAL_Linux: SPIUARTDriver: add some cosmetic changes
Mainly changes to follow the coding style and reduce the complexity a
little bit.
2016-07-29 15:01:15 -03:00
Lucas De Marchi e3c0476b8a AP_HAL_Linux: SPIUARTDriver: initialize device once 2016-07-29 15:01:14 -03:00
Lucas De Marchi 418cc817a3 AP_HAL_Linux: SPIUARTDriver: fix conversion to SPIDevice
We need to use the fullduplex method to transfer both tx and rx at the
same time.
2016-07-29 15:01:14 -03:00
Lucas De Marchi cbbd6f9d78 AP_HAL_Linux: SPIDevice: implement fullduplex transfer 2016-07-29 15:01:14 -03:00
Luiz Ywata 7ded01cf24 AP_HAL_Linux: SPIUARTDriver: use SPIDevice interface 2016-07-29 15:01:14 -03:00
Luiz Ywata c8bb5e6469 AP_HAL_Linux: RCInput_Raspilot use SPIDevice interface 2016-07-29 15:01:14 -03:00
Luiz Ywata e8d3229492 AP_HAL_Linux: RPIOUARTDriver: use SPIDevice interface 2016-07-29 15:01:14 -03:00
Luiz Ywata bfd840c5ca AP_HAL_Linux: RCOutput_Raspilot: use SPIDevice interface 2016-07-29 15:01:14 -03:00
Lucas De Marchi 86ac9bc367 AP_HAL_Linux: AnalogIn_Raspilot: use SPIDevice interface 2016-07-29 14:47:04 -03:00
Lucas De Marchi 8681d23cbd AP_HAL_Linux: remove unused Dataflash
This is selectable by a define and is never changed. Just remove
everything referencing it: we can come up with a better solution if it
is actually used later.
2016-07-29 14:47:04 -03:00
Lucas De Marchi 73bb371918 AP_HAL_Linux: remove I2CDriver
I2CDevice now serves for the same purpose.
2016-07-28 18:08:56 -03:00
Lucas De Marchi 84f45f09a3 AP_HAL_Linux: convert CameraSensor_Mt9v117 to I2CDevice 2016-07-28 18:03:09 -03:00
Lucas De Marchi 9acffc8868 AP_HAL_Linux: use Empty version if not implemented
There's little point in having the Linux::AnalogIn just to implement and
empty interface. All implementations inside AP_HAL_Linux are already
inheriting directly from AP_HAL, so just remove it.
2016-07-28 16:42:38 -03:00
Lucas De Marchi 47d2f8dc6d AP_HAL_Linux: AnalogIn_ADS1115: return 5V on board_voltage
board voltage is not available - don't return 0V since that prevents
arming.
2016-07-28 16:42:38 -03:00
Staroselskii Georgii 4ca1b58408 AP_HAL_Linux: add ConsoleDevice a handler for TTIN signal
In a case ArduPilot is launched as a background process without
detaching with *nohup* like this ./arduplane -C /dev/ttyAMA0 ConsoleDevice
is created and an attempt to read from it is made. This yields in a stopped
process. This is an endeavour to overcome this problem.
2016-07-27 21:30:19 +10:00
Staroselskii Georgii 8d2b587f71 AP_HAL_Linux: RPI: set signal handler iff nobody has already done it before 2016-07-27 21:30:19 +10:00
Staroselskii Georgii 5e8edcb1db AP_HAL_Linux: use NSIG instead of a hardcoded number in RCInput_RPI 2016-07-27 21:30:19 +10:00
hiro2233 3ae36c4a6c AP_HAL_Linux:RCInput: Minimun input channels defined 2016-07-27 00:55:55 -03:00
Lucas De Marchi cfb3124f2c AP_HAL_Linux: remove types for spi drivers
Those drivers using SPIDevice interface don't need a global id for each
of them. Remove those that were already converted.
2016-07-21 16:05:03 -03:00
Lucas De Marchi b23f7a8be4 AP_HAL_Linux: examples: remove BusTest
This needs to be rewritten using the probe methods.
2016-07-21 16:05:03 -03:00
Andrew Tridgell 96095b0942 HAL_Linux: fixed comment typo for SBUS input 2016-07-20 13:38:17 +10:00
Andrew Tridgell b69170febd HAL_Linux: fixed build for Disco with I2C changes 2016-07-20 13:38:17 +10:00
Andrew Tridgell f5a20d28bc HAL_Linux: fixed comment in SBUS 2016-07-20 13:38:17 +10:00
Andrew Tridgell a78b875ec3 HAL_Linux: fixed ULTRASOUND GPIO for Disco 2016-07-20 13:38:17 +10:00
Andrew Tridgell 1d8e4cdea9 HAL_Linux: added debugging line for Heat_Pwm 2016-07-20 13:38:17 +10:00
Andrew Tridgell 55d692708b HAL_Linux: fixed set_esc_scaling on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 298f7bffb9 HAL_Linux: fixed motor output for Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 9b057ee4f1 HAL_Linux: separate out the GPIO table for Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell 677a38a10a HAL_Linux: make SBUS input much more robust
use inter-frame gap to resync after byte loss
2016-07-20 13:38:16 +10:00
Andrew Tridgell 29135a0158 HAL_Linux: use termios2 for SBUS RCOUT on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell a40d704126 HAL_Linux: added RCOutput_Disco
combines Sysfs and Bebop RCOutput code
2016-07-20 13:38:16 +10:00
Andrew Tridgell cf83a43b56 HAL_Linux: support SBUS input on Disco 2016-07-20 13:38:16 +10:00
Andrew Tridgell aaaa6d38c7 HAL_Linux: initial support for Disco 2016-07-20 13:35:51 +10:00
Staroselskii Georgii a1f151a79b AP_HAL_Linux: do not create unnecessary consoles in UARTDriver 2016-07-15 15:31:19 -03:00
Staroselskii Georgii 7b3a5e3158 AP_HAL_Linux: use factory method for creation of UARTDriver backends
Using factory method maked it easier to grasp the lifetime of all object
that get created and destroyed. Instead of spanning this thoughout whole
source file we have it nicely encapsulated in this a little horrendeous
_parseDevicePath that is of course to improve more.
2016-07-15 15:29:05 -03:00
Staroselskii Georgii 0ca635bfb8 AP_HAL_Linux: close() console in dtor 2016-07-15 15:28:10 -03:00
Staroselskii Georgii e7a5945056 AP_HAL_Linux: make flow_control a property of SerialDevice rather than UARTDriver's
Make it possible to change flow control settings for individual devices.
2016-07-15 15:26:49 -03:00
Staroselskii Georgii 897d2fb1fb AP_HAL_Linux: use OwnPtr for _device in UARTDriver
Otherwise we're going to leak memory without any need.
Before this fix we've created ConsoleDevice 4 times in case -A switch hadn't been supplied,
but we hadn't ever deleted those. Now there's no memory leak here.
2016-07-15 15:22:51 -03:00
Staroselskii Georgii 3f1e999fc8 AP_HAL_Linux: remove ConsoleDevice construction from UARTDriver constructor
Since we're going to create ConsoleDevice in UARTDriver either way,
there's no need to do anything except setting the console flag.
2016-07-15 14:56:00 -03:00
Lucas De Marchi 24cdef24b8 AP_HAL_Linux: remove wrong ifdef
This was added when the support for navio2 went in, but the same ifdef
is already on the lines above.
2016-07-14 17:32:33 -03:00
Luiz Ywata 3e765e23a9 AP_HAL_Linux: RCOutput_PCA9685: use I2CDevice interface 2016-07-14 17:32:33 -03:00
Lucas De Marchi 08ea1ea263 AP_HAL_Linux: RCOutput_Bebop: follow coding style
Minor changes to follow coding style and improve readability:

    - sort headers
    - move struct definition to compilation unit rather than header
    - Add braces to if, for, etc
2016-07-14 17:32:33 -03:00
Luiz Ywata 7fb5db8077 AP_HAL_Linux: RCOutput_Bebop: use I2CDevice interface 2016-07-14 17:32:33 -03:00
Andrew Tridgell 847bfda48a HAL_Linux: adjust include ordering 2016-07-14 13:39:47 +10:00
Andrew Tridgell dd5d0ffbad HAL_Linux: use default module directory 2016-07-14 13:39:47 +10:00
Andrew Tridgell 107f76828d HAL_Linux: added AP_Module support 2016-07-14 13:39:46 +10:00
Andrew Tridgell f090e9b27c HAL_Linux: fixed makefile build with PRIu64 2016-07-07 15:10:59 +10:00
Andrew Tridgell 461c159b22 HAL_Linux: use set_imu_target_temp() API 2016-07-01 15:29:52 +10:00
Andrew Tridgell beb3591f67 HAL_Linux: improved help output and errors for udp and bcast 2016-06-28 21:01:45 +10:00
Andrew Tridgell 72b5cecdb2 HAL_Linux: added udpin support to HAL_Linux
useful for setting up ardupilot as a mavlink UDP listener
2016-06-28 21:01:43 +10:00
Gustavo Jose de Sousa d35cf60ce1 AP_HAL_Linux: I2CDevice: use read flag in read_registers_multiple
Use the generic support in Device interface for read flag when we are
using read_registers_multiple() method.
2016-06-27 17:20:46 -03:00
Lucas De Marchi b70b9ed8d1 AP_HAL_Linux: fix warning on 64b printf
../../libraries/AP_HAL_Linux/Perf.cpp: In member function ‘void Linux::Perf::_debug_counters()’:
../../libraries/AP_HAL_Linux/Perf.cpp:85:36: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t {aka long unsigned int}’ [-Wformat=]
                     c.name, c.count);
                                    ^
2016-06-25 12:05:55 -03:00
Lucas De Marchi 4a18108600 AP_HAL_Linux: rename min, max and avg fields
These were probably named otherwise in order not to conflict with
min/max macros from math.h. We don't have this problem anymore.
2016-06-23 19:08:14 -03:00
Lucas De Marchi b8e3e549c7 AP_HAL_Linux: Perf: add debug method
Test code for integration with another thread to pull data from internal
perf counters.  Since we are using the timer thread here, there's no
retry mechanism and we only print that data can be corrupted.
2016-06-23 19:08:14 -03:00
Lucas De Marchi 1727418dc9 AP_HAL_Linux: Perf: make lttng use internal fields
Instead of creating a new object Perf_Lttng copying the necessaries
fields, just make a tighter integration with the internal perf counters
and re-use the same fields.
2016-06-23 19:06:30 -03:00
Lucas De Marchi 619ce23799 AP_HAL_Linux: Perf: rework integration with other tools
The idea is to leave the internal perf enabled all the time, like it is
in PX4, and then allow the integration with lttng on top. Next step
would be to runtime enable/disable only the perf counters we are
interested in.

This also changes the structure so it's easy to allow another thread to
pull data from the Perf object. A rw lock protects from addition of new
counters and an atomic unsigned int allows other threads to do a
lockless copy of the data.

In order for this to work the allocation was changed to use a single
memory pool instead of returning a calloc'ed data for each perf counter.
Since most of our counters are of ' elapsed' type, don't bother using a
smaller struct for the 'count' type
2016-06-23 19:06:30 -03:00
Lucas De Marchi b687473174 AP_HAL_Linux: ignore unused result on panic
There's not much we can do if the write() call inside a panic function
failed. Just ignore the failure.
2016-06-23 18:34:01 -03:00
Lucas De Marchi ab66e3a69a AP_HAL_Linux: Perf: simplify function to get current time 2016-06-21 13:09:00 -03:00
Lucas De Marchi 1d9d0a40db AP_HAL_Linux: GPIO: reduce macro and variable scopes
Also change the coding style in a few places.
2016-06-21 12:16:32 -03:00
Lucas De Marchi 4f14b9b7e2 AP_HAL_Linux: ToneAlarm_Raspilot: add fixme comment 2016-06-21 12:16:32 -03:00
Lucas De Marchi 0bb86ae498 AP_HAL_Linux: GPIO_RPI: remove unused functions
These functions to use pins as pwm are never used in the codebase, so
remove them.
2016-06-21 12:16:32 -03:00
dgrat 0b5ab7162d AP_HAL_Linux: Changes in RPi version detection
If the RPi version detection fails, the standard version is now RPi2/3 instead of RPi1.
I think this is useful, because the RPi1 is not really supported (performance reasons).
2016-06-08 11:50:43 -03:00
dgrat 15a915edd3 AP_HAL_Linux: Simplification of the code
I applied the ArduPilot coding style guide and additionally simplified the code where possible.
2016-06-08 11:50:43 -03:00
Lucas De Marchi 3457dbcdf8 AP_HAL_Linux: rename lttng define
Like others, use HAVE_ prefix and name it HAVE_LTTNG_UST to be the same
name as exported by pkg-config While at it remove wrong comment with
_HELLO_TP_H.
2016-05-23 12:06:42 -03:00
Lucas De Marchi 13722b8858 AP_HAL_Linux: support 16 RCInput channels on Navio2 2016-05-23 09:12:33 -03:00
Andrew Tridgell ef210217dd HAL_Linux: cope with MAVLink2 in UDP driver for packetising 2016-05-23 10:10:03 +10:00
Andrew Tridgell 6f7d6269a8 AP_HAL_Linux: always build with MAVLink2 headers 2016-05-21 15:25:16 +10:00
Andrew Tridgell 31f8d26784 HAL_Linux: support mavlink2 build 2016-05-21 15:25:11 +10:00
Gustavo Jose de Sousa 9a100afede AP_HAL_Linux: Thread: add doc about rounding function 2016-05-20 16:31:15 -03:00
Lucas De Marchi 359417d544 AP_HAL_Linux: Thread: make sure pointer is aligned
Implementation of alloca() is very much architecture and compiler
dependent. Avoid the case in which it could return a non-aligned
pointer, which would mean Thread::_poison_stack() would do the wrong
thing.
2016-05-20 16:31:15 -03:00
Lucas De Marchi 7e49d0c53f AP_HAL_Linux: Thread: fix alignment warning
../../libraries/AP_HAL_Linux/Thread.cpp: In member function ‘void Linux::Thread::_poison_stack()’:
../../libraries/AP_HAL_Linux/Thread.cpp:87:31: warning: cast from ‘uint8_t* {aka unsigned char*}’ to ‘uint32_t* {aka unsigned int*}’ increases required alignment of target type [-Wcast-align]
         for (p = (uint32_t *) end; p > curr; p--) {
                               ^
../../libraries/AP_HAL_Linux/Thread.cpp:93:31: warning: cast from ‘uint8_t* {aka unsigned char*}’ to ‘uint32_t* {aka unsigned int*}’ increases required alignment of target type [-Wcast-align]
         for (p = (uint32_t *) end; p < curr; p++) {
                               ^
../../libraries/AP_HAL_Linux/Thread.cpp:98:39: warning: cast from ‘uint8_t* {aka unsigned char*}’ to ‘uint32_t* {aka unsigned int*}’ increases required alignment of target type [-Wcast-align]
     _stack_debug.start = (uint32_t *) begin;
                                       ^
../../libraries/AP_HAL_Linux/Thread.cpp:99:37: warning: cast from ‘uint8_t* {aka unsigned char*}’ to ‘uint32_t* {aka unsigned int*}’ increases required alignment of target type [-Wcast-align]
     _stack_debug.end = (uint32_t *) end;
                                     ^
2016-05-20 16:31:15 -03:00
Lucas De Marchi 18af4da690 AP_HAL_Linux: Thread: fix warning regarding shadow member
../../libraries/AP_HAL_Linux/Thread.cpp: In member function ‘void Linux::Thread::_poison_stack()’:
../../libraries/AP_HAL_Linux/Thread.cpp:63:20: warning: declaration of ‘start’ shadows a member of 'this' [-Wshadow]
     uint8_t *end, *start, *curr;
                    ^
2016-05-20 16:31:15 -03:00
Leandro Pereira 3555e439a4 AP_HAL_Linux: Simplify I2C initialization in HAL_Linux_Class 2016-05-20 10:12:17 -03:00
Aaron Wang Shi cb9cd9008a AP_HAL_Linux: fix bhat spi device driver build error 2016-05-20 10:09:50 -03:00
Lucas De Marchi 71e10c9132 AP_HAL_Linux: fix include order
Sort include alphabetically and make them in order:

Main header
system headers
library headers
local headers

While reordering, change a include of endian.h to our sparse-endian.h
which is more reliant to toolchain changes.
2016-05-18 23:05:56 -03:00
Lucas De Marchi 45c6b750f2 AP_HAL_Linux: remove ifdef checks for HAL_BOARD_LINUX
Everything inside libraries/AP_HAL_Linux is for Linux boards, there's
not need to add the ifdefs.
2016-05-18 23:05:56 -03:00
Gustavo Jose de Sousa d615628367 AP_HAL_Linux: I2CDevice: add missing stdio.h include
This was probably being included by another header, but it's not on
gcc >= 6.1 and glibc 2.23.
2016-05-16 13:12:53 -03:00
Ricardo de Almeida Gonzaga 2236640f66 AP_HAL_Linux: Fix typos 2016-05-13 19:20:06 -03:00
Lucas De Marchi 37f6b51746 AP_HAL_Linux: Scheduler: set stack sizes to 256k
Running the vehicles we check the stack size doesn't grow too much by
enabling the DEBUG_STACK in the scheduler. Even on 64bit boards the
stack is consistent around 4k. Just to be a little conservative, let it
be a little bit more that that: 256kB.

Since we have RT prio and we call mlock(), the memory for the stack of
each thread is locked in memory. This means we are effectively taking
that much memory. The default stack size varies per distro, but it's
common to have 8MB for 64 bit boards and 4MB for 32 bit boards. Here is
the output of ps -L -o 'comm,rtprio,rss $(pidof arducopter-quad)', showing the
RSS of arducopter-quad before and after this change:

Before:
	COMMAND         RTPRIO   RSS
	arducopter-quad     12 46960
	sched-timer         15 46960
	sched-uart          14 46960
	sched-rcin          13 46960
	sched-tonealarm     11 46960
	sched-io            10 46960

After:
	COMMAND         RTPRIO   RSS
	arducopter-quad     12  7320
	sched-timer         15  7320
	sched-uart          14  7320
	sched-rcin          13  7320
	sched-tonealarm     11  7320
	sched-io            10  7320
2016-05-12 13:35:23 -03:00
Lucas De Marchi b2d4da4b0a AP_HAL_Linux: Thread: allow to set stack size
This allows the code that is creating the thread to set the size of the
stack.
2016-05-12 13:35:23 -03:00
Lucas De Marchi d970451331 AP_HAL_Linux: Scheduler: debug stack usage 2016-05-12 13:35:23 -03:00
Lucas De Marchi f5f4aa7c21 AP_HAL_Linux: Thread: allow to debug stack usage 2016-05-12 13:35:23 -03:00
Staroselskii Georgii f7846403e1 AP_HAL_Linux: enabled SPI-driven LSM9DS1 for Navio 2 2016-05-10 17:24:43 -03:00
Lucas De Marchi 3315f46800 AP_HAL_Linux: inline I2C bus options for minlure
We don't need all the comments in the array declaration and we can
inline its declaration in the function call. This makes it easier to
copy it to other places.
2016-05-10 16:06:53 -03:00
Andrew Tridgell 2965e67d5d HAL_Linux: cope with non-root for Replay 2016-05-07 18:27:17 +10:00
Julien Beraud c22d791bfc AP_HAL_Linux: Add SPI driver for bebop 2016-05-03 16:43:39 -03:00
Julien Beraud 738096b3ae AP_HAL_Linux: Add support for Sonar GPIO 2016-05-03 16:43:39 -03:00
Staroselskii Georgii 60426faa52 AP_HAL_Linux: changed ADC logic a bit for Navio 2
- make voltage_average_ratiometric() the same as voltage_average()
- make read_latest() the same as voltage_average()

wip
2016-04-27 17:14:21 +03:00
Rustom Jehangir 4a10156b13 AP_HAL_Linux: Fix RCInput::read from stopping at any zero channel
This bug led to issues for us so it may help others to resolve it.
Currently, the AP_HAL_Linux RCInput::read(uint16_t*,uint8_t) function
only returns the first x nonzero channels. Once it hits a channel that
is set to zero, it stops and all remaining channels are returned as
zero, even if they are set. This causes discrepancies between the raw RC
input sent to the GCS and the RC input that is actually used on the
vehicle.

The fixes this issue and makes it behave exactly as it does on the
PX4_HAL code. We ran into this issue when sending rc_override messages
in which there were some channels set to zero.
2016-04-26 22:32:07 -03:00
mirkix 6e546ba181 AP_HAL_Linux: Fix compiler warning unused hal 2016-04-24 11:09:55 -03:00