AP_HAL_Boards.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /**
  2. * C preprocesor enumeration of the boards supported by the AP_HAL.
  3. * This list exists so HAL_BOARD == HAL_BOARD_xxx preprocessor blocks
  4. * can be used to exclude HAL boards from the build when appropriate.
  5. * It's not an elegant solution but we can improve it in future.
  6. */
  7. #pragma once
  8. #define HAL_BOARD_SITL 3
  9. #define HAL_BOARD_SMACCM 4 // unused
  10. #define HAL_BOARD_PX4 5 // unused
  11. #define HAL_BOARD_LINUX 7
  12. #define HAL_BOARD_VRBRAIN 8
  13. #define HAL_BOARD_CHIBIOS 10
  14. #define HAL_BOARD_F4LIGHT 11 // reserved
  15. #define HAL_BOARD_EMPTY 99
  16. /* Default board subtype is -1 */
  17. #define HAL_BOARD_SUBTYPE_NONE -1
  18. /* HAL Linux sub-types, starting at 1000 */
  19. #define HAL_BOARD_SUBTYPE_LINUX_NONE 1000
  20. #define HAL_BOARD_SUBTYPE_LINUX_ERLEBOARD 1001
  21. #define HAL_BOARD_SUBTYPE_LINUX_PXF 1002
  22. #define HAL_BOARD_SUBTYPE_LINUX_NAVIO 1003
  23. #define HAL_BOARD_SUBTYPE_LINUX_ZYNQ 1004
  24. #define HAL_BOARD_SUBTYPE_LINUX_BBBMINI 1005
  25. #define HAL_BOARD_SUBTYPE_LINUX_BEBOP 1006
  26. #define HAL_BOARD_SUBTYPE_LINUX_ERLEBRAIN2 1009
  27. #define HAL_BOARD_SUBTYPE_LINUX_BH 1010
  28. #define HAL_BOARD_SUBTYPE_LINUX_PXFMINI 1012
  29. #define HAL_BOARD_SUBTYPE_LINUX_NAVIO2 1013
  30. #define HAL_BOARD_SUBTYPE_LINUX_DISCO 1014
  31. #define HAL_BOARD_SUBTYPE_LINUX_AERO 1015
  32. #define HAL_BOARD_SUBTYPE_LINUX_DARK 1016
  33. #define HAL_BOARD_SUBTYPE_LINUX_BLUE 1018
  34. #define HAL_BOARD_SUBTYPE_LINUX_OCPOC_ZYNQ 1019
  35. #define HAL_BOARD_SUBTYPE_LINUX_EDGE 1020
  36. #define HAL_BOARD_SUBTYPE_LINUX_RST_ZYNQ 1021
  37. #define HAL_BOARD_SUBTYPE_LINUX_POCKET 1022
  38. #define HAL_BOARD_SUBTYPE_LINUX_NAVIGATOR 1023
  39. /* HAL CHIBIOS sub-types, starting at 5000 */
  40. #define HAL_BOARD_SUBTYPE_CHIBIOS_SKYVIPER_F412 5000
  41. #define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV3 5001
  42. #define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV4 5002
  43. #define HAL_BOARD_SUBTYPE_CHIBIOS_MINDPXV2 5003
  44. #define HAL_BOARD_SUBTYPE_CHIBIOS_SPARKY2 5004
  45. #define HAL_BOARD_SUBTYPE_CHIBIOS_REVOMINI 5005
  46. #define HAL_BOARD_SUBTYPE_CHIBIOS_MINIPIX 5006
  47. #define HAL_BOARD_SUBTYPE_CHIBIOS_CRAZYFLIE2 5007
  48. #define HAL_BOARD_SUBTYPE_CHIBIOS_OMNIBUSF7V2 5008
  49. #define HAL_BOARD_SUBTYPE_CHIBIOS_GENERIC 5009
  50. #define HAL_BOARD_SUBTYPE_CHIBIOS_F4BY 5010
  51. #define HAL_BOARD_SUBTYPE_CHIBIOS_OMNIBUSF4PRO 5011
  52. #define HAL_BOARD_SUBTYPE_CHIBIOS_AIRBOTF4 5012
  53. #define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV5 5013
  54. #define HAL_BOARD_SUBTYPE_CHIBIOS_MATEKF405WING 5014
  55. #define HAL_BOARD_SUBTYPE_CHIBIOS_FMUV4PRO 5015
  56. #define HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V51 5016
  57. #define HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V52 5017
  58. #define HAL_BOARD_SUBTYPE_CHIBIOS_VRUBRAIN_V51 5018
  59. #define HAL_BOARD_SUBTYPE_CHIBIOS_VRCORE_V10 5019
  60. #define HAL_BOARD_SUBTYPE_CHIBIOS_VRBRAIN_V54 5020
  61. /* InertialSensor driver types */
  62. #define HAL_INS_NONE 0
  63. #define HAL_INS_MPU60XX_SPI 2
  64. #define HAL_INS_MPU60XX_I2C 3
  65. #define HAL_INS_HIL 4
  66. #define HAL_INS_VRBRAIN 8
  67. #define HAL_INS_MPU9250_SPI 9
  68. #define HAL_INS_MPU9250_I2C 13
  69. #define HAL_INS_MPU6500 19
  70. #define HAL_INS_INV2_I2C 24
  71. #define HAL_INS_INV2_SPI 25
  72. /* Barometer driver types */
  73. #define HAL_BARO_NONE 0
  74. #define HAL_BARO_HIL 6
  75. #define HAL_BARO_20789_I2C_I2C 14
  76. #define HAL_BARO_20789_I2C_SPI 15
  77. #define HAL_BARO_LPS25H_IMU_I2C 17
  78. /* Compass driver types */
  79. #define HAL_COMPASS_NONE 0
  80. #define HAL_COMPASS_HIL 3
  81. /* Heat Types */
  82. #define HAL_LINUX_HEAT_PWM 1
  83. /* CPU classes, used to select if CPU intensive algorithms should be used
  84. * Note that these are only approximate, not exact CPU speeds. */
  85. /* 150Mhz: STM32F4 or similar. Assumes:
  86. * - hardware floating point
  87. * - tens of kilobytes of memory available
  88. */
  89. #define HAL_CPU_CLASS_150 3
  90. /* GigaHz class: SITL, BeagleBone etc. Assumes megabytes of memory available. */
  91. #define HAL_CPU_CLASS_1000 4
  92. /*
  93. memory classes, in kbytes. Board must have at least the given amount
  94. of memory
  95. */
  96. #define HAL_MEM_CLASS_20 1
  97. #define HAL_MEM_CLASS_64 2
  98. #define HAL_MEM_CLASS_192 3
  99. #define HAL_MEM_CLASS_300 4
  100. #define HAL_MEM_CLASS_500 5
  101. #define HAL_MEM_CLASS_1000 6
  102. /* Operating system features
  103. *
  104. * HAL implementations may define the following extra feature defines to 1 if
  105. * available:
  106. *
  107. * - HAL_OS_POSIX_IO : has posix-like filesystem IO
  108. * - HAL_OS_SOCKETS : has posix-like sockets */
  109. /* DEFINITIONS FOR BOARDS */
  110. #if CONFIG_HAL_BOARD == HAL_BOARD_SITL
  111. #include <AP_HAL/board/sitl.h>
  112. #elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX
  113. #include <AP_HAL/board/linux.h>
  114. #elif CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
  115. #include <AP_HAL/board/empty.h>
  116. #elif CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN
  117. #include <AP_HAL/board/vrbrain.h>
  118. #elif CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
  119. #include <AP_HAL/board/chibios.h>
  120. #else
  121. #error "Unknown CONFIG_HAL_BOARD type"
  122. #endif
  123. #ifndef CONFIG_HAL_BOARD_SUBTYPE
  124. #error "No CONFIG_HAL_BOARD_SUBTYPE set"
  125. #endif
  126. #ifndef HAL_OS_POSIX_IO
  127. #define HAL_OS_POSIX_IO 0
  128. #endif
  129. #ifndef HAL_OS_SOCKETS
  130. #define HAL_OS_SOCKETS 0
  131. #endif
  132. #ifndef HAL_PARAM_DEFAULTS_PATH
  133. #define HAL_PARAM_DEFAULTS_PATH nullptr
  134. #endif
  135. #ifndef HAL_HAVE_IMU_HEATER
  136. #define HAL_HAVE_IMU_HEATER 0
  137. #endif
  138. #ifndef HAL_COMPASS_HMC5843_I2C_ADDR
  139. #define HAL_COMPASS_HMC5843_I2C_ADDR 0x1E
  140. #endif
  141. #ifndef HAL_WITH_UAVCAN
  142. #define HAL_WITH_UAVCAN 0
  143. #endif
  144. #ifndef HAL_RCINPUT_WITH_AP_RADIO
  145. #define HAL_RCINPUT_WITH_AP_RADIO 0
  146. #endif
  147. #ifndef HAL_WITH_IO_MCU
  148. #define HAL_WITH_IO_MCU 0
  149. #endif
  150. #ifndef HAL_HAVE_GETTIME_SETTIME
  151. #define HAL_HAVE_GETTIME_SETTIME 0
  152. #endif
  153. // this is used as a general mechanism to make a 'small' build by
  154. // dropping little used features. We use this to allow us to keep
  155. // FMUv2 going for as long as possible
  156. #ifndef HAL_MINIMIZE_FEATURES
  157. #define HAL_MINIMIZE_FEATURES 0
  158. #endif
  159. #ifndef HAL_OS_FATFS_IO
  160. #define HAL_OS_FATFS_IO 0
  161. #endif
  162. #ifndef HAL_PX4_HAVE_PX4IO
  163. #define HAL_PX4_HAVE_PX4IO 0
  164. #endif
  165. #ifndef HAL_COMPASS_DEFAULT
  166. #define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
  167. #endif
  168. #ifndef HAL_BARO_DEFAULT
  169. #define HAL_BARO_DEFAULT HAL_BARO_NONE
  170. #endif
  171. #ifndef HAL_INS_DEFAULT
  172. #define HAL_INS_DEFAULT HAL_INS_NONE
  173. #endif
  174. #ifndef HAL_GPS_TYPE_DEFAULT
  175. #define HAL_GPS_TYPE_DEFAULT 1
  176. #endif
  177. #ifndef HAL_CAN_DRIVER_DEFAULT
  178. #define HAL_CAN_DRIVER_DEFAULT 0
  179. #endif
  180. #ifdef HAVE_LIBDL
  181. #define AP_MODULE_SUPPORTED 1
  182. #else
  183. #define AP_MODULE_SUPPORTED 0
  184. #endif
  185. #ifndef HAL_SUPPORT_RCOUT_SERIAL
  186. #define HAL_SUPPORT_RCOUT_SERIAL 0
  187. #endif
  188. #ifndef HAL_HAVE_DUAL_USB_CDC
  189. #define HAL_HAVE_DUAL_USB_CDC 0
  190. #endif
  191. #if HAL_WITH_UAVCAN && CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
  192. #define AP_UAVCAN_SLCAN_ENABLED 1
  193. #else
  194. #define AP_UAVCAN_SLCAN_ENABLED 0
  195. #endif