Changes to boards/common for upstream NuttX directory changes

This commit is contained in:
David Sidrane
2016-12-12 14:14:27 -10:00
committed by Lorenz Meier
parent 2f0a0e1c30
commit ced8c6a2ef
2 changed files with 60 additions and 1 deletions
+59
View File
@@ -48,6 +48,50 @@
* Definitions
************************************************************************************/
/* SPI bus defining tools
* For new boards we use a board_config.h to define all the SPI functionality
* A board provides SPI bus definitions and a set of buses that should be
* enumerated as well as chip selects that will be interatorable
*
* We will use these in macros place of the spi_dev_e enumeration to select a
* specific SPI device on given SPI1 bus.
*
* These macros will define BUS:DEV For clarity and indexing
*
* The board config then defines:
* 1) PX4_SPI_BUS_xxx Ids -the buses as a 1 based PX4_SPI_BUS_xxx as n+1 aping to SPI n
* where n is {1-highest SPI supported by SoC}
* 2) PX4_SPIDEV_yyyy handles - PX4_SPIDEV_xxxxx handles using the macros below.
* 3) PX4_xxxx_BUS_CS_GPIO - a set of chip selects that are indexed by the handles. and of set to 0 are
* ignored.
* 4) PX4_xxxx_BUS_FIRST_CS and PX4_xxxxx_BUS_LAST_CS as PX4_SPIDEV_lll for the first CS and
* PX4_SPIDEV_hhhh as the last CS
*
* Example:
*
* The PX4_SPI_BUS_xxx
* #define PX4_SPI_BUS_SENSORS 1
* #define PX4_SPI_BUS_MEMORY 2
*
* the PX4_SPIDEV_yyyy
* #define PX4_SPIDEV_ICM_20689 PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS,0)
* #define PX4_SPIDEV_ICM_20602 PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS,1)
* #define PX4_SPIDEV_BMI055_GYRO PX4_MK_SPI_SEL(PX4_SPI_BUS_SENSORS,2)
*
* The PX4_xxxx_BUS_CS_GPIO
* #define PX4_SENSOR_BUS_CS_GPIO {GPIO_SPI_CS_ICM20689, GPIO_SPI_CS_ICM20602, GPIO_SPI_CS_BMI055_GYR,...
*
* The PX4_xxxx_BUS_FIRST_CS and PX4_xxxxx_BUS_LAST_CS
* #define PX4_SENSORS_BUS_FIRST_CS PX4_SPIDEV_ICM_20689
* #define PX4_SENSORS_BUS_LAST_CS PX4_SPIDEV_BMI055_ACCEL
*
*
*/
#define PX4_MK_SPI_SEL(b,d) ((((b) & 0xf) << 4) + ((d) & 0xf))
#define PX4_SPI_BUS_ID(bd) (((bd) >> 4) & 0xf)
#define PX4_SPI_DEV_ID(bd) ((bd) & 0xf)
/************************************************************************************
* Private Functions
************************************************************************************/
@@ -99,3 +143,18 @@ __EXPORT int board_get_dma_usage(uint16_t *dma_total, uint16_t *dma_used, uint16
#else
#define board_get_dma_usage(dma_total,dma_used, dma_peak_used) (-ENOMEM)
#endif
/************************************************************************************
* Name: board_rc_input
*
* Description:
* All boards my optionally provide this API to invert the Serial RC input.
* This is needed on SoCs that support the notion RXINV or TXINV as apposed to
* and external XOR controlled by a GPIO
*
************************************************************************************/
#if defined(INVERT_RC_INPUT)
# if !defined(GPIO_SBUS_INV)
__EXPORT void board_rc_input(bool invert_on);
# endif
#endif
+1 -1
View File
@@ -46,7 +46,7 @@
#include <stdint.h>
#include <errno.h>
#include <nuttx/gran.h>
#include <nuttx/mm/gran.h>
#include <systemlib/perf_counter.h>