Commit Graph

285 Commits

Author SHA1 Message Date
Andrew Tridgell d0b007248f HAL_Linux: fixed SPI semaphore, and panic on CS error
This adds a check for trying to assert two CS pins on the same bus
at the same time. The change involves moving the _device handles into the
DeviceManager class, and accessing via static methods.

This also moves the semaphore to be per-bus rather than per-device,
which fixes the problem with bad MS5611 transfers.

Pair-Programmed-With: Victor, Sid, Anuj and Philip
2014-07-14 09:32:29 +10:00
bugobliterator 5bcdb039e2 HAL_Linux: Make asynchronous PRU write and reduce the size of data exchange
Change to sending Total Period and hi Period, rather than Hi and Lo Period
Change PRU firmware accordingly
2014-07-14 09:32:29 +10:00
Víctor Mayoral Vilches fa6c5ba80e HAL_Linux: Remove the additional portNumber offset
The socket is being launched in (_base_port + portNumber) port
following SITL impl. In order to avoid confusions portNumber has
been set to 0.
2014-07-14 09:32:21 +10:00
Víctor Mayoral Vilches 02c171b19f HAL_Linux: UART-like TCP sockets, check for ":wait" 2014-07-14 09:32:13 +10:00
Víctor Mayoral Vilches ca80c0b8e2 HAL_Linux: config UART file descriptor as non-blocking 2014-07-14 09:31:59 +10:00
Siddharth Bharat Purohit 65fef59dfa HAL_Linux: change initial PWM values to 490Hz, 1000us 2014-07-14 09:31:49 +10:00
Víctor Mayoral Vilches f11f0d9f2a HAL_Linux: Fix FRAM code 2014-07-14 09:31:41 +10:00
Víctor Mayoral Vilches be68de20f1 HAL_Linux: UART-like TCP sockets impl. on AP_HAL_Linux 2014-07-14 09:31:30 +10:00
Víctor Mayoral Vilches b0742fbb5b HAL_Linux: Add FRAM SPI support. 2014-07-14 09:31:18 +10:00
Siddharth Bharat Purohit 0422695e5e HAL_Linux: Correct error inside read method in RCOutput 2014-07-14 09:31:05 +10:00
bugobliterator 092bda9c37 HAL_Linux: Replace PRU1 firmware with a new one to support new way of controllong PRU PWM 2014-07-14 09:31:05 +10:00
bugobliterator 63560e8122 HAL_Linux: change to directly accessing shared_mem of pru in RCOutput 2014-07-14 09:30:54 +10:00
Siddharth Bharat Purohit 9999e77a74 HAL_Linux: add close(_fd) to some functions in RCOutput 2014-07-14 09:30:42 +10:00
Víctor Mayoral Vilches 95e0803880 HAL_Linux: Remove panic when invalid pin in GPIO
When a invalid pin is passed as a parameter
the methods return without performing anything
insted of raising a panic.
2014-07-14 09:30:25 +10:00
Víctor Mayoral Vilches 245618e298 HAL_Linux: Improve error handling SPIDriver 2014-07-14 09:30:16 +10:00
Víctor Mayoral Vilches d330cbecb3 HAL_Linux: Make the CS variables more readable in SPIDriver 2014-07-14 09:30:06 +10:00
Víctor Mayoral Vilches 665bf4a247 HAL_Linux: BUS_SPEED selected individually in SPIDriver 2014-07-14 09:29:53 +10:00
Siddharth Bharat Purohit d2b5a1cfac HAL_Linux: add HAL_ prefix to GPIO_INPUT 2014-07-14 09:29:45 +10:00
bugobliterator 1f1af0b0ea HAL_Linux: make GPIO code compact and readable
add hal instance to generate scheduler
change gpio/export write method
add gpio struct to LinuxDigitalSource class
change individual gpio banks to one gpio_bank array
2014-07-14 09:29:45 +10:00
Víctor Mayoral Vilches 651cb58ebc HAL_Linux: Add CS capabilities to the SPI driver. 2014-07-14 09:29:45 +10:00
Víctor Mayoral Vilches 763c075497 HAL_Linux: spidev1.0 to SPI0 and spidev2.0 to SPI1 2014-07-14 09:29:28 +10:00
bugobliterator fd0685cc01 HAL_Linux: change to mem access method from sysfs access method
This step is taken to reduce the time for gpio access substantially
2014-07-14 09:29:18 +10:00
bugobliterator 96bbe17bd3 HAL_Linux: add support for LinuxDigitalSource in AP_HAL_Linux 2014-07-14 09:29:18 +10:00
Víctor Mayoral Vilches 7652d47e6e HAL_Linux: Add GPIO pinmux mappings
This will allow to request channels using the
name of the BBB headers (e.g. P8_12, P9_42).
2014-07-14 09:29:08 +10:00
bugobliterator 18d7438240 HAL_Linux: increase size of sysfs_path variables inside LinuxRCOutput's methods
to avoid stack smashing error
2014-07-14 09:29:08 +10:00
bugobliterator 85d10e2ce3 HAL_Linux: add export gpio during direction set if not exported during initialisation 2014-07-14 09:29:08 +10:00
bugobliterator a7ead42f52 HAL_Linux: added initial gpio library 2014-07-14 09:29:08 +10:00
Víctor Mayoral Vilches c4b6026d53 HAL_Linux: include readRegistersMultiple in I2CDriver
AP_HAL_Linux implemments this new method.
2014-07-14 09:28:42 +10:00
Víctor Mayoral Vilches ea7dcc188b AP_HAL_Linux: Correct SPIDriver devs 2014-07-14 09:10:23 +10:00
Víctor Mayoral Vilches 8af1b6faa7 AP_HAL_Linux: Add support for SPIDevice_LSM9DS0
The LSM9DS0 SPI device is connected to
SPI0, thereby SPIDriver class should return the
corresponding device.
2014-07-14 09:10:23 +10:00
bugobliterator 79fb10d9e8 HAL_Linux: correct AP_HAL_Linux::RCOutput::enable_ch method
change the mode of file open which was set as RDONLY mistakenly
2014-07-14 09:10:23 +10:00
bugobliterator eb35c94a43 HAL_Linux: add rcout->init method to HAL_Linux_Class::init 2014-07-14 09:10:23 +10:00
bugobliterator e9f5e0d6cc HAL_Linux: add rcout->init method to HAL_Linux_Class::init method 2014-07-14 09:10:23 +10:00
bugobliterator 34ba77e048 HAL_Linux: Correct faulty RCOutput driver
solve compiler not looking ahead of RCOutput class for read and write methods
2014-07-14 09:10:23 +10:00
bugobliterator 26cd4ad237 HAL_Linux: Correct indentation 2014-07-14 09:10:23 +10:00
Siddharth Bharat Purohit 69a4b7d632 HAL_Linux: Correct Indentation issue 2014-07-14 09:10:23 +10:00
Siddharth Bharat Purohit 731d80e6c5 HAL_Linux: Add Steps to Manually test pwm channels 2014-07-14 09:10:13 +10:00
Siddharth Bharat Purohit b53b3f415a HAL_Linux: Create Readme.md adding details on manually testing pru pwm 2014-07-14 09:10:03 +10:00
bugobliterator a7de5e3d0f HAL_Linux: Add initial RCOutput driver
The functions in RCOutput.cpp are defined to access PWM over PRU sysfs
device from userspace using open, read, write and close methods.
2014-07-14 09:09:53 +10:00
Víctor Mayoral Vilches 3354fa9fc8 AP_HAL_Linux: Add support for SPIDevice_MS5611 2014-07-14 09:02:47 +10:00
Víctor Mayoral Vilches 9f5b4ffca4 AP_HAL_Linux_Class: Correct deadlock, and infinite loop in setup()
(credit to Mitch Miers <mmiers@mmiers.com>):

