stm32_registry.h 125 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094
  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 STM32F3xx/stm32_registry.h
  15. * @brief STM32F3xx capabilities registry.
  16. *
  17. * @addtogroup HAL
  18. * @{
  19. */
  20. #ifndef STM32_REGISTRY_H
  21. #define STM32_REGISTRY_H
  22. /**
  23. * @brief Sub-family identifier.
  24. */
  25. #if !defined(STM32F3XX) || defined(__DOXYGEN__)
  26. #define STM32F3XX
  27. #endif
  28. /*===========================================================================*/
  29. /* Platform capabilities. */
  30. /*===========================================================================*/
  31. /**
  32. * @name STM32F3xx capabilities
  33. * @{
  34. */
  35. /*===========================================================================*/
  36. /* Common. */
  37. /*===========================================================================*/
  38. /* RNG attributes.*/
  39. #define STM32_HAS_RNG1 TRUE
  40. /*===========================================================================*/
  41. /* STM32F303xC. */
  42. /*===========================================================================*/
  43. #if defined(STM32F303xC) || defined(__DOXYGEN__)
  44. /* ADC attributes.*/
  45. #define STM32_HAS_ADC1 TRUE
  46. #define STM32_ADC1_HANDLER Vector88
  47. #define STM32_ADC1_NUMBER 18
  48. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  49. #define STM32_ADC1_DMA_CHN 0x00000000
  50. #define STM32_HAS_ADC2 TRUE
  51. #define STM32_ADC2_HANDLER Vector88
  52. #define STM32_ADC2_NUMBER 18
  53. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1) |\
  54. STM32_DMA_STREAM_ID_MSK(2, 3))
  55. #define STM32_ADC2_DMA_CHN 0x00000000
  56. #define STM32_HAS_ADC3 TRUE
  57. #define STM32_ADC3_HANDLER VectorFC
  58. #define STM32_ADC3_NUMBER 47
  59. #define STM32_ADC3_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 5))
  60. #define STM32_ADC3_DMA_CHN 0x00000000
  61. #define STM32_HAS_ADC4 TRUE
  62. #define STM32_ADC4_HANDLER Vector134
  63. #define STM32_ADC4_NUMBER 61
  64. #define STM32_ADC4_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2) |\
  65. STM32_DMA_STREAM_ID_MSK(2, 4))
  66. #define STM32_ADC4_DMA_CHN 0x00000000
  67. #define STM32_HAS_SDADC1 FALSE
  68. #define STM32_HAS_SDADC2 FALSE
  69. #define STM32_HAS_SDADC3 FALSE
  70. /* CAN attributes.*/
  71. #define STM32_HAS_CAN1 TRUE
  72. #define STM32_HAS_CAN2 FALSE
  73. #define STM32_HAS_CAN3 FALSE
  74. #define STM32_CAN_MAX_FILTERS 14
  75. /* DAC attributes.*/
  76. #define STM32_HAS_DAC1_CH1 TRUE
  77. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  78. #define STM32_HAS_DAC1_CH2 TRUE
  79. #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
  80. #define STM32_HAS_DAC2_CH1 FALSE
  81. #define STM32_HAS_DAC2_CH2 FALSE
  82. /* DMA attributes.*/
  83. #define STM32_ADVANCED_DMA FALSE
  84. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  85. #define STM32_DMA_SUPPORTS_CSELR FALSE
  86. #define STM32_DMA1_NUM_CHANNELS 7
  87. #define STM32_DMA1_CH1_HANDLER Vector6C
  88. #define STM32_DMA1_CH2_HANDLER Vector70
  89. #define STM32_DMA1_CH3_HANDLER Vector74
  90. #define STM32_DMA1_CH4_HANDLER Vector78
  91. #define STM32_DMA1_CH5_HANDLER Vector7C
  92. #define STM32_DMA1_CH6_HANDLER Vector80
  93. #define STM32_DMA1_CH7_HANDLER Vector84
  94. #define STM32_DMA1_CH1_NUMBER 11
  95. #define STM32_DMA1_CH2_NUMBER 12
  96. #define STM32_DMA1_CH3_NUMBER 13
  97. #define STM32_DMA1_CH4_NUMBER 14
  98. #define STM32_DMA1_CH5_NUMBER 15
  99. #define STM32_DMA1_CH6_NUMBER 16
  100. #define STM32_DMA1_CH7_NUMBER 17
  101. #define STM32_DMA2_NUM_CHANNELS 5
  102. #define STM32_DMA2_CH1_HANDLER Vector120
  103. #define STM32_DMA2_CH2_HANDLER Vector124
  104. #define STM32_DMA2_CH3_HANDLER Vector128
  105. #define STM32_DMA2_CH4_HANDLER Vector12C
  106. #define STM32_DMA2_CH5_HANDLER Vector130
  107. #define STM32_DMA2_CH1_NUMBER 56
  108. #define STM32_DMA2_CH2_NUMBER 57
  109. #define STM32_DMA2_CH3_NUMBER 58
  110. #define STM32_DMA2_CH4_NUMBER 59
  111. #define STM32_DMA2_CH5_NUMBER 60
  112. /* ETH attributes.*/
  113. #define STM32_HAS_ETH FALSE
  114. /* EXTI attributes.*/
  115. #define STM32_EXTI_NUM_LINES 34
  116. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  117. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  118. /* GPIO attributes.*/
  119. #define STM32_HAS_GPIOA TRUE
  120. #define STM32_HAS_GPIOB TRUE
  121. #define STM32_HAS_GPIOC TRUE
  122. #define STM32_HAS_GPIOD TRUE
  123. #define STM32_HAS_GPIOE TRUE
  124. #define STM32_HAS_GPIOF TRUE
  125. #define STM32_HAS_GPIOG FALSE
  126. #define STM32_HAS_GPIOH FALSE
  127. #define STM32_HAS_GPIOI FALSE
  128. #define STM32_HAS_GPIOJ FALSE
  129. #define STM32_HAS_GPIOK FALSE
  130. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  131. RCC_AHBENR_GPIOBEN | \
  132. RCC_AHBENR_GPIOCEN | \
  133. RCC_AHBENR_GPIODEN | \
  134. RCC_AHBENR_GPIOEEN | \
  135. RCC_AHBENR_GPIOFEN)
  136. /* I2C attributes.*/
  137. #define STM32_HAS_I2C1 TRUE
  138. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  139. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  140. #define STM32_HAS_I2C2 TRUE
  141. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  142. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  143. #define STM32_HAS_I2C3 FALSE
  144. #define STM32_HAS_I2C4 FALSE
  145. /* QUADSPI attributes.*/
  146. #define STM32_HAS_QUADSPI1 FALSE
  147. /* RTC attributes.*/
  148. #define STM32_HAS_RTC TRUE
  149. #define STM32_RTC_HAS_SUBSECONDS TRUE
  150. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  151. #define STM32_RTC_NUM_ALARMS 1
  152. #define STM32_RTC_STORAGE_SIZE 64
  153. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  154. #define STM32_RTC_WKUP_HANDLER Vector4C
  155. #define STM32_RTC_ALARM_HANDLER VectorE4
  156. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  157. #define STM32_RTC_WKUP_NUMBER 3
  158. #define STM32_RTC_ALARM_NUMBER 41
  159. #define STM32_RTC_ALARM_EXTI 17
  160. #define STM32_RTC_TAMP_STAMP_EXTI 19
  161. #define STM32_RTC_WKUP_EXTI 20
  162. #define STM32_RTC_IRQ_ENABLE() do { \
  163. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  164. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  165. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  166. } while (false)
  167. /* SDIO attributes.*/
  168. #define STM32_HAS_SDIO FALSE
  169. /* SPI attributes.*/
  170. #define STM32_HAS_SPI1 TRUE
  171. #define STM32_SPI1_SUPPORTS_I2S FALSE
  172. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  173. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  174. #define STM32_HAS_SPI2 TRUE
  175. #define STM32_SPI2_SUPPORTS_I2S TRUE
  176. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  177. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  178. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  179. #define STM32_HAS_SPI3 TRUE
  180. #define STM32_SPI3_SUPPORTS_I2S TRUE
  181. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  182. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
  183. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
  184. #define STM32_HAS_SPI4 FALSE
  185. #define STM32_HAS_SPI5 FALSE
  186. #define STM32_HAS_SPI6 FALSE
  187. /* TIM attributes.*/
  188. #define STM32_TIM_MAX_CHANNELS 6
  189. #define STM32_HAS_TIM1 TRUE
  190. #define STM32_TIM1_IS_32BITS FALSE
  191. #define STM32_TIM1_CHANNELS 6
  192. #define STM32_HAS_TIM2 TRUE
  193. #define STM32_TIM2_IS_32BITS TRUE
  194. #define STM32_TIM2_CHANNELS 4
  195. #define STM32_HAS_TIM3 TRUE
  196. #define STM32_TIM3_IS_32BITS FALSE
  197. #define STM32_TIM3_CHANNELS 4
  198. #define STM32_HAS_TIM4 TRUE
  199. #define STM32_TIM4_IS_32BITS FALSE
  200. #define STM32_TIM4_CHANNELS 4
  201. #define STM32_HAS_TIM6 TRUE
  202. #define STM32_TIM6_IS_32BITS FALSE
  203. #define STM32_TIM6_CHANNELS 0
  204. #define STM32_HAS_TIM7 TRUE
  205. #define STM32_TIM7_IS_32BITS FALSE
  206. #define STM32_TIM7_CHANNELS 0
  207. #define STM32_HAS_TIM8 TRUE
  208. #define STM32_TIM8_IS_32BITS FALSE
  209. #define STM32_TIM8_CHANNELS 6
  210. #define STM32_HAS_TIM15 TRUE
  211. #define STM32_TIM15_IS_32BITS FALSE
  212. #define STM32_TIM15_CHANNELS 2
  213. #define STM32_HAS_TIM16 TRUE
  214. #define STM32_TIM16_IS_32BITS FALSE
  215. #define STM32_TIM16_CHANNELS 1
  216. #define STM32_HAS_TIM17 TRUE
  217. #define STM32_TIM17_IS_32BITS FALSE
  218. #define STM32_TIM17_CHANNELS 1
  219. #define STM32_HAS_TIM5 FALSE
  220. #define STM32_HAS_TIM9 FALSE
  221. #define STM32_HAS_TIM10 FALSE
  222. #define STM32_HAS_TIM11 FALSE
  223. #define STM32_HAS_TIM12 FALSE
  224. #define STM32_HAS_TIM13 FALSE
  225. #define STM32_HAS_TIM14 FALSE
  226. #define STM32_HAS_TIM18 FALSE
  227. #define STM32_HAS_TIM19 FALSE
  228. #define STM32_HAS_TIM20 FALSE
  229. #define STM32_HAS_TIM21 FALSE
  230. #define STM32_HAS_TIM22 FALSE
  231. /* USART attributes.*/
  232. #define STM32_HAS_USART1 TRUE
  233. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  234. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  235. #define STM32_HAS_USART2 TRUE
  236. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  237. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  238. #define STM32_HAS_USART3 TRUE
  239. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  240. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  241. #define STM32_HAS_UART4 TRUE
  242. #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  243. #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
  244. #define STM32_HAS_UART5 TRUE
  245. #define STM32_HAS_USART6 FALSE
  246. #define STM32_HAS_UART7 FALSE
  247. #define STM32_HAS_UART8 FALSE
  248. #define STM32_HAS_LPUART1 FALSE
  249. /* USB attributes.*/
  250. #define STM32_HAS_USB TRUE
  251. #define STM32_USB_ACCESS_SCHEME_2x16 FALSE
  252. #define STM32_USB_PMA_SIZE 512
  253. #define STM32_USB_HAS_BCDR FALSE
  254. #define STM32_HAS_OTG1 FALSE
  255. #define STM32_HAS_OTG2 FALSE
  256. /* IWDG attributes.*/
  257. #define STM32_HAS_IWDG TRUE
  258. #define STM32_IWDG_IS_WINDOWED TRUE
  259. /* LTDC attributes.*/
  260. #define STM32_HAS_LTDC FALSE
  261. /* DMA2D attributes.*/
  262. #define STM32_HAS_DMA2D FALSE
  263. /* FSMC attributes.*/
  264. #define STM32_HAS_FSMC FALSE
  265. /* CRC attributes.*/
  266. #define STM32_HAS_CRC TRUE
  267. #define STM32_CRC_PROGRAMMABLE TRUE
  268. #endif /* defined(STM32F303xC) */
  269. /*===========================================================================*/
  270. /* STM32F303xE. */
  271. /*===========================================================================*/
  272. #if defined(STM32F303xE)
  273. /* ADC attributes.*/
  274. #define STM32_HAS_ADC1 TRUE
  275. #define STM32_ADC1_HANDLER Vector88
  276. #define STM32_ADC1_NUMBER 18
  277. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  278. #define STM32_ADC1_DMA_CHN 0x00000000
  279. #define STM32_HAS_ADC2 TRUE
  280. #define STM32_ADC2_HANDLER Vector88
  281. #define STM32_ADC2_NUMBER 18
  282. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1) |\
  283. STM32_DMA_STREAM_ID_MSK(2, 3))
  284. #define STM32_ADC2_DMA_CHN 0x00000000
  285. #define STM32_HAS_ADC3 TRUE
  286. #define STM32_ADC3_HANDLER VectorFC
  287. #define STM32_ADC3_NUMBER 47
  288. #define STM32_ADC3_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 5))
  289. #define STM32_ADC3_DMA_CHN 0x00000000
  290. #define STM32_HAS_ADC4 TRUE
  291. #define STM32_ADC4_HANDLER Vector134
  292. #define STM32_ADC4_NUMBER 61
  293. #define STM32_ADC4_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2) |\
  294. STM32_DMA_STREAM_ID_MSK(2, 4))
  295. #define STM32_ADC4_DMA_CHN 0x00000000
  296. #define STM32_HAS_SDADC1 FALSE
  297. #define STM32_HAS_SDADC2 FALSE
  298. #define STM32_HAS_SDADC3 FALSE
  299. /* CAN attributes.*/
  300. #define STM32_HAS_CAN1 TRUE
  301. #define STM32_HAS_CAN2 FALSE
  302. #define STM32_HAS_CAN3 FALSE
  303. #define STM32_CAN_MAX_FILTERS 14
  304. /* DAC attributes.*/
  305. #define STM32_HAS_DAC1_CH1 TRUE
  306. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  307. #define STM32_HAS_DAC1_CH2 TRUE
  308. #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
  309. #define STM32_HAS_DAC2_CH1 FALSE
  310. #define STM32_HAS_DAC2_CH2 FALSE
  311. /* DMA attributes.*/
  312. #define STM32_ADVANCED_DMA FALSE
  313. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  314. #define STM32_DMA_SUPPORTS_CSELR FALSE
  315. #define STM32_DMA1_NUM_CHANNELS 7
  316. #define STM32_DMA1_CH1_HANDLER Vector6C
  317. #define STM32_DMA1_CH2_HANDLER Vector70
  318. #define STM32_DMA1_CH3_HANDLER Vector74
  319. #define STM32_DMA1_CH4_HANDLER Vector78
  320. #define STM32_DMA1_CH5_HANDLER Vector7C
  321. #define STM32_DMA1_CH6_HANDLER Vector80
  322. #define STM32_DMA1_CH7_HANDLER Vector84
  323. #define STM32_DMA1_CH1_NUMBER 11
  324. #define STM32_DMA1_CH2_NUMBER 12
  325. #define STM32_DMA1_CH3_NUMBER 13
  326. #define STM32_DMA1_CH4_NUMBER 14
  327. #define STM32_DMA1_CH5_NUMBER 15
  328. #define STM32_DMA1_CH6_NUMBER 16
  329. #define STM32_DMA1_CH7_NUMBER 17
  330. #define STM32_DMA2_NUM_CHANNELS 5
  331. #define STM32_DMA2_CH1_HANDLER Vector120
  332. #define STM32_DMA2_CH2_HANDLER Vector124
  333. #define STM32_DMA2_CH3_HANDLER Vector128
  334. #define STM32_DMA2_CH4_HANDLER Vector12C
  335. #define STM32_DMA2_CH5_HANDLER Vector130
  336. #define STM32_DMA2_CH1_NUMBER 56
  337. #define STM32_DMA2_CH2_NUMBER 57
  338. #define STM32_DMA2_CH3_NUMBER 58
  339. #define STM32_DMA2_CH4_NUMBER 59
  340. #define STM32_DMA2_CH5_NUMBER 60
  341. /* ETH attributes.*/
  342. #define STM32_HAS_ETH FALSE
  343. /* EXTI attributes.*/
  344. #define STM32_EXTI_NUM_LINES 34
  345. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  346. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  347. /* GPIO attributes.*/
  348. #define STM32_HAS_GPIOA TRUE
  349. #define STM32_HAS_GPIOB TRUE
  350. #define STM32_HAS_GPIOC TRUE
  351. #define STM32_HAS_GPIOD TRUE
  352. #define STM32_HAS_GPIOE TRUE
  353. #define STM32_HAS_GPIOF TRUE
  354. #define STM32_HAS_GPIOG TRUE
  355. #define STM32_HAS_GPIOH TRUE
  356. #define STM32_HAS_GPIOI FALSE
  357. #define STM32_HAS_GPIOJ FALSE
  358. #define STM32_HAS_GPIOK FALSE
  359. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  360. RCC_AHBENR_GPIOBEN | \
  361. RCC_AHBENR_GPIOCEN | \
  362. RCC_AHBENR_GPIODEN | \
  363. RCC_AHBENR_GPIOEEN | \
  364. RCC_AHBENR_GPIOFEN | \
  365. RCC_AHBENR_GPIOGEN | \
  366. RCC_AHBENR_GPIOHEN)
  367. /* I2C attributes.*/
  368. #define STM32_HAS_I2C1 TRUE
  369. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  370. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  371. #define STM32_HAS_I2C2 TRUE
  372. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  373. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  374. #define STM32_HAS_I2C3 TRUE
  375. #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  376. #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
  377. #define STM32_HAS_I2C4 FALSE
  378. /* QUADSPI attributes.*/
  379. #define STM32_HAS_QUADSPI1 FALSE
  380. /* RTC attributes.*/
  381. #define STM32_HAS_RTC TRUE
  382. #define STM32_RTC_HAS_SUBSECONDS TRUE
  383. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  384. #define STM32_RTC_NUM_ALARMS 2
  385. #define STM32_RTC_STORAGE_SIZE 64
  386. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  387. #define STM32_RTC_WKUP_HANDLER Vector4C
  388. #define STM32_RTC_ALARM_HANDLER VectorE4
  389. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  390. #define STM32_RTC_WKUP_NUMBER 3
  391. #define STM32_RTC_ALARM_NUMBER 41
  392. #define STM32_RTC_ALARM_EXTI 17
  393. #define STM32_RTC_TAMP_STAMP_EXTI 19
  394. #define STM32_RTC_WKUP_EXTI 20
  395. #define STM32_RTC_IRQ_ENABLE() do { \
  396. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  397. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  398. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  399. } while (false)
  400. /* SDIO attributes.*/
  401. #define STM32_HAS_SDIO FALSE
  402. /* SPI attributes.*/
  403. #define STM32_HAS_SPI1 TRUE
  404. #define STM32_SPI1_SUPPORTS_I2S FALSE
  405. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  406. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  407. #define STM32_HAS_SPI2 TRUE
  408. #define STM32_SPI2_SUPPORTS_I2S TRUE
  409. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  410. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  411. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  412. #define STM32_HAS_SPI3 TRUE
  413. #define STM32_SPI3_SUPPORTS_I2S TRUE
  414. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  415. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
  416. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
  417. #define STM32_HAS_SPI4 TRUE
  418. #define STM32_SPI4_SUPPORTS_I2S FALSE
  419. #define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  420. #define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  421. #define STM32_HAS_SPI5 FALSE
  422. #define STM32_HAS_SPI6 FALSE
  423. /* TIM attributes.*/
  424. #define STM32_TIM_MAX_CHANNELS 6
  425. #define STM32_HAS_TIM1 TRUE
  426. #define STM32_TIM1_IS_32BITS FALSE
  427. #define STM32_TIM1_CHANNELS 6
  428. #define STM32_HAS_TIM2 TRUE
  429. #define STM32_TIM2_IS_32BITS TRUE
  430. #define STM32_TIM2_CHANNELS 4
  431. #define STM32_HAS_TIM3 TRUE
  432. #define STM32_TIM3_IS_32BITS FALSE
  433. #define STM32_TIM3_CHANNELS 4
  434. #define STM32_HAS_TIM4 TRUE
  435. #define STM32_TIM4_IS_32BITS FALSE
  436. #define STM32_TIM4_CHANNELS 4
  437. #define STM32_HAS_TIM6 TRUE
  438. #define STM32_TIM6_IS_32BITS FALSE
  439. #define STM32_TIM6_CHANNELS 0
  440. #define STM32_HAS_TIM7 TRUE
  441. #define STM32_TIM7_IS_32BITS FALSE
  442. #define STM32_TIM7_CHANNELS 0
  443. #define STM32_HAS_TIM8 TRUE
  444. #define STM32_TIM8_IS_32BITS FALSE
  445. #define STM32_TIM8_CHANNELS 6
  446. #define STM32_HAS_TIM15 TRUE
  447. #define STM32_TIM15_IS_32BITS FALSE
  448. #define STM32_TIM15_CHANNELS 2
  449. #define STM32_HAS_TIM16 TRUE
  450. #define STM32_TIM16_IS_32BITS FALSE
  451. #define STM32_TIM16_CHANNELS 1
  452. #define STM32_HAS_TIM17 TRUE
  453. #define STM32_TIM17_IS_32BITS FALSE
  454. #define STM32_TIM17_CHANNELS 1
  455. #define STM32_HAS_TIM20 TRUE
  456. #define STM32_TIM20_IS_32BITS FALSE
  457. #define STM32_TIM20_CHANNELS 6
  458. #define STM32_HAS_TIM5 FALSE
  459. #define STM32_HAS_TIM9 FALSE
  460. #define STM32_HAS_TIM10 FALSE
  461. #define STM32_HAS_TIM11 FALSE
  462. #define STM32_HAS_TIM12 FALSE
  463. #define STM32_HAS_TIM13 FALSE
  464. #define STM32_HAS_TIM14 FALSE
  465. #define STM32_HAS_TIM18 FALSE
  466. #define STM32_HAS_TIM19 FALSE
  467. #define STM32_HAS_TIM21 FALSE
  468. #define STM32_HAS_TIM22 FALSE
  469. /* USART attributes.*/
  470. #define STM32_HAS_USART1 TRUE
  471. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  472. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  473. #define STM32_HAS_USART2 TRUE
  474. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  475. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  476. #define STM32_HAS_USART3 TRUE
  477. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  478. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  479. #define STM32_HAS_UART4 TRUE
  480. #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  481. #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
  482. #define STM32_HAS_UART5 TRUE
  483. #define STM32_HAS_USART6 FALSE
  484. #define STM32_HAS_UART7 FALSE
  485. #define STM32_HAS_UART8 FALSE
  486. #define STM32_HAS_LPUART1 FALSE
  487. /* USB attributes.*/
  488. #define STM32_HAS_USB TRUE
  489. #define STM32_USB_ACCESS_SCHEME_2x16 TRUE
  490. #define STM32_USB_PMA_SIZE 768
  491. #define STM32_USB_HAS_BCDR FALSE
  492. #define STM32_HAS_OTG1 FALSE
  493. #define STM32_HAS_OTG2 FALSE
  494. /* IWDG attributes.*/
  495. #define STM32_HAS_IWDG TRUE
  496. #define STM32_IWDG_IS_WINDOWED TRUE
  497. /* LTDC attributes.*/
  498. #define STM32_HAS_LTDC FALSE
  499. /* DMA2D attributes.*/
  500. #define STM32_HAS_DMA2D FALSE
  501. /* FSMC attributes.*/
  502. #define STM32_HAS_FSMC FALSE
  503. /* CRC attributes.*/
  504. #define STM32_HAS_CRC TRUE
  505. #define STM32_CRC_PROGRAMMABLE TRUE
  506. #endif /* defined(STM32F303xE) */
  507. /*===========================================================================*/
  508. /* STM32F303x8. */
  509. /*===========================================================================*/
  510. #if defined(STM32F303x8)
  511. /* ADC attributes.*/
  512. #define STM32_HAS_ADC1 TRUE
  513. #define STM32_ADC1_HANDLER Vector88
  514. #define STM32_ADC1_NUMBER 18
  515. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  516. #define STM32_ADC1_DMA_CHN 0x00000000
  517. #define STM32_HAS_ADC2 TRUE
  518. #define STM32_ADC2_HANDLER Vector88
  519. #define STM32_ADC2_NUMBER 18
  520. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2))
  521. #define STM32_ADC2_DMA_CHN 0x00000000
  522. #define STM32_HAS_ADC3 FALSE
  523. #define STM32_HAS_ADC4 FALSE
  524. #define STM32_HAS_SDADC1 FALSE
  525. #define STM32_HAS_SDADC2 FALSE
  526. #define STM32_HAS_SDADC3 FALSE
  527. /* CAN attributes.*/
  528. #define STM32_HAS_CAN1 TRUE
  529. #define STM32_HAS_CAN2 FALSE
  530. #define STM32_HAS_CAN3 FALSE
  531. #define STM32_CAN_MAX_FILTERS 14
  532. /* DAC attributes.*/
  533. #define STM32_HAS_DAC1_CH1 TRUE
  534. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  535. #define STM32_HAS_DAC1_CH2 TRUE
  536. #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  537. #define STM32_HAS_DAC2_CH1 TRUE
  538. #define STM32_DAC_DAC2_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  539. #define STM32_HAS_DAC2_CH2 FALSE
  540. /* DMA attributes.*/
  541. #define STM32_ADVANCED_DMA FALSE
  542. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  543. #define STM32_DMA_SUPPORTS_CSELR FALSE
  544. #define STM32_DMA1_NUM_CHANNELS 7
  545. #define STM32_DMA1_CH1_HANDLER Vector6C
  546. #define STM32_DMA1_CH2_HANDLER Vector70
  547. #define STM32_DMA1_CH3_HANDLER Vector74
  548. #define STM32_DMA1_CH4_HANDLER Vector78
  549. #define STM32_DMA1_CH5_HANDLER Vector7C
  550. #define STM32_DMA1_CH6_HANDLER Vector80
  551. #define STM32_DMA1_CH7_HANDLER Vector84
  552. #define STM32_DMA1_CH1_NUMBER 11
  553. #define STM32_DMA1_CH2_NUMBER 12
  554. #define STM32_DMA1_CH3_NUMBER 13
  555. #define STM32_DMA1_CH4_NUMBER 14
  556. #define STM32_DMA1_CH5_NUMBER 15
  557. #define STM32_DMA1_CH6_NUMBER 16
  558. #define STM32_DMA1_CH7_NUMBER 17
  559. #define STM32_DMA2_NUM_CHANNELS 0
  560. /* ETH attributes.*/
  561. #define STM32_HAS_ETH FALSE
  562. /* EXTI attributes.*/
  563. #define STM32_EXTI_NUM_LINES 33
  564. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  565. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  566. /* GPIO attributes.*/
  567. #define STM32_HAS_GPIOA TRUE
  568. #define STM32_HAS_GPIOB TRUE
  569. #define STM32_HAS_GPIOC TRUE
  570. #define STM32_HAS_GPIOD TRUE
  571. #define STM32_HAS_GPIOE FALSE
  572. #define STM32_HAS_GPIOF TRUE
  573. #define STM32_HAS_GPIOG FALSE
  574. #define STM32_HAS_GPIOH FALSE
  575. #define STM32_HAS_GPIOI FALSE
  576. #define STM32_HAS_GPIOJ FALSE
  577. #define STM32_HAS_GPIOK FALSE
  578. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  579. RCC_AHBENR_GPIOBEN | \
  580. RCC_AHBENR_GPIOCEN | \
  581. RCC_AHBENR_GPIODEN | \
  582. RCC_AHBENR_GPIOFEN)
  583. /* I2C attributes.*/
  584. #define STM32_HAS_I2C1 TRUE
  585. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  586. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  587. #define STM32_HAS_I2C2 FALSE
  588. #define STM32_HAS_I2C3 FALSE
  589. #define STM32_HAS_I2C4 FALSE
  590. /* QUADSPI attributes.*/
  591. #define STM32_HAS_QUADSPI1 FALSE
  592. /* RTC attributes.*/
  593. #define STM32_HAS_RTC TRUE
  594. #define STM32_RTC_HAS_SUBSECONDS TRUE
  595. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  596. #define STM32_RTC_NUM_ALARMS 2
  597. #define STM32_RTC_STORAGE_SIZE 64
  598. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  599. #define STM32_RTC_WKUP_HANDLER Vector4C
  600. #define STM32_RTC_ALARM_HANDLER VectorE4
  601. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  602. #define STM32_RTC_WKUP_NUMBER 3
  603. #define STM32_RTC_ALARM_NUMBER 41
  604. #define STM32_RTC_ALARM_EXTI 17
  605. #define STM32_RTC_TAMP_STAMP_EXTI 19
  606. #define STM32_RTC_WKUP_EXTI 20
  607. #define STM32_RTC_IRQ_ENABLE() do { \
  608. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  609. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  610. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  611. } while (false)
  612. /* SDIO attributes.*/
  613. #define STM32_HAS_SDIO FALSE
  614. /* SPI attributes.*/
  615. #define STM32_HAS_SPI1 TRUE
  616. #define STM32_SPI1_SUPPORTS_I2S FALSE
  617. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  618. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  619. #define STM32_HAS_SPI2 FALSE
  620. #define STM32_HAS_SPI3 FALSE
  621. #define STM32_HAS_SPI4 FALSE
  622. #define STM32_HAS_SPI5 FALSE
  623. #define STM32_HAS_SPI6 FALSE
  624. /* TIM attributes.*/
  625. #define STM32_TIM_MAX_CHANNELS 6
  626. #define STM32_HAS_TIM1 TRUE
  627. #define STM32_TIM1_IS_32BITS FALSE
  628. #define STM32_TIM1_CHANNELS 6
  629. #define STM32_HAS_TIM2 TRUE
  630. #define STM32_TIM2_IS_32BITS TRUE
  631. #define STM32_TIM2_CHANNELS 4
  632. #define STM32_HAS_TIM3 TRUE
  633. #define STM32_TIM3_IS_32BITS FALSE
  634. #define STM32_TIM3_CHANNELS 4
  635. #define STM32_HAS_TIM4 TRUE
  636. #define STM32_TIM4_IS_32BITS FALSE
  637. #define STM32_TIM4_CHANNELS 4
  638. #define STM32_HAS_TIM6 TRUE
  639. #define STM32_TIM6_IS_32BITS FALSE
  640. #define STM32_TIM6_CHANNELS 0
  641. #define STM32_HAS_TIM7 TRUE
  642. #define STM32_TIM7_IS_32BITS FALSE
  643. #define STM32_TIM7_CHANNELS 0
  644. #define STM32_HAS_TIM15 TRUE
  645. #define STM32_TIM15_IS_32BITS FALSE
  646. #define STM32_TIM15_CHANNELS 2
  647. #define STM32_HAS_TIM16 TRUE
  648. #define STM32_TIM16_IS_32BITS FALSE
  649. #define STM32_TIM16_CHANNELS 1
  650. #define STM32_HAS_TIM17 TRUE
  651. #define STM32_TIM17_IS_32BITS FALSE
  652. #define STM32_TIM17_CHANNELS 1
  653. #define STM32_HAS_TIM5 FALSE
  654. #define STM32_HAS_TIM8 FALSE
  655. #define STM32_HAS_TIM9 FALSE
  656. #define STM32_HAS_TIM10 FALSE
  657. #define STM32_HAS_TIM11 FALSE
  658. #define STM32_HAS_TIM12 FALSE
  659. #define STM32_HAS_TIM13 FALSE
  660. #define STM32_HAS_TIM14 FALSE
  661. #define STM32_HAS_TIM18 FALSE
  662. #define STM32_HAS_TIM19 FALSE
  663. #define STM32_HAS_TIM20 FALSE
  664. #define STM32_HAS_TIM21 FALSE
  665. #define STM32_HAS_TIM22 FALSE
  666. /* USART attributes.*/
  667. #define STM32_HAS_USART1 TRUE
  668. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  669. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  670. #define STM32_HAS_USART2 TRUE
  671. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  672. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  673. #define STM32_HAS_USART3 TRUE
  674. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  675. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  676. #define STM32_HAS_UART4 FALSE
  677. #define STM32_HAS_UART5 FALSE
  678. #define STM32_HAS_USART6 FALSE
  679. #define STM32_HAS_UART7 FALSE
  680. #define STM32_HAS_UART8 FALSE
  681. #define STM32_HAS_LPUART1 FALSE
  682. /* USB attributes.*/
  683. #define STM32_HAS_USB FALSE
  684. #define STM32_HAS_OTG1 FALSE
  685. #define STM32_HAS_OTG2 FALSE
  686. /* IWDG attributes.*/
  687. #define STM32_HAS_IWDG TRUE
  688. #define STM32_IWDG_IS_WINDOWED TRUE
  689. /* LTDC attributes.*/
  690. #define STM32_HAS_LTDC FALSE
  691. /* DMA2D attributes.*/
  692. #define STM32_HAS_DMA2D FALSE
  693. /* FSMC attributes.*/
  694. #define STM32_HAS_FSMC FALSE
  695. /* CRC attributes.*/
  696. #define STM32_HAS_CRC TRUE
  697. #define STM32_CRC_PROGRAMMABLE TRUE
  698. #endif /* defined(STM32F303x8) */
  699. /*===========================================================================*/
  700. /* STM32F301x8. */
  701. /*===========================================================================*/
  702. #if defined(STM32F301x8)
  703. /* ADC attributes.*/
  704. #define STM32_HAS_ADC1 TRUE
  705. #define STM32_ADC1_HANDLER Vector88
  706. #define STM32_ADC1_NUMBER 18
  707. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  708. #define STM32_ADC1_DMA_CHN 0x00000000
  709. #define STM32_HAS_ADC2 FALSE
  710. #define STM32_HAS_ADC3 FALSE
  711. #define STM32_HAS_ADC4 FALSE
  712. #define STM32_HAS_SDADC1 FALSE
  713. #define STM32_HAS_SDADC2 FALSE
  714. #define STM32_HAS_SDADC3 FALSE
  715. /* CAN attributes.*/
  716. #define STM32_HAS_CAN1 FALSE
  717. #define STM32_HAS_CAN2 FALSE
  718. #define STM32_HAS_CAN3 FALSE
  719. #define STM32_CAN_MAX_FILTERS 14
  720. /* DAC attributes.*/
  721. #define STM32_HAS_DAC1_CH1 TRUE
  722. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  723. #define STM32_HAS_DAC1_CH2 FALSE
  724. #define STM32_HAS_DAC2_CH1 FALSE
  725. #define STM32_HAS_DAC2_CH2 FALSE
  726. /* DMA attributes.*/
  727. #define STM32_ADVANCED_DMA FALSE
  728. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  729. #define STM32_DMA_SUPPORTS_CSELR FALSE
  730. #define STM32_DMA1_NUM_CHANNELS 7
  731. #define STM32_DMA1_CH1_HANDLER Vector6C
  732. #define STM32_DMA1_CH2_HANDLER Vector70
  733. #define STM32_DMA1_CH3_HANDLER Vector74
  734. #define STM32_DMA1_CH4_HANDLER Vector78
  735. #define STM32_DMA1_CH5_HANDLER Vector7C
  736. #define STM32_DMA1_CH6_HANDLER Vector80
  737. #define STM32_DMA1_CH7_HANDLER Vector84
  738. #define STM32_DMA1_CH1_NUMBER 11
  739. #define STM32_DMA1_CH2_NUMBER 12
  740. #define STM32_DMA1_CH3_NUMBER 13
  741. #define STM32_DMA1_CH4_NUMBER 14
  742. #define STM32_DMA1_CH5_NUMBER 15
  743. #define STM32_DMA1_CH6_NUMBER 16
  744. #define STM32_DMA1_CH7_NUMBER 17
  745. #define STM32_DMA2_NUM_CHANNELS 0
  746. /* ETH attributes.*/
  747. #define STM32_HAS_ETH FALSE
  748. /* EXTI attributes.*/
  749. #define STM32_EXTI_NUM_LINES 33
  750. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  751. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  752. /* GPIO attributes.*/
  753. #define STM32_HAS_GPIOA TRUE
  754. #define STM32_HAS_GPIOB TRUE
  755. #define STM32_HAS_GPIOC TRUE
  756. #define STM32_HAS_GPIOD TRUE
  757. #define STM32_HAS_GPIOE FALSE
  758. #define STM32_HAS_GPIOF TRUE
  759. #define STM32_HAS_GPIOG FALSE
  760. #define STM32_HAS_GPIOH FALSE
  761. #define STM32_HAS_GPIOI FALSE
  762. #define STM32_HAS_GPIOJ FALSE
  763. #define STM32_HAS_GPIOK FALSE
  764. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  765. RCC_AHBENR_GPIOBEN | \
  766. RCC_AHBENR_GPIOCEN | \
  767. RCC_AHBENR_GPIODEN | \
  768. RCC_AHBENR_GPIOFEN)
  769. /* I2C attributes.*/
  770. #define STM32_HAS_I2C1 TRUE
  771. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  772. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  773. #define STM32_HAS_I2C2 TRUE
  774. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  775. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  776. #define STM32_HAS_I2C3 TRUE
  777. #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  778. #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
  779. #define STM32_HAS_I2C4 FALSE
  780. /* QUADSPI attributes.*/
  781. #define STM32_HAS_QUADSPI1 FALSE
  782. /* RTC attributes.*/
  783. #define STM32_HAS_RTC TRUE
  784. #define STM32_RTC_HAS_SUBSECONDS TRUE
  785. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  786. #define STM32_RTC_NUM_ALARMS 2
  787. #define STM32_RTC_STORAGE_SIZE 64
  788. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  789. #define STM32_RTC_WKUP_HANDLER Vector4C
  790. #define STM32_RTC_ALARM_HANDLER VectorE4
  791. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  792. #define STM32_RTC_WKUP_NUMBER 3
  793. #define STM32_RTC_ALARM_NUMBER 41
  794. #define STM32_RTC_ALARM_EXTI 17
  795. #define STM32_RTC_TAMP_STAMP_EXTI 19
  796. #define STM32_RTC_WKUP_EXTI 20
  797. #define STM32_RTC_IRQ_ENABLE() do { \
  798. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  799. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  800. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  801. } while (false)
  802. /* SDIO attributes.*/
  803. #define STM32_HAS_SDIO FALSE
  804. /* SPI attributes.*/
  805. #define STM32_HAS_SPI2 TRUE
  806. #define STM32_SPI2_SUPPORTS_I2S TRUE
  807. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  808. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  809. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  810. #define STM32_HAS_SPI3 TRUE
  811. #define STM32_SPI3_SUPPORTS_I2S TRUE
  812. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  813. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  814. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  815. #define STM32_HAS_SPI1 FALSE
  816. #define STM32_HAS_SPI4 FALSE
  817. #define STM32_HAS_SPI5 FALSE
  818. #define STM32_HAS_SPI6 FALSE
  819. /* TIM attributes.*/
  820. #define STM32_TIM_MAX_CHANNELS 6
  821. #define STM32_HAS_TIM1 TRUE
  822. #define STM32_TIM1_IS_32BITS FALSE
  823. #define STM32_TIM1_CHANNELS 6
  824. #define STM32_HAS_TIM2 TRUE
  825. #define STM32_TIM2_IS_32BITS TRUE
  826. #define STM32_TIM2_CHANNELS 4
  827. #define STM32_HAS_TIM6 TRUE
  828. #define STM32_TIM6_IS_32BITS FALSE
  829. #define STM32_TIM6_CHANNELS 0
  830. #define STM32_HAS_TIM15 TRUE
  831. #define STM32_TIM15_IS_32BITS FALSE
  832. #define STM32_TIM15_CHANNELS 2
  833. #define STM32_HAS_TIM16 TRUE
  834. #define STM32_TIM16_IS_32BITS FALSE
  835. #define STM32_TIM16_CHANNELS 1
  836. #define STM32_HAS_TIM17 TRUE
  837. #define STM32_TIM17_IS_32BITS FALSE
  838. #define STM32_TIM17_CHANNELS 1
  839. #define STM32_HAS_TIM3 FALSE
  840. #define STM32_HAS_TIM4 FALSE
  841. #define STM32_HAS_TIM5 FALSE
  842. #define STM32_HAS_TIM7 FALSE
  843. #define STM32_HAS_TIM8 FALSE
  844. #define STM32_HAS_TIM9 FALSE
  845. #define STM32_HAS_TIM10 FALSE
  846. #define STM32_HAS_TIM11 FALSE
  847. #define STM32_HAS_TIM12 FALSE
  848. #define STM32_HAS_TIM13 FALSE
  849. #define STM32_HAS_TIM14 FALSE
  850. #define STM32_HAS_TIM18 FALSE
  851. #define STM32_HAS_TIM19 FALSE
  852. #define STM32_HAS_TIM20 FALSE
  853. #define STM32_HAS_TIM21 FALSE
  854. #define STM32_HAS_TIM22 FALSE
  855. /* USART attributes.*/
  856. #define STM32_HAS_USART1 TRUE
  857. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  858. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  859. #define STM32_HAS_USART2 TRUE
  860. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  861. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  862. #define STM32_HAS_USART3 TRUE
  863. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  864. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  865. #define STM32_HAS_UART4 FALSE
  866. #define STM32_HAS_UART5 FALSE
  867. #define STM32_HAS_USART6 FALSE
  868. #define STM32_HAS_UART7 FALSE
  869. #define STM32_HAS_UART8 FALSE
  870. #define STM32_HAS_LPUART1 FALSE
  871. /* USB attributes.*/
  872. #define STM32_HAS_USB FALSE
  873. #define STM32_HAS_OTG1 FALSE
  874. #define STM32_HAS_OTG2 FALSE
  875. /* IWDG attributes.*/
  876. #define STM32_HAS_IWDG TRUE
  877. #define STM32_IWDG_IS_WINDOWED TRUE
  878. /* LTDC attributes.*/
  879. #define STM32_HAS_LTDC FALSE
  880. /* DMA2D attributes.*/
  881. #define STM32_HAS_DMA2D FALSE
  882. /* FSMC attributes.*/
  883. #define STM32_HAS_FSMC FALSE
  884. /* CRC attributes.*/
  885. #define STM32_HAS_CRC TRUE
  886. #define STM32_CRC_PROGRAMMABLE TRUE
  887. #endif /* defined(STM32F301x8) */
  888. /*===========================================================================*/
  889. /* STM32F302x8. */
  890. /*===========================================================================*/
  891. #if defined(STM32F302x8)
  892. /* ADC attributes.*/
  893. #define STM32_HAS_ADC1 TRUE
  894. #define STM32_ADC1_HANDLER Vector88
  895. #define STM32_ADC1_NUMBER 18
  896. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  897. #define STM32_ADC1_DMA_CHN 0x00000000
  898. #define STM32_HAS_ADC2 FALSE
  899. #define STM32_HAS_ADC3 FALSE
  900. #define STM32_HAS_ADC4 FALSE
  901. #define STM32_HAS_SDADC1 FALSE
  902. #define STM32_HAS_SDADC2 FALSE
  903. #define STM32_HAS_SDADC3 FALSE
  904. /* CAN attributes.*/
  905. #define STM32_HAS_CAN1 TRUE
  906. #define STM32_HAS_CAN2 FALSE
  907. #define STM32_HAS_CAN3 FALSE
  908. #define STM32_CAN_MAX_FILTERS 14
  909. /* DAC attributes.*/
  910. #define STM32_HAS_DAC1_CH1 TRUE
  911. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  912. #define STM32_HAS_DAC1_CH2 FALSE
  913. #define STM32_HAS_DAC2_CH1 FALSE
  914. #define STM32_HAS_DAC2_CH2 FALSE
  915. /* DMA attributes.*/
  916. #define STM32_ADVANCED_DMA FALSE
  917. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  918. #define STM32_DMA_SUPPORTS_CSELR FALSE
  919. #define STM32_DMA1_NUM_CHANNELS 7
  920. #define STM32_DMA1_CH1_HANDLER Vector6C
  921. #define STM32_DMA1_CH2_HANDLER Vector70
  922. #define STM32_DMA1_CH3_HANDLER Vector74
  923. #define STM32_DMA1_CH4_HANDLER Vector78
  924. #define STM32_DMA1_CH5_HANDLER Vector7C
  925. #define STM32_DMA1_CH6_HANDLER Vector80
  926. #define STM32_DMA1_CH7_HANDLER Vector84
  927. #define STM32_DMA1_CH1_NUMBER 11
  928. #define STM32_DMA1_CH2_NUMBER 12
  929. #define STM32_DMA1_CH3_NUMBER 13
  930. #define STM32_DMA1_CH4_NUMBER 14
  931. #define STM32_DMA1_CH5_NUMBER 15
  932. #define STM32_DMA1_CH6_NUMBER 16
  933. #define STM32_DMA1_CH7_NUMBER 17
  934. #define STM32_DMA2_NUM_CHANNELS 0
  935. /* ETH attributes.*/
  936. #define STM32_HAS_ETH FALSE
  937. /* EXTI attributes.*/
  938. #define STM32_EXTI_NUM_LINES 33
  939. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  940. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  941. /* GPIO attributes.*/
  942. #define STM32_HAS_GPIOA TRUE
  943. #define STM32_HAS_GPIOB TRUE
  944. #define STM32_HAS_GPIOC TRUE
  945. #define STM32_HAS_GPIOD TRUE
  946. #define STM32_HAS_GPIOE FALSE
  947. #define STM32_HAS_GPIOF TRUE
  948. #define STM32_HAS_GPIOG FALSE
  949. #define STM32_HAS_GPIOH FALSE
  950. #define STM32_HAS_GPIOI FALSE
  951. #define STM32_HAS_GPIOJ FALSE
  952. #define STM32_HAS_GPIOK FALSE
  953. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  954. RCC_AHBENR_GPIOBEN | \
  955. RCC_AHBENR_GPIOCEN | \
  956. RCC_AHBENR_GPIODEN | \
  957. RCC_AHBENR_GPIOFEN)
  958. /* I2C attributes.*/
  959. #define STM32_HAS_I2C1 TRUE
  960. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  961. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  962. #define STM32_HAS_I2C2 TRUE
  963. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  964. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  965. #define STM32_HAS_I2C3 TRUE
  966. #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  967. #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
  968. #define STM32_HAS_I2C4 FALSE
  969. /* QUADSPI attributes.*/
  970. #define STM32_HAS_QUADSPI1 FALSE
  971. /* RTC attributes.*/
  972. #define STM32_HAS_RTC TRUE
  973. #define STM32_RTC_HAS_SUBSECONDS TRUE
  974. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  975. #define STM32_RTC_NUM_ALARMS 2
  976. #define STM32_RTC_STORAGE_SIZE 64
  977. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  978. #define STM32_RTC_WKUP_HANDLER Vector4C
  979. #define STM32_RTC_ALARM_HANDLER VectorE4
  980. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  981. #define STM32_RTC_WKUP_NUMBER 3
  982. #define STM32_RTC_ALARM_NUMBER 41
  983. #define STM32_RTC_ALARM_EXTI 17
  984. #define STM32_RTC_TAMP_STAMP_EXTI 19
  985. #define STM32_RTC_WKUP_EXTI 20
  986. #define STM32_RTC_IRQ_ENABLE() do { \
  987. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  988. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  989. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  990. } while (false)
  991. /* SDIO attributes.*/
  992. #define STM32_HAS_SDIO FALSE
  993. /* SPI attributes.*/
  994. #define STM32_HAS_SPI2 TRUE
  995. #define STM32_SPI2_SUPPORTS_I2S TRUE
  996. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  997. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  998. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  999. #define STM32_HAS_SPI3 TRUE
  1000. #define STM32_SPI3_SUPPORTS_I2S TRUE
  1001. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  1002. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1003. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1004. #define STM32_HAS_SPI1 FALSE
  1005. #define STM32_HAS_SPI4 FALSE
  1006. #define STM32_HAS_SPI5 FALSE
  1007. #define STM32_HAS_SPI6 FALSE
  1008. /* TIM attributes.*/
  1009. #define STM32_TIM_MAX_CHANNELS 6
  1010. #define STM32_HAS_TIM1 TRUE
  1011. #define STM32_TIM1_IS_32BITS FALSE
  1012. #define STM32_TIM1_CHANNELS 6
  1013. #define STM32_HAS_TIM2 TRUE
  1014. #define STM32_TIM2_IS_32BITS TRUE
  1015. #define STM32_TIM2_CHANNELS 4
  1016. #define STM32_HAS_TIM6 TRUE
  1017. #define STM32_TIM6_IS_32BITS FALSE
  1018. #define STM32_TIM6_CHANNELS 0
  1019. #define STM32_HAS_TIM15 TRUE
  1020. #define STM32_TIM15_IS_32BITS FALSE
  1021. #define STM32_TIM15_CHANNELS 2
  1022. #define STM32_HAS_TIM16 TRUE
  1023. #define STM32_TIM16_IS_32BITS FALSE
  1024. #define STM32_TIM16_CHANNELS 1
  1025. #define STM32_HAS_TIM17 TRUE
  1026. #define STM32_TIM17_IS_32BITS FALSE
  1027. #define STM32_TIM17_CHANNELS 1
  1028. #define STM32_HAS_TIM3 FALSE
  1029. #define STM32_HAS_TIM4 FALSE
  1030. #define STM32_HAS_TIM5 FALSE
  1031. #define STM32_HAS_TIM7 FALSE
  1032. #define STM32_HAS_TIM8 FALSE
  1033. #define STM32_HAS_TIM9 FALSE
  1034. #define STM32_HAS_TIM10 FALSE
  1035. #define STM32_HAS_TIM11 FALSE
  1036. #define STM32_HAS_TIM12 FALSE
  1037. #define STM32_HAS_TIM13 FALSE
  1038. #define STM32_HAS_TIM14 FALSE
  1039. #define STM32_HAS_TIM18 FALSE
  1040. #define STM32_HAS_TIM19 FALSE
  1041. #define STM32_HAS_TIM20 FALSE
  1042. #define STM32_HAS_TIM21 FALSE
  1043. #define STM32_HAS_TIM22 FALSE
  1044. /* USART attributes.*/
  1045. #define STM32_HAS_USART1 TRUE
  1046. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1047. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1048. #define STM32_HAS_USART2 TRUE
  1049. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1050. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1051. #define STM32_HAS_USART3 TRUE
  1052. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1053. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1054. #define STM32_HAS_UART4 FALSE
  1055. #define STM32_HAS_UART5 FALSE
  1056. #define STM32_HAS_USART6 FALSE
  1057. #define STM32_HAS_UART7 FALSE
  1058. #define STM32_HAS_UART8 FALSE
  1059. #define STM32_HAS_LPUART1 FALSE
  1060. /* USB attributes.*/
  1061. #define STM32_HAS_USB TRUE
  1062. #define STM32_USB_ACCESS_SCHEME_2x16 TRUE
  1063. #define STM32_USB_PMA_SIZE 768
  1064. #define STM32_USB_HAS_BCDR FALSE
  1065. #define STM32_HAS_OTG1 FALSE
  1066. #define STM32_HAS_OTG2 FALSE
  1067. /* IWDG attributes.*/
  1068. #define STM32_HAS_IWDG TRUE
  1069. #define STM32_IWDG_IS_WINDOWED TRUE
  1070. /* LTDC attributes.*/
  1071. #define STM32_HAS_LTDC FALSE
  1072. /* DMA2D attributes.*/
  1073. #define STM32_HAS_DMA2D FALSE
  1074. /* FSMC attributes.*/
  1075. #define STM32_HAS_FSMC FALSE
  1076. /* CRC attributes.*/
  1077. #define STM32_HAS_CRC TRUE
  1078. #define STM32_CRC_PROGRAMMABLE TRUE
  1079. #endif /* defined(STM32F302x8) */
  1080. /*===========================================================================*/
  1081. /* STM32F302xC. */
  1082. /*===========================================================================*/
  1083. #if defined(STM32F302xC)
  1084. /* ADC attributes.*/
  1085. #define STM32_HAS_ADC1 TRUE
  1086. #define STM32_ADC1_HANDLER Vector88
  1087. #define STM32_ADC1_NUMBER 18
  1088. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  1089. #define STM32_ADC1_DMA_CHN 0x00000000
  1090. #define STM32_HAS_ADC2 TRUE
  1091. #define STM32_ADC2_HANDLER Vector88
  1092. #define STM32_ADC2_NUMBER 18
  1093. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1094. STM32_DMA_STREAM_ID_MSK(2, 3))
  1095. #define STM32_ADC2_DMA_CHN 0x00000000
  1096. #define STM32_HAS_ADC3 FALSE
  1097. #define STM32_HAS_ADC4 FALSE
  1098. #define STM32_HAS_SDADC1 FALSE
  1099. #define STM32_HAS_SDADC2 FALSE
  1100. #define STM32_HAS_SDADC3 FALSE
  1101. /* CAN attributes.*/
  1102. #define STM32_HAS_CAN1 TRUE
  1103. #define STM32_HAS_CAN2 FALSE
  1104. #define STM32_HAS_CAN3 FALSE
  1105. #define STM32_CAN_MAX_FILTERS 14
  1106. /* DAC attributes.*/
  1107. #define STM32_HAS_DAC1_CH1 TRUE
  1108. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  1109. #define STM32_HAS_DAC1_CH2 FALSE
  1110. #define STM32_HAS_DAC2_CH1 FALSE
  1111. #define STM32_HAS_DAC2_CH2 FALSE
  1112. /* DMA attributes.*/
  1113. #define STM32_ADVANCED_DMA FALSE
  1114. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  1115. #define STM32_DMA_SUPPORTS_CSELR FALSE
  1116. #define STM32_DMA1_NUM_CHANNELS 7
  1117. #define STM32_DMA1_CH1_HANDLER Vector6C
  1118. #define STM32_DMA1_CH2_HANDLER Vector70
  1119. #define STM32_DMA1_CH3_HANDLER Vector74
  1120. #define STM32_DMA1_CH4_HANDLER Vector78
  1121. #define STM32_DMA1_CH5_HANDLER Vector7C
  1122. #define STM32_DMA1_CH6_HANDLER Vector80
  1123. #define STM32_DMA1_CH7_HANDLER Vector84
  1124. #define STM32_DMA1_CH1_NUMBER 11
  1125. #define STM32_DMA1_CH2_NUMBER 12
  1126. #define STM32_DMA1_CH3_NUMBER 13
  1127. #define STM32_DMA1_CH4_NUMBER 14
  1128. #define STM32_DMA1_CH5_NUMBER 15
  1129. #define STM32_DMA1_CH6_NUMBER 16
  1130. #define STM32_DMA1_CH7_NUMBER 17
  1131. #define STM32_DMA2_NUM_CHANNELS 5
  1132. #define STM32_DMA2_CH1_HANDLER Vector120
  1133. #define STM32_DMA2_CH2_HANDLER Vector124
  1134. #define STM32_DMA2_CH3_HANDLER Vector128
  1135. #define STM32_DMA2_CH4_HANDLER Vector12C
  1136. #define STM32_DMA2_CH5_HANDLER Vector130
  1137. #define STM32_DMA2_CH1_NUMBER 56
  1138. #define STM32_DMA2_CH2_NUMBER 57
  1139. #define STM32_DMA2_CH3_NUMBER 58
  1140. #define STM32_DMA2_CH4_NUMBER 59
  1141. #define STM32_DMA2_CH5_NUMBER 60
  1142. /* ETH attributes.*/
  1143. #define STM32_HAS_ETH FALSE
  1144. /* EXTI attributes.*/
  1145. #define STM32_EXTI_NUM_LINES 34
  1146. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  1147. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  1148. /* GPIO attributes.*/
  1149. #define STM32_HAS_GPIOA TRUE
  1150. #define STM32_HAS_GPIOB TRUE
  1151. #define STM32_HAS_GPIOC TRUE
  1152. #define STM32_HAS_GPIOD TRUE
  1153. #define STM32_HAS_GPIOE TRUE
  1154. #define STM32_HAS_GPIOF TRUE
  1155. #define STM32_HAS_GPIOG FALSE
  1156. #define STM32_HAS_GPIOH FALSE
  1157. #define STM32_HAS_GPIOI FALSE
  1158. #define STM32_HAS_GPIOJ FALSE
  1159. #define STM32_HAS_GPIOK FALSE
  1160. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  1161. RCC_AHBENR_GPIOBEN | \
  1162. RCC_AHBENR_GPIOCEN | \
  1163. RCC_AHBENR_GPIODEN | \
  1164. RCC_AHBENR_GPIOEEN | \
  1165. RCC_AHBENR_GPIOFEN)
  1166. /* I2C attributes.*/
  1167. #define STM32_HAS_I2C1 TRUE
  1168. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1169. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1170. #define STM32_HAS_I2C2 TRUE
  1171. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1172. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1173. #define STM32_HAS_I2C3 FALSE
  1174. #define STM32_HAS_I2C4 FALSE
  1175. /* QUADSPI attributes.*/
  1176. #define STM32_HAS_QUADSPI1 FALSE
  1177. /* RTC attributes.*/
  1178. #define STM32_HAS_RTC TRUE
  1179. #define STM32_RTC_HAS_SUBSECONDS TRUE
  1180. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  1181. #define STM32_RTC_NUM_ALARMS 2
  1182. #define STM32_RTC_STORAGE_SIZE 64
  1183. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  1184. #define STM32_RTC_WKUP_HANDLER Vector4C
  1185. #define STM32_RTC_ALARM_HANDLER VectorE4
  1186. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  1187. #define STM32_RTC_WKUP_NUMBER 3
  1188. #define STM32_RTC_ALARM_NUMBER 41
  1189. #define STM32_RTC_ALARM_EXTI 17
  1190. #define STM32_RTC_TAMP_STAMP_EXTI 19
  1191. #define STM32_RTC_WKUP_EXTI 20
  1192. #define STM32_RTC_IRQ_ENABLE() do { \
  1193. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  1194. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  1195. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  1196. } while (false)
  1197. /* SDIO attributes.*/
  1198. #define STM32_HAS_SDIO FALSE
  1199. /* SPI attributes.*/
  1200. #define STM32_HAS_SPI1 TRUE
  1201. #define STM32_SPI1_SUPPORTS_I2S FALSE
  1202. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1203. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1204. #define STM32_HAS_SPI2 TRUE
  1205. #define STM32_SPI2_SUPPORTS_I2S TRUE
  1206. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  1207. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1208. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1209. #define STM32_HAS_SPI3 TRUE
  1210. #define STM32_SPI3_SUPPORTS_I2S TRUE
  1211. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  1212. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
  1213. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
  1214. #define STM32_HAS_SPI4 FALSE
  1215. #define STM32_HAS_SPI5 FALSE
  1216. #define STM32_HAS_SPI6 FALSE
  1217. /* TIM attributes.*/
  1218. #define STM32_TIM_MAX_CHANNELS 6
  1219. #define STM32_HAS_TIM1 TRUE
  1220. #define STM32_TIM1_IS_32BITS FALSE
  1221. #define STM32_TIM1_CHANNELS 6
  1222. #define STM32_HAS_TIM2 TRUE
  1223. #define STM32_TIM2_IS_32BITS TRUE
  1224. #define STM32_TIM2_CHANNELS 4
  1225. #define STM32_HAS_TIM3 TRUE
  1226. #define STM32_TIM3_IS_32BITS FALSE
  1227. #define STM32_TIM3_CHANNELS 4
  1228. #define STM32_HAS_TIM4 TRUE
  1229. #define STM32_TIM4_IS_32BITS FALSE
  1230. #define STM32_TIM4_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_TIM15 TRUE
  1235. #define STM32_TIM15_IS_32BITS FALSE
  1236. #define STM32_TIM15_CHANNELS 2
  1237. #define STM32_HAS_TIM16 TRUE
  1238. #define STM32_TIM16_IS_32BITS FALSE
  1239. #define STM32_TIM16_CHANNELS 1
  1240. #define STM32_HAS_TIM17 TRUE
  1241. #define STM32_TIM17_IS_32BITS FALSE
  1242. #define STM32_TIM17_CHANNELS 1
  1243. #define STM32_HAS_TIM5 FALSE
  1244. #define STM32_HAS_TIM7 FALSE
  1245. #define STM32_HAS_TIM8 FALSE
  1246. #define STM32_HAS_TIM9 FALSE
  1247. #define STM32_HAS_TIM10 FALSE
  1248. #define STM32_HAS_TIM11 FALSE
  1249. #define STM32_HAS_TIM12 FALSE
  1250. #define STM32_HAS_TIM13 FALSE
  1251. #define STM32_HAS_TIM14 FALSE
  1252. #define STM32_HAS_TIM18 FALSE
  1253. #define STM32_HAS_TIM19 FALSE
  1254. #define STM32_HAS_TIM20 FALSE
  1255. #define STM32_HAS_TIM21 FALSE
  1256. #define STM32_HAS_TIM22 FALSE
  1257. /* USART attributes.*/
  1258. #define STM32_HAS_USART1 TRUE
  1259. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1260. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1261. #define STM32_HAS_USART2 TRUE
  1262. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1263. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1264. #define STM32_HAS_USART3 TRUE
  1265. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1266. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1267. #define STM32_HAS_UART4 TRUE
  1268. #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  1269. #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
  1270. #define STM32_HAS_UART5 TRUE
  1271. #define STM32_HAS_USART6 FALSE
  1272. #define STM32_HAS_UART7 FALSE
  1273. #define STM32_HAS_UART8 FALSE
  1274. #define STM32_HAS_LPUART1 FALSE
  1275. /* USB attributes.*/
  1276. #define STM32_HAS_USB TRUE
  1277. #define STM32_USB_ACCESS_SCHEME_2x16 FALSE
  1278. #define STM32_USB_PMA_SIZE 512
  1279. #define STM32_USB_HAS_BCDR FALSE
  1280. #define STM32_HAS_OTG1 FALSE
  1281. #define STM32_HAS_OTG2 FALSE
  1282. /* IWDG attributes.*/
  1283. #define STM32_HAS_IWDG TRUE
  1284. #define STM32_IWDG_IS_WINDOWED TRUE
  1285. /* LTDC attributes.*/
  1286. #define STM32_HAS_LTDC FALSE
  1287. /* DMA2D attributes.*/
  1288. #define STM32_HAS_DMA2D FALSE
  1289. /* FSMC attributes.*/
  1290. #define STM32_HAS_FSMC FALSE
  1291. /* CRC attributes.*/
  1292. #define STM32_HAS_CRC TRUE
  1293. #define STM32_CRC_PROGRAMMABLE TRUE
  1294. #endif /* defined(STM32F302xC) */
  1295. /*===========================================================================*/
  1296. /* STM32F302xE. */
  1297. /*===========================================================================*/
  1298. #if defined(STM32F302xE)
  1299. /* ADC attributes.*/
  1300. #define STM32_HAS_ADC1 TRUE
  1301. #define STM32_ADC1_HANDLER Vector88
  1302. #define STM32_ADC1_NUMBER 18
  1303. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  1304. #define STM32_ADC1_DMA_CHN 0x00000000
  1305. #define STM32_HAS_ADC2 TRUE
  1306. #define STM32_ADC2_HANDLER Vector88
  1307. #define STM32_ADC2_NUMBER 18
  1308. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1309. STM32_DMA_STREAM_ID_MSK(2, 3))
  1310. #define STM32_ADC2_DMA_CHN 0x00000000
  1311. #define STM32_HAS_ADC3 FALSE
  1312. #define STM32_HAS_ADC4 FALSE
  1313. #define STM32_HAS_SDADC1 FALSE
  1314. #define STM32_HAS_SDADC2 FALSE
  1315. #define STM32_HAS_SDADC3 FALSE
  1316. /* CAN attributes.*/
  1317. #define STM32_HAS_CAN1 TRUE
  1318. #define STM32_HAS_CAN2 FALSE
  1319. #define STM32_HAS_CAN3 FALSE
  1320. #define STM32_CAN_MAX_FILTERS 14
  1321. /* DAC attributes.*/
  1322. #define STM32_HAS_DAC1_CH1 TRUE
  1323. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  1324. #define STM32_HAS_DAC1_CH2 FALSE
  1325. #define STM32_HAS_DAC2_CH1 FALSE
  1326. #define STM32_HAS_DAC2_CH2 FALSE
  1327. /* DMA attributes.*/
  1328. #define STM32_ADVANCED_DMA FALSE
  1329. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  1330. #define STM32_DMA_SUPPORTS_CSELR FALSE
  1331. #define STM32_DMA1_NUM_CHANNELS 7
  1332. #define STM32_DMA1_CH1_HANDLER Vector6C
  1333. #define STM32_DMA1_CH2_HANDLER Vector70
  1334. #define STM32_DMA1_CH3_HANDLER Vector74
  1335. #define STM32_DMA1_CH4_HANDLER Vector78
  1336. #define STM32_DMA1_CH5_HANDLER Vector7C
  1337. #define STM32_DMA1_CH6_HANDLER Vector80
  1338. #define STM32_DMA1_CH7_HANDLER Vector84
  1339. #define STM32_DMA1_CH1_NUMBER 11
  1340. #define STM32_DMA1_CH2_NUMBER 12
  1341. #define STM32_DMA1_CH3_NUMBER 13
  1342. #define STM32_DMA1_CH4_NUMBER 14
  1343. #define STM32_DMA1_CH5_NUMBER 15
  1344. #define STM32_DMA1_CH6_NUMBER 16
  1345. #define STM32_DMA1_CH7_NUMBER 17
  1346. #define STM32_DMA2_NUM_CHANNELS 5
  1347. #define STM32_DMA2_CH1_HANDLER Vector120
  1348. #define STM32_DMA2_CH2_HANDLER Vector124
  1349. #define STM32_DMA2_CH3_HANDLER Vector128
  1350. #define STM32_DMA2_CH4_HANDLER Vector12C
  1351. #define STM32_DMA2_CH5_HANDLER Vector130
  1352. #define STM32_DMA2_CH1_NUMBER 56
  1353. #define STM32_DMA2_CH2_NUMBER 57
  1354. #define STM32_DMA2_CH3_NUMBER 58
  1355. #define STM32_DMA2_CH4_NUMBER 59
  1356. #define STM32_DMA2_CH5_NUMBER 60
  1357. /* ETH attributes.*/
  1358. #define STM32_HAS_ETH FALSE
  1359. /* EXTI attributes.*/
  1360. #define STM32_EXTI_NUM_LINES 34
  1361. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  1362. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  1363. /* GPIO attributes.*/
  1364. #define STM32_HAS_GPIOA TRUE
  1365. #define STM32_HAS_GPIOB TRUE
  1366. #define STM32_HAS_GPIOC TRUE
  1367. #define STM32_HAS_GPIOD TRUE
  1368. #define STM32_HAS_GPIOE TRUE
  1369. #define STM32_HAS_GPIOF TRUE
  1370. #define STM32_HAS_GPIOG TRUE
  1371. #define STM32_HAS_GPIOH TRUE
  1372. #define STM32_HAS_GPIOI FALSE
  1373. #define STM32_HAS_GPIOJ FALSE
  1374. #define STM32_HAS_GPIOK FALSE
  1375. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  1376. RCC_AHBENR_GPIOBEN | \
  1377. RCC_AHBENR_GPIOCEN | \
  1378. RCC_AHBENR_GPIODEN | \
  1379. RCC_AHBENR_GPIOEEN | \
  1380. RCC_AHBENR_GPIOFEN | \
  1381. RCC_AHBENR_GPIOGEN | \
  1382. RCC_AHBENR_GPIOHEN)
  1383. /* I2C attributes.*/
  1384. #define STM32_HAS_I2C1 TRUE
  1385. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1386. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1387. #define STM32_HAS_I2C2 TRUE
  1388. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1389. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1390. #define STM32_HAS_I2C3 TRUE
  1391. #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1392. #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
  1393. #define STM32_HAS_I2C4 FALSE
  1394. /* QUADSPI attributes.*/
  1395. #define STM32_HAS_QUADSPI1 FALSE
  1396. /* RTC attributes.*/
  1397. #define STM32_HAS_RTC TRUE
  1398. #define STM32_RTC_HAS_SUBSECONDS TRUE
  1399. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  1400. #define STM32_RTC_NUM_ALARMS 2
  1401. #define STM32_RTC_STORAGE_SIZE 64
  1402. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  1403. #define STM32_RTC_WKUP_HANDLER Vector4C
  1404. #define STM32_RTC_ALARM_HANDLER VectorE4
  1405. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  1406. #define STM32_RTC_WKUP_NUMBER 3
  1407. #define STM32_RTC_ALARM_NUMBER 41
  1408. #define STM32_RTC_ALARM_EXTI 17
  1409. #define STM32_RTC_TAMP_STAMP_EXTI 19
  1410. #define STM32_RTC_WKUP_EXTI 20
  1411. #define STM32_RTC_IRQ_ENABLE() do { \
  1412. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  1413. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  1414. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  1415. } while (false)
  1416. /* SDIO attributes.*/
  1417. #define STM32_HAS_SDIO FALSE
  1418. /* SPI attributes.*/
  1419. #define STM32_HAS_SPI1 TRUE
  1420. #define STM32_SPI1_SUPPORTS_I2S FALSE
  1421. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1422. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1423. #define STM32_HAS_SPI2 TRUE
  1424. #define STM32_SPI2_SUPPORTS_I2S TRUE
  1425. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  1426. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1427. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1428. #define STM32_HAS_SPI3 TRUE
  1429. #define STM32_SPI3_SUPPORTS_I2S TRUE
  1430. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  1431. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
  1432. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
  1433. #define STM32_HAS_SPI4 TRUE
  1434. #define STM32_SPI4_SUPPORTS_I2S FALSE
  1435. #define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1436. #define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1437. #define STM32_HAS_SPI5 FALSE
  1438. #define STM32_HAS_SPI6 FALSE
  1439. /* TIM attributes.*/
  1440. #define STM32_TIM_MAX_CHANNELS 6
  1441. #define STM32_HAS_TIM1 TRUE
  1442. #define STM32_TIM1_IS_32BITS FALSE
  1443. #define STM32_TIM1_CHANNELS 6
  1444. #define STM32_HAS_TIM2 TRUE
  1445. #define STM32_TIM2_IS_32BITS TRUE
  1446. #define STM32_TIM2_CHANNELS 4
  1447. #define STM32_HAS_TIM3 TRUE
  1448. #define STM32_TIM3_IS_32BITS FALSE
  1449. #define STM32_TIM3_CHANNELS 4
  1450. #define STM32_HAS_TIM4 TRUE
  1451. #define STM32_TIM4_IS_32BITS FALSE
  1452. #define STM32_TIM4_CHANNELS 4
  1453. #define STM32_HAS_TIM6 TRUE
  1454. #define STM32_TIM6_IS_32BITS FALSE
  1455. #define STM32_TIM6_CHANNELS 0
  1456. #define STM32_HAS_TIM15 TRUE
  1457. #define STM32_TIM15_IS_32BITS FALSE
  1458. #define STM32_TIM15_CHANNELS 2
  1459. #define STM32_HAS_TIM16 TRUE
  1460. #define STM32_TIM16_IS_32BITS FALSE
  1461. #define STM32_TIM16_CHANNELS 1
  1462. #define STM32_HAS_TIM17 TRUE
  1463. #define STM32_TIM17_IS_32BITS FALSE
  1464. #define STM32_TIM17_CHANNELS 1
  1465. #define STM32_HAS_TIM5 FALSE
  1466. #define STM32_HAS_TIM7 FALSE
  1467. #define STM32_HAS_TIM8 FALSE
  1468. #define STM32_HAS_TIM9 FALSE
  1469. #define STM32_HAS_TIM10 FALSE
  1470. #define STM32_HAS_TIM11 FALSE
  1471. #define STM32_HAS_TIM12 FALSE
  1472. #define STM32_HAS_TIM13 FALSE
  1473. #define STM32_HAS_TIM14 FALSE
  1474. #define STM32_HAS_TIM18 FALSE
  1475. #define STM32_HAS_TIM19 FALSE
  1476. #define STM32_HAS_TIM20 FALSE
  1477. #define STM32_HAS_TIM21 FALSE
  1478. #define STM32_HAS_TIM22 FALSE
  1479. /* USART attributes.*/
  1480. #define STM32_HAS_USART1 TRUE
  1481. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1482. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1483. #define STM32_HAS_USART2 TRUE
  1484. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1485. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1486. #define STM32_HAS_USART3 TRUE
  1487. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1488. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1489. #define STM32_HAS_UART4 TRUE
  1490. #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  1491. #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
  1492. #define STM32_HAS_UART5 TRUE
  1493. #define STM32_HAS_USART6 FALSE
  1494. #define STM32_HAS_UART7 FALSE
  1495. #define STM32_HAS_UART8 FALSE
  1496. #define STM32_HAS_LPUART1 FALSE
  1497. /* USB attributes.*/
  1498. #define STM32_HAS_USB TRUE
  1499. #define STM32_USB_ACCESS_SCHEME_2x16 TRUE
  1500. #define STM32_USB_PMA_SIZE 768
  1501. #define STM32_USB_HAS_BCDR FALSE
  1502. #define STM32_HAS_OTG1 FALSE
  1503. #define STM32_HAS_OTG2 FALSE
  1504. /* IWDG attributes.*/
  1505. #define STM32_HAS_IWDG TRUE
  1506. #define STM32_IWDG_IS_WINDOWED TRUE
  1507. /* LTDC attributes.*/
  1508. #define STM32_HAS_LTDC FALSE
  1509. /* DMA2D attributes.*/
  1510. #define STM32_HAS_DMA2D FALSE
  1511. /* FSMC attributes.*/
  1512. #define STM32_HAS_FSMC FALSE
  1513. /* CRC attributes.*/
  1514. #define STM32_HAS_CRC TRUE
  1515. #define STM32_CRC_PROGRAMMABLE TRUE
  1516. #endif /* defined(STM32F302xE) */
  1517. /*===========================================================================*/
  1518. /* STM32F318x8. */
  1519. /*===========================================================================*/
  1520. #if defined(STM32F318x8)
  1521. /* ADC attributes.*/
  1522. #define STM32_HAS_ADC1 TRUE
  1523. #define STM32_ADC1_HANDLER Vector88
  1524. #define STM32_ADC1_NUMBER 18
  1525. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  1526. #define STM32_ADC1_DMA_CHN 0x00000000
  1527. #define STM32_HAS_ADC2 FALSE
  1528. #define STM32_HAS_ADC3 FALSE
  1529. #define STM32_HAS_ADC4 FALSE
  1530. #define STM32_HAS_SDADC1 FALSE
  1531. #define STM32_HAS_SDADC2 FALSE
  1532. #define STM32_HAS_SDADC3 FALSE
  1533. /* CAN attributes.*/
  1534. #define STM32_HAS_CAN1 TRUE
  1535. #define STM32_HAS_CAN2 FALSE
  1536. #define STM32_HAS_CAN3 FALSE
  1537. #define STM32_CAN_MAX_FILTERS 14
  1538. /* DAC attributes.*/
  1539. #define STM32_HAS_DAC1_CH1 TRUE
  1540. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1541. #define STM32_HAS_DAC1_CH2 FALSE
  1542. #define STM32_HAS_DAC2_CH1 FALSE
  1543. #define STM32_HAS_DAC2_CH2 FALSE
  1544. /* DMA attributes.*/
  1545. #define STM32_ADVANCED_DMA FALSE
  1546. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  1547. #define STM32_DMA_SUPPORTS_CSELR FALSE
  1548. #define STM32_DMA1_NUM_CHANNELS 7
  1549. #define STM32_DMA1_CH1_HANDLER Vector6C
  1550. #define STM32_DMA1_CH2_HANDLER Vector70
  1551. #define STM32_DMA1_CH3_HANDLER Vector74
  1552. #define STM32_DMA1_CH4_HANDLER Vector78
  1553. #define STM32_DMA1_CH5_HANDLER Vector7C
  1554. #define STM32_DMA1_CH6_HANDLER Vector80
  1555. #define STM32_DMA1_CH7_HANDLER Vector84
  1556. #define STM32_DMA1_CH1_NUMBER 11
  1557. #define STM32_DMA1_CH2_NUMBER 12
  1558. #define STM32_DMA1_CH3_NUMBER 13
  1559. #define STM32_DMA1_CH4_NUMBER 14
  1560. #define STM32_DMA1_CH5_NUMBER 15
  1561. #define STM32_DMA1_CH6_NUMBER 16
  1562. #define STM32_DMA1_CH7_NUMBER 17
  1563. #define STM32_DMA2_NUM_CHANNELS 0
  1564. /* ETH attributes.*/
  1565. #define STM32_HAS_ETH FALSE
  1566. /* EXTI attributes.*/
  1567. #define STM32_EXTI_NUM_LINES 33
  1568. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  1569. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  1570. /* GPIO attributes.*/
  1571. #define STM32_HAS_GPIOA TRUE
  1572. #define STM32_HAS_GPIOB TRUE
  1573. #define STM32_HAS_GPIOC TRUE
  1574. #define STM32_HAS_GPIOD FALSE
  1575. #define STM32_HAS_GPIOE FALSE
  1576. #define STM32_HAS_GPIOF TRUE
  1577. #define STM32_HAS_GPIOG FALSE
  1578. #define STM32_HAS_GPIOH FALSE
  1579. #define STM32_HAS_GPIOI FALSE
  1580. #define STM32_HAS_GPIOJ FALSE
  1581. #define STM32_HAS_GPIOK FALSE
  1582. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  1583. RCC_AHBENR_GPIOBEN | \
  1584. RCC_AHBENR_GPIOCEN | \
  1585. RCC_AHBENR_GPIOFEN)
  1586. /* I2C attributes.*/
  1587. #define STM32_HAS_I2C1 TRUE
  1588. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1589. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1590. #define STM32_HAS_I2C2 TRUE
  1591. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1592. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1593. #define STM32_HAS_I2C3 TRUE
  1594. #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1595. #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
  1596. #define STM32_HAS_I2C4 FALSE
  1597. /* QUADSPI attributes.*/
  1598. #define STM32_HAS_QUADSPI1 FALSE
  1599. /* RTC attributes.*/
  1600. #define STM32_HAS_RTC TRUE
  1601. #define STM32_RTC_HAS_SUBSECONDS TRUE
  1602. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  1603. #define STM32_RTC_NUM_ALARMS 2
  1604. #define STM32_RTC_STORAGE_SIZE 64
  1605. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  1606. #define STM32_RTC_WKUP_HANDLER Vector4C
  1607. #define STM32_RTC_ALARM_HANDLER VectorE4
  1608. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  1609. #define STM32_RTC_WKUP_NUMBER 3
  1610. #define STM32_RTC_ALARM_NUMBER 41
  1611. #define STM32_RTC_ALARM_EXTI 17
  1612. #define STM32_RTC_TAMP_STAMP_EXTI 19
  1613. #define STM32_RTC_WKUP_EXTI 20
  1614. #define STM32_RTC_IRQ_ENABLE() do { \
  1615. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  1616. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  1617. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  1618. } while (false)
  1619. /* SDIO attributes.*/
  1620. #define STM32_HAS_SDIO FALSE
  1621. /* SPI attributes.*/
  1622. #define STM32_HAS_SPI2 TRUE
  1623. #define STM32_SPI2_SUPPORTS_I2S TRUE
  1624. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  1625. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1626. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1627. #define STM32_HAS_SPI3 TRUE
  1628. #define STM32_SPI3_SUPPORTS_I2S TRUE
  1629. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  1630. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1631. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1632. #define STM32_HAS_SPI1 FALSE
  1633. #define STM32_HAS_SPI4 FALSE
  1634. #define STM32_HAS_SPI5 FALSE
  1635. #define STM32_HAS_SPI6 FALSE
  1636. /* TIM attributes.*/
  1637. #define STM32_TIM_MAX_CHANNELS 6
  1638. #define STM32_HAS_TIM1 TRUE
  1639. #define STM32_TIM1_IS_32BITS FALSE
  1640. #define STM32_TIM1_CHANNELS 6
  1641. #define STM32_HAS_TIM2 TRUE
  1642. #define STM32_TIM2_IS_32BITS TRUE
  1643. #define STM32_TIM2_CHANNELS 4
  1644. #define STM32_HAS_TIM6 TRUE
  1645. #define STM32_TIM6_IS_32BITS FALSE
  1646. #define STM32_TIM6_CHANNELS 0
  1647. #define STM32_HAS_TIM15 TRUE
  1648. #define STM32_TIM15_IS_32BITS FALSE
  1649. #define STM32_TIM15_CHANNELS 2
  1650. #define STM32_HAS_TIM16 TRUE
  1651. #define STM32_TIM16_IS_32BITS FALSE
  1652. #define STM32_TIM16_CHANNELS 1
  1653. #define STM32_HAS_TIM17 TRUE
  1654. #define STM32_TIM17_IS_32BITS FALSE
  1655. #define STM32_TIM17_CHANNELS 1
  1656. #define STM32_HAS_TIM3 FALSE
  1657. #define STM32_HAS_TIM4 FALSE
  1658. #define STM32_HAS_TIM5 FALSE
  1659. #define STM32_HAS_TIM7 FALSE
  1660. #define STM32_HAS_TIM8 FALSE
  1661. #define STM32_HAS_TIM9 FALSE
  1662. #define STM32_HAS_TIM10 FALSE
  1663. #define STM32_HAS_TIM11 FALSE
  1664. #define STM32_HAS_TIM12 FALSE
  1665. #define STM32_HAS_TIM13 FALSE
  1666. #define STM32_HAS_TIM14 FALSE
  1667. #define STM32_HAS_TIM18 FALSE
  1668. #define STM32_HAS_TIM19 FALSE
  1669. #define STM32_HAS_TIM20 FALSE
  1670. #define STM32_HAS_TIM21 FALSE
  1671. #define STM32_HAS_TIM22 FALSE
  1672. /* USART attributes.*/
  1673. #define STM32_HAS_USART1 TRUE
  1674. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1675. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1676. #define STM32_HAS_USART2 TRUE
  1677. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1678. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1679. #define STM32_HAS_USART3 TRUE
  1680. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1681. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1682. #define STM32_HAS_UART4 FALSE
  1683. #define STM32_HAS_UART5 FALSE
  1684. #define STM32_HAS_USART6 FALSE
  1685. #define STM32_HAS_UART7 FALSE
  1686. #define STM32_HAS_UART8 FALSE
  1687. #define STM32_HAS_LPUART1 FALSE
  1688. /* USB attributes.*/
  1689. #define STM32_HAS_USB FALSE
  1690. #define STM32_HAS_OTG1 FALSE
  1691. #define STM32_HAS_OTG2 FALSE
  1692. /* IWDG attributes.*/
  1693. #define STM32_HAS_IWDG TRUE
  1694. #define STM32_IWDG_IS_WINDOWED TRUE
  1695. /* LTDC attributes.*/
  1696. #define STM32_HAS_LTDC FALSE
  1697. /* DMA2D attributes.*/
  1698. #define STM32_HAS_DMA2D FALSE
  1699. /* FSMC attributes.*/
  1700. #define STM32_HAS_FSMC FALSE
  1701. /* CRC attributes.*/
  1702. #define STM32_HAS_CRC TRUE
  1703. #define STM32_CRC_PROGRAMMABLE TRUE
  1704. #endif /* defined(STM32F318x8) */
  1705. /*===========================================================================*/
  1706. /* STM32F328x8. */
  1707. /*===========================================================================*/
  1708. #if defined(STM32F328x8)
  1709. /* ADC attributes.*/
  1710. #define STM32_HAS_ADC1 TRUE
  1711. #define STM32_ADC1_HANDLER Vector88
  1712. #define STM32_ADC1_NUMBER 18
  1713. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  1714. #define STM32_ADC1_DMA_CHN 0x00000000
  1715. #define STM32_HAS_ADC2 TRUE
  1716. #define STM32_ADC2_HANDLER Vector88
  1717. #define STM32_ADC2_NUMBER 18
  1718. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1719. STM32_DMA_STREAM_ID_MSK(2, 3))
  1720. #define STM32_ADC2_DMA_CHN 0x00000000
  1721. #define STM32_HAS_ADC3 FALSE
  1722. #define STM32_HAS_ADC4 FALSE
  1723. #define STM32_HAS_SDADC1 FALSE
  1724. #define STM32_HAS_SDADC2 FALSE
  1725. #define STM32_HAS_SDADC3 FALSE
  1726. /* CAN attributes.*/
  1727. #define STM32_HAS_CAN1 TRUE
  1728. #define STM32_HAS_CAN2 FALSE
  1729. #define STM32_HAS_CAN3 FALSE
  1730. #define STM32_CAN_MAX_FILTERS 14
  1731. /* DAC attributes.*/
  1732. #define STM32_HAS_DAC1_CH1 TRUE
  1733. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1734. #define STM32_HAS_DAC1_CH2 TRUE
  1735. #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1736. #define STM32_HAS_DAC2_CH1 TRUE
  1737. #define STM32_DAC_DAC2_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1738. #define STM32_HAS_DAC2_CH2 FALSE
  1739. /* DMA attributes.*/
  1740. #define STM32_ADVANCED_DMA FALSE
  1741. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  1742. #define STM32_DMA_SUPPORTS_CSELR FALSE
  1743. #define STM32_DMA1_NUM_CHANNELS 7
  1744. #define STM32_DMA1_CH1_HANDLER Vector6C
  1745. #define STM32_DMA1_CH2_HANDLER Vector70
  1746. #define STM32_DMA1_CH3_HANDLER Vector74
  1747. #define STM32_DMA1_CH4_HANDLER Vector78
  1748. #define STM32_DMA1_CH5_HANDLER Vector7C
  1749. #define STM32_DMA1_CH6_HANDLER Vector80
  1750. #define STM32_DMA1_CH7_HANDLER Vector84
  1751. #define STM32_DMA1_CH1_NUMBER 11
  1752. #define STM32_DMA1_CH2_NUMBER 12
  1753. #define STM32_DMA1_CH3_NUMBER 13
  1754. #define STM32_DMA1_CH4_NUMBER 14
  1755. #define STM32_DMA1_CH5_NUMBER 15
  1756. #define STM32_DMA1_CH6_NUMBER 16
  1757. #define STM32_DMA1_CH7_NUMBER 17
  1758. #define STM32_DMA2_NUM_CHANNELS 0
  1759. /* ETH attributes.*/
  1760. #define STM32_HAS_ETH FALSE
  1761. /* EXTI attributes.*/
  1762. #define STM32_EXTI_NUM_LINES 33
  1763. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  1764. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  1765. /* GPIO attributes.*/
  1766. #define STM32_HAS_GPIOA TRUE
  1767. #define STM32_HAS_GPIOB TRUE
  1768. #define STM32_HAS_GPIOC TRUE
  1769. #define STM32_HAS_GPIOD TRUE
  1770. #define STM32_HAS_GPIOE FALSE
  1771. #define STM32_HAS_GPIOF TRUE
  1772. #define STM32_HAS_GPIOG FALSE
  1773. #define STM32_HAS_GPIOH FALSE
  1774. #define STM32_HAS_GPIOI FALSE
  1775. #define STM32_HAS_GPIOJ FALSE
  1776. #define STM32_HAS_GPIOK FALSE
  1777. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  1778. RCC_AHBENR_GPIOBEN | \
  1779. RCC_AHBENR_GPIOCEN | \
  1780. RCC_AHBENR_GPIODEN | \
  1781. RCC_AHBENR_GPIOFEN)
  1782. /* I2C attributes.*/
  1783. #define STM32_HAS_I2C1 TRUE
  1784. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1785. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1786. #define STM32_HAS_I2C2 FALSE
  1787. #define STM32_HAS_I2C3 FALSE
  1788. #define STM32_HAS_I2C4 FALSE
  1789. /* QUADSPI attributes.*/
  1790. #define STM32_HAS_QUADSPI1 FALSE
  1791. /* RTC attributes.*/
  1792. #define STM32_HAS_RTC TRUE
  1793. #define STM32_RTC_HAS_SUBSECONDS TRUE
  1794. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  1795. #define STM32_RTC_NUM_ALARMS 2
  1796. #define STM32_RTC_STORAGE_SIZE 64
  1797. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  1798. #define STM32_RTC_WKUP_HANDLER Vector4C
  1799. #define STM32_RTC_ALARM_HANDLER VectorE4
  1800. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  1801. #define STM32_RTC_WKUP_NUMBER 3
  1802. #define STM32_RTC_ALARM_NUMBER 41
  1803. #define STM32_RTC_ALARM_EXTI 17
  1804. #define STM32_RTC_TAMP_STAMP_EXTI 19
  1805. #define STM32_RTC_WKUP_EXTI 20
  1806. #define STM32_RTC_IRQ_ENABLE() do { \
  1807. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  1808. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  1809. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  1810. } while (false)
  1811. /* SDIO attributes.*/
  1812. #define STM32_HAS_SDIO FALSE
  1813. /* SPI attributes.*/
  1814. #define STM32_HAS_SPI1 TRUE
  1815. #define STM32_SPI1_SUPPORTS_I2S FALSE
  1816. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1817. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1818. #define STM32_HAS_SPI2 FALSE
  1819. #define STM32_HAS_SPI3 FALSE
  1820. #define STM32_HAS_SPI4 FALSE
  1821. #define STM32_HAS_SPI5 FALSE
  1822. #define STM32_HAS_SPI6 FALSE
  1823. /* TIM attributes.*/
  1824. #define STM32_TIM_MAX_CHANNELS 6
  1825. #define STM32_HAS_TIM1 TRUE
  1826. #define STM32_TIM1_IS_32BITS FALSE
  1827. #define STM32_TIM1_CHANNELS 6
  1828. #define STM32_HAS_TIM2 TRUE
  1829. #define STM32_TIM2_IS_32BITS TRUE
  1830. #define STM32_TIM2_CHANNELS 4
  1831. #define STM32_HAS_TIM3 TRUE
  1832. #define STM32_TIM3_IS_32BITS FALSE
  1833. #define STM32_TIM3_CHANNELS 4
  1834. #define STM32_HAS_TIM6 TRUE
  1835. #define STM32_TIM6_IS_32BITS FALSE
  1836. #define STM32_TIM6_CHANNELS 0
  1837. #define STM32_HAS_TIM7 TRUE
  1838. #define STM32_TIM7_IS_32BITS FALSE
  1839. #define STM32_TIM7_CHANNELS 0
  1840. #define STM32_HAS_TIM15 TRUE
  1841. #define STM32_TIM15_IS_32BITS FALSE
  1842. #define STM32_TIM15_CHANNELS 2
  1843. #define STM32_HAS_TIM16 TRUE
  1844. #define STM32_TIM16_IS_32BITS FALSE
  1845. #define STM32_TIM16_CHANNELS 1
  1846. #define STM32_HAS_TIM17 TRUE
  1847. #define STM32_TIM17_IS_32BITS FALSE
  1848. #define STM32_TIM17_CHANNELS 1
  1849. #define STM32_HAS_TIM4 FALSE
  1850. #define STM32_HAS_TIM5 FALSE
  1851. #define STM32_HAS_TIM8 FALSE
  1852. #define STM32_HAS_TIM9 FALSE
  1853. #define STM32_HAS_TIM10 FALSE
  1854. #define STM32_HAS_TIM11 FALSE
  1855. #define STM32_HAS_TIM12 FALSE
  1856. #define STM32_HAS_TIM13 FALSE
  1857. #define STM32_HAS_TIM14 FALSE
  1858. #define STM32_HAS_TIM18 FALSE
  1859. #define STM32_HAS_TIM19 FALSE
  1860. #define STM32_HAS_TIM20 FALSE
  1861. #define STM32_HAS_TIM21 FALSE
  1862. #define STM32_HAS_TIM22 FALSE
  1863. /* USART attributes.*/
  1864. #define STM32_HAS_USART1 TRUE
  1865. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1866. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1867. #define STM32_HAS_USART2 TRUE
  1868. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1869. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1870. #define STM32_HAS_USART3 TRUE
  1871. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  1872. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  1873. #define STM32_HAS_UART4 FALSE
  1874. #define STM32_HAS_UART5 FALSE
  1875. #define STM32_HAS_USART6 FALSE
  1876. #define STM32_HAS_UART7 FALSE
  1877. #define STM32_HAS_UART8 FALSE
  1878. #define STM32_HAS_LPUART1 FALSE
  1879. /* USB attributes.*/
  1880. #define STM32_HAS_USB FALSE
  1881. #define STM32_HAS_OTG1 FALSE
  1882. #define STM32_HAS_OTG2 FALSE
  1883. /* IWDG attributes.*/
  1884. #define STM32_HAS_IWDG TRUE
  1885. #define STM32_IWDG_IS_WINDOWED TRUE
  1886. /* LTDC attributes.*/
  1887. #define STM32_HAS_LTDC FALSE
  1888. /* DMA2D attributes.*/
  1889. #define STM32_HAS_DMA2D FALSE
  1890. /* FSMC attributes.*/
  1891. #define STM32_HAS_FSMC FALSE
  1892. /* CRC attributes.*/
  1893. #define STM32_HAS_CRC TRUE
  1894. #define STM32_CRC_PROGRAMMABLE TRUE
  1895. #endif /* defined(STM32F328x8) */
  1896. /*===========================================================================*/
  1897. /* STM32F358xC. */
  1898. /*===========================================================================*/
  1899. #if defined(STM32F358xC)
  1900. /* ADC attributes.*/
  1901. #define STM32_HAS_ADC1 TRUE
  1902. #define STM32_ADC1_HANDLER Vector88
  1903. #define STM32_ADC1_NUMBER 18
  1904. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  1905. #define STM32_ADC1_DMA_CHN 0x00000000
  1906. #define STM32_HAS_ADC2 TRUE
  1907. #define STM32_ADC2_HANDLER Vector88
  1908. #define STM32_ADC2_NUMBER 18
  1909. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1) |\
  1910. STM32_DMA_STREAM_ID_MSK(2, 3))
  1911. #define STM32_ADC2_DMA_CHN 0x00000000
  1912. #define STM32_HAS_ADC3 FALSE
  1913. #define STM32_HAS_ADC4 FALSE
  1914. #define STM32_HAS_SDADC1 FALSE
  1915. #define STM32_HAS_SDADC2 FALSE
  1916. #define STM32_HAS_SDADC3 FALSE
  1917. /* CAN attributes.*/
  1918. #define STM32_HAS_CAN1 TRUE
  1919. #define STM32_HAS_CAN2 FALSE
  1920. #define STM32_HAS_CAN3 FALSE
  1921. #define STM32_CAN_MAX_FILTERS 14
  1922. /* DAC attributes.*/
  1923. #define STM32_HAS_DAC1_CH1 TRUE
  1924. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  1925. #define STM32_HAS_DAC1_CH2 TRUE
  1926. #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
  1927. #define STM32_HAS_DAC2_CH1 FALSE
  1928. #define STM32_HAS_DAC2_CH2 FALSE
  1929. /* DMA attributes.*/
  1930. #define STM32_ADVANCED_DMA FALSE
  1931. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  1932. #define STM32_DMA_SUPPORTS_CSELR FALSE
  1933. #define STM32_DMA1_NUM_CHANNELS 7
  1934. #define STM32_DMA1_CH1_HANDLER Vector6C
  1935. #define STM32_DMA1_CH2_HANDLER Vector70
  1936. #define STM32_DMA1_CH3_HANDLER Vector74
  1937. #define STM32_DMA1_CH4_HANDLER Vector78
  1938. #define STM32_DMA1_CH5_HANDLER Vector7C
  1939. #define STM32_DMA1_CH6_HANDLER Vector80
  1940. #define STM32_DMA1_CH7_HANDLER Vector84
  1941. #define STM32_DMA1_CH1_NUMBER 11
  1942. #define STM32_DMA1_CH2_NUMBER 12
  1943. #define STM32_DMA1_CH3_NUMBER 13
  1944. #define STM32_DMA1_CH4_NUMBER 14
  1945. #define STM32_DMA1_CH5_NUMBER 15
  1946. #define STM32_DMA1_CH6_NUMBER 16
  1947. #define STM32_DMA1_CH7_NUMBER 17
  1948. #define STM32_DMA2_NUM_CHANNELS 5
  1949. #define STM32_DMA2_CH1_HANDLER Vector120
  1950. #define STM32_DMA2_CH2_HANDLER Vector124
  1951. #define STM32_DMA2_CH3_HANDLER Vector128
  1952. #define STM32_DMA2_CH4_HANDLER Vector12C
  1953. #define STM32_DMA2_CH5_HANDLER Vector130
  1954. #define STM32_DMA2_CH1_NUMBER 56
  1955. #define STM32_DMA2_CH2_NUMBER 57
  1956. #define STM32_DMA2_CH3_NUMBER 58
  1957. #define STM32_DMA2_CH4_NUMBER 59
  1958. #define STM32_DMA2_CH5_NUMBER 60
  1959. /* ETH attributes.*/
  1960. #define STM32_HAS_ETH FALSE
  1961. /* EXTI attributes.*/
  1962. #define STM32_EXTI_NUM_LINES 34
  1963. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  1964. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  1965. /* GPIO attributes.*/
  1966. #define STM32_HAS_GPIOA TRUE
  1967. #define STM32_HAS_GPIOB TRUE
  1968. #define STM32_HAS_GPIOC TRUE
  1969. #define STM32_HAS_GPIOD TRUE
  1970. #define STM32_HAS_GPIOE TRUE
  1971. #define STM32_HAS_GPIOF TRUE
  1972. #define STM32_HAS_GPIOG FALSE
  1973. #define STM32_HAS_GPIOH FALSE
  1974. #define STM32_HAS_GPIOI FALSE
  1975. #define STM32_HAS_GPIOJ FALSE
  1976. #define STM32_HAS_GPIOK FALSE
  1977. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  1978. RCC_AHBENR_GPIOBEN | \
  1979. RCC_AHBENR_GPIOCEN | \
  1980. RCC_AHBENR_GPIODEN | \
  1981. RCC_AHBENR_GPIOEEN | \
  1982. RCC_AHBENR_GPIOFEN)
  1983. /* I2C attributes.*/
  1984. #define STM32_HAS_I2C1 TRUE
  1985. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  1986. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  1987. #define STM32_HAS_I2C2 TRUE
  1988. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  1989. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  1990. #define STM32_HAS_I2C3 FALSE
  1991. #define STM32_HAS_I2C4 FALSE
  1992. /* QUADSPI attributes.*/
  1993. #define STM32_HAS_QUADSPI1 FALSE
  1994. /* RTC attributes.*/
  1995. #define STM32_HAS_RTC TRUE
  1996. #define STM32_RTC_HAS_SUBSECONDS TRUE
  1997. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  1998. #define STM32_RTC_NUM_ALARMS 1
  1999. #define STM32_RTC_STORAGE_SIZE 64
  2000. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  2001. #define STM32_RTC_WKUP_HANDLER Vector4C
  2002. #define STM32_RTC_ALARM_HANDLER VectorE4
  2003. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  2004. #define STM32_RTC_WKUP_NUMBER 3
  2005. #define STM32_RTC_ALARM_NUMBER 41
  2006. #define STM32_RTC_ALARM_EXTI 17
  2007. #define STM32_RTC_TAMP_STAMP_EXTI 19
  2008. #define STM32_RTC_WKUP_EXTI 20
  2009. #define STM32_RTC_IRQ_ENABLE() do { \
  2010. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  2011. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  2012. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  2013. } while (false)
  2014. /* SDIO attributes.*/
  2015. #define STM32_HAS_SDIO FALSE
  2016. /* SPI attributes.*/
  2017. #define STM32_HAS_SPI1 TRUE
  2018. #define STM32_SPI1_SUPPORTS_I2S FALSE
  2019. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  2020. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  2021. #define STM32_HAS_SPI2 TRUE
  2022. #define STM32_SPI2_SUPPORTS_I2S TRUE
  2023. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  2024. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  2025. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  2026. #define STM32_HAS_SPI3 TRUE
  2027. #define STM32_SPI3_SUPPORTS_I2S TRUE
  2028. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  2029. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
  2030. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
  2031. #define STM32_HAS_SPI4 FALSE
  2032. #define STM32_HAS_SPI5 FALSE
  2033. #define STM32_HAS_SPI6 FALSE
  2034. /* TIM attributes.*/
  2035. #define STM32_TIM_MAX_CHANNELS 6
  2036. #define STM32_HAS_TIM1 TRUE
  2037. #define STM32_TIM1_IS_32BITS FALSE
  2038. #define STM32_TIM1_CHANNELS 6
  2039. #define STM32_HAS_TIM2 TRUE
  2040. #define STM32_TIM2_IS_32BITS TRUE
  2041. #define STM32_TIM2_CHANNELS 4
  2042. #define STM32_HAS_TIM3 TRUE
  2043. #define STM32_TIM3_IS_32BITS FALSE
  2044. #define STM32_TIM3_CHANNELS 4
  2045. #define STM32_HAS_TIM4 TRUE
  2046. #define STM32_TIM4_IS_32BITS FALSE
  2047. #define STM32_TIM4_CHANNELS 4
  2048. #define STM32_HAS_TIM6 TRUE
  2049. #define STM32_TIM6_IS_32BITS FALSE
  2050. #define STM32_TIM6_CHANNELS 0
  2051. #define STM32_HAS_TIM15 TRUE
  2052. #define STM32_TIM15_IS_32BITS FALSE
  2053. #define STM32_TIM15_CHANNELS 2
  2054. #define STM32_HAS_TIM16 TRUE
  2055. #define STM32_TIM16_IS_32BITS FALSE
  2056. #define STM32_TIM16_CHANNELS 1
  2057. #define STM32_HAS_TIM17 TRUE
  2058. #define STM32_TIM17_IS_32BITS FALSE
  2059. #define STM32_TIM17_CHANNELS 1
  2060. #define STM32_HAS_TIM5 FALSE
  2061. #define STM32_HAS_TIM7 FALSE
  2062. #define STM32_HAS_TIM8 FALSE
  2063. #define STM32_HAS_TIM9 FALSE
  2064. #define STM32_HAS_TIM10 FALSE
  2065. #define STM32_HAS_TIM11 FALSE
  2066. #define STM32_HAS_TIM12 FALSE
  2067. #define STM32_HAS_TIM13 FALSE
  2068. #define STM32_HAS_TIM14 FALSE
  2069. #define STM32_HAS_TIM18 FALSE
  2070. #define STM32_HAS_TIM19 FALSE
  2071. #define STM32_HAS_TIM20 FALSE
  2072. #define STM32_HAS_TIM21 FALSE
  2073. #define STM32_HAS_TIM22 FALSE
  2074. /* USART attributes.*/
  2075. #define STM32_HAS_USART1 TRUE
  2076. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  2077. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  2078. #define STM32_HAS_USART2 TRUE
  2079. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  2080. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  2081. #define STM32_HAS_USART3 TRUE
  2082. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  2083. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  2084. #define STM32_HAS_UART4 TRUE
  2085. #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  2086. #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
  2087. #define STM32_HAS_UART5 TRUE
  2088. #define STM32_HAS_USART6 FALSE
  2089. #define STM32_HAS_UART7 FALSE
  2090. #define STM32_HAS_UART8 FALSE
  2091. #define STM32_HAS_LPUART1 FALSE
  2092. /* USB attributes.*/
  2093. #define STM32_HAS_USB TRUE
  2094. #define STM32_USB_ACCESS_SCHEME_2x16 FALSE
  2095. #define STM32_USB_PMA_SIZE 512
  2096. #define STM32_USB_HAS_BCDR FALSE
  2097. #define STM32_HAS_OTG1 FALSE
  2098. #define STM32_HAS_OTG2 FALSE
  2099. /* IWDG attributes.*/
  2100. #define STM32_HAS_IWDG TRUE
  2101. #define STM32_IWDG_IS_WINDOWED TRUE
  2102. /* LTDC attributes.*/
  2103. #define STM32_HAS_LTDC FALSE
  2104. /* DMA2D attributes.*/
  2105. #define STM32_HAS_DMA2D FALSE
  2106. /* FSMC attributes.*/
  2107. #define STM32_HAS_FSMC FALSE
  2108. /* CRC attributes.*/
  2109. #define STM32_HAS_CRC TRUE
  2110. #define STM32_CRC_PROGRAMMABLE TRUE
  2111. #endif /* defined(STM32F358xC) */
  2112. /*===========================================================================*/
  2113. /* STM32F334x8. */
  2114. /*===========================================================================*/
  2115. #if defined(STM32F334x8)
  2116. /* ADC attributes.*/
  2117. #define STM32_HAS_ADC1 TRUE
  2118. #define STM32_ADC1_HANDLER Vector88
  2119. #define STM32_ADC1_NUMBER 18
  2120. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  2121. #define STM32_ADC1_DMA_CHN 0x00000000
  2122. #define STM32_HAS_ADC2 TRUE
  2123. #define STM32_ADC2_HANDLER Vector88
  2124. #define STM32_ADC2_NUMBER 18
  2125. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 2) |\
  2126. STM32_DMA_STREAM_ID_MSK(1, 4))
  2127. #define STM32_ADC2_DMA_CHN 0x00000000
  2128. #define STM32_HAS_ADC3 FALSE
  2129. #define STM32_HAS_ADC4 FALSE
  2130. #define STM32_HAS_SDADC1 FALSE
  2131. #define STM32_HAS_SDADC2 FALSE
  2132. #define STM32_HAS_SDADC3 FALSE
  2133. /* CAN attributes.*/
  2134. #define STM32_HAS_CAN1 TRUE
  2135. #define STM32_HAS_CAN2 FALSE
  2136. #define STM32_HAS_CAN3 FALSE
  2137. #define STM32_CAN_MAX_FILTERS 14
  2138. /* DAC attributes.*/
  2139. #define STM32_HAS_DAC1_CH1 TRUE
  2140. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  2141. #define STM32_HAS_DAC1_CH2 TRUE
  2142. #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  2143. #define STM32_HAS_DAC2_CH1 TRUE
  2144. #define STM32_DAC_DAC2_CH1_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  2145. #define STM32_HAS_DAC2_CH2 FALSE
  2146. /* DMA attributes.*/
  2147. #define STM32_ADVANCED_DMA FALSE
  2148. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  2149. #define STM32_DMA_SUPPORTS_CSELR FALSE
  2150. #define STM32_DMA1_NUM_CHANNELS 7
  2151. #define STM32_DMA1_CH1_HANDLER Vector6C
  2152. #define STM32_DMA1_CH2_HANDLER Vector70
  2153. #define STM32_DMA1_CH3_HANDLER Vector74
  2154. #define STM32_DMA1_CH4_HANDLER Vector78
  2155. #define STM32_DMA1_CH5_HANDLER Vector7C
  2156. #define STM32_DMA1_CH6_HANDLER Vector80
  2157. #define STM32_DMA1_CH7_HANDLER Vector84
  2158. #define STM32_DMA1_CH1_NUMBER 11
  2159. #define STM32_DMA1_CH2_NUMBER 12
  2160. #define STM32_DMA1_CH3_NUMBER 13
  2161. #define STM32_DMA1_CH4_NUMBER 14
  2162. #define STM32_DMA1_CH5_NUMBER 15
  2163. #define STM32_DMA1_CH6_NUMBER 16
  2164. #define STM32_DMA1_CH7_NUMBER 17
  2165. #define STM32_DMA2_NUM_CHANNELS 0
  2166. /* ETH attributes.*/
  2167. #define STM32_HAS_ETH FALSE
  2168. /* EXTI attributes.*/
  2169. #define STM32_EXTI_NUM_LINES 33
  2170. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  2171. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  2172. /* GPIO attributes.*/
  2173. #define STM32_HAS_GPIOA TRUE
  2174. #define STM32_HAS_GPIOB TRUE
  2175. #define STM32_HAS_GPIOC TRUE
  2176. #define STM32_HAS_GPIOD TRUE
  2177. #define STM32_HAS_GPIOE FALSE
  2178. #define STM32_HAS_GPIOF TRUE
  2179. #define STM32_HAS_GPIOG FALSE
  2180. #define STM32_HAS_GPIOH FALSE
  2181. #define STM32_HAS_GPIOI FALSE
  2182. #define STM32_HAS_GPIOJ FALSE
  2183. #define STM32_HAS_GPIOK FALSE
  2184. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  2185. RCC_AHBENR_GPIOBEN | \
  2186. RCC_AHBENR_GPIOCEN | \
  2187. RCC_AHBENR_GPIODEN | \
  2188. RCC_AHBENR_GPIOFEN)
  2189. /* I2C attributes.*/
  2190. #define STM32_HAS_I2C1 TRUE
  2191. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  2192. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  2193. #define STM32_HAS_I2C2 FALSE
  2194. #define STM32_HAS_I2C3 FALSE
  2195. #define STM32_HAS_I2C4 FALSE
  2196. /* QUADSPI attributes.*/
  2197. #define STM32_HAS_QUADSPI1 FALSE
  2198. /* RTC attributes.*/
  2199. #define STM32_HAS_RTC TRUE
  2200. #define STM32_RTC_HAS_SUBSECONDS TRUE
  2201. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  2202. #define STM32_RTC_NUM_ALARMS 1
  2203. #define STM32_RTC_STORAGE_SIZE 64
  2204. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  2205. #define STM32_RTC_WKUP_HANDLER Vector4C
  2206. #define STM32_RTC_ALARM_HANDLER VectorE4
  2207. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  2208. #define STM32_RTC_WKUP_NUMBER 3
  2209. #define STM32_RTC_ALARM_NUMBER 41
  2210. #define STM32_RTC_ALARM_EXTI 17
  2211. #define STM32_RTC_TAMP_STAMP_EXTI 19
  2212. #define STM32_RTC_WKUP_EXTI 20
  2213. #define STM32_RTC_IRQ_ENABLE() do { \
  2214. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  2215. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  2216. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  2217. } while (false)
  2218. /* SDIO attributes.*/
  2219. #define STM32_HAS_SDIO FALSE
  2220. /* SPI attributes.*/
  2221. #define STM32_HAS_SPI1 TRUE
  2222. #define STM32_SPI1_SUPPORTS_I2S FALSE
  2223. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  2224. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  2225. #define STM32_HAS_SPI2 FALSE
  2226. #define STM32_HAS_SPI3 FALSE
  2227. #define STM32_HAS_SPI4 FALSE
  2228. #define STM32_HAS_SPI5 FALSE
  2229. #define STM32_HAS_SPI6 FALSE
  2230. /* TIM attributes.*/
  2231. #define STM32_TIM_MAX_CHANNELS 6
  2232. #define STM32_HAS_TIM1 TRUE
  2233. #define STM32_TIM1_IS_32BITS FALSE
  2234. #define STM32_TIM1_CHANNELS 6
  2235. #define STM32_HAS_TIM2 TRUE
  2236. #define STM32_TIM2_IS_32BITS TRUE
  2237. #define STM32_TIM2_CHANNELS 4
  2238. #define STM32_HAS_TIM3 TRUE
  2239. #define STM32_TIM3_IS_32BITS FALSE
  2240. #define STM32_TIM3_CHANNELS 4
  2241. #define STM32_HAS_TIM6 TRUE
  2242. #define STM32_TIM6_IS_32BITS FALSE
  2243. #define STM32_TIM6_CHANNELS 0
  2244. #define STM32_HAS_TIM7 TRUE
  2245. #define STM32_TIM7_IS_32BITS FALSE
  2246. #define STM32_TIM7_CHANNELS 0
  2247. #define STM32_HAS_TIM15 TRUE
  2248. #define STM32_TIM15_IS_32BITS FALSE
  2249. #define STM32_TIM15_CHANNELS 2
  2250. #define STM32_HAS_TIM16 TRUE
  2251. #define STM32_TIM16_IS_32BITS FALSE
  2252. #define STM32_TIM16_CHANNELS 1
  2253. #define STM32_HAS_TIM17 TRUE
  2254. #define STM32_TIM17_IS_32BITS FALSE
  2255. #define STM32_TIM17_CHANNELS 1
  2256. #define STM32_HAS_TIM4 FALSE
  2257. #define STM32_HAS_TIM5 FALSE
  2258. #define STM32_HAS_TIM8 FALSE
  2259. #define STM32_HAS_TIM9 FALSE
  2260. #define STM32_HAS_TIM10 FALSE
  2261. #define STM32_HAS_TIM11 FALSE
  2262. #define STM32_HAS_TIM12 FALSE
  2263. #define STM32_HAS_TIM13 FALSE
  2264. #define STM32_HAS_TIM14 FALSE
  2265. #define STM32_HAS_TIM18 FALSE
  2266. #define STM32_HAS_TIM19 FALSE
  2267. #define STM32_HAS_TIM20 FALSE
  2268. #define STM32_HAS_TIM21 FALSE
  2269. #define STM32_HAS_TIM22 FALSE
  2270. /* HRTIM attributes.*/
  2271. #define STM32_HAS_HRTIM1 TRUE
  2272. /* USART attributes.*/
  2273. #define STM32_HAS_USART1 TRUE
  2274. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  2275. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  2276. #define STM32_HAS_USART2 TRUE
  2277. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  2278. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  2279. #define STM32_HAS_USART3 TRUE
  2280. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  2281. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  2282. #define STM32_HAS_UART4 FALSE
  2283. #define STM32_HAS_UART5 FALSE
  2284. #define STM32_HAS_USART6 FALSE
  2285. #define STM32_HAS_UART7 FALSE
  2286. #define STM32_HAS_UART8 FALSE
  2287. #define STM32_HAS_LPUART1 FALSE
  2288. /* USB attributes.*/
  2289. #define STM32_HAS_USB FALSE
  2290. #define STM32_HAS_OTG1 FALSE
  2291. #define STM32_HAS_OTG2 FALSE
  2292. /* IWDG attributes.*/
  2293. #define STM32_HAS_IWDG TRUE
  2294. #define STM32_IWDG_IS_WINDOWED TRUE
  2295. /* LTDC attributes.*/
  2296. #define STM32_HAS_LTDC FALSE
  2297. /* DMA2D attributes.*/
  2298. #define STM32_HAS_DMA2D FALSE
  2299. /* FSMC attributes.*/
  2300. #define STM32_HAS_FSMC FALSE
  2301. /* CRC attributes.*/
  2302. #define STM32_HAS_CRC TRUE
  2303. #define STM32_CRC_PROGRAMMABLE TRUE
  2304. #endif /* defined(STM32F334x8) */
  2305. /*===========================================================================*/
  2306. /* STM32F398xx. */
  2307. /*===========================================================================*/
  2308. #if defined(STM32F398xx)
  2309. /* ADC attributes.*/
  2310. #define STM32_HAS_ADC1 TRUE
  2311. #define STM32_ADC1_HANDLER Vector88
  2312. #define STM32_ADC1_NUMBER 18
  2313. #define STM32_ADC1_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 1))
  2314. #define STM32_ADC1_DMA_CHN 0x00000000
  2315. #define STM32_HAS_ADC2 TRUE
  2316. #define STM32_ADC2_HANDLER Vector88
  2317. #define STM32_ADC2_NUMBER 18
  2318. #define STM32_ADC2_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 1) |\
  2319. STM32_DMA_STREAM_ID_MSK(2, 3))
  2320. #define STM32_ADC2_DMA_CHN 0x00000000
  2321. #define STM32_HAS_ADC3 TRUE
  2322. #define STM32_ADC3_HANDLER VectorFC
  2323. #define STM32_ADC3_NUMBER 47
  2324. #define STM32_ADC3_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 5))
  2325. #define STM32_ADC3_DMA_CHN 0x00000000
  2326. #define STM32_HAS_ADC4 TRUE
  2327. #define STM32_ADC4_HANDLER Vector134
  2328. #define STM32_ADC4_NUMBER 61
  2329. #define STM32_ADC4_DMA_MSK (STM32_DMA_STREAM_ID_MSK(2, 2) |\
  2330. STM32_DMA_STREAM_ID_MSK(2, 4))
  2331. #define STM32_ADC4_DMA_CHN 0x00000000
  2332. #define STM32_HAS_SDADC1 FALSE
  2333. #define STM32_HAS_SDADC2 FALSE
  2334. #define STM32_HAS_SDADC3 FALSE
  2335. /* CAN attributes.*/
  2336. #define STM32_HAS_CAN1 TRUE
  2337. #define STM32_HAS_CAN2 FALSE
  2338. #define STM32_HAS_CAN3 FALSE
  2339. #define STM32_CAN_MAX_FILTERS 14
  2340. /* DAC attributes.*/
  2341. #define STM32_HAS_DAC1_CH1 TRUE
  2342. #define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  2343. #define STM32_HAS_DAC1_CH2 TRUE
  2344. #define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
  2345. #define STM32_HAS_DAC2_CH1 FALSE
  2346. #define STM32_HAS_DAC2_CH2 FALSE
  2347. /* DMA attributes.*/
  2348. #define STM32_ADVANCED_DMA FALSE
  2349. #define STM32_DMA_SUPPORTS_DMAMUX FALSE
  2350. #define STM32_DMA_SUPPORTS_CSELR FALSE
  2351. #define STM32_DMA1_NUM_CHANNELS 7
  2352. #define STM32_DMA1_CH1_HANDLER Vector6C
  2353. #define STM32_DMA1_CH2_HANDLER Vector70
  2354. #define STM32_DMA1_CH3_HANDLER Vector74
  2355. #define STM32_DMA1_CH4_HANDLER Vector78
  2356. #define STM32_DMA1_CH5_HANDLER Vector7C
  2357. #define STM32_DMA1_CH6_HANDLER Vector80
  2358. #define STM32_DMA1_CH7_HANDLER Vector84
  2359. #define STM32_DMA1_CH1_NUMBER 11
  2360. #define STM32_DMA1_CH2_NUMBER 12
  2361. #define STM32_DMA1_CH3_NUMBER 13
  2362. #define STM32_DMA1_CH4_NUMBER 14
  2363. #define STM32_DMA1_CH5_NUMBER 15
  2364. #define STM32_DMA1_CH6_NUMBER 16
  2365. #define STM32_DMA1_CH7_NUMBER 17
  2366. #define STM32_DMA2_NUM_CHANNELS 5
  2367. #define STM32_DMA2_CH1_HANDLER Vector120
  2368. #define STM32_DMA2_CH2_HANDLER Vector124
  2369. #define STM32_DMA2_CH3_HANDLER Vector128
  2370. #define STM32_DMA2_CH4_HANDLER Vector12C
  2371. #define STM32_DMA2_CH5_HANDLER Vector130
  2372. #define STM32_DMA2_CH1_NUMBER 56
  2373. #define STM32_DMA2_CH2_NUMBER 57
  2374. #define STM32_DMA2_CH3_NUMBER 58
  2375. #define STM32_DMA2_CH4_NUMBER 59
  2376. #define STM32_DMA2_CH5_NUMBER 60
  2377. /* ETH attributes.*/
  2378. #define STM32_HAS_ETH FALSE
  2379. /* EXTI attributes.*/
  2380. #define STM32_EXTI_NUM_LINES 34
  2381. #define STM32_EXTI_IMR1_MASK 0x1F800000U
  2382. #define STM32_EXTI_IMR2_MASK 0xFFFFFFFCU
  2383. /* GPIO attributes.*/
  2384. #define STM32_HAS_GPIOA TRUE
  2385. #define STM32_HAS_GPIOB TRUE
  2386. #define STM32_HAS_GPIOC TRUE
  2387. #define STM32_HAS_GPIOD TRUE
  2388. #define STM32_HAS_GPIOE TRUE
  2389. #define STM32_HAS_GPIOF TRUE
  2390. #define STM32_HAS_GPIOG TRUE
  2391. #define STM32_HAS_GPIOH TRUE
  2392. #define STM32_HAS_GPIOI FALSE
  2393. #define STM32_HAS_GPIOJ FALSE
  2394. #define STM32_HAS_GPIOK FALSE
  2395. #define STM32_GPIO_EN_MASK (RCC_AHBENR_GPIOAEN | \
  2396. RCC_AHBENR_GPIOBEN | \
  2397. RCC_AHBENR_GPIOCEN | \
  2398. RCC_AHBENR_GPIODEN | \
  2399. RCC_AHBENR_GPIOEEN | \
  2400. RCC_AHBENR_GPIOFEN | \
  2401. RCC_AHBENR_GPIOGEN | \
  2402. RCC_AHBENR_GPIOHEN)
  2403. /* I2C attributes.*/
  2404. #define STM32_HAS_I2C1 TRUE
  2405. #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  2406. #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  2407. #define STM32_HAS_I2C2 TRUE
  2408. #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  2409. #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  2410. #define STM32_HAS_I2C3 TRUE
  2411. #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  2412. #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
  2413. #define STM32_HAS_I2C4 FALSE
  2414. /* QUADSPI attributes.*/
  2415. #define STM32_HAS_QUADSPI1 FALSE
  2416. /* RTC attributes.*/
  2417. #define STM32_HAS_RTC TRUE
  2418. #define STM32_RTC_HAS_SUBSECONDS TRUE
  2419. #define STM32_RTC_HAS_PERIODIC_WAKEUPS TRUE
  2420. #define STM32_RTC_NUM_ALARMS 2
  2421. #define STM32_RTC_STORAGE_SIZE 64
  2422. #define STM32_RTC_TAMP_STAMP_HANDLER Vector48
  2423. #define STM32_RTC_WKUP_HANDLER Vector4C
  2424. #define STM32_RTC_ALARM_HANDLER VectorE4
  2425. #define STM32_RTC_TAMP_STAMP_NUMBER 2
  2426. #define STM32_RTC_WKUP_NUMBER 3
  2427. #define STM32_RTC_ALARM_NUMBER 41
  2428. #define STM32_RTC_ALARM_EXTI 17
  2429. #define STM32_RTC_TAMP_STAMP_EXTI 19
  2430. #define STM32_RTC_WKUP_EXTI 20
  2431. #define STM32_RTC_IRQ_ENABLE() do { \
  2432. nvicEnableVector(STM32_RTC_TAMP_STAMP_NUMBER, STM32_IRQ_EXTI19_PRIORITY); \
  2433. nvicEnableVector(STM32_RTC_WKUP_NUMBER, STM32_IRQ_EXTI20_PRIORITY); \
  2434. nvicEnableVector(STM32_RTC_ALARM_NUMBER, STM32_IRQ_EXTI17_PRIORITY); \
  2435. } while (false)
  2436. /* SDIO attributes.*/
  2437. #define STM32_HAS_SDIO FALSE
  2438. /* SPI attributes.*/
  2439. #define STM32_HAS_SPI1 TRUE
  2440. #define STM32_SPI1_SUPPORTS_I2S FALSE
  2441. #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  2442. #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  2443. #define STM32_HAS_SPI2 TRUE
  2444. #define STM32_SPI2_SUPPORTS_I2S TRUE
  2445. #define STM32_SPI2_I2S_FULLDUPLEX TRUE
  2446. #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  2447. #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  2448. #define STM32_HAS_SPI3 TRUE
  2449. #define STM32_SPI3_SUPPORTS_I2S TRUE
  2450. #define STM32_SPI3_I2S_FULLDUPLEX TRUE
  2451. #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
  2452. #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
  2453. #define STM32_HAS_SPI4 TRUE
  2454. #define STM32_SPI4_SUPPORTS_I2S FALSE
  2455. #define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  2456. #define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  2457. #define STM32_HAS_SPI5 FALSE
  2458. #define STM32_HAS_SPI6 FALSE
  2459. /* TIM attributes.*/
  2460. #define STM32_TIM_MAX_CHANNELS 6
  2461. #define STM32_HAS_TIM1 TRUE
  2462. #define STM32_TIM1_IS_32BITS FALSE
  2463. #define STM32_TIM1_CHANNELS 6
  2464. #define STM32_HAS_TIM2 TRUE
  2465. #define STM32_TIM2_IS_32BITS TRUE
  2466. #define STM32_TIM2_CHANNELS 4
  2467. #define STM32_HAS_TIM3 TRUE
  2468. #define STM32_TIM3_IS_32BITS FALSE
  2469. #define STM32_TIM3_CHANNELS 4
  2470. #define STM32_HAS_TIM4 TRUE
  2471. #define STM32_TIM4_IS_32BITS FALSE
  2472. #define STM32_TIM4_CHANNELS 4
  2473. #define STM32_HAS_TIM6 TRUE
  2474. #define STM32_TIM6_IS_32BITS FALSE
  2475. #define STM32_TIM6_CHANNELS 0
  2476. #define STM32_HAS_TIM7 TRUE
  2477. #define STM32_TIM7_IS_32BITS FALSE
  2478. #define STM32_TIM7_CHANNELS 0
  2479. #define STM32_HAS_TIM8 TRUE
  2480. #define STM32_TIM8_IS_32BITS FALSE
  2481. #define STM32_TIM8_CHANNELS 6
  2482. #define STM32_HAS_TIM15 TRUE
  2483. #define STM32_TIM15_IS_32BITS FALSE
  2484. #define STM32_TIM15_CHANNELS 2
  2485. #define STM32_HAS_TIM16 TRUE
  2486. #define STM32_TIM16_IS_32BITS FALSE
  2487. #define STM32_TIM16_CHANNELS 1
  2488. #define STM32_HAS_TIM17 TRUE
  2489. #define STM32_TIM17_IS_32BITS FALSE
  2490. #define STM32_TIM17_CHANNELS 1
  2491. #define STM32_HAS_TIM20 TRUE
  2492. #define STM32_TIM20_IS_32BITS FALSE
  2493. #define STM32_TIM20_CHANNELS 6
  2494. #define STM32_HAS_TIM5 FALSE
  2495. #define STM32_HAS_TIM9 FALSE
  2496. #define STM32_HAS_TIM10 FALSE
  2497. #define STM32_HAS_TIM11 FALSE
  2498. #define STM32_HAS_TIM12 FALSE
  2499. #define STM32_HAS_TIM13 FALSE
  2500. #define STM32_HAS_TIM14 FALSE
  2501. #define STM32_HAS_TIM18 FALSE
  2502. #define STM32_HAS_TIM19 FALSE
  2503. #define STM32_HAS_TIM21 FALSE
  2504. #define STM32_HAS_TIM22 FALSE
  2505. /* USART attributes.*/
  2506. #define STM32_HAS_USART1 TRUE
  2507. #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
  2508. #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
  2509. #define STM32_HAS_USART2 TRUE
  2510. #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
  2511. #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
  2512. #define STM32_HAS_USART3 TRUE
  2513. #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
  2514. #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
  2515. #define STM32_HAS_UART4 TRUE
  2516. #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
  2517. #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
  2518. #define STM32_HAS_UART5 TRUE
  2519. #define STM32_HAS_USART6 FALSE
  2520. #define STM32_HAS_UART7 FALSE
  2521. #define STM32_HAS_UART8 FALSE
  2522. #define STM32_HAS_LPUART1 FALSE
  2523. /* USB attributes.*/
  2524. #define STM32_HAS_USB FALSE
  2525. #define STM32_HAS_OTG1 FALSE
  2526. #define STM32_HAS_OTG2 FALSE
  2527. /* IWDG attributes.*/
  2528. #define STM32_HAS_IWDG TRUE
  2529. #define STM32_IWDG_IS_WINDOWED TRUE
  2530. /* LTDC attributes.*/
  2531. #define STM32_HAS_LTDC FALSE
  2532. /* DMA2D attributes.*/
  2533. #define STM32_HAS_DMA2D FALSE
  2534. /* FSMC attributes.*/
  2535. #define STM32_HAS_FSMC TRUE
  2536. #define STM32_FSMC_IS_FMC FALSE
  2537. /* CRC attributes.*/
  2538. #define STM32_HAS_CRC TRUE
  2539. #define STM32_CRC_PROGRAMMABLE TRUE
  2540. #endif /* defined(STM32F398xx) */
  2541. /** @} */
  2542. #endif /* STM32_REGISTRY_H */
  2543. /** @} */