Commit Graph

20 Commits

Author SHA1 Message Date
Gustavo Jose de Sousa 124b750c10 AP_HAL_Linux: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:43 +10:00
Andrew Tridgell c8a6a02be1 HAL_Linux: don't do chardev test on subtype NONE
otherwise replay is broken
2015-07-01 15:36:34 +10:00
Lucas De Marchi 623c5f0713 AP_HAL_Linux: check if I2C device is chardev 2015-06-30 09:10:54 +10:00
Lucas De Marchi a4c1b0d75f AP_HAL_Linux: add constructor to find I2C bus reliably
The device number in /dev may not be reliable from one boot to another
due to the initialization order of each bus.

For example, in Minnow Board Max, the exposed I2C buses may be i2c-7 and
i2c-8 or i2c-8 and i2c-9 depending if the platform driver in the kernel
is initialized before or after the PCI.

It also may change with different version and configuration of the DT or
UEFI used making another kernel driver to bind to the device. This means that
for Minnow Board Max we need to use something like below to pass to the
constructor:

	static const char * const i2c_devpaths[] = {
	    /* UEFI with lpss set to ACPI */
	    "/devices/platform/80860F41:05",
	    /* UEFI with lpss set to PCI */
	    "/devices/pci0000:00/0000:00:18.6",
	     NULL
	};

The devpath here is the one returned by udev with the following command:

	udevadm info -q path /dev/<i2c-device>

In contrary to the device number in /dev/i2c-N, this path in sysfs is
stable across reboots and can only change if there's a change in the
UEFI firmware or the board's device tree.

This patch assumes the currently supported boards don't have this
problem so it's not touching them.
2015-06-30 09:10:54 +10:00
Lucas De Marchi ec5d0b6c08 AP_HAL_Linux: reorder members and methods and use C++ initializer 2015-06-30 09:10:53 +10:00
Andrew Tridgell b09fcfc20e HAL_Linux: cope with systems without I2C_RDRW_IOCTL_MAX_MSGS
such as my ubuntu 14.04 laptop :-)
2015-05-05 21:42:46 +10:00
Lucas De Marchi d640bc8345 AP_HAL_Linux: use kernel's limit of msgs per I2C transaction
Instead of hardcoding 8 as the limit for I2C msgs, use whatever the
kernel exported to us.  In upstream this is 42 so it means we can group
together 21 addr/data pair instead of only 8.
2015-05-05 09:56:44 +10:00
Andrew Tridgell 1b85b12738 HAL_Linux: made I2C driver more portable
this uses a typeof() to cope with different kernel data types for I2C
messages
2014-07-15 13:56:50 +10:00
Andrew Tridgell 6312b9f8c0 HAL_Linux: allow different SPI and GPIO devices on different boards
this fixes the Replay utility, which uses subtype NONE, and will make
it easier to port to new boards
2014-07-14 09:44:37 +10:00
Andrew Tridgell 8e5915ef7d HAL_Linux: fixed some valgrind errors 2014-07-14 09:44:35 +10:00
Andrew Tridgell fc8068adfe HAL_Linux: use board subtypes 2014-07-14 09:44:35 +10:00
Andrew Tridgell 1bf0c4c67d HAL_Linux: cope with different I2C headers for data 2014-07-14 09:44:34 +10:00
Andrew Tridgell fa2a1c495e HAL_Linux: fixed I2C driver build errors 2014-07-14 09:44:34 +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
Andrew Tridgell 74ee70d463 HAL_Linux: updates for ERLE board type 2014-07-14 08:52:27 +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 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 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