Commit Graph

920 Commits

Author SHA1 Message Date
Vinicius Juvinski 36204e5dae AP_HAL_Linux: Fix PWM FS to follow the Kernel's 4.X instead 3.9
Checking the ToneAlarm under AP_HAL_Linux(BBBMINI is using that)  I realize was using old kernek
3.9 device tree, so I updated to 4.X - this will affect only BBBMINI and
Blue boards.
2020-10-26 22:55:03 -07:00
bugobliterator ba576247f0 AP_HAL_Linux: configure filter only if in filtered mode 2020-10-08 09:31:35 +11:00
Peter Barker 4ebde78bbf AP_HAL_Linux: throw warning if we ever stop-clock backwards
Also don't compile in the stop_clock symbol to make it clear changes in
this method won't affect vehicles
2020-09-15 10:02:36 +10:00
Patrick José Pereira 5746943f50 AP_HAL_Linux: Use pthread_self in place of _ctx
Avoid aproblem where _ctx is initialized in a race condition.

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-08-25 07:15:00 -07:00
Patrick José Pereira 248daa85a1 AP_HAL_Linux: Scheduler: Use pthread_* over sched_* calls for setschedparam
musl implements `sched_*` following the posix standard,
where `sched_setschedule` is used for process scheduling.
Linux implementation defines `sched_*` functions based in
the thread scheduler and not with the process.

Using `pthread_*` should be used to follow such standard.

Ref: https://pubs.opengroup.org/onlinepubs/9699919799/

From: https://www.openwall.com/lists/musl/2016/03/01/5

> ... Linux does not provide a way
> to set scheduling parameters for a _process_, only for threads. The
> sched_setscheduler syscall is documented as taking a pid but actually
> takes a thread id and only operates on that thread. glibc just ignores
> this and provides sched_* functions that do the wrong thing.

This can be fixed by using `pthread_setschedparam` and requesting the current
thread id via `pthread_self`.

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-08-25 07:15:00 -07:00
Siddharth Purohit 0e923fe061 HAL_Linux: add methods for native clock info methods 2020-08-19 17:31:09 +10:00
Siddharth Purohit 7de444ec53 HAL_Linux: add uavcan agnostic CANSocket Iface Driver 2020-08-19 17:31:09 +10:00
Isaac Ault e74acba4ec AP_HAL_Linux: Allow for parameters to be passed with -G, -H
All other work has been previously implemented, however when fetching
params these values were ignored.
2020-08-10 10:03:12 +10:00
mhefny e137698a4a AP_HAL_Linux: Fix RCInput_RPI Segmentation Fault 2020-08-08 10:01:57 -07:00
Andrew Tridgell c5a60c31a7 HAL_Linux: fixed build warnings in RC input methods 2020-07-07 10:23:00 +10:00
Peter Barker f3bee7fa03 AP_HAL_Linux: correct clearing of UART drivers 2020-06-03 17:00:44 +10:00
Peter Barker 1ebfc79eb0 AP_HAL_Linux: enable console for examples
Turns out we *do* need this for examples.  We're back to stuffing up
terminals where examples have been run, but that can be addressed later.
2020-05-28 13:49:47 +10:00
Peter Barker 9a9743e6ba AP_HAL_Linux: add discard_input method on UARTDriver 2020-05-26 09:20:32 +10:00
Lucas De Marchi 29d8586ea4 AP_HAL_Linux: RCInput_UDP: accept up to 16 channels
This allows more channels to be passed to RCInput_UDP protocol while
also allowing less than 8 channels - this is similar to the approach
used by SITL in which the packet size is used to figure out the number
of channels.
2020-05-03 00:07:52 -07:00
Patrick José Pereira 3268c234d8 AP_HAL_Linux: Add PAGE_SIZE in RCInput_RPI
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-04-29 02:12:58 -07:00
Patrick José Pereira 32c0e37512 AP_HAL_Linux: Organize and document GPIO_RPI class
- Move macros to functions and improve explanation about logic behind it
- Break code in functions to make it more readable
- Add doxygen comments about functions and how they work in a comprehensive manner
- Improve general code maintainability

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-04-29 02:12:58 -07:00
Patrick José Pereira c83ce93165 AP_HAL_Linux: Add missing wscript for GPIOTest
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-04-17 15:59:25 +10:00
Peter Barker a3e2e156e7 AP_HAL_Linux: do not create ConsoleDevices for Replay or examples
Uusally problems evidence themsleves with stdin not working correctly -
for example, "git add -p" skipping through all queries as if the
user was just pressing enter.
2020-03-31 11:22:21 +11:00
Patrick José Pereira e65cc35fb0 AP_HAL_Linux: Use template to generate raspberry pins
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-03-15 22:35:50 -07:00
Peter Barker f8058bcf70 AP_HAL_Linux: avoid segfaults during early panics
singletons failing to be singleton can cause the segfaults.  This is
more a tidiness thing - but better not to have cascading failures.
2020-03-10 10:45:09 +11:00
Peter Barker c917cd4dbb AP_HAL_Linux: make a static-const hal references references to external symbol 2020-03-03 10:12:14 +11:00
Andy Piper 127a0e9b41 AP_HAL_Linux: add in empty dsp driver 2020-02-22 11:15:37 +11:00
Andrew Tridgell cbbf61af93 HAL_Linux: fixed bitmask error on storage erase 2020-01-31 11:06:29 +11:00
Andrew Tridgell a153799e26 HAL_Linux: support inverted 115200 protocols
this allows for FrSky FPort input
2020-01-19 21:10:00 +11:00
Andrew Tridgell 4b9442dad7 AP_HAL_Linux: make all semaphores recursive
the cost is very similar and this prevents an easy coding error which
can occur on less used code paths
2020-01-19 20:19:30 +11:00
Andrew Tridgell 67bd4ed396 AP_HAL_Linux: use take_blocking instead of HAL_SEMAPHORE_BLOCK_FOREVER
this makes for cleaner and smaller code as the failure case is not
needed
2020-01-19 20:19:30 +11:00
Patrick José Pereira 0c0d97debe AP_HAL_Linux: Add storage-directory argument in usage
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-01-18 17:03:20 +11:00
Patrick José Pereira 6518d6dc4d AP_HAL_LINUX: Add support for Raspberry Pi 4
The Raspberry Pi 4 uses a new BCM cpu, the BCM2711 with
a peripheral base address of 0xFE000000

Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-01-16 08:03:34 +11:00
Patrick José Pereira 6230524636 AP_HAL_Linux: Add navigator board
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2020-01-16 08:01:54 +11:00
Daniel Magree 209bb132fa HAL_Linux: disable input modifications on serial interface for rc receiver
Make sure to clear CBAUD before setting the baud and disable
input modifications.

