stm32_registry.h 96 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230
  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 STM32F0xx/stm32_registry.h
  15. * @brief STM32F0xx capabilities registry.
  16. *
  17. * @addtogroup HAL
  18. * @{
  19. */
  20. #ifndef STM32_REGISTRY_H
  21. #define STM32_REGISTRY_H
  22. #if !defined(STM32F0XX) || defined(__DOXYGEN__)
  23. #define STM32F0XX
  24. #endif
  25. /*===========================================================================*/
  26. /* Platform capabilities. */
  27. /*===========================================================================*/
  28. /**
  29. * @name STM32F0xx capabilities
  30. * @{
  31. */
  32. /*===========================================================================*/
  33. /* Common. */
  34. /*===========================================================================*/
  35. /* RNG attributes.*/
  36. #define STM32_HAS_RNG1 FALSE
  37. /*===========================================================================*/
  38. /* STM32F030x4, STM32F030x6, STM32F030x8, STM32F030xC. */
  39. /*===========================================================================*/
  40. #if defined(STM32F030x4) || defined(STM32F030x6) || \
  41. defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__)
  42. /* Common identifier of all STM32F030 devices.*/
  43. #define STM32F030
  44. /* RCC attributes. */
  45. #define STM32_HAS_HSI48 FALSE
  46. #if defined(STM32F030xC) || defined(__DOXYGEN__)
  47. #define STM32_HAS_HSI_PREDIV TRUE
  48. #else
  49. #define STM32_HAS_HSI_PREDIV FALSE
  50. #endif
  51. #define STM32_HAS_MCO_PREDIV TRUE
  52. /* ADC attributes.*/
  53. #define STM32_HAS_ADC1 TRUE
  54. #define STM32_ADC_SUPPORTS_PRESCALER FALSE
  55. #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE
  56. #define STM32_ADC1_IRQ_SHARED_WITH_EXTI FALSE
  57. #define STM32_ADC1_HANDLER Vector70
  58. #define STM32_ADC1_NUMBER 12
  59. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  60. STM32_DMA_STREAM_ID_MSK(1, 2))
  61. #define STM32_ADC1_DMA_CHN 0x00000011
  62. #define STM32_HAS_ADC2 FALSE
  63. #define STM32_HAS_ADC3 FALSE
  64. #define STM32_HAS_ADC4 FALSE
  65. /* CAN attributes.*/
  66. #define STM32_HAS_CAN1 FALSE
  67. #define STM32_HAS_CAN2 FALSE
  68. #define STM32_HAS_CAN3 FALSE
  69. /* DAC attributes.*/
  70. #define STM32_HAS_DAC1_CH1 FALSE
  71. #define STM32_HAS_DAC1_CH2 FALSE
  72. #define STM32_HAS_DAC2_CH1 FALSE
  73. #define STM32_HAS_DAC2_CH2 FALSE
  74. /* DMA attributes.*/
  75. #define STM32_ADVANCED_DMA TRUE
  76. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  77. #if defined(STM32F030xC) || defined(__DOXYGEN__)
  78. #define STM32_DMA_SUPPORTS_CSELR TRUE
  79. #else
  80. #define STM32_DMA_SUPPORTS_CSELR FALSE
  81. #endif
  82. #define STM32_DMA1_NUM_CHANNELS 5
  83. #define STM32_DMA2_NUM_CHANNELS 0
  84. #define STM32_DMA1_CH1_HANDLER Vector64
  85. #define STM32_DMA1_CH23_HANDLER Vector68
  86. #define STM32_DMA1_CH4567_HANDLER Vector6C
  87. #define STM32_DMA1_CH1_NUMBER 9
  88. #define STM32_DMA1_CH23_NUMBER 10
  89. #define STM32_DMA1_CH4567_NUMBER 11
  90. #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER
  91. #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER
  92. #define DMA1_CH2_CMASK 0x00000006U
  93. #define DMA1_CH3_CMASK 0x00000006U
  94. #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER
  95. #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER
  96. #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER
  97. #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER
  98. #define DMA1_CH4_CMASK 0x00000078U
  99. #define DMA1_CH5_CMASK 0x00000078U
  100. #define DMA1_CH6_CMASK 0x00000078U
  101. #define DMA1_CH7_CMASK 0x00000078U
  102. /* ETH attributes.*/
  103. #define STM32_HAS_ETH FALSE
  104. /* EXTI attributes.*/
  105. #define STM32_EXTI_NUM_LINES 20
  106. #define STM32_EXTI_IMR1_MASK 0xFFF50000U
  107. /* GPIO attributes.*/
  108. #define STM32_HAS_GPIOA TRUE
  109. #define STM32_HAS_GPIOB TRUE
  110. #if !defined(STM32F030x4)
  111. #define STM32_HAS_GPIOC TRUE
  112. #define STM32_HAS_GPIOD TRUE
  113. #else
  114. #define STM32_HAS_GPIOC FALSE
  115. #define STM32_HAS_GPIOD FALSE
  116. #endif
  117. #define STM32_HAS_GPIOE FALSE
  118. #define STM32_HAS_GPIOF TRUE
  119. #define STM32_HAS_GPIOG FALSE
  120. #define STM32_HAS_GPIOH FALSE
  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_GPIOFEN)
  129. /* I2C attributes.*/
  130. #define STM32_HAS_I2C1 TRUE
  131. #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  132. #define STM32_I2C1_RX_DMA_CHN 0x00000200
  133. #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  134. #define STM32_I2C1_TX_DMA_CHN 0x00000020
  135. #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__)
  136. #define STM32_HAS_I2C2 TRUE
  137. #define STM32_I2C2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  138. #define STM32_I2C2_RX_DMA_CHN 0x00020000
  139. #define STM32_I2C2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  140. #define STM32_I2C2_TX_DMA_CHN 0x00002000
  141. #else
  142. #define STM32_HAS_I2C2 FALSE
  143. #endif
  144. #define STM32_HAS_I2C3 FALSE
  145. #define STM32_HAS_I2C4 FALSE
  146. /* QUADSPI attributes.*/
  147. #define STM32_HAS_QUADSPI1 FALSE
  148. /* RTC attributes.*/
  149. #define STM32_HAS_RTC TRUE
  150. #define STM32_RTC_HAS_SUBSECONDS TRUE
  151. #if defined (STM32F030xC)
  152. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  153. #else
  154. #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE
  155. #endif
  156. #define STM32_RTC_NUM_ALARMS 1
  157. #define STM32_RTC_STORAGE_SIZE 0
  158. #define STM32_RTC_COMMON_HANDLER Vector48
  159. #define STM32_RTC_COMMON_NUMBER 2
  160. #define STM32_RTC_ALARM_EXTI 17
  161. #define STM32_RTC_TAMP_STAMP_EXTI 19
  162. #define STM32_RTC_WKUP_EXTI 20
  163. #define STM32_RTC_IRQ_ENABLE() \
  164. nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY)
  165. /* SDIO attributes.*/
  166. #define STM32_HAS_SDIO FALSE
  167. /* SPI attributes.*/
  168. #define STM32_HAS_SPI1 TRUE
  169. #define STM32_SPI1_SUPPORTS_I2S FALSE
  170. #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  171. #define STM32_SPI1_RX_DMA_CHN 0x00000030
  172. #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  173. #define STM32_SPI1_TX_DMA_CHN 0x00000300
  174. #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__)
  175. #define STM32_HAS_SPI2 TRUE
  176. #define STM32_SPI2_SUPPORTS_I2S FALSE
  177. #define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  178. #define STM32_SPI2_RX_DMA_CHN 0x00003000
  179. #define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  180. #define STM32_SPI2_TX_DMA_CHN 0x00030000
  181. #else
  182. #define STM32_HAS_SPI2 FALSE
  183. #endif
  184. #define STM32_HAS_SPI3 FALSE
  185. #define STM32_HAS_SPI4 FALSE
  186. #define STM32_HAS_SPI5 FALSE
  187. #define STM32_HAS_SPI6 FALSE
  188. /* TIM attributes.*/
  189. #define STM32_TIM_MAX_CHANNELS 4
  190. #define STM32_HAS_TIM1 TRUE
  191. #define STM32_TIM1_IS_32BITS FALSE
  192. #define STM32_TIM1_CHANNELS 4
  193. #define STM32_HAS_TIM3 TRUE
  194. #define STM32_TIM3_IS_32BITS FALSE
  195. #define STM32_TIM3_CHANNELS 4
  196. #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__)
  197. #define STM32_HAS_TIM6 TRUE
  198. #define STM32_TIM6_IS_32BITS FALSE
  199. #define STM32_TIM6_CHANNELS 0
  200. #else
  201. #define STM32_HAS_TIM6 FALSE
  202. #endif
  203. #if defined(STM32F030xC)
  204. #define STM32_HAS_TIM7 TRUE
  205. #define STM32_TIM7_IS_32BITS FALSE
  206. #define STM32_TIM7_CHANNELS 0
  207. #else
  208. #define STM32_HAS_TIM7 FALSE
  209. #endif
  210. #define STM32_HAS_TIM14 TRUE
  211. #define STM32_TIM14_IS_32BITS FALSE
  212. #define STM32_TIM14_CHANNELS 1
  213. #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__)
  214. #define STM32_HAS_TIM15 TRUE
  215. #define STM32_TIM15_IS_32BITS FALSE
  216. #define STM32_TIM15_CHANNELS 2
  217. #else
  218. #define STM32_HAS_TIM15 FALSE
  219. #endif
  220. #define STM32_HAS_TIM16 TRUE
  221. #define STM32_TIM16_IS_32BITS FALSE
  222. #define STM32_TIM16_CHANNELS 1
  223. #define STM32_HAS_TIM17 TRUE
  224. #define STM32_TIM17_IS_32BITS FALSE
  225. #define STM32_TIM17_CHANNELS 1
  226. #define STM32_HAS_TIM2 FALSE
  227. #define STM32_HAS_TIM4 FALSE
  228. #define STM32_HAS_TIM5 FALSE
  229. #define STM32_HAS_TIM8 FALSE
  230. #define STM32_HAS_TIM9 FALSE
  231. #define STM32_HAS_TIM10 FALSE
  232. #define STM32_HAS_TIM11 FALSE
  233. #define STM32_HAS_TIM12 FALSE
  234. #define STM32_HAS_TIM13 FALSE
  235. #define STM32_HAS_TIM18 FALSE
  236. #define STM32_HAS_TIM19 FALSE
  237. #define STM32_HAS_TIM20 FALSE
  238. #define STM32_HAS_TIM21 FALSE
  239. #define STM32_HAS_TIM22 FALSE
  240. /* USART attributes.*/
  241. #define STM32_HAS_USART1 TRUE
  242. #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  243. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  244. STM32_DMA_STREAM_ID_MSK(1, 5))
  245. #define STM32_USART1_RX_DMA_CHN 0x00080808
  246. #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  247. STM32_DMA_STREAM_ID_MSK(1, 4))
  248. #define STM32_USART1_TX_DMA_CHN 0x00008080
  249. #if defined(STM32F030x8) || defined(STM32F030xC) || defined(__DOXYGEN__)
  250. #define STM32_HAS_USART2 TRUE
  251. #define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  252. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  253. STM32_DMA_STREAM_ID_MSK(1, 5))
  254. #define STM32_USART2_RX_DMA_CHN 0x00090909
  255. #define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  256. STM32_DMA_STREAM_ID_MSK(1, 4))
  257. #define STM32_USART2_TX_DMA_CHN 0x00009090
  258. #else
  259. #define STM32_HAS_USART2 FALSE
  260. #endif
  261. #if defined(STM32F030xC) || defined(__DOXYGEN__)
  262. #define STM32_HAS_USART3 TRUE
  263. #define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  264. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  265. STM32_DMA_STREAM_ID_MSK(1, 5))
  266. #define STM32_USART3_RX_DMA_CHN 0x000A0A0A
  267. #define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  268. STM32_DMA_STREAM_ID_MSK(1, 4))
  269. #define STM32_USART3_TX_DMA_CHN 0x0000A0A0
  270. #define STM32_HAS_UART4 TRUE
  271. #define STM32_UART4_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  272. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  273. STM32_DMA_STREAM_ID_MSK(1, 5))
  274. #define STM32_UART4_RX_DMA_CHN 0x000B0B0B
  275. #define STM32_UART4_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  276. STM32_DMA_STREAM_ID_MSK(1, 4))
  277. #define STM32_UART4_TX_DMA_CHN 0x0000B0B0
  278. #define STM32_HAS_UART5 TRUE
  279. #define STM32_UART5_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  280. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  281. STM32_DMA_STREAM_ID_MSK(1, 5))
  282. #define STM32_UART5_RX_DMA_CHN 0x000C0C0C
  283. #define STM32_UART5_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  284. STM32_DMA_STREAM_ID_MSK(1, 4))
  285. #define STM32_UART5_TX_DMA_CHN 0x0000C0C0
  286. #define STM32_HAS_USART6 TRUE
  287. #define STM32_USART6_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  288. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  289. STM32_DMA_STREAM_ID_MSK(1, 5))
  290. #define STM32_USART6_RX_DMA_CHN 0x000D0D0D
  291. #define STM32_USART6_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  292. STM32_DMA_STREAM_ID_MSK(1, 4))
  293. #define STM32_USART6_TX_DMA_CHN 0x0000D0D0
  294. #define STM32_HAS_UART7 FALSE
  295. #define STM32_HAS_UART8 FALSE
  296. #define STM32_HAS_LPUART1 FALSE
  297. #else
  298. #define STM32_HAS_USART3 FALSE
  299. #define STM32_HAS_UART4 FALSE
  300. #define STM32_HAS_UART5 FALSE
  301. #define STM32_HAS_USART6 FALSE
  302. #define STM32_HAS_UART7 FALSE
  303. #define STM32_HAS_UART8 FALSE
  304. #define STM32_HAS_LPUART1 FALSE
  305. #endif
  306. /* USB attributes.*/
  307. #define STM32_HAS_USB FALSE
  308. #define STM32_HAS_OTG1 FALSE
  309. #define STM32_HAS_OTG2 FALSE
  310. /* IWDG attributes.*/
  311. #define STM32_HAS_IWDG TRUE
  312. #define STM32_IWDG_IS_WINDOWED TRUE
  313. /* LTDC attributes.*/
  314. #define STM32_HAS_LTDC FALSE
  315. /* DMA2D attributes.*/
  316. #define STM32_HAS_DMA2D FALSE
  317. /* FSMC attributes.*/
  318. #define STM32_HAS_FSMC FALSE
  319. /* CRC attributes.*/
  320. #define STM32_HAS_CRC TRUE
  321. #define STM32_CRC_PROGRAMMABLE FALSE
  322. /*===========================================================================*/
  323. /* STM32F031x6, STM32F038xx. */
  324. /*===========================================================================*/
  325. #elif defined(STM32F031x6) || defined(STM32F038xx)
  326. /* RCC attributes. */
  327. #define STM32_HAS_HSI48 FALSE
  328. #define STM32_HAS_HSI_PREDIV FALSE
  329. #define STM32_HAS_MCO_PREDIV TRUE
  330. /* ADC attributes.*/
  331. #define STM32_HAS_ADC1 TRUE
  332. #define STM32_ADC_SUPPORTS_PRESCALER FALSE
  333. #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE
  334. #define STM32_ADC1_IRQ_SHARED_WITH_EXTI TRUE
  335. #define STM32_ADC1_HANDLER Vector70
  336. #define STM32_ADC1_NUMBER 12
  337. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  338. STM32_DMA_STREAM_ID_MSK(1, 2))
  339. #define STM32_ADC1_DMA_CHN 0x00000000
  340. #define STM32_HAS_ADC2 FALSE
  341. #define STM32_HAS_ADC3 FALSE
  342. #define STM32_HAS_ADC4 FALSE
  343. /* CAN attributes.*/
  344. #define STM32_HAS_CAN1 FALSE
  345. #define STM32_HAS_CAN2 FALSE
  346. #define STM32_HAS_CAN3 FALSE
  347. /* DAC attributes.*/
  348. #define STM32_HAS_DAC1_CH1 FALSE
  349. #define STM32_HAS_DAC1_CH2 FALSE
  350. #define STM32_HAS_DAC2_CH1 FALSE
  351. #define STM32_HAS_DAC2_CH2 FALSE
  352. /* DMA attributes.*/
  353. #define STM32_ADVANCED_DMA TRUE
  354. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  355. #define STM32_DMA_SUPPORTS_CSELR FALSE
  356. #define STM32_DMA1_NUM_CHANNELS 5
  357. #define STM32_DMA2_NUM_CHANNELS 0
  358. #define STM32_DMA1_CH1_HANDLER Vector64
  359. #define STM32_DMA1_CH23_HANDLER Vector68
  360. #define STM32_DMA1_CH4567_HANDLER Vector6C
  361. #define STM32_DMA1_CH1_NUMBER 9
  362. #define STM32_DMA1_CH23_NUMBER 10
  363. #define STM32_DMA1_CH4567_NUMBER 11
  364. #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER
  365. #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER
  366. #define DMA1_CH2_CMASK 0x00000006U
  367. #define DMA1_CH3_CMASK 0x00000006U
  368. #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER
  369. #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER
  370. #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER
  371. #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER
  372. #define DMA1_CH4_CMASK 0x00000078U
  373. #define DMA1_CH5_CMASK 0x00000078U
  374. #define DMA1_CH6_CMASK 0x00000078U
  375. #define DMA1_CH7_CMASK 0x00000078U
  376. /* ETH attributes.*/
  377. #define STM32_HAS_ETH FALSE
  378. /* EXTI attributes.*/
  379. #define STM32_EXTI_NUM_LINES 32
  380. #define STM32_EXTI_IMR1_MASK 0x0FF40000U
  381. /* GPIO attributes.*/
  382. #define STM32_HAS_GPIOA TRUE
  383. #define STM32_HAS_GPIOB TRUE
  384. #define STM32_HAS_GPIOC TRUE
  385. #define STM32_HAS_GPIOD FALSE
  386. #define STM32_HAS_GPIOE FALSE
  387. #define STM32_HAS_GPIOF TRUE
  388. #define STM32_HAS_GPIOG FALSE
  389. #define STM32_HAS_GPIOH FALSE
  390. #define STM32_HAS_GPIOI FALSE
  391. #define STM32_HAS_GPIOJ FALSE
  392. #define STM32_HAS_GPIOK FALSE
  393. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  394. RCC_AHBENR_GPIOBEN | \
  395. RCC_AHBENR_GPIOCEN | \
  396. RCC_AHBENR_GPIOFEN)
  397. /* I2C attributes.*/
  398. #define STM32_HAS_I2C1 TRUE
  399. #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  400. #define STM32_I2C1_RX_DMA_CHN 0x00000000
  401. #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  402. #define STM32_I2C1_TX_DMA_CHN 0x00000000
  403. #define STM32_HAS_I2C2 FALSE
  404. #define STM32_HAS_I2C3 FALSE
  405. #define STM32_HAS_I2C4 FALSE
  406. /* QUADSPI attributes.*/
  407. #define STM32_HAS_QUADSPI1 FALSE
  408. /* RTC attributes.*/
  409. #define STM32_HAS_RTC TRUE
  410. #define STM32_RTC_HAS_SUBSECONDS TRUE
  411. #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE
  412. #define STM32_RTC_NUM_ALARMS 1
  413. #define STM32_RTC_STORAGE_SIZE 0
  414. #define STM32_RTC_COMMON_HANDLER Vector48
  415. #define STM32_RTC_COMMON_NUMBER 2
  416. #define STM32_RTC_ALARM_EXTI 17
  417. #define STM32_RTC_TAMP_STAMP_EXTI 19
  418. #define STM32_RTC_WKUP_EXTI 20
  419. #define STM32_RTC_IRQ_ENABLE() \
  420. nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY)
  421. /* SDIO attributes.*/
  422. #define STM32_HAS_SDIO FALSE
  423. /* SPI attributes.*/
  424. #define STM32_HAS_SPI1 TRUE
  425. #define STM32_SPI1_SUPPORTS_I2S TRUE
  426. #define STM32_SPI1_I2S_FULLDUPLEX FALSE
  427. #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  428. #define STM32_SPI1_RX_DMA_CHN 0x00000000
  429. #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  430. #define STM32_SPI1_TX_DMA_CHN 0x00000000
  431. #define STM32_HAS_SPI2 FALSE
  432. #define STM32_HAS_SPI3 FALSE
  433. #define STM32_HAS_SPI4 FALSE
  434. #define STM32_HAS_SPI5 FALSE
  435. #define STM32_HAS_SPI6 FALSE
  436. /* TIM attributes.*/
  437. #define STM32_TIM_MAX_CHANNELS 4
  438. #define STM32_HAS_TIM1 TRUE
  439. #define STM32_TIM1_IS_32BITS FALSE
  440. #define STM32_TIM1_CHANNELS 4
  441. #define STM32_HAS_TIM2 TRUE
  442. #define STM32_TIM2_IS_32BITS TRUE
  443. #define STM32_TIM2_CHANNELS 4
  444. #define STM32_HAS_TIM3 TRUE
  445. #define STM32_TIM3_IS_32BITS FALSE
  446. #define STM32_TIM3_CHANNELS 4
  447. #define STM32_HAS_TIM14 TRUE
  448. #define STM32_TIM14_IS_32BITS FALSE
  449. #define STM32_TIM14_CHANNELS 1
  450. #define STM32_HAS_TIM16 TRUE
  451. #define STM32_TIM16_IS_32BITS FALSE
  452. #define STM32_TIM16_CHANNELS 1
  453. #define STM32_HAS_TIM17 TRUE
  454. #define STM32_TIM17_IS_32BITS FALSE
  455. #define STM32_TIM17_CHANNELS 1
  456. #define STM32_HAS_TIM4 FALSE
  457. #define STM32_HAS_TIM5 FALSE
  458. #define STM32_HAS_TIM6 FALSE
  459. #define STM32_HAS_TIM7 FALSE
  460. #define STM32_HAS_TIM8 FALSE
  461. #define STM32_HAS_TIM9 FALSE
  462. #define STM32_HAS_TIM10 FALSE
  463. #define STM32_HAS_TIM11 FALSE
  464. #define STM32_HAS_TIM12 FALSE
  465. #define STM32_HAS_TIM13 FALSE
  466. #define STM32_HAS_TIM15 FALSE
  467. #define STM32_HAS_TIM18 FALSE
  468. #define STM32_HAS_TIM19 FALSE
  469. #define STM32_HAS_TIM20 FALSE
  470. #define STM32_HAS_TIM21 FALSE
  471. #define STM32_HAS_TIM22 FALSE
  472. /* USART attributes.*/
  473. #define STM32_HAS_USART1 TRUE
  474. #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  475. STM32_DMA_STREAM_ID_MSK(1, 5))
  476. #define STM32_USART1_RX_DMA_CHN 0x00000000
  477. #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  478. STM32_DMA_STREAM_ID_MSK(1, 4))
  479. #define STM32_USART1_TX_DMA_CHN 0x00000000
  480. #define STM32_HAS_USART2 FALSE
  481. #define STM32_HAS_USART3 FALSE
  482. #define STM32_HAS_UART4 FALSE
  483. #define STM32_HAS_UART5 FALSE
  484. #define STM32_HAS_USART6 FALSE
  485. #define STM32_HAS_UART7 FALSE
  486. #define STM32_HAS_UART8 FALSE
  487. #define STM32_HAS_LPUART1 FALSE
  488. /* USB attributes.*/
  489. #define STM32_HAS_USB FALSE
  490. #define STM32_HAS_OTG1 FALSE
  491. #define STM32_HAS_OTG2 FALSE
  492. /* IWDG attributes.*/
  493. #define STM32_HAS_IWDG TRUE
  494. #define STM32_IWDG_IS_WINDOWED TRUE
  495. /* LTDC attributes.*/
  496. #define STM32_HAS_LTDC FALSE
  497. /* DMA2D attributes.*/
  498. #define STM32_HAS_DMA2D FALSE
  499. /* FSMC attributes.*/
  500. #define STM32_HAS_FSMC FALSE
  501. /* CRC attributes.*/
  502. #define STM32_HAS_CRC TRUE
  503. #define STM32_CRC_PROGRAMMABLE TRUE
  504. /*===========================================================================*/
  505. /* STM32F042x6. */
  506. /*===========================================================================*/
  507. #elif defined(STM32F042x6)
  508. /* RCC attributes. */
  509. #define STM32_HAS_HSI48 TRUE
  510. #define STM32_HAS_HSI_PREDIV TRUE
  511. #define STM32_HAS_MCO_PREDIV TRUE
  512. /* ADC attributes.*/
  513. #define STM32_HAS_ADC1 TRUE
  514. #define STM32_ADC_SUPPORTS_PRESCALER FALSE
  515. #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE
  516. #define STM32_ADC1_IRQ_SHARED_WITH_EXTI TRUE
  517. #define STM32_ADC1_HANDLER Vector70
  518. #define STM32_ADC1_NUMBER 12
  519. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  520. STM32_DMA_STREAM_ID_MSK(1, 2))
  521. #define STM32_ADC1_DMA_CHN 0x00000000
  522. #define STM32_HAS_ADC2 FALSE
  523. #define STM32_HAS_ADC3 FALSE
  524. #define STM32_HAS_ADC4 FALSE
  525. /* CAN attributes.*/
  526. #define STM32_HAS_CAN1 TRUE
  527. #define STM32_HAS_CAN2 FALSE
  528. #define STM32_HAS_CAN3 FALSE
  529. #define STM32_CAN_MAX_FILTERS 14
  530. /* DAC attributes.*/
  531. #define STM32_HAS_DAC1_CH1 FALSE
  532. #define STM32_HAS_DAC1_CH2 FALSE
  533. #define STM32_HAS_DAC2_CH1 FALSE
  534. #define STM32_HAS_DAC2_CH2 FALSE
  535. /* DMA attributes.*/
  536. #define STM32_ADVANCED_DMA TRUE
  537. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  538. #define STM32_DMA_SUPPORTS_CSELR FALSE
  539. #define STM32_DMA1_NUM_CHANNELS 5
  540. #define STM32_DMA2_NUM_CHANNELS 0
  541. #define STM32_DMA1_CH1_HANDLER Vector64
  542. #define STM32_DMA1_CH23_HANDLER Vector68
  543. #define STM32_DMA1_CH4567_HANDLER Vector6C
  544. #define STM32_DMA1_CH1_NUMBER 9
  545. #define STM32_DMA1_CH23_NUMBER 10
  546. #define STM32_DMA1_CH4567_NUMBER 11
  547. #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER
  548. #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER
  549. #define DMA1_CH2_CMASK 0x00000006U
  550. #define DMA1_CH3_CMASK 0x00000006U
  551. #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER
  552. #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER
  553. #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER
  554. #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER
  555. #define DMA1_CH4_CMASK 0x00000078U
  556. #define DMA1_CH5_CMASK 0x00000078U
  557. #define DMA1_CH6_CMASK 0x00000078U
  558. #define DMA1_CH7_CMASK 0x00000078U
  559. /* ETH attributes.*/
  560. #define STM32_HAS_ETH FALSE
  561. /* EXTI attributes.*/
  562. #define STM32_EXTI_NUM_LINES 32
  563. #define STM32_EXTI_IMR1_MASK 0x7FF40000U
  564. /* GPIO attributes.*/
  565. #define STM32_HAS_GPIOA TRUE
  566. #define STM32_HAS_GPIOB TRUE
  567. #define STM32_HAS_GPIOC TRUE
  568. #define STM32_HAS_GPIOD FALSE
  569. #define STM32_HAS_GPIOE FALSE
  570. #define STM32_HAS_GPIOF TRUE
  571. #define STM32_HAS_GPIOG FALSE
  572. #define STM32_HAS_GPIOH FALSE
  573. #define STM32_HAS_GPIOI FALSE
  574. #define STM32_HAS_GPIOJ FALSE
  575. #define STM32_HAS_GPIOK FALSE
  576. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  577. RCC_AHBENR_GPIOBEN | \
  578. RCC_AHBENR_GPIOCEN | \
  579. RCC_AHBENR_GPIOFEN)
  580. /* I2C attributes.*/
  581. #define STM32_HAS_I2C1 TRUE
  582. #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  583. #define STM32_I2C1_RX_DMA_CHN 0x00000000
  584. #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  585. #define STM32_I2C1_TX_DMA_CHN 0x00000000
  586. #define STM32_HAS_I2C2 FALSE
  587. #define STM32_HAS_I2C3 FALSE
  588. #define STM32_HAS_I2C4 FALSE
  589. /* QUADSPI attributes.*/
  590. #define STM32_HAS_QUADSPI1 FALSE
  591. /* RTC attributes.*/
  592. #define STM32_HAS_RTC TRUE
  593. #define STM32_RTC_HAS_SUBSECONDS TRUE
  594. #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE
  595. #define STM32_RTC_NUM_ALARMS 1
  596. #define STM32_RTC_STORAGE_SIZE 0
  597. #define STM32_RTC_COMMON_HANDLER Vector48
  598. #define STM32_RTC_COMMON_NUMBER 2
  599. #define STM32_RTC_ALARM_EXTI 17
  600. #define STM32_RTC_TAMP_STAMP_EXTI 19
  601. #define STM32_RTC_WKUP_EXTI 20
  602. #define STM32_RTC_IRQ_ENABLE() \
  603. nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY)
  604. /* SDIO attributes.*/
  605. #define STM32_HAS_SDIO FALSE
  606. /* SPI attributes.*/
  607. #define STM32_HAS_SPI1 TRUE
  608. #define STM32_SPI1_SUPPORTS_I2S TRUE
  609. #define STM32_SPI1_I2S_FULLDUPLEX FALSE
  610. #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  611. #define STM32_SPI1_RX_DMA_CHN 0x00000000
  612. #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  613. #define STM32_SPI1_TX_DMA_CHN 0x00000000
  614. #define STM32_HAS_SPI2 FALSE
  615. #define STM32_HAS_SPI3 FALSE
  616. #define STM32_HAS_SPI4 FALSE
  617. #define STM32_HAS_SPI5 FALSE
  618. #define STM32_HAS_SPI6 FALSE
  619. /* TIM attributes.*/
  620. #define STM32_TIM_MAX_CHANNELS 4
  621. #define STM32_HAS_TIM1 TRUE
  622. #define STM32_TIM1_IS_32BITS FALSE
  623. #define STM32_TIM1_CHANNELS 4
  624. #define STM32_HAS_TIM2 TRUE
  625. #define STM32_TIM2_IS_32BITS TRUE
  626. #define STM32_TIM2_CHANNELS 4
  627. #define STM32_HAS_TIM3 TRUE
  628. #define STM32_TIM3_IS_32BITS FALSE
  629. #define STM32_TIM3_CHANNELS 4
  630. #define STM32_HAS_TIM14 TRUE
  631. #define STM32_TIM14_IS_32BITS FALSE
  632. #define STM32_TIM14_CHANNELS 1
  633. #define STM32_HAS_TIM16 TRUE
  634. #define STM32_TIM16_IS_32BITS FALSE
  635. #define STM32_TIM16_CHANNELS 1
  636. #define STM32_HAS_TIM17 TRUE
  637. #define STM32_TIM17_IS_32BITS FALSE
  638. #define STM32_TIM17_CHANNELS 1
  639. #define STM32_HAS_TIM4 FALSE
  640. #define STM32_HAS_TIM5 FALSE
  641. #define STM32_HAS_TIM6 FALSE
  642. #define STM32_HAS_TIM7 FALSE
  643. #define STM32_HAS_TIM8 FALSE
  644. #define STM32_HAS_TIM9 FALSE
  645. #define STM32_HAS_TIM10 FALSE
  646. #define STM32_HAS_TIM11 FALSE
  647. #define STM32_HAS_TIM12 FALSE
  648. #define STM32_HAS_TIM13 FALSE
  649. #define STM32_HAS_TIM15 FALSE
  650. #define STM32_HAS_TIM18 FALSE
  651. #define STM32_HAS_TIM19 FALSE
  652. #define STM32_HAS_TIM20 FALSE
  653. #define STM32_HAS_TIM21 FALSE
  654. #define STM32_HAS_TIM22 FALSE
  655. /* USART attributes.*/
  656. #define STM32_HAS_USART1 TRUE
  657. #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  658. STM32_DMA_STREAM_ID_MSK(1, 5))
  659. #define STM32_USART1_RX_DMA_CHN 0x00000000
  660. #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  661. STM32_DMA_STREAM_ID_MSK(1, 4))
  662. #define STM32_USART1_TX_DMA_CHN 0x00000000
  663. #define STM32_HAS_USART2 TRUE
  664. #define STM32_USART2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  665. #define STM32_USART2_RX_DMA_CHN 0x00000000
  666. #define STM32_USART2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  667. #define STM32_USART2_TX_DMA_CHN 0x00000000
  668. #define STM32_HAS_USART3 FALSE
  669. #define STM32_HAS_UART4 FALSE
  670. #define STM32_HAS_UART5 FALSE
  671. #define STM32_HAS_USART6 FALSE
  672. #define STM32_HAS_UART7 FALSE
  673. #define STM32_HAS_UART8 FALSE
  674. #define STM32_HAS_LPUART1 FALSE
  675. /* USB attributes.*/
  676. #define STM32_HAS_USB TRUE
  677. #define STM32_USB_ACCESS_SCHEME_2x16 TRUE
  678. #define STM32_USB_PMA_SIZE 768
  679. #define STM32_USB_HAS_BCDR TRUE
  680. #define STM32_HAS_OTG1 FALSE
  681. #define STM32_HAS_OTG2 FALSE
  682. /* IWDG attributes.*/
  683. #define STM32_HAS_IWDG TRUE
  684. #define STM32_IWDG_IS_WINDOWED TRUE
  685. /* LTDC attributes.*/
  686. #define STM32_HAS_LTDC FALSE
  687. /* DMA2D attributes.*/
  688. #define STM32_HAS_DMA2D FALSE
  689. /* FSMC attributes.*/
  690. #define STM32_HAS_FSMC FALSE
  691. /* CRC attributes.*/
  692. #define STM32_HAS_CRC TRUE
  693. #define STM32_CRC_PROGRAMMABLE TRUE
  694. /*===========================================================================*/
  695. /* STM32F048xx. */
  696. /*===========================================================================*/
  697. #elif defined(STM32F048xx)
  698. /* RCC attributes. */
  699. #define STM32_HAS_HSI48 TRUE
  700. #define STM32_HAS_HSI_PREDIV TRUE
  701. #define STM32_HAS_MCO_PREDIV TRUE
  702. /* ADC attributes.*/
  703. #define STM32_HAS_ADC1 TRUE
  704. #define STM32_ADC_SUPPORTS_PRESCALER FALSE
  705. #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE
  706. #define STM32_ADC1_IRQ_SHARED_WITH_EXTI TRUE
  707. #define STM32_ADC1_HANDLER Vector70
  708. #define STM32_ADC1_NUMBER 12
  709. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  710. STM32_DMA_STREAM_ID_MSK(1, 2))
  711. #define STM32_ADC1_DMA_CHN 0x00000000
  712. #define STM32_HAS_ADC2 FALSE
  713. #define STM32_HAS_ADC3 FALSE
  714. #define STM32_HAS_ADC4 FALSE
  715. /* CAN attributes.*/
  716. #define STM32_HAS_CAN1 FALSE
  717. #define STM32_HAS_CAN2 FALSE
  718. #define STM32_HAS_CAN3 FALSE
  719. /* DAC attributes.*/
  720. #define STM32_HAS_DAC1_CH1 FALSE
  721. #define STM32_HAS_DAC1_CH2 FALSE
  722. #define STM32_HAS_DAC2_CH1 FALSE
  723. #define STM32_HAS_DAC2_CH2 FALSE
  724. /* DMA attributes.*/
  725. #define STM32_ADVANCED_DMA TRUE
  726. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  727. #define STM32_DMA_SUPPORTS_CSELR FALSE
  728. #define STM32_DMA1_NUM_CHANNELS 5
  729. #define STM32_DMA2_NUM_CHANNELS 0
  730. #define STM32_DMA1_CH1_HANDLER Vector64
  731. #define STM32_DMA1_CH23_HANDLER Vector68
  732. #define STM32_DMA1_CH4567_HANDLER Vector6C
  733. #define STM32_DMA1_CH1_NUMBER 9
  734. #define STM32_DMA1_CH23_NUMBER 10
  735. #define STM32_DMA1_CH4567_NUMBER 11
  736. #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER
  737. #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER
  738. #define DMA1_CH2_CMASK 0x00000006U
  739. #define DMA1_CH3_CMASK 0x00000006U
  740. #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER
  741. #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER
  742. #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER
  743. #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER
  744. #define DMA1_CH4_CMASK 0x00000078U
  745. #define DMA1_CH5_CMASK 0x00000078U
  746. #define DMA1_CH6_CMASK 0x00000078U
  747. #define DMA1_CH7_CMASK 0x00000078U
  748. /* ETH attributes.*/
  749. #define STM32_HAS_ETH FALSE
  750. /* EXTI attributes.*/
  751. #define STM32_EXTI_NUM_LINES 32
  752. #define STM32_EXTI_IMR1_MASK 0x7FF40000U
  753. /* GPIO attributes.*/
  754. #define STM32_HAS_GPIOA TRUE
  755. #define STM32_HAS_GPIOB TRUE
  756. #define STM32_HAS_GPIOC TRUE
  757. #define STM32_HAS_GPIOD FALSE
  758. #define STM32_HAS_GPIOE FALSE
  759. #define STM32_HAS_GPIOF TRUE
  760. #define STM32_HAS_GPIOG FALSE
  761. #define STM32_HAS_GPIOH FALSE
  762. #define STM32_HAS_GPIOI FALSE
  763. #define STM32_HAS_GPIOJ FALSE
  764. #define STM32_HAS_GPIOK FALSE
  765. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  766. RCC_AHBENR_GPIOBEN | \
  767. RCC_AHBENR_GPIOCEN | \
  768. RCC_AHBENR_GPIOFEN)
  769. /* I2C attributes.*/
  770. #define STM32_HAS_I2C1 TRUE
  771. #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  772. #define STM32_I2C1_RX_DMA_CHN 0x00000000
  773. #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  774. #define STM32_I2C1_TX_DMA_CHN 0x00000000
  775. #define STM32_HAS_I2C2 FALSE
  776. #define STM32_HAS_I2C3 FALSE
  777. #define STM32_HAS_I2C4 FALSE
  778. /* QUADSPI attributes.*/
  779. #define STM32_HAS_QUADSPI1 FALSE
  780. /* RTC attributes.*/
  781. #define STM32_HAS_RTC TRUE
  782. #define STM32_RTC_HAS_SUBSECONDS TRUE
  783. #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE
  784. #define STM32_RTC_NUM_ALARMS 1
  785. #define STM32_RTC_STORAGE_SIZE 0
  786. #define STM32_RTC_COMMON_HANDLER Vector48
  787. #define STM32_RTC_COMMON_NUMBER 2
  788. #define STM32_RTC_ALARM_EXTI 17
  789. #define STM32_RTC_TAMP_STAMP_EXTI 19
  790. #define STM32_RTC_WKUP_EXTI 20
  791. #define STM32_RTC_IRQ_ENABLE() \
  792. nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY)
  793. /* SDIO attributes.*/
  794. #define STM32_HAS_SDIO FALSE
  795. /* SPI attributes.*/
  796. #define STM32_HAS_SPI1 TRUE
  797. #define STM32_SPI1_SUPPORTS_I2S TRUE
  798. #define STM32_SPI1_I2S_FULLDUPLEX FALSE
  799. #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  800. #define STM32_SPI1_RX_DMA_CHN 0x00000000
  801. #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  802. #define STM32_SPI1_TX_DMA_CHN 0x00000000
  803. #define STM32_HAS_SPI2 TRUE
  804. #define STM32_SPI2_SUPPORTS_I2S FALSE
  805. #define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  806. #define STM32_SPI2_RX_DMA_CHN 0x00000000
  807. #define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  808. #define STM32_SPI2_TX_DMA_CHN 0x00000000
  809. #define STM32_HAS_SPI3 FALSE
  810. #define STM32_HAS_SPI4 FALSE
  811. #define STM32_HAS_SPI5 FALSE
  812. #define STM32_HAS_SPI6 FALSE
  813. /* TIM attributes.*/
  814. #define STM32_TIM_MAX_CHANNELS 4
  815. #define STM32_HAS_TIM1 TRUE
  816. #define STM32_TIM1_IS_32BITS FALSE
  817. #define STM32_TIM1_CHANNELS 4
  818. #define STM32_HAS_TIM2 TRUE
  819. #define STM32_TIM2_IS_32BITS TRUE
  820. #define STM32_TIM2_CHANNELS 4
  821. #define STM32_HAS_TIM3 TRUE
  822. #define STM32_TIM3_IS_32BITS FALSE
  823. #define STM32_TIM3_CHANNELS 4
  824. #define STM32_HAS_TIM14 TRUE
  825. #define STM32_TIM14_IS_32BITS FALSE
  826. #define STM32_TIM14_CHANNELS 1
  827. #define STM32_HAS_TIM16 TRUE
  828. #define STM32_TIM16_IS_32BITS FALSE
  829. #define STM32_TIM16_CHANNELS 1
  830. #define STM32_HAS_TIM17 TRUE
  831. #define STM32_TIM17_IS_32BITS FALSE
  832. #define STM32_TIM17_CHANNELS 1
  833. #define STM32_HAS_TIM4 FALSE
  834. #define STM32_HAS_TIM5 FALSE
  835. #define STM32_HAS_TIM6 FALSE
  836. #define STM32_HAS_TIM7 FALSE
  837. #define STM32_HAS_TIM8 FALSE
  838. #define STM32_HAS_TIM9 FALSE
  839. #define STM32_HAS_TIM10 FALSE
  840. #define STM32_HAS_TIM11 FALSE
  841. #define STM32_HAS_TIM12 FALSE
  842. #define STM32_HAS_TIM13 FALSE
  843. #define STM32_HAS_TIM15 FALSE
  844. #define STM32_HAS_TIM18 FALSE
  845. #define STM32_HAS_TIM19 FALSE
  846. #define STM32_HAS_TIM20 FALSE
  847. #define STM32_HAS_TIM21 FALSE
  848. #define STM32_HAS_TIM22 FALSE
  849. /* USART attributes.*/
  850. #define STM32_HAS_USART1 TRUE
  851. #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  852. STM32_DMA_STREAM_ID_MSK(1, 5))
  853. #define STM32_USART1_RX_DMA_CHN 0x00000000
  854. #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  855. STM32_DMA_STREAM_ID_MSK(1, 4))
  856. #define STM32_USART1_TX_DMA_CHN 0x00000000
  857. #define STM32_HAS_USART2 TRUE
  858. #define STM32_USART2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  859. #define STM32_USART2_RX_DMA_CHN 0x00000000
  860. #define STM32_USART2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  861. #define STM32_USART2_TX_DMA_CHN 0x00000000
  862. #define STM32_HAS_USART3 FALSE
  863. #define STM32_HAS_UART4 FALSE
  864. #define STM32_HAS_UART5 FALSE
  865. #define STM32_HAS_USART6 FALSE
  866. #define STM32_HAS_UART7 FALSE
  867. #define STM32_HAS_UART8 FALSE
  868. #define STM32_HAS_LPUART1 FALSE
  869. /* USB attributes.*/
  870. #define STM32_HAS_USB TRUE
  871. #define STM32_USB_ACCESS_SCHEME_2x16 TRUE
  872. #define STM32_USB_PMA_SIZE 768
  873. #define STM32_USB_HAS_BCDR TRUE
  874. #define STM32_HAS_OTG1 FALSE
  875. #define STM32_HAS_OTG2 FALSE
  876. /* IWDG attributes.*/
  877. #define STM32_HAS_IWDG TRUE
  878. #define STM32_IWDG_IS_WINDOWED TRUE
  879. /* LTDC attributes.*/
  880. #define STM32_HAS_LTDC FALSE
  881. /* DMA2D attributes.*/
  882. #define STM32_HAS_DMA2D FALSE
  883. /* FSMC attributes.*/
  884. #define STM32_HAS_FSMC FALSE
  885. /* CRC attributes.*/
  886. #define STM32_HAS_CRC TRUE
  887. #define STM32_CRC_PROGRAMMABLE TRUE
  888. /*===========================================================================*/
  889. /* STM32F051x8, STM32F058xx. */
  890. /*===========================================================================*/
  891. #elif defined(STM32F051x8) || defined(STM32F058xx)
  892. /* RCC attributes. */
  893. #define STM32_HAS_HSI48 FALSE
  894. #define STM32_HAS_HSI_PREDIV FALSE
  895. #define STM32_HAS_MCO_PREDIV FALSE
  896. /* ADC attributes.*/
  897. #define STM32_HAS_ADC1 TRUE
  898. #define STM32_ADC_SUPPORTS_PRESCALER FALSE
  899. #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE
  900. #define STM32_ADC1_IRQ_SHARED_WITH_EXTI TRUE
  901. #define STM32_ADC1_HANDLER Vector70
  902. #define STM32_ADC1_NUMBER 12
  903. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  904. STM32_DMA_STREAM_ID_MSK(1, 2))
  905. #define STM32_ADC1_DMA_CHN 0x00000000
  906. #define STM32_HAS_ADC2 FALSE
  907. #define STM32_HAS_ADC3 FALSE
  908. #define STM32_HAS_ADC4 FALSE
  909. /* CAN attributes.*/
  910. #define STM32_HAS_CAN1 FALSE
  911. #define STM32_HAS_CAN2 FALSE
  912. #define STM32_HAS_CAN3 FALSE
  913. /* DAC attributes.*/
  914. #define STM32_HAS_DAC1_CH1 TRUE
  915. #define STM32_DAC1_CH1_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  916. #define STM32_DAC1_CH1_DMA_CHN 0x00000000
  917. #define STM32_HAS_DAC1_CH2 FALSE
  918. #define STM32_HAS_DAC2_CH1 FALSE
  919. #define STM32_HAS_DAC2_CH2 FALSE
  920. /* DMA attributes.*/
  921. #define STM32_ADVANCED_DMA TRUE
  922. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  923. #define STM32_DMA_SUPPORTS_CSELR FALSE
  924. #define STM32_DMA1_NUM_CHANNELS 5
  925. #define STM32_DMA2_NUM_CHANNELS 0
  926. #define STM32_DMA1_CH1_HANDLER Vector64
  927. #define STM32_DMA1_CH23_HANDLER Vector68
  928. #define STM32_DMA1_CH4567_HANDLER Vector6C
  929. #define STM32_DMA1_CH1_NUMBER 9
  930. #define STM32_DMA1_CH23_NUMBER 10
  931. #define STM32_DMA1_CH4567_NUMBER 11
  932. #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER
  933. #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER
  934. #define DMA1_CH2_CMASK 0x00000006U
  935. #define DMA1_CH3_CMASK 0x00000006U
  936. #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER
  937. #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER
  938. #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER
  939. #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER
  940. #define DMA1_CH4_CMASK 0x00000078U
  941. #define DMA1_CH5_CMASK 0x00000078U
  942. #define DMA1_CH6_CMASK 0x00000078U
  943. #define DMA1_CH7_CMASK 0x00000078U
  944. /* ETH attributes.*/
  945. #define STM32_HAS_ETH FALSE
  946. /* EXTI attributes.*/
  947. #define STM32_EXTI_NUM_LINES 32
  948. #define STM32_EXTI_IMR1_MASK 0x0F940000U
  949. /* GPIO attributes.*/
  950. #define STM32_HAS_GPIOA TRUE
  951. #define STM32_HAS_GPIOB TRUE
  952. #define STM32_HAS_GPIOC TRUE
  953. #define STM32_HAS_GPIOD TRUE
  954. #define STM32_HAS_GPIOE FALSE
  955. #define STM32_HAS_GPIOF TRUE
  956. #define STM32_HAS_GPIOG FALSE
  957. #define STM32_HAS_GPIOH FALSE
  958. #define STM32_HAS_GPIOI FALSE
  959. #define STM32_HAS_GPIOJ FALSE
  960. #define STM32_HAS_GPIOK FALSE
  961. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  962. RCC_AHBENR_GPIOBEN | \
  963. RCC_AHBENR_GPIOCEN | \
  964. RCC_AHBENR_GPIODEN | \
  965. RCC_AHBENR_GPIOFEN)
  966. /* I2C attributes.*/
  967. #define STM32_HAS_I2C1 TRUE
  968. #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  969. #define STM32_I2C1_RX_DMA_CHN 0x00000000
  970. #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  971. #define STM32_I2C1_TX_DMA_CHN 0x00000000
  972. #define STM32_HAS_I2C2 TRUE
  973. #define STM32_I2C2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  974. #define STM32_I2C2_RX_DMA_CHN 0x00000000
  975. #define STM32_I2C2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  976. #define STM32_I2C2_TX_DMA_CHN 0x00000000
  977. #define STM32_HAS_I2C3 FALSE
  978. #define STM32_HAS_I2C4 FALSE
  979. /* QUADSPI attributes.*/
  980. #define STM32_HAS_QUADSPI1 FALSE
  981. /* RTC attributes.*/
  982. #define STM32_HAS_RTC TRUE
  983. #define STM32_RTC_HAS_SUBSECONDS TRUE
  984. #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE
  985. #define STM32_RTC_NUM_ALARMS 1
  986. #define STM32_RTC_STORAGE_SIZE 0
  987. #define STM32_RTC_COMMON_HANDLER Vector48
  988. #define STM32_RTC_COMMON_NUMBER 2
  989. #define STM32_RTC_ALARM_EXTI 17
  990. #define STM32_RTC_TAMP_STAMP_EXTI 19
  991. #define STM32_RTC_WKUP_EXTI 20
  992. #define STM32_RTC_IRQ_ENABLE() \
  993. nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY)
  994. /* SDIO attributes.*/
  995. #define STM32_HAS_SDIO FALSE
  996. /* SPI attributes.*/
  997. #define STM32_HAS_SPI1 TRUE
  998. #define STM32_SPI1_SUPPORTS_I2S TRUE
  999. #define STM32_SPI1_I2S_FULLDUPLEX FALSE
  1000. #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  1001. #define STM32_SPI1_RX_DMA_CHN 0x00000000
  1002. #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  1003. #define STM32_SPI1_TX_DMA_CHN 0x00000000
  1004. #define STM32_HAS_SPI2 TRUE
  1005. #define STM32_SPI2_SUPPORTS_I2S FALSE
  1006. #define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  1007. #define STM32_SPI2_RX_DMA_CHN 0x00000000
  1008. #define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  1009. #define STM32_SPI2_TX_DMA_CHN 0x00000000
  1010. #define STM32_HAS_SPI3 FALSE
  1011. #define STM32_HAS_SPI4 FALSE
  1012. #define STM32_HAS_SPI5 FALSE
  1013. #define STM32_HAS_SPI6 FALSE
  1014. /* TIM attributes.*/
  1015. #define STM32_TIM_MAX_CHANNELS 4
  1016. #define STM32_HAS_TIM1 TRUE
  1017. #define STM32_TIM1_IS_32BITS FALSE
  1018. #define STM32_TIM1_CHANNELS 4
  1019. #define STM32_HAS_TIM2 TRUE
  1020. #define STM32_TIM2_IS_32BITS TRUE
  1021. #define STM32_TIM2_CHANNELS 4
  1022. #define STM32_HAS_TIM3 TRUE
  1023. #define STM32_TIM3_IS_32BITS FALSE
  1024. #define STM32_TIM3_CHANNELS 4
  1025. #define STM32_HAS_TIM6 TRUE
  1026. #define STM32_TIM6_IS_32BITS FALSE
  1027. #define STM32_TIM6_CHANNELS 0
  1028. #define STM32_HAS_TIM14 TRUE
  1029. #define STM32_TIM14_IS_32BITS FALSE
  1030. #define STM32_TIM14_CHANNELS 1
  1031. #define STM32_HAS_TIM15 TRUE
  1032. #define STM32_TIM15_IS_32BITS FALSE
  1033. #define STM32_TIM15_CHANNELS 2
  1034. #define STM32_HAS_TIM16 TRUE
  1035. #define STM32_TIM16_IS_32BITS FALSE
  1036. #define STM32_TIM16_CHANNELS 1
  1037. #define STM32_HAS_TIM17 TRUE
  1038. #define STM32_TIM17_IS_32BITS FALSE
  1039. #define STM32_TIM17_CHANNELS 1
  1040. #define STM32_HAS_TIM4 FALSE
  1041. #define STM32_HAS_TIM5 FALSE
  1042. #define STM32_HAS_TIM7 FALSE
  1043. #define STM32_HAS_TIM8 FALSE
  1044. #define STM32_HAS_TIM9 FALSE
  1045. #define STM32_HAS_TIM10 FALSE
  1046. #define STM32_HAS_TIM11 FALSE
  1047. #define STM32_HAS_TIM12 FALSE
  1048. #define STM32_HAS_TIM13 FALSE
  1049. #define STM32_HAS_TIM18 FALSE
  1050. #define STM32_HAS_TIM19 FALSE
  1051. #define STM32_HAS_TIM20 FALSE
  1052. #define STM32_HAS_TIM21 FALSE
  1053. #define STM32_HAS_TIM22 FALSE
  1054. /* USART attributes.*/
  1055. #define STM32_HAS_USART1 TRUE
  1056. #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1057. STM32_DMA_STREAM_ID_MSK(1, 5))
  1058. #define STM32_USART1_RX_DMA_CHN 0x00000000
  1059. #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1060. STM32_DMA_STREAM_ID_MSK(1, 4))
  1061. #define STM32_USART1_TX_DMA_CHN 0x00000000
  1062. #define STM32_HAS_USART2 TRUE
  1063. #define STM32_USART2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  1064. #define STM32_USART2_RX_DMA_CHN 0x00000000
  1065. #define STM32_USART2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  1066. #define STM32_USART2_TX_DMA_CHN 0x00000000
  1067. #define STM32_HAS_USART3 FALSE
  1068. #define STM32_HAS_UART4 FALSE
  1069. #define STM32_HAS_UART5 FALSE
  1070. #define STM32_HAS_USART6 FALSE
  1071. #define STM32_HAS_UART7 FALSE
  1072. #define STM32_HAS_UART8 FALSE
  1073. #define STM32_HAS_LPUART1 FALSE
  1074. /* USB attributes.*/
  1075. #define STM32_HAS_USB FALSE
  1076. #define STM32_HAS_OTG1 FALSE
  1077. #define STM32_HAS_OTG2 FALSE
  1078. /* IWDG attributes.*/
  1079. #define STM32_HAS_IWDG TRUE
  1080. #define STM32_IWDG_IS_WINDOWED TRUE
  1081. /* LTDC attributes.*/
  1082. #define STM32_HAS_LTDC FALSE
  1083. /* DMA2D attributes.*/
  1084. #define STM32_HAS_DMA2D FALSE
  1085. /* FSMC attributes.*/
  1086. #define STM32_HAS_FSMC FALSE
  1087. /* CRC attributes.*/
  1088. #define STM32_HAS_CRC TRUE
  1089. #define STM32_CRC_PROGRAMMABLE TRUE
  1090. /*===========================================================================*/
  1091. /* STM32F070x6, STM32F070xB. */
  1092. /*===========================================================================*/
  1093. #elif defined(STM32F070x6) || defined(STM32F070xB)
  1094. /* Common identifier of all STM32F070 devices.*/
  1095. #define STM32F070
  1096. /* RCC attributes. */
  1097. #define STM32_HAS_HSI48 FALSE
  1098. #define STM32_HAS_HSI_PREDIV TRUE
  1099. #define STM32_HAS_MCO_PREDIV TRUE
  1100. /* ADC attributes.*/
  1101. #define STM32_HAS_ADC1 TRUE
  1102. #define STM32_ADC_SUPPORTS_PRESCALER FALSE
  1103. #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE
  1104. #define STM32_ADC1_IRQ_SHARED_WITH_EXTI TRUE
  1105. #define STM32_ADC1_HANDLER Vector70
  1106. #define STM32_ADC1_NUMBER 12
  1107. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1108. STM32_DMA_STREAM_ID_MSK(1, 2))
  1109. #define STM32_ADC1_DMA_CHN 0x00000000
  1110. #define STM32_HAS_ADC2 FALSE
  1111. #define STM32_HAS_ADC3 FALSE
  1112. #define STM32_HAS_ADC4 FALSE
  1113. /* CAN attributes.*/
  1114. #define STM32_HAS_CAN1 FALSE
  1115. #define STM32_HAS_CAN2 FALSE
  1116. #define STM32_HAS_CAN3 FALSE
  1117. /* DAC attributes.*/
  1118. #define STM32_HAS_DAC1_CH1 FALSE
  1119. #define STM32_HAS_DAC1_CH2 FALSE
  1120. #define STM32_HAS_DAC2_CH1 FALSE
  1121. #define STM32_HAS_DAC2_CH2 FALSE
  1122. /* DMA attributes.*/
  1123. #define STM32_ADVANCED_DMA TRUE
  1124. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  1125. #define STM32_DMA_SUPPORTS_CSELR FALSE
  1126. #define STM32_DMA1_NUM_CHANNELS 5
  1127. #define STM32_DMA2_NUM_CHANNELS 0
  1128. #define STM32_DMA1_CH1_HANDLER Vector64
  1129. #define STM32_DMA1_CH23_HANDLER Vector68
  1130. #define STM32_DMA1_CH4567_HANDLER Vector6C
  1131. #define STM32_DMA1_CH1_NUMBER 9
  1132. #define STM32_DMA1_CH23_NUMBER 10
  1133. #define STM32_DMA1_CH4567_NUMBER 11
  1134. #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER
  1135. #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER
  1136. #define DMA1_CH2_CMASK 0x00000006U
  1137. #define DMA1_CH3_CMASK 0x00000006U
  1138. #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER
  1139. #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER
  1140. #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER
  1141. #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER
  1142. #define DMA1_CH4_CMASK 0x00000078U
  1143. #define DMA1_CH5_CMASK 0x00000078U
  1144. #define DMA1_CH6_CMASK 0x00000078U
  1145. #define DMA1_CH7_CMASK 0x00000078U
  1146. /* ETH attributes.*/
  1147. #define STM32_HAS_ETH FALSE
  1148. /* EXTI attributes.*/
  1149. #define STM32_EXTI_NUM_LINES 32
  1150. #define STM32_EXTI_IMR1_MASK 0x7F840000U
  1151. /* GPIO attributes.*/
  1152. #define STM32_HAS_GPIOA TRUE
  1153. #define STM32_HAS_GPIOB TRUE
  1154. #define STM32_HAS_GPIOC TRUE
  1155. #if defined(STM32F070x6)
  1156. #define STM32_HAS_GPIOD FALSE
  1157. #else
  1158. #define STM32_HAS_GPIOD TRUE
  1159. #endif
  1160. #define STM32_HAS_GPIOE FALSE
  1161. #define STM32_HAS_GPIOF TRUE
  1162. #define STM32_HAS_GPIOG FALSE
  1163. #define STM32_HAS_GPIOH FALSE
  1164. #define STM32_HAS_GPIOI FALSE
  1165. #define STM32_HAS_GPIOJ FALSE
  1166. #define STM32_HAS_GPIOK FALSE
  1167. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  1168. RCC_AHBENR_GPIOBEN | \
  1169. RCC_AHBENR_GPIOCEN | \
  1170. RCC_AHBENR_GPIODEN | \
  1171. RCC_AHBENR_GPIOFEN)
  1172. /* I2C attributes.*/
  1173. #define STM32_HAS_I2C1 TRUE
  1174. #define STM32_I2C1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  1175. #define STM32_I2C1_RX_DMA_CHN 0x00000000
  1176. #define STM32_I2C1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  1177. #define STM32_I2C1_TX_DMA_CHN 0x00000000
  1178. #define STM32_HAS_I2C2 TRUE
  1179. #define STM32_I2C2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  1180. #define STM32_I2C2_RX_DMA_CHN 0x00000000
  1181. #define STM32_I2C2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  1182. #define STM32_I2C2_TX_DMA_CHN 0x00000000
  1183. #define STM32_HAS_I2C3 FALSE
  1184. #define STM32_HAS_I2C4 FALSE
  1185. /* QUADSPI attributes.*/
  1186. #define STM32_HAS_QUADSPI1 FALSE
  1187. /* RTC attributes.*/
  1188. #define STM32_HAS_RTC TRUE
  1189. #define STM32_RTC_HAS_SUBSECONDS TRUE
  1190. #if defined (STM32F070xB)
  1191. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  1192. #else
  1193. #define STM32_RTC_HAS_PERIODIC_WAKEUPS FALSE
  1194. #endif
  1195. #define STM32_RTC_NUM_ALARMS 1
  1196. #define STM32_RTC_STORAGE_SIZE 0
  1197. #define STM32_RTC_COMMON_HANDLER Vector48
  1198. #define STM32_RTC_COMMON_NUMBER 2
  1199. #define STM32_RTC_ALARM_EXTI 17
  1200. #define STM32_RTC_TAMP_STAMP_EXTI 19
  1201. #define STM32_RTC_WKUP_EXTI 20
  1202. #define STM32_RTC_IRQ_ENABLE() \
  1203. nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY)
  1204. /* SDIO attributes.*/
  1205. #define STM32_HAS_SDIO FALSE
  1206. /* SPI attributes.*/
  1207. #define STM32_HAS_SPI1 TRUE
  1208. #define STM32_SPI1_SUPPORTS_I2S FALSE
  1209. #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  1210. #define STM32_SPI1_RX_DMA_CHN 0x00000000
  1211. #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  1212. #define STM32_SPI1_TX_DMA_CHN 0x00000000
  1213. #define STM32_HAS_SPI2 TRUE
  1214. #define STM32_SPI2_SUPPORTS_I2S FALSE
  1215. #define STM32_SPI2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  1216. #define STM32_SPI2_RX_DMA_CHN 0x00000000
  1217. #define STM32_SPI2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  1218. #define STM32_SPI2_TX_DMA_CHN 0x00000000
  1219. #define STM32_HAS_SPI3 FALSE
  1220. #define STM32_HAS_SPI4 FALSE
  1221. #define STM32_HAS_SPI5 FALSE
  1222. #define STM32_HAS_SPI6 FALSE
  1223. /* TIM attributes.*/
  1224. #define STM32_TIM_MAX_CHANNELS 4
  1225. #define STM32_HAS_TIM1 TRUE
  1226. #define STM32_TIM1_IS_32BITS FALSE
  1227. #define STM32_TIM1_CHANNELS 4
  1228. #define STM32_HAS_TIM3 TRUE
  1229. #define STM32_TIM3_IS_32BITS FALSE
  1230. #define STM32_TIM3_CHANNELS 4
  1231. #define STM32_HAS_TIM6 TRUE
  1232. #define STM32_TIM6_IS_32BITS FALSE
  1233. #define STM32_TIM6_CHANNELS 0
  1234. #define STM32_HAS_TIM7 TRUE
  1235. #define STM32_TIM7_IS_32BITS FALSE
  1236. #define STM32_TIM7_CHANNELS 0
  1237. #define STM32_HAS_TIM14 TRUE
  1238. #define STM32_TIM14_IS_32BITS FALSE
  1239. #define STM32_TIM14_CHANNELS 1
  1240. #define STM32_HAS_TIM15 TRUE
  1241. #define STM32_TIM15_IS_32BITS FALSE
  1242. #define STM32_TIM15_CHANNELS 2
  1243. #define STM32_HAS_TIM16 TRUE
  1244. #define STM32_TIM16_IS_32BITS FALSE
  1245. #define STM32_TIM16_CHANNELS 1
  1246. #define STM32_HAS_TIM17 TRUE
  1247. #define STM32_TIM17_IS_32BITS FALSE
  1248. #define STM32_TIM17_CHANNELS 1
  1249. #define STM32_HAS_TIM2 FALSE
  1250. #define STM32_HAS_TIM4 FALSE
  1251. #define STM32_HAS_TIM5 FALSE
  1252. #define STM32_HAS_TIM8 FALSE
  1253. #define STM32_HAS_TIM9 FALSE
  1254. #define STM32_HAS_TIM10 FALSE
  1255. #define STM32_HAS_TIM11 FALSE
  1256. #define STM32_HAS_TIM12 FALSE
  1257. #define STM32_HAS_TIM13 FALSE
  1258. #define STM32_HAS_TIM18 FALSE
  1259. #define STM32_HAS_TIM19 FALSE
  1260. #define STM32_HAS_TIM20 FALSE
  1261. #define STM32_HAS_TIM21 FALSE
  1262. #define STM32_HAS_TIM22 FALSE
  1263. /* USART attributes.*/
  1264. #define STM32_HAS_USART1 TRUE
  1265. #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1266. STM32_DMA_STREAM_ID_MSK(1, 5))
  1267. #define STM32_USART1_RX_DMA_CHN 0x00000000
  1268. #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1269. STM32_DMA_STREAM_ID_MSK(1, 4))
  1270. #define STM32_USART1_TX_DMA_CHN 0x00000000
  1271. #define STM32_HAS_USART2 TRUE
  1272. #define STM32_USART2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  1273. #define STM32_USART2_RX_DMA_CHN 0x00000000
  1274. #define STM32_USART2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  1275. #define STM32_USART2_TX_DMA_CHN 0x00000000
  1276. #define STM32_HAS_USART3 TRUE
  1277. #define STM32_USART3_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  1278. #define STM32_USART3_RX_DMA_CHN 0x00000000
  1279. #define STM32_USART3_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  1280. #define STM32_USART3_TX_DMA_CHN 0x00000000
  1281. #define STM32_HAS_UART4 TRUE
  1282. #define STM32_UART4_RX_DMA_MSK 0
  1283. #define STM32_UART4_RX_DMA_CHN 0x00000000
  1284. #define STM32_UART4_TX_DMA_MSK 0
  1285. #define STM32_UART4_TX_DMA_CHN 0x00000000
  1286. #define STM32_HAS_UART5 FALSE
  1287. #define STM32_HAS_USART6 FALSE
  1288. #define STM32_HAS_UART7 FALSE
  1289. #define STM32_HAS_UART8 FALSE
  1290. #define STM32_HAS_LPUART1 FALSE
  1291. /* USB attributes.*/
  1292. #define STM32_HAS_USB TRUE
  1293. #define STM32_USB_ACCESS_SCHEME_2x16 TRUE
  1294. #define STM32_USB_PMA_SIZE 768
  1295. #define STM32_USB_HAS_BCDR TRUE
  1296. #define STM32_HAS_OTG1 FALSE
  1297. #define STM32_HAS_OTG2 FALSE
  1298. /* IWDG attributes.*/
  1299. #define STM32_HAS_IWDG TRUE
  1300. #define STM32_IWDG_IS_WINDOWED TRUE
  1301. /* LTDC attributes.*/
  1302. #define STM32_HAS_LTDC FALSE
  1303. /* DMA2D attributes.*/
  1304. #define STM32_HAS_DMA2D FALSE
  1305. /* FSMC attributes.*/
  1306. #define STM32_HAS_FSMC FALSE
  1307. /* CRC attributes.*/
  1308. #define STM32_HAS_CRC TRUE
  1309. #define STM32_CRC_PROGRAMMABLE FALSE
  1310. /*===========================================================================*/
  1311. /* STM32F071xB, STM32F072xB, STM32F078xx. */
  1312. /*===========================================================================*/
  1313. #elif defined(STM32F071xB) || defined(STM32F072xB) || \
  1314. defined(STM32F078xx)
  1315. /* RCC attributes. */
  1316. #define STM32_HAS_HSI48 TRUE
  1317. #define STM32_HAS_HSI_PREDIV TRUE
  1318. #define STM32_HAS_MCO_PREDIV TRUE
  1319. /* ADC attributes.*/
  1320. #define STM32_HAS_ADC1 TRUE
  1321. #define STM32_ADC_SUPPORTS_PRESCALER FALSE
  1322. #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE
  1323. #define STM32_ADC1_IRQ_SHARED_WITH_EXTI TRUE
  1324. #define STM32_ADC1_HANDLER Vector70
  1325. #define STM32_ADC1_NUMBER 12
  1326. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1327. STM32_DMA_STREAM_ID_MSK(1, 2))
  1328. #define STM32_ADC1_DMA_CHN 0x00000000
  1329. #define STM32_HAS_ADC2 FALSE
  1330. #define STM32_HAS_ADC3 FALSE
  1331. #define STM32_HAS_ADC4 FALSE
  1332. /* CAN attributes.*/
  1333. #if defined(STM32F072xB)
  1334. #define STM32_HAS_CAN1 TRUE
  1335. #define STM32_CAN_MAX_FILTERS 14
  1336. #else
  1337. #define STM32_HAS_CAN1 FALSE
  1338. #endif
  1339. #define STM32_HAS_CAN2 FALSE
  1340. #define STM32_HAS_CAN3 FALSE
  1341. /* DAC attributes.*/
  1342. #define STM32_HAS_DAC1_CH1 TRUE
  1343. #define STM32_DAC1_CH1_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  1344. #define STM32_DAC1_CH1_DMA_CHN 0x00000000
  1345. #define STM32_HAS_DAC1_CH2 TRUE
  1346. #define STM32_DAC1_CH2_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  1347. #define STM32_DAC1_CH2_DMA_CHN 0x00000000
  1348. #define STM32_HAS_DAC2_CH1 FALSE
  1349. #define STM32_HAS_DAC2_CH2 FALSE
  1350. /* DMA attributes.*/
  1351. #define STM32_ADVANCED_DMA TRUE
  1352. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  1353. #define STM32_DMA_SUPPORTS_CSELR FALSE
  1354. #define STM32_DMA1_NUM_CHANNELS 7
  1355. #define STM32_DMA2_NUM_CHANNELS 0
  1356. #define STM32_DMA1_CH1_HANDLER Vector64
  1357. #define STM32_DMA1_CH23_HANDLER Vector68
  1358. #define STM32_DMA1_CH4567_HANDLER Vector6C
  1359. #define STM32_DMA1_CH1_NUMBER 9
  1360. #define STM32_DMA1_CH23_NUMBER 10
  1361. #define STM32_DMA1_CH4567_NUMBER 11
  1362. #define STM32_DMA1_CH2_NUMBER STM32_DMA1_CH23_NUMBER
  1363. #define STM32_DMA1_CH3_NUMBER STM32_DMA1_CH23_NUMBER
  1364. #define DMA1_CH2_CMASK 0x00000006U
  1365. #define DMA1_CH3_CMASK 0x00000006U
  1366. #define STM32_DMA1_CH4_NUMBER STM32_DMA1_CH4567_NUMBER
  1367. #define STM32_DMA1_CH5_NUMBER STM32_DMA1_CH4567_NUMBER
  1368. #define STM32_DMA1_CH6_NUMBER STM32_DMA1_CH4567_NUMBER
  1369. #define STM32_DMA1_CH7_NUMBER STM32_DMA1_CH4567_NUMBER
  1370. #define DMA1_CH4_CMASK 0x00000078U
  1371. #define DMA1_CH5_CMASK 0x00000078U
  1372. #define DMA1_CH6_CMASK 0x00000078U
  1373. #define DMA1_CH7_CMASK 0x00000078U
  1374. /* ETH attributes.*/
  1375. #define STM32_HAS_ETH FALSE
  1376. /* EXTI attributes.*/
  1377. #define STM32_EXTI_NUM_LINES 32
  1378. #define STM32_EXTI_IMR1_MASK 0x7F840000U
  1379. /* GPIO attributes.*/
  1380. #define STM32_HAS_GPIOA TRUE
  1381. #define STM32_HAS_GPIOB TRUE
  1382. #define STM32_HAS_GPIOC TRUE
  1383. #define STM32_HAS_GPIOD TRUE
  1384. #define STM32_HAS_GPIOE TRUE
  1385. #define STM32_HAS_GPIOF TRUE
  1386. #define STM32_HAS_GPIOG FALSE
  1387. #define STM32_HAS_GPIOH FALSE
  1388. #define STM32_HAS_GPIOI FALSE
  1389. #define STM32_HAS_GPIOJ FALSE
  1390. #define STM32_HAS_GPIOK FALSE
  1391. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  1392. RCC_AHBENR_GPIOBEN | \
  1393. RCC_AHBENR_GPIOCEN | \
  1394. RCC_AHBENR_GPIODEN | \
  1395. RCC_AHBENR_GPIOEEN | \
  1396. RCC_AHBENR_GPIOFEN)
  1397. /* I2C attributes.*/
  1398. #define STM32_HAS_I2C1 TRUE
  1399. #define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1400. STM32_DMA_STREAM_ID_MSK(1, 7))
  1401. #define STM32_I2C1_RX_DMA_CHN 0x00000000
  1402. #define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1403. STM32_DMA_STREAM_ID_MSK(1, 6))
  1404. #define STM32_I2C1_TX_DMA_CHN 0x00000000
  1405. #define STM32_HAS_I2C2 TRUE
  1406. #define STM32_I2C2_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 5)
  1407. #define STM32_I2C2_RX_DMA_CHN 0x00000000
  1408. #define STM32_I2C2_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 4)
  1409. #define STM32_I2C2_TX_DMA_CHN 0x00000000
  1410. #define STM32_HAS_I2C3 FALSE
  1411. #define STM32_HAS_I2C4 FALSE
  1412. /* QUADSPI attributes.*/
  1413. #define STM32_HAS_QUADSPI1 FALSE
  1414. /* RTC attributes.*/
  1415. #define STM32_HAS_RTC TRUE
  1416. #define STM32_RTC_HAS_SUBSECONDS TRUE
  1417. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  1418. #define STM32_RTC_NUM_ALARMS 1
  1419. #define STM32_RTC_STORAGE_SIZE 0
  1420. #define STM32_RTC_COMMON_HANDLER Vector48
  1421. #define STM32_RTC_COMMON_NUMBER 2
  1422. #define STM32_RTC_ALARM_EXTI 17
  1423. #define STM32_RTC_TAMP_STAMP_EXTI 19
  1424. #define STM32_RTC_WKUP_EXTI 20
  1425. #define STM32_RTC_IRQ_ENABLE() \
  1426. nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY)
  1427. /* SDIO attributes.*/
  1428. #define STM32_HAS_SDIO FALSE
  1429. /* SPI attributes.*/
  1430. #define STM32_HAS_SPI1 TRUE
  1431. #define STM32_SPI1_SUPPORTS_I2S TRUE
  1432. #define STM32_SPI1_I2S_FULLDUPLEX FALSE
  1433. #define STM32_SPI1_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 2)
  1434. #define STM32_SPI1_RX_DMA_CHN 0x00000000
  1435. #define STM32_SPI1_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 3)
  1436. #define STM32_SPI1_TX_DMA_CHN 0x00000000
  1437. #define STM32_HAS_SPI2 TRUE
  1438. #define STM32_SPI2_SUPPORTS_I2S TRUE
  1439. #define STM32_SPI2_I2S_FULLDUPLEX FALSE
  1440. #define STM32_SPI2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1441. STM32_DMA_STREAM_ID_MSK(1, 6))
  1442. #define STM32_SPI2_RX_DMA_CHN 0x00000000
  1443. #define STM32_SPI2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1444. STM32_DMA_STREAM_ID_MSK(1, 7))
  1445. #define STM32_SPI2_TX_DMA_CHN 0x00000000
  1446. #define STM32_HAS_SPI3 FALSE
  1447. #define STM32_HAS_SPI4 FALSE
  1448. #define STM32_HAS_SPI5 FALSE
  1449. #define STM32_HAS_SPI6 FALSE
  1450. /* TIM attributes.*/
  1451. #define STM32_TIM_MAX_CHANNELS 4
  1452. #define STM32_HAS_TIM1 TRUE
  1453. #define STM32_TIM1_IS_32BITS FALSE
  1454. #define STM32_TIM1_CHANNELS 4
  1455. #define STM32_HAS_TIM2 TRUE
  1456. #define STM32_TIM2_IS_32BITS TRUE
  1457. #define STM32_TIM2_CHANNELS 4
  1458. #define STM32_HAS_TIM3 TRUE
  1459. #define STM32_TIM3_IS_32BITS FALSE
  1460. #define STM32_TIM3_CHANNELS 4
  1461. #define STM32_HAS_TIM6 TRUE
  1462. #define STM32_TIM6_IS_32BITS FALSE
  1463. #define STM32_TIM6_CHANNELS 0
  1464. #define STM32_HAS_TIM14 TRUE
  1465. #define STM32_TIM14_IS_32BITS FALSE
  1466. #define STM32_TIM14_CHANNELS 1
  1467. #define STM32_HAS_TIM15 TRUE
  1468. #define STM32_TIM15_IS_32BITS FALSE
  1469. #define STM32_TIM15_CHANNELS 2
  1470. #define STM32_HAS_TIM16 TRUE
  1471. #define STM32_TIM16_IS_32BITS FALSE
  1472. #define STM32_TIM16_CHANNELS 1
  1473. #define STM32_HAS_TIM17 TRUE
  1474. #define STM32_TIM17_IS_32BITS FALSE
  1475. #define STM32_TIM17_CHANNELS 1
  1476. #define STM32_HAS_TIM4 FALSE
  1477. #define STM32_HAS_TIM5 FALSE
  1478. #define STM32_HAS_TIM7 FALSE
  1479. #define STM32_HAS_TIM8 FALSE
  1480. #define STM32_HAS_TIM9 FALSE
  1481. #define STM32_HAS_TIM10 FALSE
  1482. #define STM32_HAS_TIM11 FALSE
  1483. #define STM32_HAS_TIM12 FALSE
  1484. #define STM32_HAS_TIM13 FALSE
  1485. #define STM32_HAS_TIM18 FALSE
  1486. #define STM32_HAS_TIM19 FALSE
  1487. #define STM32_HAS_TIM20 FALSE
  1488. #define STM32_HAS_TIM21 FALSE
  1489. #define STM32_HAS_TIM22 FALSE
  1490. /* USART attributes.*/
  1491. #define STM32_HAS_USART1 TRUE
  1492. #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1493. STM32_DMA_STREAM_ID_MSK(1, 5))
  1494. #define STM32_USART1_RX_DMA_CHN 0x00000000
  1495. #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1496. STM32_DMA_STREAM_ID_MSK(1, 4))
  1497. #define STM32_USART1_TX_DMA_CHN 0x00000000
  1498. #define STM32_HAS_USART2 TRUE
  1499. #define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1500. STM32_DMA_STREAM_ID_MSK(1, 6))
  1501. #define STM32_USART2_RX_DMA_CHN 0x00000000
  1502. #define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1503. STM32_DMA_STREAM_ID_MSK(1, 7))
  1504. #define STM32_USART2_TX_DMA_CHN 0x00000000
  1505. #define STM32_HAS_USART3 TRUE
  1506. #define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1507. STM32_DMA_STREAM_ID_MSK(1, 3))
  1508. #define STM32_USART3_RX_DMA_CHN 0x00000000
  1509. #define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1510. STM32_DMA_STREAM_ID_MSK(1, 2))
  1511. #define STM32_USART3_TX_DMA_CHN 0x00000000
  1512. #define STM32_HAS_UART4 TRUE
  1513. #define STM32_UART4_RX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 6)
  1514. #define STM32_UART4_RX_DMA_CHN 0x00000000
  1515. #define STM32_UART4_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 7)
  1516. #define STM32_UART4_TX_DMA_CHN 0x00000000
  1517. #define STM32_HAS_UART5 FALSE
  1518. #define STM32_HAS_USART6 FALSE
  1519. #define STM32_HAS_UART7 FALSE
  1520. #define STM32_HAS_UART8 FALSE
  1521. #define STM32_HAS_LPUART1 FALSE
  1522. /* USB attributes.*/
  1523. #if defined(STM32F072xB) || defined(STM32F078xx)
  1524. #define STM32_HAS_USB TRUE
  1525. #define STM32_USB_ACCESS_SCHEME_2x16 TRUE
  1526. #define STM32_USB_PMA_SIZE 768
  1527. #define STM32_USB_HAS_BCDR TRUE
  1528. #else
  1529. #define STM32_HAS_USB FALSE
  1530. #endif
  1531. #define STM32_HAS_OTG1 FALSE
  1532. #define STM32_HAS_OTG2 FALSE
  1533. /* IWDG attributes.*/
  1534. #define STM32_HAS_IWDG TRUE
  1535. #define STM32_IWDG_IS_WINDOWED TRUE
  1536. /* LTDC attributes.*/
  1537. #define STM32_HAS_LTDC FALSE
  1538. /* DMA2D attributes.*/
  1539. #define STM32_HAS_DMA2D FALSE
  1540. /* FSMC attributes.*/
  1541. #define STM32_HAS_FSMC FALSE
  1542. /* CRC attributes.*/
  1543. #define STM32_HAS_CRC TRUE
  1544. #define STM32_CRC_PROGRAMMABLE TRUE
  1545. /*===========================================================================*/
  1546. /* STM32F091xC, STM32F098xx. */
  1547. /*===========================================================================*/
  1548. #elif defined(STM32F091xC) || defined(STM32F098xx)
  1549. /* RCC attributes. */
  1550. #define STM32_HAS_HSI48 TRUE
  1551. #define STM32_HAS_HSI_PREDIV TRUE
  1552. #define STM32_HAS_MCO_PREDIV TRUE
  1553. /* ADC attributes.*/
  1554. #define STM32_HAS_ADC1 TRUE
  1555. #define STM32_ADC_SUPPORTS_PRESCALER FALSE
  1556. #define STM32_ADC_SUPPORTS_OVERSAMPLING FALSE
  1557. #define STM32_ADC1_IRQ_SHARED_WITH_EXTI TRUE
  1558. #define STM32_ADC1_HANDLER Vector70
  1559. #define STM32_ADC1_NUMBER 12
  1560. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1561. STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1562. STM32_DMA_STREAM_ID_MSK(2, 5))
  1563. #define STM32_ADC1_DMA_CHN 0x00100011
  1564. #define STM32_HAS_ADC2 FALSE
  1565. #define STM32_HAS_ADC3 FALSE
  1566. #define STM32_HAS_ADC4 FALSE
  1567. /* CAN attributes.*/
  1568. #define STM32_HAS_CAN1 TRUE
  1569. #define STM32_HAS_CAN2 FALSE
  1570. #define STM32_HAS_CAN3 FALSE
  1571. #define STM32_CAN_MAX_FILTERS 14
  1572. /* DAC attributes.*/
  1573. #define STM32_HAS_DAC1_CH1 TRUE
  1574. #define STM32_DAC1_CH1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1575. STM32_DMA_STREAM_ID_MSK(2, 3))
  1576. #define STM32_DAC1_CH1_DMA_CHN 0x00000100
  1577. #define STM32_HAS_DAC1_CH2 TRUE
  1578. #define STM32_DAC1_CH2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1579. STM32_DMA_STREAM_ID_MSK(2, 4))
  1580. #define STM32_DAC1_CH2_DMA_CHN 0x00001000
  1581. #define STM32_HAS_DAC2_CH1 FALSE
  1582. #define STM32_HAS_DAC2_CH2 FALSE
  1583. /* DMA attributes.*/
  1584. #define STM32_ADVANCED_DMA TRUE
  1585. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  1586. #define STM32_DMA_SUPPORTS_CSELR TRUE
  1587. #define STM32_DMA1_NUM_CHANNELS 7
  1588. #define STM32_DMA2_NUM_CHANNELS 5
  1589. #define STM32_DMA1_CH1_HANDLER Vector64
  1590. #define STM32_DMA12_CH23_CH12_HANDLER Vector68
  1591. #define STM32_DMA12_CH4567_CH345_HANDLER Vector6C
  1592. #define STM32_DMA1_CH1_NUMBER 9
  1593. #define STM32_DMA12_CH23_CH12_NUMBER 10
  1594. #define STM32_DMA12_CH4567_CH345_NUMBER 11
  1595. #define STM32_DMA1_CH2_NUMBER STM32_DMA12_CH23_CH12_NUMBER
  1596. #define STM32_DMA1_CH3_NUMBER STM32_DMA12_CH23_CH12_NUMBER
  1597. #define STM32_DMA2_CH1_NUMBER STM32_DMA12_CH23_CH12_NUMBER
  1598. #define STM32_DMA2_CH2_NUMBER STM32_DMA12_CH23_CH12_NUMBER
  1599. #define DMA1_CH2_CMASK 0x00000186U
  1600. #define DMA1_CH3_CMASK 0x00000186U
  1601. #define DMA2_CH1_CMASK 0x00000186U
  1602. #define DMA2_CH2_CMASK 0x00000186U
  1603. #define STM32_DMA1_CH4_NUMBER STM32_DMA12_CH4567_CH345_NUMBER
  1604. #define STM32_DMA1_CH5_NUMBER STM32_DMA12_CH4567_CH345_NUMBER
  1605. #define STM32_DMA1_CH6_NUMBER STM32_DMA12_CH4567_CH345_NUMBER
  1606. #define STM32_DMA1_CH7_NUMBER STM32_DMA12_CH4567_CH345_NUMBER
  1607. #define STM32_DMA2_CH3_NUMBER STM32_DMA12_CH4567_CH345_NUMBER
  1608. #define STM32_DMA2_CH4_NUMBER STM32_DMA12_CH4567_CH345_NUMBER
  1609. #define STM32_DMA2_CH5_NUMBER STM32_DMA12_CH4567_CH345_NUMBER
  1610. #define DMA1_CH4_CMASK 0x00000E78U
  1611. #define DMA1_CH5_CMASK 0x00000E78U
  1612. #define DMA1_CH6_CMASK 0x00000E78U
  1613. #define DMA1_CH7_CMASK 0x00000E78U
  1614. #define DMA2_CH3_CMASK 0x00000E78U
  1615. #define DMA2_CH4_CMASK 0x00000E78U
  1616. #define DMA2_CH5_CMASK 0x00000E78U
  1617. /* ETH attributes.*/
  1618. #define STM32_HAS_ETH FALSE
  1619. /* EXTI attributes.*/
  1620. #define STM32_EXTI_NUM_LINES 32
  1621. #define STM32_EXTI_IMR1_MASK 0x7F840000U
  1622. /* GPIO attributes.*/
  1623. #define STM32_HAS_GPIOA TRUE
  1624. #define STM32_HAS_GPIOB TRUE
  1625. #define STM32_HAS_GPIOC TRUE
  1626. #define STM32_HAS_GPIOD TRUE
  1627. #define STM32_HAS_GPIOE FALSE
  1628. #define STM32_HAS_GPIOF TRUE
  1629. #define STM32_HAS_GPIOG FALSE
  1630. #define STM32_HAS_GPIOH FALSE
  1631. #define STM32_HAS_GPIOI FALSE
  1632. #define STM32_HAS_GPIOJ FALSE
  1633. #define STM32_HAS_GPIOK FALSE
  1634. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  1635. RCC_AHBENR_GPIOBEN | \
  1636. RCC_AHBENR_GPIOCEN | \
  1637. RCC_AHBENR_GPIODEN | \
  1638. RCC_AHBENR_GPIOFEN)
  1639. /* I2C attributes.*/
  1640. #define STM32_HAS_I2C1 TRUE
  1641. #define STM32_I2C1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1642. STM32_DMA_STREAM_ID_MSK(1, 7))
  1643. #define STM32_I2C1_RX_DMA_CHN 0x02000200
  1644. #define STM32_I2C1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1645. STM32_DMA_STREAM_ID_MSK(1, 6))
  1646. #define STM32_I2C1_TX_DMA_CHN 0x00200020
  1647. #define STM32_HAS_I2C2 TRUE
  1648. #define STM32_I2C2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1649. STM32_DMA_STREAM_ID_MSK(2, 2))
  1650. #define STM32_I2C2_RX_DMA_CHN 0x00020020
  1651. #define STM32_I2C2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1652. STM32_DMA_STREAM_ID_MSK(2, 1))
  1653. #define STM32_I2C2_TX_DMA_CHN 0x00002002
  1654. #define STM32_HAS_I2C3 FALSE
  1655. #define STM32_HAS_I2C4 FALSE
  1656. /* QUADSPI attributes.*/
  1657. #define STM32_HAS_QUADSPI1 FALSE
  1658. /* RTC attributes.*/
  1659. #define STM32_HAS_RTC TRUE
  1660. #define STM32_RTC_HAS_SUBSECONDS TRUE
  1661. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  1662. #define STM32_RTC_NUM_ALARMS 1
  1663. #define STM32_RTC_STORAGE_SIZE 0
  1664. #define STM32_RTC_COMMON_HANDLER Vector48
  1665. #define STM32_RTC_COMMON_NUMBER 2
  1666. #define STM32_RTC_ALARM_EXTI 17
  1667. #define STM32_RTC_TAMP_STAMP_EXTI 19
  1668. #define STM32_RTC_WKUP_EXTI 20
  1669. #define STM32_RTC_IRQ_ENABLE() \
  1670. nvicEnableVector(STM32_RTC_COMMON_NUMBER, STM32_IRQ_EXTI17_20_IRQ_PRIORITY)
  1671. /* SDIO attributes.*/
  1672. #define STM32_HAS_SDIO FALSE
  1673. /* SPI attributes.*/
  1674. #define STM32_HAS_SPI1 TRUE
  1675. #define STM32_SPI1_SUPPORTS_I2S TRUE
  1676. #define STM32_SPI1_I2S_FULLDUPLEX FALSE
  1677. #define STM32_SPI1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1678. STM32_DMA_STREAM_ID_MSK(2, 3))
  1679. #define STM32_SPI1_RX_DMA_CHN 0x00000330
  1680. #define STM32_SPI1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1681. STM32_DMA_STREAM_ID_MSK(2, 4))
  1682. #define STM32_SPI1_TX_DMA_CHN 0x00003300
  1683. #define STM32_HAS_SPI2 TRUE
  1684. #define STM32_SPI2_SUPPORTS_I2S TRUE
  1685. #define STM32_SPI2_I2S_FULLDUPLEX FALSE
  1686. #define STM32_SPI2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1687. STM32_DMA_STREAM_ID_MSK(1, 6))
  1688. #define STM32_SPI2_RX_DMA_CHN 0x00303000
  1689. #define STM32_SPI2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1690. STM32_DMA_STREAM_ID_MSK(1, 7))
  1691. #define STM32_SPI2_TX_DMA_CHN 0x03030000
  1692. #define STM32_HAS_SPI3 FALSE
  1693. #define STM32_HAS_SPI4 FALSE
  1694. #define STM32_HAS_SPI5 FALSE
  1695. #define STM32_HAS_SPI6 FALSE
  1696. /* TIM attributes.*/
  1697. #define STM32_TIM_MAX_CHANNELS 4
  1698. #define STM32_HAS_TIM1 TRUE
  1699. #define STM32_TIM1_IS_32BITS FALSE
  1700. #define STM32_TIM1_CHANNELS 4
  1701. #define STM32_HAS_TIM2 TRUE
  1702. #define STM32_TIM2_IS_32BITS TRUE
  1703. #define STM32_TIM2_CHANNELS 4
  1704. #define STM32_HAS_TIM3 TRUE
  1705. #define STM32_TIM3_IS_32BITS FALSE
  1706. #define STM32_TIM3_CHANNELS 4
  1707. #define STM32_HAS_TIM6 TRUE
  1708. #define STM32_TIM6_IS_32BITS FALSE
  1709. #define STM32_TIM6_CHANNELS 0
  1710. #define STM32_HAS_TIM7 TRUE
  1711. #define STM32_TIM7_IS_32BITS FALSE
  1712. #define STM32_TIM7_CHANNELS 0
  1713. #define STM32_HAS_TIM14 TRUE
  1714. #define STM32_TIM14_IS_32BITS FALSE
  1715. #define STM32_TIM14_CHANNELS 1
  1716. #define STM32_HAS_TIM15 TRUE
  1717. #define STM32_TIM15_IS_32BITS FALSE
  1718. #define STM32_TIM15_CHANNELS 2
  1719. #define STM32_HAS_TIM16 TRUE
  1720. #define STM32_TIM16_IS_32BITS FALSE
  1721. #define STM32_TIM16_CHANNELS 1
  1722. #define STM32_HAS_TIM17 TRUE
  1723. #define STM32_TIM17_IS_32BITS FALSE
  1724. #define STM32_TIM17_CHANNELS 1
  1725. #define STM32_HAS_TIM4 FALSE
  1726. #define STM32_HAS_TIM5 FALSE
  1727. #define STM32_HAS_TIM8 FALSE
  1728. #define STM32_HAS_TIM9 FALSE
  1729. #define STM32_HAS_TIM10 FALSE
  1730. #define STM32_HAS_TIM11 FALSE
  1731. #define STM32_HAS_TIM12 FALSE
  1732. #define STM32_HAS_TIM13 FALSE
  1733. #define STM32_HAS_TIM18 FALSE
  1734. #define STM32_HAS_TIM19 FALSE
  1735. #define STM32_HAS_TIM20 FALSE
  1736. #define STM32_HAS_TIM21 FALSE
  1737. #define STM32_HAS_TIM22 FALSE
  1738. /* USART attributes.*/
  1739. #define STM32_HAS_USART1 TRUE
  1740. #define STM32_USART1_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1741. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1742. STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1743. STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1744. STM32_DMA_STREAM_ID_MSK(2, 2) |\
  1745. STM32_DMA_STREAM_ID_MSK(2, 3))
  1746. #define STM32_USART1_RX_DMA_CHN 0x00880888
  1747. #define STM32_USART1_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1748. STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1749. STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1750. STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1751. STM32_DMA_STREAM_ID_MSK(2, 4) |\
  1752. STM32_DMA_STREAM_ID_MSK(2, 5))
  1753. #define STM32_USART1_TX_DMA_CHN 0x08088088
  1754. #define STM32_HAS_USART2 TRUE
  1755. #define STM32_USART2_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1756. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1757. STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1758. STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1759. STM32_DMA_STREAM_ID_MSK(2, 2) |\
  1760. STM32_DMA_STREAM_ID_MSK(2, 3))
  1761. #define STM32_USART2_RX_DMA_CHN 0x00990999
  1762. #define STM32_USART2_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1763. STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1764. STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1765. STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1766. STM32_DMA_STREAM_ID_MSK(2, 4) |\
  1767. STM32_DMA_STREAM_ID_MSK(2, 5))
  1768. #define STM32_USART2_TX_DMA_CHN 0x09099099
  1769. #define STM32_HAS_USART3 TRUE
  1770. #define STM32_USART3_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1771. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1772. STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1773. STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1774. STM32_DMA_STREAM_ID_MSK(2, 2) |\
  1775. STM32_DMA_STREAM_ID_MSK(2, 3))
  1776. #define STM32_USART3_RX_DMA_CHN 0x00AA0AAA
  1777. #define STM32_USART3_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1778. STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1779. STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1780. STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1781. STM32_DMA_STREAM_ID_MSK(2, 4) |\
  1782. STM32_DMA_STREAM_ID_MSK(2, 5))
  1783. #define STM32_USART3_TX_DMA_CHN 0x0A0AA0AA
  1784. #define STM32_HAS_UART4 TRUE
  1785. #define STM32_UART4_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1786. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1787. STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1788. STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1789. STM32_DMA_STREAM_ID_MSK(2, 2) |\
  1790. STM32_DMA_STREAM_ID_MSK(2, 3))
  1791. #define STM32_UART4_RX_DMA_CHN 0x00BB0BBB
  1792. #define STM32_UART4_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1793. STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1794. STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1795. STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1796. STM32_DMA_STREAM_ID_MSK(2, 4) |\
  1797. STM32_DMA_STREAM_ID_MSK(2, 5))
  1798. #define STM32_UART4_TX_DMA_CHN 0x0B0BB0BB
  1799. #define STM32_HAS_UART5 TRUE
  1800. #define STM32_UART5_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1801. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1802. STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1803. STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1804. STM32_DMA_STREAM_ID_MSK(2, 2) |\
  1805. STM32_DMA_STREAM_ID_MSK(2, 3))
  1806. #define STM32_UART5_RX_DMA_CHN 0x00CC0CCC
  1807. #define STM32_UART5_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1808. STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1809. STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1810. STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1811. STM32_DMA_STREAM_ID_MSK(2, 4) |\
  1812. STM32_DMA_STREAM_ID_MSK(2, 5))
  1813. #define STM32_UART5_TX_DMA_CHN 0x0C0CC0CC
  1814. #define STM32_HAS_USART6 TRUE
  1815. #define STM32_USART6_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1816. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1817. STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1818. STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1819. STM32_DMA_STREAM_ID_MSK(2, 2) |\
  1820. STM32_DMA_STREAM_ID_MSK(2, 3))
  1821. #define STM32_USART6_RX_DMA_CHN 0x00DD0DDD
  1822. #define STM32_USART6_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1823. STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1824. STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1825. STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1826. STM32_DMA_STREAM_ID_MSK(2, 4) |\
  1827. STM32_DMA_STREAM_ID_MSK(2, 5))
  1828. #define STM32_USART6_TX_DMA_CHN 0x0D0DD0DD
  1829. #define STM32_HAS_UART7 TRUE
  1830. #define STM32_UART7_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1831. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1832. STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1833. STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1834. STM32_DMA_STREAM_ID_MSK(2, 2) |\
  1835. STM32_DMA_STREAM_ID_MSK(2, 3))
  1836. #define STM32_UART7_RX_DMA_CHN 0x00EE0EEE
  1837. #define STM32_UART7_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1838. STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1839. STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1840. STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1841. STM32_DMA_STREAM_ID_MSK(2, 4) |\
  1842. STM32_DMA_STREAM_ID_MSK(2, 5))
  1843. #define STM32_UART7_TX_DMA_CHN 0x0E0EE0EE
  1844. #define STM32_HAS_UART8 TRUE
  1845. #define STM32_UART8_RX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1) |\
  1846. STM32_DMA_STREAM_ID_MSK(1, 3) |\
  1847. STM32_DMA_STREAM_ID_MSK(1, 5) |\
  1848. STM32_DMA_STREAM_ID_MSK(1, 6) |\
  1849. STM32_DMA_STREAM_ID_MSK(2, 2) |\
  1850. STM32_DMA_STREAM_ID_MSK(2, 3))
  1851. #define STM32_UART8_RX_DMA_CHN 0x00FF0FFF
  1852. #define STM32_UART8_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  1853. STM32_DMA_STREAM_ID_MSK(1, 4) |\
  1854. STM32_DMA_STREAM_ID_MSK(1, 7) |\
  1855. STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1856. STM32_DMA_STREAM_ID_MSK(2, 4) |\
  1857. STM32_DMA_STREAM_ID_MSK(2, 5))
  1858. #define STM32_UART8_TX_DMA_CHN 0x0F0FF0FF
  1859. #define STM32_HAS_LPUART1 FALSE
  1860. /* USB attributes.*/
  1861. #define STM32_HAS_USB FALSE
  1862. #define STM32_HAS_OTG1 FALSE
  1863. #define STM32_HAS_OTG2 FALSE
  1864. /* IWDG attributes.*/
  1865. #define STM32_HAS_IWDG TRUE
  1866. #define STM32_IWDG_IS_WINDOWED TRUE
  1867. /* LTDC attributes.*/
  1868. #define STM32_HAS_LTDC FALSE
  1869. /* DMA2D attributes.*/
  1870. #define STM32_HAS_DMA2D FALSE
  1871. /* FSMC attributes.*/
  1872. #define STM32_HAS_FSMC FALSE
  1873. /* CRC attributes.*/
  1874. #define STM32_HAS_CRC TRUE
  1875. #define STM32_CRC_PROGRAMMABLE TRUE
  1876. #else
  1877. #error "STM32F0xx device not specified"
  1878. #endif
  1879. /** @} */
  1880. #endif /* STM32_REGISTRY_H */
  1881. /** @} */