AP_HAL_Linux: add support for Aerotenna OcPoC-Zynq hardware

This commit is contained in:
davidaroyer 2017-08-17 17:41:58 -05:00 committed by Lucas De Marchi
parent 8862e76284
commit 7d2e44862f
7 changed files with 35 additions and 3 deletions

View File

@ -32,6 +32,7 @@
#include "RCInput_UDP.h"
#include "RCInput_115200.h"
#include "RCInput_Multi.h"
#include "RCInput_ZYNQ.h"
#include "RCOutput_AeroIO.h"
#include "RCOutput_AioPRU.h"
#include "RCOutput_Bebop.h"
@ -156,6 +157,12 @@ static RCInput_RPI rcinDriver;
static RCInput_Raspilot rcinDriver;
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ZYNQ
static RCInput_ZYNQ rcinDriver;
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
#if OCPOC_DEFAULT_RCIN_SBUS
static RCInput_SBUS rcinDriver;
#else
static RCInput_ZYNQ rcinDriver;
#endif
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
static RCInput_UDP rcinDriver;
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_MINLURE
@ -195,7 +202,8 @@ static RCOutput_PCA9685 rcoutDriver(i2c_mgr_instance.get_device(1, PCA9685_QUINA
*/
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_RASPILOT
static RCOutput_Raspilot rcoutDriver;
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ZYNQ
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ZYNQ || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
static RCOutput_ZYNQ rcoutDriver;
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
static RCOutput_Bebop rcoutDriver(i2c_mgr_instance.get_device(HAL_RCOUT_BEBOP_BLDC_I2C_BUS, HAL_RCOUT_BEBOP_BLDC_I2C_ADDR));

View File

@ -21,7 +21,8 @@
#include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_AERO
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_AERO || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
#include "RCInput_SBUS.h"
#include <stdio.h>
#include <fcntl.h>

View File

@ -17,7 +17,8 @@
#include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_AERO
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_AERO || \
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
#include "RCInput.h"
@ -35,6 +36,8 @@ private:
const char *device_path = "/dev/ttyS1";
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO
const char *device_path = "/dev/uart-sbus";
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
const char *device_path = "/dev/ttyS2";
#else
const char *device_path = nullptr;
#endif

View File

@ -16,7 +16,11 @@
#include "GPIO.h"
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
#define RCIN_ZYNQ_PULSE_INPUT_BASE 0x43c70000
#else
#define RCIN_ZYNQ_PULSE_INPUT_BASE 0x43c10000
#endif
extern const AP_HAL::HAL& hal;

View File

@ -15,8 +15,13 @@ public:
void _timer_tick(void);
private:
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
static const int TICK_PER_US=50;
static const int TICK_PER_S=50000000;
#else
static const int TICK_PER_US=100;
static const int TICK_PER_S=100000000;
#endif
// Memory mapped keyhole register to pulse input FIFO
volatile uint32_t *pulse_input;

View File

@ -20,8 +20,13 @@ public:
void push(void) override;
private:
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
static const int TICK_PER_US=50;
static const int TICK_PER_S=50000000;
#else
static const int TICK_PER_US=100;
static const int TICK_PER_S=100000000;
#endif
// Period|Hi 32 bits each
struct s_period_hi {

View File

@ -107,6 +107,12 @@ SPIDesc SPIDeviceManager::_device[] = {
SPIDesc("lsm9ds0_g", 0, 0, SPI_MODE_3, 8, RPI_GPIO_12, 10*MHZ, 10*MHZ),
SPIDesc("raspio", 0, 0, SPI_MODE_3, 8, RPI_GPIO_7, 10*MHZ, 10*MHZ),
};
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ
SPIDesc SPIDeviceManager::_device[] = {
/* MPU9250 is restricted to 1MHz for non-data and interrupt registers */
SPIDesc("mpu9250", 1, 0, SPI_MODE_3, 8, SPI_CS_KERNEL, 1*MHZ, 10*MHZ),
SPIDesc("ms5611", 1, 1, SPI_MODE_3, 8, SPI_CS_KERNEL, 1*MHZ, 10*MHZ),
};
#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BH
SPIDesc SPIDeviceManager::_device[] = {
SPIDesc("mpu9250", 0, 0, SPI_MODE_0, 8, RPI_GPIO_7, 1*MHZ, 11*MHZ),