setup() is attempting to initialize the hardware, and while doing so
is attempting to output some text via the console (and maybe mavlink
data).  The problem is, the output isn't going to complete once a
write buffer is full, because LinuxUARTDriver::_timer_tick() doesn't
perform work until _initialized is true.  So, what happens is,
setup() (and subroutines) call LinuxUARTDriver::_write(uint8_t c),
which loops waiting for buffer space to become available (once the
write buffer is full).  The buffer never gets space, because the
UART thread is waiting for initialization to complete before it
will write out data and drain the buffer, but that doesn't happen
until setup() returns (see AP_HAL_Linux_main.h).

Refer to https://groups.google.com/forum/#!topic/beaglepilot/dQlxse11JNI
2014-07-14 09:02:47 +10:00
Víctor Mayoral Vilches 27ebf790e2 AP_HAL_Linux: Add support for SPIDevice_MPU9250
The Invensense MPU9250 SPI device is connected to
SPI1, thereby SPIDriver class should return the
corresponding device.
2014-07-14 09:02:46 +10:00
Víctor Mayoral Vilches 815c2df2d0 AP_HAL_Linux: SPIDriver, add MPU6000 support 2014-07-14 08:52:51 +10:00
Andrew Tridgell 74ee70d463 HAL_Linux: updates for ERLE board type 2014-07-14 08:52:27 +10:00
Andrew Tridgell b99ae63cbb HAL_Linux: more generic fix for scheduler issues in example sketches
this ensures drivers can run
2014-05-16 22:40:38 +10:00
Andrew Tridgell 6eee2421cc AP_HAL: removed RCInput valid_channels() and added new_input() and num_channels()
the valid_channels() method was inconsistently implemented between
boards, and served two quite different purposes. It is clearer as two
functions
2014-03-25 14:39:41 +11:00
Andrew Tridgell 3fa2207a2d AP_HAL: allow for microsecond resolution in scheduler->stop_clock()
this makes 400Hz in the replay code possible
2014-02-26 19:33:39 +11:00
Andrew Tridgell bf2dd141e9 HAL_PX4: support uartE for 2nd GPS 2014-02-26 08:18:11 +11:00
Andrew Tridgell a273951f70 HAL_Linux: added missing Util.cpp 2014-02-24 11:59:24 +11:00
Andrew Tridgell 735c6449a1 AP_HAL: added support for commandline arguments
useful for log replay, specifying log file
2014-02-23 08:15:39 +11:00
Andrew Tridgell 78ff078988 HAL_Linux: fixed stopped clock delay 2014-02-15 05:48:18 +11:00
Andrew Tridgell 117b77460e HAL_Linux: added stop_clock hack! 2014-02-15 05:28:08 +11:00
Andrew Tridgell 1849db7074 AP_HAL: added board_voltage AnalogIn method
this makes it easier to get the board voltage from any library,
without having to allocate another analog channel object
2014-02-14 21:25:38 +11:00
Andrew Tridgell 87cc95dd7f AP_HAL: removed unused enable_mask and disable_mask functions 2014-01-16 17:16:17 +11:00
Andrew Tridgell a8946a5f31 HAL_Linux: fixed build 2013-12-31 10:28:38 +11:00
Andrew Tridgell ea649e036b AP_HAL: added HAL_CPU_CLASS define for selecting algorithms
this will make it easier to select the appropiate level of algorithm
for a CPU
2013-12-31 10:28:37 +11:00
Andrew Tridgell ecbfdfba6c HAL_Linux: implement time_shift() API 2013-12-30 14:35:12 +11:00
Andrew Tridgell c000a08d6f HAL_LINUX: added uartD 2013-11-23 19:29:22 +11:00
Andrew Tridgell 5af51140a9 HAL_Linux: fixed scheduler initialisation bug in Linux HAL as well 2013-10-26 18:25:27 +11:00
Andrew Tridgell 0d682e74c1 HAL_Linux: run threads a bit more slowly
this was just wasting cycles
2013-10-10 07:21:38 +11:00
Andrew Tridgell 8f79a03c25 HAL_Linux: use larger UART buffers
might as well use the memory
2013-10-10 07:21:38 +11:00
Andrew Tridgell 28b4ae1c3a HAL_Linux: improved latency of timed semaphores 2013-10-08 11:50:54 +11:00
Andrew Tridgell a216e1d239 HAL_Linux: don't prevent write while timer is busy
the timer can block on I2C writes, which causes the main loop to run
2013-10-08 11:50:53 +11:00
Andrew Tridgell 91511e6503 HAL_Linux: better realtime setup
lock all memory and pre-fault the stack in all threads
2013-10-08 11:50:53 +11:00
Andrew Tridgell 07b8f45770 HAL_Linux: use CLOCK_MONOTONIC_RAW to ensure clock never goes backwards
this avoids ntp mucking with APM timing
2013-10-07 08:41:52 +11:00
Andrew Tridgell b30f652cec HAL_Linux: removed Console driver 2013-10-05 18:32:57 +10:00
Andrew Tridgell 1440c8cebd HAL_Linux: implement a dummy console buffered write() 2013-10-03 12:21:08 +10:00
Andrew Tridgell c9fea2c706 HAL_Linux: fixed scheduling priorities
need to be between 1 and 99
2013-10-01 13:05:04 +10:00
Andrew Tridgell bbac3265b2 HAL_Linux: default to hal.console on stdout 2013-10-01 12:49:58 +10:00
Andrew Tridgell bcc9cdbf43 HAL_Linux: make I2CDriver more portable
this allows it to build on the Beaglebone
2013-10-01 12:37:13 +10:00
Andrew Tridgell 51c19331a6 HAL_Linux: fixed build 2013-10-01 12:11:48 +10:00
Andrew Tridgell f2ebb2ca87 HAL_Linux: updates for AP_HAL::MemberProc 2013-09-30 20:56:15 +10:00
Andrew Tridgell 53f66b23f4 AP_HAL_Linux: fixed APM2 build 2013-09-29 14:24:55 +10:00
Andrew Tridgell 1698e1800c HAL_Linux: timer calls may block on HAL_Linux
timer calls can do SPI transfers, which can block
2013-09-29 10:48:22 +10:00
Andrew Tridgell 5102f1511b HAL_Linux: fixed callbacks from delay() 2013-09-29 10:32:51 +10:00
Andrew Tridgell a1ef1a9318 HAL_Linux: tweak the scheduling priorities 2013-09-29 12:04:37 +10:00
Andrew Tridgell d3fe625742 HAL_Linux: make the SPI driver much more efficient
use a single transaction for multiple bytes. This makes the APM1
Oilpan driver generate only 2 interrupts per sensor read
2013-09-29 12:04:36 +10:00
Andrew Tridgell 1e786b3e20 HAL_Linux: added buffering on the UARTs 2013-09-29 12:04:36 +10:00
Andrew Tridgell 605e6c3cf7 HAL_Linux: use pthread mutexes for semaphores 2013-09-29 07:49:30 +10:00
Andrew Tridgell 884af71ef6 HAL_Linux: added SPI support 2013-09-29 00:57:13 +10:00
Andrew Tridgell f03315237a HAL_Linux: fixed timer scheduler 2013-09-28 21:24:03 +10:00
Andrew Tridgell cca59ce3c9 HAL_Linux: update for new scheduler API 2013-09-28 21:24:02 +10:00
Andrew Tridgell bcf4f48e65 HAL_Linux: switched to pthread based scheduling 2013-09-28 21:24:02 +10:00
Andrew Tridgell 58a31318ee AP_HAL_Linux: initial I2C driver implementation
this works sufficiently for the HMC5883
2013-09-28 21:24:02 +10:00
Andrew Tridgell 4ba044c441 AP_HAL_Linux: initial Linux AP_HAL 2013-09-28 21:24:01 +10:00