Fix for #12162

This change removes input options that can modify the input data stream.
INLCR: map new line to carriage return
ICRNL: map carriage return to new line
IUCLC: map upper case to lower case
IGNCR: ignore carriage return
BRKINT: send SIGINT on serial break
2019-11-13 09:02:30 -08:00
Peter Barker cbe73b91d5 AP_HAL_Linux: correct format-string warnings
Using the string template to determine the size of the array to print
into strikes issues as varargs passes the stack variables as integer
types, so the perceived range is larger.
2019-11-05 11:29:08 +11:00
Andrew Tridgell 9e9be95943 HAL_Linux: fixed build 2019-11-01 10:53:53 +11:00
Peter Barker 0f4337b7b1 AP_HAL_Linux: release mutex lock before calling write(c)
It instantly tries to take it, but we're still holding it, leading to
instant failure.

This mirrors the same code in AP_HAL_ChibiOS.
2019-10-25 11:38:16 +11:00
Patrick José Pereira 29fadc2417 AP_HAL_Linux: PCA9685: Check for device before accessing it
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2019-09-26 12:42:12 +10:00
Andrew Tridgell 312018898f HAL_Linux: use AP::RC() 2019-09-06 08:51:45 +10:00
Michael du Breuil 979a431e4a AP_HAL_Linux: Remove set_stop_pin from AnalogSource 2019-09-04 09:54:50 +10:00
Michael du Breuil 1484a12f4b AP_HAL_Linux: Fix bad check order on heap_realloc 2019-08-27 13:54:54 +10:00
Peter Barker 914e6c5497 AP_HAL_Linux: check return value of system command
Compilation fails on disco without this patch as system is declared with
attribute warn_unused_result
2019-08-19 14:37:13 +10:00
Peter Barker 1b3e2e3c8b AP_HAL_Linux: add missing override keywords 2019-08-15 15:14:23 +10:00
Mirko Denecke bb7f80b452 AP_HAL_Linux: UARTDriver remove unused field and tabs 2019-07-21 21:52:42 -07:00
Andrew Tridgell 019f441b2f HAL_Linux: added uartH 2019-07-12 17:01:21 +10:00
Andrew Tridgell 2bab0efc41 HAL_Linux: implement HAL_GPIO_SCRIPT support
this allows Linux boards to trigger an external script on GPIO
writes. This can be hooked up to relays with either RC options or
mavlink or mission items to trigger actions that can be scripted
2019-07-06 09:02:54 +10:00
Peter Barker a9c4f1d0d5 AP_HAL_Linux: return RC protocol being decoded 2019-06-18 11:35:38 +10:00
Peter Barker 1ce2424e49 AP_HAL_Linux: add required override keyword on configure_parity
Also remove virtual - doesn't make sense here.
2019-05-27 09:55:18 -07:00
Andrew Tridgell a159b01b26 AP_HAL_Linux: removed unusued AP_Common/Semaphore.h 2019-05-15 15:33:48 +10:00
Andrew Tridgell 48aacb9462 HAL_Linux: removed use of RCInput_SBUS and RCInput_115200 2019-05-02 17:58:51 +10:00
Andrew Tridgell 1c322d296f HAL_Linux: switch Disco to using AP_RCProtocol library for RCIN
this is the first step to using AP_RCProtocol for most (or all) RC
input on Linux boards. It also fixes a major bug on Disco where the
old SBUS decoder didn't use strict enough timing checks to filter out
bad frames when video capture is running. That led to erratic flight
mode changes and sometimes loss of control.
2019-05-02 17:58:51 +10:00
Lucas De Marchi 5520b397c2 AP_HAL_Linux: allow disco to use RCInput_UDP
This allows to use any device to send RCInput to Disco via network.
Particularly this is useful when paired to additional changes on
SkyController 2 so it can be used to control Ardupilot.

This was tested with https://github.com/lucasdemarchi/dema-rc running
on SkyController 2.
2019-05-02 16:14:17 +10:00
Jeremy Feltracco 100f06614c AP_HAL_Linux: Add support for setting uart parity on Linux boards
Pass set_parity down through UART class so that set_parity actually
works for Linux boards.
2019-04-26 00:49:25 -07:00
Michael du Breuil 7b7b852c75 AP_HAL_Linux: fix GCC warning in storage 2019-04-15 17:46:44 -07:00