2012-12-11 19:19:52 -04:00
|
|
|
/**
|
|
|
|
* C preprocesor enumeration of the boards supported by the AP_HAL.
|
|
|
|
* This list exists so HAL_BOARD == HAL_BOARD_xxx preprocessor blocks
|
|
|
|
* can be used to exclude HAL boards from the build when appropriate.
|
2016-09-16 22:43:32 -03:00
|
|
|
* It's not an elegant solution but we can improve it in future.
|
2012-12-11 19:19:52 -04:00
|
|
|
*/
|
2016-08-30 12:59:12 -03:00
|
|
|
#pragma once
|
2014-07-23 09:23:26 -03:00
|
|
|
|
2015-11-01 07:22:15 -04:00
|
|
|
#define HAL_BOARD_SITL 3
|
2016-08-30 12:59:12 -03:00
|
|
|
#define HAL_BOARD_SMACCM 4 // unused
|
2019-02-25 01:13:47 -04:00
|
|
|
#define HAL_BOARD_PX4 5 // unused
|
2013-09-22 03:03:28 -03:00
|
|
|
#define HAL_BOARD_LINUX 7
|
2014-03-31 14:29:33 -03:00
|
|
|
#define HAL_BOARD_VRBRAIN 8
|
2018-01-05 03:07:23 -04:00
|
|
|
#define HAL_BOARD_CHIBIOS 10
|
2019-01-20 20:47:39 -04:00
|
|
|
#define HAL_BOARD_F4LIGHT 11 // reserved
|
2021-10-27 05:06:41 -03:00
|
|
|
#define HAL_BOARD_ESP32 12
|
2018-02-02 16:35:15 -04:00
|
|
|
#define HAL_BOARD_EMPTY 99
|
2012-12-11 19:19:52 -04:00
|
|
|
|
2016-08-30 12:59:12 -03:00
|
|
|
/* Default board subtype is -1 */
|
2014-08-13 01:42:52 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_NONE -1
|
2013-12-30 18:24:43 -04:00
|
|
|
|
2016-08-30 12:59:12 -03:00
|
|
|
/* HAL Linux sub-types, starting at 1000 */
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_NONE 1000
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_ERLEBOARD 1001
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_PXF 1002
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_NAVIO 1003
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_ZYNQ 1004
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_BBBMINI 1005
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_BEBOP 1006
|
2015-11-01 07:22:15 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_ERLEBRAIN2 1009
|
2016-08-30 12:59:12 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_BH 1010
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_PXFMINI 1012
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_NAVIO2 1013
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_DISCO 1014
|
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_AERO 1015
|
2016-10-17 14:11:03 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_DARK 1016
|
2016-12-29 10:52:56 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_BLUE 1018
|
2017-08-17 19:41:28 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ 1019
|
2017-10-19 06:53:36 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_EDGE 1020
|
2017-10-30 06:03:04 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_RST_ZYNQ 1021
|
2017-12-13 15:35:00 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_POCKET 1022
|
2020-01-10 15:16:08 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_NAVIGATOR 1023
|
2021-01-13 17:08:05 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_VNAV 1024
|
2021-09-07 02:09:36 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_LINUX_OBAL_V1 1025
|
2016-08-30 12:59:12 -03:00
|
|
|
|
2020-03-13 17:40:20 -03:00
|
|
|
/* HAL CHIBIOS sub-types, starting at 5000
|
|
|
|
|
|
|
|
NOTE!! Do not add more subtypes unless they are really needed. Most
|
|
|
|
boards do not need a subtype defined. It is only needed if we need
|
|
|
|
to use #ifdef'd code to change behaviour
|
|
|
|
*/
|
2018-01-05 03:07:23 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_SKYVIPER_F412 5000
|
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV3 5001
|
2018-01-10 06:33:57 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV4 5002
|
2018-03-01 20:45:39 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_GENERIC 5009
|
2018-05-29 06:40:09 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV5 5013
|
2019-01-23 18:06:13 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V51 5016
|
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V52 5017
|
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_VRUBRAIN_V51 5018
|
2019-01-23 18:08:17 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_VRCORE_V10 5019
|
2019-01-23 18:10:04 -04:00
|
|
|
#define HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V54 5020
|
2018-01-05 03:07:23 -04:00
|
|
|
|
2021-10-27 05:06:41 -03:00
|
|
|
#define HAL_BOARD_SUBTYPE_ESP32_DIY 6001
|
|
|
|
#define HAL_BOARD_SUBTYPE_ESP32_ICARUS 6002
|
|
|
|
#define HAL_BOARD_SUBTYPE_ESP32_BUZZ 6003
|
|
|
|
|
2016-08-30 12:59:12 -03:00
|
|
|
/* InertialSensor driver types */
|
2018-02-07 03:22:20 -04:00
|
|
|
#define HAL_INS_NONE 0
|
2016-08-30 12:59:12 -03:00
|
|
|
#define HAL_INS_MPU60XX_SPI 2
|
|
|
|
#define HAL_INS_MPU60XX_I2C 3
|
2021-06-09 08:31:35 -03:00
|
|
|
#define HAL_INS_HIL_UNUSED 4 // unused
|
2016-08-30 12:59:12 -03:00
|
|
|
#define HAL_INS_VRBRAIN 8
|
2016-01-20 18:20:35 -04:00
|
|
|
#define HAL_INS_MPU9250_SPI 9
|
2015-09-28 13:49:32 -03:00
|
|
|
#define HAL_INS_MPU9250_I2C 13
|
2017-02-06 19:51:58 -04:00
|
|
|
#define HAL_INS_MPU6500 19
|
2019-02-15 08:03:42 -04:00
|
|
|
#define HAL_INS_INV2_I2C 24
|
|
|
|
#define HAL_INS_INV2_SPI 25
|
|
|
|
|
2016-08-30 12:59:12 -03:00
|
|
|
|
|
|
|
/* Barometer driver types */
|
2018-02-07 03:22:20 -04:00
|
|
|
#define HAL_BARO_NONE 0
|
2021-06-09 08:31:35 -03:00
|
|
|
#define HAL_BARO_HIL_UNUSED 6 // unused
|
2018-01-19 01:06:22 -04:00
|
|
|
#define HAL_BARO_20789_I2C_I2C 14
|
|
|
|
#define HAL_BARO_20789_I2C_SPI 15
|
2018-02-15 00:00:41 -04:00
|
|
|
#define HAL_BARO_LPS25H_IMU_I2C 17
|
2016-08-30 12:59:12 -03:00
|
|
|
|
|
|
|
/* Heat Types */
|
2015-10-02 06:29:27 -03:00
|
|
|
#define HAL_LINUX_HEAT_PWM 1
|
|
|
|
|
2016-08-30 12:59:12 -03:00
|
|
|
/* CPU classes, used to select if CPU intensive algorithms should be used
|
|
|
|
* Note that these are only approximate, not exact CPU speeds. */
|
|
|
|
|
2019-09-22 19:51:30 -03:00
|
|
|
/* 150Mhz: STM32F4 or similar. Assumes:
|
2016-08-30 12:59:12 -03:00
|
|
|
* - hardware floating point
|
2019-09-22 19:51:30 -03:00
|
|
|
* - tens of kilobytes of memory available
|
|
|
|
*/
|
2016-08-30 12:59:12 -03:00
|
|
|
#define HAL_CPU_CLASS_150 3
|
2019-09-22 19:51:30 -03:00
|
|
|
|
2016-08-30 12:59:12 -03:00
|
|
|
/* GigaHz class: SITL, BeagleBone etc. Assumes megabytes of memory available. */
|
|
|
|
#define HAL_CPU_CLASS_1000 4
|
|
|
|
|
2019-09-22 19:51:30 -03:00
|
|
|
|
|
|
|
/*
|
|
|
|
memory classes, in kbytes. Board must have at least the given amount
|
|
|
|
of memory
|
|
|
|
*/
|
|
|
|
#define HAL_MEM_CLASS_20 1
|
|
|
|
#define HAL_MEM_CLASS_64 2
|
|
|
|
#define HAL_MEM_CLASS_192 3
|
|
|
|
#define HAL_MEM_CLASS_300 4
|
|
|
|
#define HAL_MEM_CLASS_500 5
|
|
|
|
#define HAL_MEM_CLASS_1000 6
|
|
|
|
|
2016-08-30 12:59:12 -03:00
|
|
|
/* Operating system features
|
|
|
|
*
|
|
|
|
* HAL implementations may define the following extra feature defines to 1 if
|
|
|
|
* available:
|
|
|
|
*
|
|
|
|
* - HAL_OS_POSIX_IO : has posix-like filesystem IO
|
|
|
|
* - HAL_OS_SOCKETS : has posix-like sockets */
|
|
|
|
|
|
|
|
/* DEFINITIONS FOR BOARDS */
|
2013-12-30 18:24:43 -04:00
|
|
|
|
2015-11-03 09:46:29 -04:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
2016-09-24 07:42:22 -03:00
|
|
|
#include <AP_HAL/board/sitl.h>
|
2013-09-22 03:03:28 -03:00
|
|
|
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
2016-09-24 07:42:22 -03:00
|
|
|
#include <AP_HAL/board/linux.h>
|
2012-12-23 16:30:50 -04:00
|
|
|
#elif CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
|
2016-09-24 07:42:22 -03:00
|
|
|
#include <AP_HAL/board/empty.h>
|
2014-03-31 14:29:33 -03:00
|
|
|
#elif CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
|
2016-09-24 07:42:22 -03:00
|
|
|
#include <AP_HAL/board/vrbrain.h>
|
2018-01-05 03:07:23 -04:00
|
|
|
#elif CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
|
|
|
#include <AP_HAL/board/chibios.h>
|
2021-10-27 05:06:41 -03:00
|
|
|
#elif CONFIG_HAL_BOARD == HAL_BOARD_ESP32
|
|
|
|
#include <AP_HAL/board/esp32.h>
|
2012-12-18 05:04:20 -04:00
|
|
|
#else
|
|
|
|
#error "Unknown CONFIG_HAL_BOARD type"
|
|
|
|
#endif
|
|
|
|
|
2014-08-13 01:42:52 -03:00
|
|
|
#ifndef CONFIG_HAL_BOARD_SUBTYPE
|
|
|
|
#error "No CONFIG_HAL_BOARD_SUBTYPE set"
|
|
|
|
#endif
|
|
|
|
|
2015-03-24 20:28:26 -03:00
|
|
|
#ifndef HAL_OS_POSIX_IO
|
|
|
|
#define HAL_OS_POSIX_IO 0
|
|
|
|
#endif
|
2013-12-30 18:24:43 -04:00
|
|
|
|
2016-02-24 10:30:36 -04:00
|
|
|
#ifndef HAL_OS_SOCKETS
|
|
|
|
#define HAL_OS_SOCKETS 0
|
|
|
|
#endif
|
|
|
|
|
2016-01-06 18:09:09 -04:00
|
|
|
#ifndef HAL_PARAM_DEFAULTS_PATH
|
2016-10-30 02:24:21 -03:00
|
|
|
#define HAL_PARAM_DEFAULTS_PATH nullptr
|
2016-01-06 18:09:09 -04:00
|
|
|
#endif
|
2016-06-15 05:00:55 -03:00
|
|
|
|
|
|
|
#ifndef HAL_HAVE_IMU_HEATER
|
|
|
|
#define HAL_HAVE_IMU_HEATER 0
|
|
|
|
#endif
|
2016-07-25 17:00:02 -03:00
|
|
|
|
2016-10-31 22:16:31 -03:00
|
|
|
#ifndef HAL_COMPASS_HMC5843_I2C_ADDR
|
|
|
|
#define HAL_COMPASS_HMC5843_I2C_ADDR 0x1E
|
|
|
|
#endif
|
|
|
|
|
2020-05-31 09:12:02 -03:00
|
|
|
#ifndef HAL_NUM_CAN_IFACES
|
|
|
|
#define HAL_NUM_CAN_IFACES 0
|
2016-12-10 03:01:49 -04:00
|
|
|
#endif
|
|
|
|
|
2018-03-11 11:47:40 -03:00
|
|
|
#ifndef HAL_RCINPUT_WITH_AP_RADIO
|
|
|
|
#define HAL_RCINPUT_WITH_AP_RADIO 0
|
|
|
|
#endif
|
|
|
|
|
2018-01-30 15:42:04 -04:00
|
|
|
#ifndef HAL_WITH_IO_MCU
|
|
|
|
#define HAL_WITH_IO_MCU 0
|
|
|
|
#endif
|
|
|
|
|
2017-01-27 00:52:51 -04:00
|
|
|
// this is used as a general mechanism to make a 'small' build by
|
|
|
|
// dropping little used features. We use this to allow us to keep
|
|
|
|
// FMUv2 going for as long as possible
|
|
|
|
#ifndef HAL_MINIMIZE_FEATURES
|
|
|
|
#define HAL_MINIMIZE_FEATURES 0
|
|
|
|
#endif
|
2018-01-05 03:07:23 -04:00
|
|
|
|
2019-08-09 13:04:00 -03:00
|
|
|
#ifndef BOARD_FLASH_SIZE
|
|
|
|
#define BOARD_FLASH_SIZE 2048
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAL_WITH_DSP
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX || defined(HAL_BOOTLOADER_BUILD) || defined(HAL_BUILD_AP_PERIPH) || BOARD_FLASH_SIZE <= 1024
|
|
|
|
#define HAL_WITH_DSP 0
|
|
|
|
#else
|
|
|
|
#define HAL_WITH_DSP !HAL_MINIMIZE_FEATURES
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2018-01-05 03:07:23 -04:00
|
|
|
#ifndef HAL_OS_FATFS_IO
|
|
|
|
#define HAL_OS_FATFS_IO 0
|
|
|
|
#endif
|
2018-02-07 03:22:20 -04:00
|
|
|
|
|
|
|
#ifndef HAL_BARO_DEFAULT
|
|
|
|
#define HAL_BARO_DEFAULT HAL_BARO_NONE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAL_INS_DEFAULT
|
|
|
|
#define HAL_INS_DEFAULT HAL_INS_NONE
|
|
|
|
#endif
|
2018-02-09 19:09:02 -04:00
|
|
|
|
2018-02-12 23:08:57 -04:00
|
|
|
#ifndef HAL_GPS_TYPE_DEFAULT
|
|
|
|
#define HAL_GPS_TYPE_DEFAULT 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAL_CAN_DRIVER_DEFAULT
|
|
|
|
#define HAL_CAN_DRIVER_DEFAULT 0
|
|
|
|
#endif
|
|
|
|
|
2020-05-31 09:12:02 -03:00
|
|
|
#ifndef HAL_MAX_CAN_PROTOCOL_DRIVERS
|
2021-04-30 22:30:10 -03:00
|
|
|
#if defined(HAL_BOOTLOADER_BUILD)
|
2020-07-30 14:49:36 -03:00
|
|
|
#define HAL_MAX_CAN_PROTOCOL_DRIVERS 0
|
|
|
|
#else
|
|
|
|
#define HAL_MAX_CAN_PROTOCOL_DRIVERS HAL_NUM_CAN_IFACES
|
|
|
|
#endif
|
2020-05-31 09:12:02 -03:00
|
|
|
#endif
|
|
|
|
|
2021-06-20 07:50:20 -03:00
|
|
|
#ifndef HAL_CANMANAGER_ENABLED
|
|
|
|
#define HAL_CANMANAGER_ENABLED ((HAL_MAX_CAN_PROTOCOL_DRIVERS > 0) && !defined(HAL_BUILD_AP_PERIPH))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAL_ENABLE_LIBUAVCAN_DRIVERS
|
|
|
|
#define HAL_ENABLE_LIBUAVCAN_DRIVERS HAL_CANMANAGER_ENABLED
|
2020-05-31 09:12:02 -03:00
|
|
|
#endif
|
|
|
|
|
2018-02-09 19:09:02 -04:00
|
|
|
#ifdef HAVE_LIBDL
|
|
|
|
#define AP_MODULE_SUPPORTED 1
|
|
|
|
#else
|
|
|
|
#define AP_MODULE_SUPPORTED 0
|
|
|
|
#endif
|
|
|
|
|
2018-04-01 22:15:46 -03:00
|
|
|
#ifndef HAL_SUPPORT_RCOUT_SERIAL
|
|
|
|
#define HAL_SUPPORT_RCOUT_SERIAL 0
|
|
|
|
#endif
|
2018-02-12 23:08:57 -04:00
|
|
|
|
2019-07-05 00:28:21 -03:00
|
|
|
|
|
|
|
#ifndef HAL_HAVE_DUAL_USB_CDC
|
|
|
|
#define HAL_HAVE_DUAL_USB_CDC 0
|
|
|
|
#endif
|
2019-10-06 02:29:15 -03:00
|
|
|
|
2020-05-31 09:12:02 -03:00
|
|
|
#if HAL_NUM_CAN_IFACES && CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
2019-10-06 02:29:15 -03:00
|
|
|
#define AP_UAVCAN_SLCAN_ENABLED 1
|
|
|
|
#else
|
|
|
|
#define AP_UAVCAN_SLCAN_ENABLED 0
|
|
|
|
#endif
|
2020-03-17 05:47:38 -03:00
|
|
|
|
|
|
|
#ifndef USE_LIBC_REALLOC
|
|
|
|
#define USE_LIBC_REALLOC 1
|
|
|
|
#endif
|
2020-12-23 06:41:17 -04:00
|
|
|
|
|
|
|
#ifndef HAL_ENABLE_THREAD_STATISTICS
|
|
|
|
#define HAL_ENABLE_THREAD_STATISTICS 0
|
|
|
|
#endif
|
2021-06-23 02:22:31 -03:00
|
|
|
|
|
|
|
#ifndef HAL_INS_ENABLED
|
|
|
|
#define HAL_INS_ENABLED (!defined(HAL_BUILD_AP_PERIPH))
|
|
|
|
#endif
|
2021-08-22 22:40:20 -03:00
|
|
|
|
|
|
|
#ifndef HAL_WITH_MCU_MONITORING
|
2022-02-20 23:44:26 -04:00
|
|
|
#define HAL_WITH_MCU_MONITORING 0
|
2021-08-22 22:40:20 -03:00
|
|
|
#endif
|
2021-11-13 18:40:24 -04:00
|
|
|
|
|
|
|
#ifndef HAL_HNF_MAX_FILTERS
|
|
|
|
// On an F7 The difference in CPU load between 1 notch and 24 notches is about 2%
|
|
|
|
// The difference in CPU load between 1Khz backend and 2Khz backend is about 10%
|
|
|
|
// So at 1Khz almost all notch combinations can be supported on F7 and certainly H7
|
|
|
|
#if defined(STM32H7) || CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
|
|
|
// Enough for a double-notch per motor on an octa using three IMUs and one harmonics
|
|
|
|
// plus one static notch with one double-notch harmonics
|
|
|
|
#define HAL_HNF_MAX_FILTERS 54
|
|
|
|
#elif defined(STM32F7)
|
|
|
|
// Enough for a notch per motor on an octa using three IMUs and one harmonics
|
|
|
|
// plus one static notch with one harmonics
|
|
|
|
#define HAL_HNF_MAX_FILTERS 27
|
|
|
|
#else
|
|
|
|
// Enough for a notch per motor on an octa quad using two IMUs and one harmonic
|
|
|
|
// plus one static notch with one harmonic
|
|
|
|
#define HAL_HNF_MAX_FILTERS 18
|
|
|
|
#endif
|
2021-05-03 09:53:04 -03:00
|
|
|
#endif // HAL_HNF_MAX_FILTERS
|
|
|
|
|
2022-03-26 16:41:17 -03:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL // allow SITL to have all the CANFD options
|
|
|
|
#define HAL_CANFD_SUPPORTED 8
|
|
|
|
#elif !defined(HAL_CANFD_SUPPORTED)
|
2021-05-03 09:53:04 -03:00
|
|
|
#define HAL_CANFD_SUPPORTED 0
|
2021-11-13 18:40:24 -04:00
|
|
|
#endif
|
2021-09-04 09:01:51 -03:00
|
|
|
|
|
|
|
#ifndef __RAMFUNC__
|
|
|
|
#define __RAMFUNC__
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __FASTRAMFUNC__
|
|
|
|
#define __FASTRAMFUNC__
|
|
|
|
#endif
|