stm32_registry.h 137 KB

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