stm32_registry.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 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 STM32L1xx/stm32_registry.h
  15. * @brief STM32L1xx capabilities registry.
  16. *
  17. * @addtogroup HAL
  18. * @{
  19. */
  20. #ifndef STM32_REGISTRY_H
  21. #define STM32_REGISTRY_H
  22. #if defined(STM32L100xB) || defined(STM32L151xB) || defined(STM32L152xB)
  23. #define STM32L1XX_PROD_CAT 1
  24. #elif defined(STM32L100xBA) || defined(STM32L151xBA) || defined(STM32L152xBA)
  25. #define STM32L1XX_PROD_CAT 2
  26. #elif defined(STM32L100xC) || defined(STM32L151xC) || \
  27. defined(STM32L151xCA) || defined(STM32L152xC) || \
  28. defined(STM32L152xCA) || defined(STM32L162xC) || \
  29. defined(STM32L162xCA)
  30. #define STM32L1XX_PROD_CAT 3
  31. #elif defined(STM32L151xD) || defined(STM32L152xD) || \
  32. defined(STM32L162xD)
  33. #define STM32L1XX_PROD_CAT 4
  34. #elif defined(STM32L151xE) || defined (STM32L152xE) || \
  35. defined(STM32L162xE)
  36. #define STM32L1XX_PROD_CAT 5
  37. #elif defined(STM32L151xDX) || defined (STM32L152xDX) || \
  38. defined(STM32L162xDX)
  39. #define STM32L1XX_PROD_CAT 6
  40. #else
  41. #error "STM32L1xx device not specified"
  42. #endif
  43. /*===========================================================================*/
  44. /* Platform capabilities. */
  45. /*===========================================================================*/
  46. /**
  47. * @name STM32L1xx capabilities
  48. * @{
  49. */
  50. /* ADC attributes.*/
  51. #define STM32_HAS_ADC1 TRUE
  52. #define STM32_HAS_ADC2 FALSE
  53. #define STM32_HAS_ADC3 FALSE
  54. #define STM32_HAS_ADC4 FALSE
  55. /* CAN attributes.*/
  56. #define STM32_HAS_CAN1 FALSE
  57. #define STM32_HAS_CAN2 FALSE
  58. #define STM32_HAS_CAN3 FALSE
  59. /* DAC attributes.*/
  60. #define STM32_HAS_DAC1_CH1 TRUE
  61. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  62. #define STM32_HAS_DAC1_CH2 TRUE
  63. #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  64. #define STM32_HAS_DAC2_CH1 FALSE
  65. #define STM32_HAS_DAC2_CH2 FALSE
  66. /* DMA attributes.*/
  67. #define STM32_ADVANCED_DMA FALSE
  68. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  69. #define STM32_DMA_SUPPORTS_CSELR FALSE
  70. #define STM32_DMA1_NUM_CHANNELS 7
  71. #define STM32_DMA1_CH1_HANDLER Vector6C
  72. #define STM32_DMA1_CH2_HANDLER Vector70
  73. #define STM32_DMA1_CH3_HANDLER Vector74
  74. #define STM32_DMA1_CH4_HANDLER Vector78
  75. #define STM32_DMA1_CH5_HANDLER Vector7C
  76. #define STM32_DMA1_CH6_HANDLER Vector80
  77. #define STM32_DMA1_CH7_HANDLER Vector84
  78. #define STM32_DMA1_CH1_NUMBER 11
  79. #define STM32_DMA1_CH2_NUMBER 12
  80. #define STM32_DMA1_CH3_NUMBER 13
  81. #define STM32_DMA1_CH4_NUMBER 14
  82. #define STM32_DMA1_CH5_NUMBER 15
  83. #define STM32_DMA1_CH6_NUMBER 16
  84. #define STM32_DMA1_CH7_NUMBER 17
  85. #if (STM32L1XX_PROD_CAT == 1) || (STM32L1XX_PROD_CAT == 2) || \
  86. defined(__DOXYGEN__)
  87. #define STM32_DMA2_NUM_CHANNELS 0
  88. #else
  89. #define STM32_DMA2_NUM_CHANNELS 5
  90. #define STM32_DMA2_CH1_HANDLER Vector108
  91. #define STM32_DMA2_CH2_HANDLER Vector10C
  92. #define STM32_DMA2_CH3_HANDLER Vector110
  93. #define STM32_DMA2_CH4_HANDLER Vector114
  94. #define STM32_DMA2_CH5_HANDLER Vector118
  95. #define STM32_DMA2_CH1_NUMBER 50
  96. #define STM32_DMA2_CH2_NUMBER 51
  97. #define STM32_DMA2_CH3_NUMBER 52
  98. #define STM32_DMA2_CH4_NUMBER 53
  99. #define STM32_DMA2_CH5_NUMBER 54
  100. #endif
  101. /* ETH attributes.*/
  102. #define STM32_HAS_ETH FALSE
  103. /* EXTI attributes.*/
  104. #if (STM32L1XX_PROD_CAT == 1) || (STM32L1XX_PROD_CAT == 2) || \
  105. defined(__DOXYGEN__)
  106. #define STM32_EXTI_NUM_LINES 23
  107. #else
  108. #define STM32_EXTI_NUM_LINES 24
  109. #endif
  110. #define STM32_EXTI_IMR_MASK 0x00000000U
  111. #if (STM32L1XX_PROD_CAT == 1) || (STM32L1XX_PROD_CAT == 2) || \
  112. (STM32L1XX_PROD_CAT == 3) || defined(__DOXYGEN__)
  113. #define STM32_HAS_GPIOA TRUE
  114. #define STM32_HAS_GPIOB TRUE
  115. #define STM32_HAS_GPIOC TRUE
  116. #define STM32_HAS_GPIOD TRUE
  117. #define STM32_HAS_GPIOE TRUE
  118. #define STM32_HAS_GPIOF FALSE
  119. #define STM32_HAS_GPIOG FALSE
  120. #define STM32_HAS_GPIOH TRUE
  121. #define STM32_HAS_GPIOI FALSE
  122. #define STM32_HAS_GPIOJ FALSE
  123. #define STM32_HAS_GPIOK FALSE
  124. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  125. RCC_AHBENR_GPIOBEN | \
  126. RCC_AHBENR_GPIOCEN | \
  127. RCC_AHBENR_GPIODEN | \
  128. RCC_AHBENR_GPIOEEN | \
  129. RCC_AHBENR_GPIOHEN)
  130. #else
  131. #define STM32_HAS_GPIOA TRUE
  132. #define STM32_HAS_GPIOB TRUE
  133. #define STM32_HAS_GPIOC TRUE
  134. #define STM32_HAS_GPIOD TRUE
  135. #define STM32_HAS_GPIOE TRUE
  136. #define STM32_HAS_GPIOF TRUE
  137. #define STM32_HAS_GPIOG TRUE
  138. #define STM32_HAS_GPIOH TRUE
  139. #define STM32_HAS_GPIOI FALSE
  140. #define STM32_HAS_GPIOJ FALSE
  141. #define STM32_HAS_GPIOK FALSE
  142. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  143. RCC_AHBENR_GPIOBEN | \
  144. RCC_AHBENR_GPIOCEN | \
  145. RCC_AHBENR_GPIODEN | \
  146. RCC_AHBENR_GPIOEEN | \
  147. RCC_AHBENR_GPIOFEN | \
  148. RCC_AHBENR_GPIOGEN | \
  149. RCC_AHBENR_GPIOHEN)
  150. #endif
  151. /* I2C attributes.*/
  152. #define STM32_HAS_I2C1 TRUE
  153. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  154. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  155. #define STM32_HAS_I2C2 TRUE
  156. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  157. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  158. #define STM32_HAS_I2C3 FALSE
  159. #define STM32_HAS_I2C4 FALSE
  160. /* QUADSPI attributes.*/
  161. #define STM32_HAS_QUADSPI1 FALSE
  162. /* RTC attributes.*/
  163. #define STM32_HAS_RTC TRUE
  164. #if (STM32L1XX_PROD_CAT == 1) || defined(__DOXYGEN__)
  165. #define STM32_RTC_HAS_SUBSECONDS FALSE
  166. #else
  167. #define STM32_RTC_HAS_SUBSECONDS TRUE
  168. #endif
  169. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  170. #define STM32_RTC_NUM_ALARMS 2
  171. #define STM32_RTC_HAS_INTERRUPTS FALSE
  172. /* SDIO attributes.*/
  173. #define STM32_HAS_SDIO TRUE
  174. /* SPI attributes.*/
  175. #define STM32_HAS_SPI1 TRUE
  176. #define STM32_SPI1_SUPPORTS_I2S FALSE
  177. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  178. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  179. #define STM32_HAS_SPI2 TRUE
  180. #define STM32_SPI2_SUPPORTS_I2S TRUE
  181. #define STM32_SPI2_I2S_FULLDUPLEX FALSE
  182. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  183. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  184. #if (STM32L1XX_PROD_CAT == 1) || (STM32L1XX_PROD_CAT == 2) || \
  185. defined(__DOXYGEN__)
  186. #define STM32_HAS_SPI3 FALSE
  187. #else
  188. #define STM32_HAS_SPI3 TRUE
  189. #define STM32_SPI3_SUPPORTS_I2S TRUE
  190. #define STM32_SPI3_I2S_FULLDUPLEX FALSE
  191. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
  192. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
  193. #endif
  194. #define STM32_HAS_SPI4 FALSE
  195. #define STM32_HAS_SPI5 FALSE
  196. #define STM32_HAS_SPI6 FALSE
  197. /* TIM attributes.*/
  198. #define STM32_TIM_MAX_CHANNELS 4
  199. #define STM32_HAS_TIM2 TRUE
  200. #define STM32_TIM2_IS_32BITS FALSE
  201. #define STM32_TIM2_CHANNELS 4
  202. #define STM32_HAS_TIM3 TRUE
  203. #define STM32_TIM3_IS_32BITS FALSE
  204. #define STM32_TIM3_CHANNELS 4
  205. #define STM32_HAS_TIM4 TRUE
  206. #define STM32_TIM4_IS_32BITS FALSE
  207. #define STM32_TIM4_CHANNELS 4
  208. #if (STM32L1XX_PROD_CAT == 1) || (STM32L1XX_PROD_CAT == 2) || \
  209. defined(__DOXYGEN__)
  210. #define STM32_HAS_TIM5 FALSE
  211. #else
  212. #define STM32_HAS_TIM5 TRUE
  213. #define STM32_TIM5_IS_32BITS TRUE
  214. #define STM32_TIM5_CHANNELS 4
  215. #endif
  216. #define STM32_HAS_TIM6 TRUE
  217. #define STM32_TIM6_IS_32BITS FALSE
  218. #define STM32_TIM6_CHANNELS 0
  219. #define STM32_HAS_TIM7 TRUE
  220. #define STM32_TIM7_IS_32BITS FALSE
  221. #define STM32_TIM7_CHANNELS 0
  222. #define STM32_HAS_TIM9 TRUE
  223. #define STM32_TIM9_IS_32BITS FALSE
  224. #define STM32_TIM9_CHANNELS 2
  225. #define STM32_HAS_TIM10 TRUE
  226. #define STM32_TIM10_IS_32BITS FALSE
  227. #define STM32_TIM10_CHANNELS 2
  228. #define STM32_HAS_TIM11 TRUE
  229. #define STM32_TIM11_IS_32BITS FALSE
  230. #define STM32_TIM11_CHANNELS 2
  231. #define STM32_HAS_TIM1 FALSE
  232. #define STM32_HAS_TIM8 FALSE
  233. #define STM32_HAS_TIM12 FALSE
  234. #define STM32_HAS_TIM13 FALSE
  235. #define STM32_HAS_TIM14 FALSE
  236. #define STM32_HAS_TIM15 FALSE
  237. #define STM32_HAS_TIM16 FALSE
  238. #define STM32_HAS_TIM17 FALSE
  239. #define STM32_HAS_TIM18 FALSE
  240. #define STM32_HAS_TIM19 FALSE
  241. #define STM32_HAS_TIM20 FALSE
  242. #define STM32_HAS_TIM21 FALSE
  243. #define STM32_HAS_TIM22 FALSE
  244. /* USART attributes.*/
  245. #define STM32_HAS_USART1 TRUE
  246. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  247. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  248. #define STM32_HAS_USART2 TRUE
  249. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  250. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  251. #define STM32_HAS_USART3 TRUE
  252. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  253. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  254. #if (STM32L1XX_PROD_CAT == 1) || (STM32L1XX_PROD_CAT == 2) || \
  255. (STM32L1XX_PROD_CAT == 3) || defined(__DOXYGEN__)
  256. #define STM32_HAS_UART4 FALSE
  257. #define STM32_HAS_UART5 FALSE
  258. #else
  259. #define STM32_HAS_UART4 TRUE
  260. #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  261. #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
  262. #define STM32_HAS_UART5 TRUE
  263. #define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
  264. #define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
  265. #endif
  266. #define STM32_HAS_USART6 FALSE
  267. #define STM32_HAS_UART7 FALSE
  268. #define STM32_HAS_UART8 FALSE
  269. #define STM32_HAS_LPUART1 FALSE
  270. /* USB attributes.*/
  271. #define STM32_HAS_USB TRUE
  272. #define STM32_USB_ACCESS_SCHEME_2x16 FALSE
  273. #define STM32_USB_PMA_SIZE 512
  274. #define STM32_USB_HAS_BCDR FALSE
  275. #define STM32_HAS_OTG1 FALSE
  276. #define STM32_HAS_OTG2 FALSE
  277. /* IWDG attributes.*/
  278. #define STM32_HAS_IWDG TRUE
  279. #define STM32_IWDG_IS_WINDOWED FALSE
  280. /* LTDC attributes.*/
  281. #define STM32_HAS_LTDC FALSE
  282. /* DMA2D attributes.*/
  283. #define STM32_HAS_DMA2D FALSE
  284. /* FSMC attributes.*/
  285. #define STM32_HAS_FSMC FALSE
  286. /* CRC attributes.*/
  287. #define STM32_HAS_CRC TRUE
  288. #define STM32_CRC_PROGRAMMABLE FALSE
  289. /** @} */
  290. #endif /* STM32_REGISTRY_H */
  291. /** @} */