PD Buddy Sink Firmware
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

halconf.h 17KB

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