halconf.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. /*
  2. ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. /*
  14. * This file is free software: you can redistribute it and/or modify it
  15. * under the terms of the GNU General Public License as published by the
  16. * Free Software Foundation, either version 3 of the License, or
  17. * (at your option) any later version.
  18. *
  19. * This file is distributed in the hope that it will be useful, but
  20. * WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  22. * See the GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License along
  25. * with this program. If not, see <http://www.gnu.org/licenses/>.
  26. *
  27. * Modified for use in AP_HAL by Andrew Tridgell and Siddharth Bharat Purohit
  28. */
  29. /**
  30. * @file templates/halconf.h
  31. * @brief HAL configuration header.
  32. * @details HAL configuration file, this file allows to enable or disable the
  33. * various device drivers from your application. You may also use
  34. * this file in order to override the device drivers default settings.
  35. *
  36. * @addtogroup HAL_CONF
  37. * @{
  38. */
  39. #pragma once
  40. #define _CHIBIOS_HAL_CONF_
  41. #define _CHIBIOS_HAL_CONF_VER_7_0_
  42. #include "mcuconf.h"
  43. /**
  44. * @brief Enables the PAL subsystem.
  45. */
  46. #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__)
  47. #define HAL_USE_PAL TRUE
  48. #endif
  49. /**
  50. * @brief Enables the ADC subsystem.
  51. */
  52. #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
  53. #define HAL_USE_ADC TRUE
  54. #endif
  55. /**
  56. * @brief Enables the CAN subsystem.
  57. */
  58. #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
  59. #define HAL_USE_CAN FALSE
  60. #endif
  61. /**
  62. * @brief Enables the cryptographic subsystem.
  63. */
  64. #if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
  65. #define HAL_USE_CRY FALSE
  66. #endif
  67. /**
  68. * @brief Enables the DAC subsystem.
  69. */
  70. #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
  71. #define HAL_USE_DAC FALSE
  72. #endif
  73. /**
  74. * @brief Enables the GPT subsystem. We don't need it on most boards
  75. * in ArduPilot, so it is disabled by default
  76. */
  77. #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__)
  78. #define HAL_USE_GPT FALSE
  79. #endif
  80. /**
  81. * @brief Enables the I2C subsystem.
  82. */
  83. #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__)
  84. #define HAL_USE_I2C TRUE
  85. #endif
  86. /**
  87. * @brief Enables the I2S subsystem.
  88. */
  89. #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__)
  90. #define HAL_USE_I2S FALSE
  91. #endif
  92. /**
  93. * @brief Enables the ICU subsystem.
  94. */
  95. #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__)
  96. #define HAL_USE_ICU FALSE
  97. #endif
  98. /**
  99. * @brief Enables the MAC subsystem.
  100. */
  101. #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__)
  102. #define HAL_USE_MAC FALSE
  103. #endif
  104. /**
  105. * @brief Enables the MMC_SPI subsystem.
  106. */
  107. #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
  108. #define HAL_USE_MMC_SPI FALSE
  109. #endif
  110. /**
  111. * @brief Enables the PWM subsystem.
  112. */
  113. #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__)
  114. #define HAL_USE_PWM TRUE
  115. #endif
  116. /**
  117. * @brief Enables the RTC subsystem.
  118. */
  119. #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
  120. #define HAL_USE_RTC FALSE
  121. #endif
  122. /**
  123. * @brief Enables the SDC subsystem.
  124. */
  125. #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
  126. #define HAL_USE_SDC TRUE
  127. #endif
  128. /**
  129. * @brief Enables the SERIAL subsystem.
  130. */
  131. #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__)
  132. #define HAL_USE_SERIAL TRUE
  133. #endif
  134. /**
  135. * @brief Enables the SERIAL over USB subsystem.
  136. */
  137. #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
  138. #define HAL_USE_SERIAL_USB FALSE
  139. #endif
  140. /**
  141. * @brief Enables the SIO subsystem.
  142. */
  143. #if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
  144. #define HAL_USE_SIO FALSE
  145. #endif
  146. /**
  147. * @brief Enables the SPI subsystem.
  148. */
  149. #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
  150. #define HAL_USE_SPI TRUE
  151. #endif
  152. /**
  153. * @brief Enables the TRNG subsystem.
  154. */
  155. #if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
  156. #define HAL_USE_TRNG FALSE
  157. #endif
  158. /**
  159. * @brief Enables the UART subsystem.
  160. */
  161. #if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
  162. #define HAL_USE_UART FALSE
  163. #endif
  164. /**
  165. * @brief Enables the USB subsystem.
  166. */
  167. #if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
  168. #define HAL_USE_USB FALSE
  169. #endif
  170. /**
  171. * @brief Enables the WDG subsystem.
  172. */
  173. #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__)
  174. #define HAL_USE_WDG FALSE
  175. #endif
  176. /**
  177. * @brief Enables the WSPI subsystem.
  178. */
  179. #if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
  180. #define HAL_USE_WSPI FALSE
  181. #endif
  182. /*===========================================================================*/
  183. /* PAL driver related settings. */
  184. /*===========================================================================*/
  185. /**
  186. * @brief Enables synchronous APIs.
  187. * @note Disabling this option saves both code and data space.
  188. */
  189. #if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
  190. #define PAL_USE_CALLBACKS TRUE
  191. #endif
  192. /**
  193. * @brief Enables synchronous APIs.
  194. * @note Disabling this option saves both code and data space.
  195. */
  196. #if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
  197. #define PAL_USE_WAIT FALSE
  198. #endif
  199. /*===========================================================================*/
  200. /* ADC driver related settings. */
  201. /*===========================================================================*/
  202. /**
  203. * @brief Enables synchronous APIs.
  204. * @note Disabling this option saves both code and data space.
  205. */
  206. #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__)
  207. #define ADC_USE_WAIT TRUE
  208. #endif
  209. /**
  210. * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs.
  211. * @note Disabling this option saves both code and data space.
  212. */
  213. #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  214. #define ADC_USE_MUTUAL_EXCLUSION FALSE
  215. #endif
  216. /*===========================================================================*/
  217. /* CAN driver related settings. */
  218. /*===========================================================================*/
  219. /**
  220. * @brief Sleep mode related APIs inclusion switch.
  221. */
  222. #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__)
  223. #define CAN_USE_SLEEP_MODE TRUE
  224. #endif
  225. /**
  226. * @brief Enforces the driver to use direct callbacks rather than OSAL events.
  227. */
  228. #if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
  229. #define CAN_ENFORCE_USE_CALLBACKS FALSE
  230. #endif
  231. /*===========================================================================*/
  232. /* CRY driver related settings. */
  233. /*===========================================================================*/
  234. /**
  235. * @brief Enables the SW fall-back of the cryptographic driver.
  236. * @details When enabled, this option, activates a fall-back software
  237. * implementation for algorithms not supported by the underlying
  238. * hardware.
  239. * @note Fall-back implementations may not be present for all algorithms.
  240. */
  241. #if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
  242. #define HAL_CRY_USE_FALLBACK FALSE
  243. #endif
  244. /**
  245. * @brief Makes the driver forcibly use the fall-back implementations.
  246. */
  247. #if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
  248. #define HAL_CRY_ENFORCE_FALLBACK FALSE
  249. #endif
  250. /*===========================================================================*/
  251. /* DAC driver related settings. */
  252. /*===========================================================================*/
  253. /**
  254. * @brief Enables synchronous APIs.
  255. * @note Disabling this option saves both code and data space.
  256. */
  257. #if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
  258. #define DAC_USE_WAIT TRUE
  259. #endif
  260. /**
  261. * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
  262. * @note Disabling this option saves both code and data space.
  263. */
  264. #if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  265. #define DAC_USE_MUTUAL_EXCLUSION TRUE
  266. #endif
  267. /*===========================================================================*/
  268. /* I2C driver related settings. */
  269. /*===========================================================================*/
  270. /**
  271. * @brief Enables the mutual exclusion APIs on the I2C bus.
  272. */
  273. #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  274. #define I2C_USE_MUTUAL_EXCLUSION TRUE
  275. #endif
  276. /*===========================================================================*/
  277. /* MAC driver related settings. */
  278. /*===========================================================================*/
  279. /**
  280. * @brief Enables the zero-copy API.
  281. */
  282. #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
  283. #define MAC_USE_ZERO_COPY FALSE
  284. #endif
  285. /**
  286. * @brief Enables an event sources for incoming packets.
  287. */
  288. #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__)
  289. #define MAC_USE_EVENTS TRUE
  290. #endif
  291. /*===========================================================================*/
  292. /* MMC_SPI driver related settings. */
  293. /*===========================================================================*/
  294. /**
  295. * @brief Delays insertions.
  296. * @details If enabled this options inserts delays into the MMC waiting
  297. * routines releasing some extra CPU time for the threads with
  298. * lower priority, this may slow down the driver a bit however.
  299. * This option is recommended also if the SPI driver does not
  300. * use a DMA channel and heavily loads the CPU.
  301. */
  302. #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__)
  303. #define MMC_NICE_WAITING TRUE
  304. #endif
  305. /*===========================================================================*/
  306. /* SDC driver related settings. */
  307. /*===========================================================================*/
  308. /**
  309. * @brief Number of initialization attempts before rejecting the card.
  310. * @note Attempts are performed at 10mS intervals.
  311. */
  312. #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__)
  313. #define SDC_INIT_RETRY 100
  314. #endif
  315. /**
  316. * @brief Include support for MMC cards.
  317. * @note MMC support is not yet implemented so this option must be kept
  318. * at @p FALSE.
  319. */
  320. #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__)
  321. #define SDC_MMC_SUPPORT FALSE
  322. #endif
  323. /**
  324. * @brief Delays insertions.
  325. * @details If enabled this options inserts delays into the MMC waiting
  326. * routines releasing some extra CPU time for the threads with
  327. * lower priority, this may slow down the driver a bit however.
  328. */
  329. #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__)
  330. #define SDC_NICE_WAITING TRUE
  331. #endif
  332. /**
  333. * @brief OCR initialization constant for V20 cards.
  334. */
  335. #if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
  336. #define SDC_INIT_OCR_V20 0x50FF8000U
  337. #endif
  338. /**
  339. * @brief OCR initialization constant for non-V20 cards.
  340. */
  341. #if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
  342. #define SDC_INIT_OCR 0x80100000U
  343. #endif
  344. /*===========================================================================*/
  345. /* SERIAL driver related settings. */
  346. /*===========================================================================*/
  347. /**
  348. * @brief Default bit rate.
  349. * @details Configuration parameter, this is the baud rate selected for the
  350. * default configuration.
  351. */
  352. #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
  353. #define SERIAL_DEFAULT_BITRATE 38400
  354. #endif
  355. /**
  356. * @brief Serial buffers size.
  357. * @details Configuration parameter, you can change the depth of the queue
  358. * buffers depending on the requirements of your application.
  359. * @note The default is 16 bytes for both the transmission and receive
  360. * buffers.
  361. */
  362. #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
  363. #define SERIAL_BUFFERS_SIZE 512
  364. #endif
  365. /*===========================================================================*/
  366. /* SERIAL_USB driver related setting. */
  367. /*===========================================================================*/
  368. /**
  369. * @brief Serial over USB buffers size.
  370. * @details Configuration parameter, the buffer size must be a multiple of
  371. * the USB data endpoint maximum packet size.
  372. * @note The default is 256 bytes for both the transmission and receive
  373. * buffers.
  374. */
  375. #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
  376. #define SERIAL_USB_BUFFERS_SIZE 256
  377. #endif
  378. /**
  379. * @brief Serial over USB number of buffers.
  380. * @note The default is 2 buffers.
  381. */
  382. #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
  383. #define SERIAL_USB_BUFFERS_NUMBER 2
  384. #endif
  385. /*===========================================================================*/
  386. /* SPI driver related settings. */
  387. /*===========================================================================*/
  388. /**
  389. * @brief Enables synchronous APIs.
  390. * @note Disabling this option saves both code and data space.
  391. */
  392. #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
  393. #define SPI_USE_WAIT TRUE
  394. #endif
  395. /**
  396. * @brief Enables circular transfers APIs.
  397. * @note Disabling this option saves both code and data space.
  398. */
  399. #if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
  400. #define SPI_USE_CIRCULAR FALSE
  401. #endif
  402. /**
  403. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
  404. * @note Disabling this option saves both code and data space.
  405. */
  406. #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  407. #define SPI_USE_MUTUAL_EXCLUSION TRUE
  408. #endif
  409. /**
  410. * @brief Handling method for SPI CS line.
  411. * @note Disabling this option saves both code and data space.
  412. */
  413. #if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
  414. #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
  415. #endif
  416. /*===========================================================================*/
  417. /* UART driver related settings. */
  418. /*===========================================================================*/
  419. /**
  420. * @brief Enables synchronous APIs.
  421. * @note Disabling this option saves both code and data space.
  422. */
  423. #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
  424. #define UART_USE_WAIT FALSE
  425. #endif
  426. /**
  427. * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
  428. * @note Disabling this option saves both code and data space.
  429. */
  430. #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  431. #define UART_USE_MUTUAL_EXCLUSION FALSE
  432. #endif
  433. /*===========================================================================*/
  434. /* USB driver related settings. */
  435. /*===========================================================================*/
  436. /**
  437. * @brief Enables synchronous APIs.
  438. * @note Disabling this option saves both code and data space.
  439. */
  440. #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__)
  441. #define USB_USE_WAIT FALSE
  442. #endif
  443. /*===========================================================================*/
  444. /* WSPI driver related settings. */
  445. /*===========================================================================*/
  446. /**
  447. * @brief Enables synchronous APIs.
  448. * @note Disabling this option saves both code and data space.
  449. */
  450. #if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
  451. #define WSPI_USE_WAIT TRUE
  452. #endif
  453. /**
  454. * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
  455. * @note Disabling this option saves both code and data space.
  456. */
  457. #if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
  458. #define WSPI_USE_MUTUAL_EXCLUSION TRUE
  459. #endif
  460. /** @} */