halconf.h 17 KB

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