board.h 109 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764
  1. /*
  2. ChibiOS - Copyright (C) 2006..2017 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. * This file has been automatically generated using ChibiStudio board
  15. * generator plugin. Do not edit manually.
  16. */
  17. #ifndef BOARD_H
  18. #define BOARD_H
  19. /*===========================================================================*/
  20. /* Driver constants. */
  21. /*===========================================================================*/
  22. /*
  23. * Setup for STMicroelectronics STM32F769I-Discovery board.
  24. */
  25. /*
  26. * Board identifier.
  27. */
  28. #define BOARD_ST_STM32F769I_DISCOVERY
  29. #define BOARD_NAME "STMicroelectronics STM32F769I-Discovery"
  30. /*
  31. * Ethernet PHY type.
  32. */
  33. #define BOARD_PHY_ID MII_LAN8742A_ID
  34. #define BOARD_PHY_RMII
  35. /*
  36. * The board has an ULPI USB PHY.
  37. */
  38. #define BOARD_OTG2_USES_ULPI
  39. /*
  40. * Board oscillators-related settings.
  41. */
  42. #if !defined(STM32_LSECLK)
  43. #define STM32_LSECLK 32768U
  44. #endif
  45. #define STM32_LSEDRV (3U << 3U)
  46. #if !defined(STM32_HSECLK)
  47. #define STM32_HSECLK 25000000U
  48. #endif
  49. #define STM32_HSE_BYPASS
  50. /*
  51. * Board voltages.
  52. * Required for performance limits calculation.
  53. */
  54. #define STM32_VDD 300U
  55. /*
  56. * MCU type as defined in the ST header.
  57. */
  58. #define STM32F769xx
  59. /*
  60. * IO pins assignments.
  61. */
  62. #define GPIOA_BUTTON_USER 0U
  63. #define GPIOA_RMII_REF_CLK 1U
  64. #define GPIOA_RMII_MDIO 2U
  65. #define GPIOA_ULPI_D0 3U
  66. #define GPIOA_ARD_A1 4U
  67. #define GPIOA_ULPI_CK 5U
  68. #define GPIOA_ARD_A0 6U
  69. #define GPIOA_RMII_CRS_DV 7U
  70. #define GPIOA_CEC_CLK 8U
  71. #define GPIOA_VCP_TX 9U
  72. #define GPIOA_VCP_RX 10U
  73. #define GPIOA_ARD_D10 11U
  74. #define GPIOA_ARD_D13 12U
  75. #define GPIOA_SWDIO 13U
  76. #define GPIOA_SWCLK 14U
  77. #define GPIOA_CEC 15U
  78. #define GPIOB_ULPI_D1 0U
  79. #define GPIOB_ULPI_D2 1U
  80. #define GPIOB_QSPI_CLK 2U
  81. #define GPIOB_SD_D2 3U
  82. #define GPIOB_SD_D3 4U
  83. #define GPIOB_ULPI_D7 5U
  84. #define GPIOB_QSPI_NCS 6U
  85. #define GPIOB_AUDIO_SDA 7U
  86. #define GPIOB_LCD_SDA 7U
  87. #define GPIOB_ARD_D15 8U
  88. #define GPIOB_ARD_D14 9U
  89. #define GPIOB_ULPI_D3 10U
  90. #define GPIOB_ULPI_D4 11U
  91. #define GPIOB_ULPI_D5 12U
  92. #define GPIOB_ULPI_D6 13U
  93. #define GPIOB_ARD_D12 14U
  94. #define GPIOB_ARD_D11 15U
  95. #define GPIOC_ULPI_STP 0U
  96. #define GPIOC_RMII_MDC 1U
  97. #define GPIOC_ARD_A2 2U
  98. #define GPIOC_DFSDM_DATIN1 3U
  99. #define GPIOC_RMII_RXD0 4U
  100. #define GPIOC_RMII_RXD1 5U
  101. #define GPIOC_ARD_D1 6U
  102. #define GPIOC_ARD_D0 7U
  103. #define GPIOC_ARD_D5 8U
  104. #define GPIOC_QSPI_D0 9U
  105. #define GPIOC_QSPI_D1 10U
  106. #define GPIOC_DFSDM_DATIN5 11U
  107. #define GPIOC_WIFI_RX 12U
  108. #define GPIOC_PIN13 13U
  109. #define GPIOC_OSC32_IN 14U
  110. #define GPIOC_OSC32_OUT 15U
  111. #define GPIOD_FMC_D2 0U
  112. #define GPIOD_FMC_D3 1U
  113. #define GPIOD_WIFI_TX 2U
  114. #define GPIOD_DFSDM_CKOUT 3U
  115. #define GPIOD_OTG_HS_OVER_CURRENT 4U
  116. #define GPIOD_RMII_RXER 5U
  117. #define GPIOD_SD_CLK 6U
  118. #define GPIOD_SD_CMD 7U
  119. #define GPIOD_FMC_D13 8U
  120. #define GPIOD_FMC_D14 9U
  121. #define GPIOD_FMC_D15 10U
  122. #define GPIOD_SPDIF_I2S 11U
  123. #define GPIOD_AUDIO_SCL 12U
  124. #define GPIOD_LCD_SCL 12U
  125. #define GPIOD_QSPI_D3 13U
  126. #define GPIOD_FMC_D0 14U
  127. #define GPIOD_FMC_D1 15U
  128. #define GPIOE_FMC_NBL0 0U
  129. #define GPIOE_FMC_NBL1 1U
  130. #define GPIOE_QSPI_D2 2U
  131. #define GPIOE_SAI1_SDB 3U
  132. #define GPIOE_SAI1_FSA 4U
  133. #define GPIOE_SAI1_SCKA 5U
  134. #define GPIOE_SAI1_SDA 6U
  135. #define GPIOE_FMC_D4 7U
  136. #define GPIOE_FMC_D5 8U
  137. #define GPIOE_FMC_D6 9U
  138. #define GPIOE_FMC_D7 10U
  139. #define GPIOE_FMC_D8 11U
  140. #define GPIOE_FMC_D9 12U
  141. #define GPIOE_FMC_D10 13U
  142. #define GPIOE_FMC_11 14U
  143. #define GPIOE_FMC_D12 15U
  144. #define GPIOF_FMC_A0 0U
  145. #define GPIOF_FMC_A1 1U
  146. #define GPIOF_FMC_A2 2U
  147. #define GPIOF_FMC_A3 3U
  148. #define GPIOF_FMC_A4 4U
  149. #define GPIOF_FMC_A5 5U
  150. #define GPIOF_ARD_D3 6U
  151. #define GPIOF_ARD_D6 7U
  152. #define GPIOF_ARD_A4 8U
  153. #define GPIOF_ARD_A5 9U
  154. #define GPIOF_ARD_A3 10U
  155. #define GPIOF_FMC_SDNRAS 11U
  156. #define GPIOF_FMC_A6 12U
  157. #define GPIOF_FMC_A7 13U
  158. #define GPIOF_FMC_A8 14U
  159. #define GPIOF_FMC_A9 15U
  160. #define GPIOG_FMC_A10 0U
  161. #define GPIOG_FMC_A11 1U
  162. #define GPIOG_FMC_A12 2U
  163. #define GPIOG_EXT_SCL 3U
  164. #define GPIOG_FMC_BA0 4U
  165. #define GPIOG_FMC_BA1 5U
  166. #define GPIOG_EXT_SDA 6U
  167. #define GPIOG_SAI1_MCLKA 7U
  168. #define GPIOG_FMC_SDCLK 8U
  169. #define GPIOG_SD_D0 9U
  170. #define GPIOG_SD_D1 10U
  171. #define GPIOG_RMII_TX_EN 11U
  172. #define GPIOG_SPDIF_RX 12U
  173. #define GPIOG_RMII_TXD0 13U
  174. #define GPIOG_RMII_TXD1 14U
  175. #define GPIOG_FMC_SDNCAS 15U
  176. #define GPIOH_OSC_IN 0U
  177. #define GPIOH_OSC_OUT 1U
  178. #define GPIOH_FMC_SDCKE0 2U
  179. #define GPIOH_FMC_SDNE0 3U
  180. #define GPIOH_ULPI_NXT 4U
  181. #define GPIOH_FMC_SDNWE 5U
  182. #define GPIOH_ARD_D9 6U
  183. #define GPIOH_EXT_RST 7U
  184. #define GPIOH_FMC_D16 8U
  185. #define GPIOH_FMC_D17 9U
  186. #define GPIOH_FMC_D18 10U
  187. #define GPIOH_FMC_D19 11U
  188. #define GPIOH_FMC_D20 12U
  189. #define GPIOH_FMC_D21 13U
  190. #define GPIOH_FMC_D22 14U
  191. #define GPIOH_FMC_D23 15U
  192. #define GPIOI_FMC_D24 0U
  193. #define GPIOI_FMC_D25 1U
  194. #define GPIOI_FMC_D26 2U
  195. #define GPIOI_FMC_D27 3U
  196. #define GPIOI_FMC_NBL2 4U
  197. #define GPIOI_FMC_NBL3 5U
  198. #define GPIOI_FMC_D28 6U
  199. #define GPIOI_FMC_D29 7U
  200. #define GPIOI_PIN8 8U
  201. #define GPIOI_FMC_D30 9U
  202. #define GPIOI_FMC_D31 10U
  203. #define GPIOI_ULPI_DIR 11U
  204. #define GPIOI_PIN12 12U
  205. #define GPIOI_LCD_INT 13U
  206. #define GPIOI_LCD_BL_CTRL 14U
  207. #define GPIOI_SD_DETECT 15U
  208. #define GPIOJ_ARD_D4 0U
  209. #define GPIOJ_ARD_D2 1U
  210. #define GPIOJ_DSI_TE 2U
  211. #define GPIOJ_ARD_D7 3U
  212. #define GPIOJ_ARD_D8 4U
  213. #define GPIOJ_LED2_GREEN 5U
  214. #define GPIOJ_PIN6 6U
  215. #define GPIOJ_PIN7 7U
  216. #define GPIOJ_PIN8 8U
  217. #define GPIOJ_PIN9 9U
  218. #define GPIOJ_PIN10 10U
  219. #define GPIOJ_PIN11 11U
  220. #define GPIOJ_AUDIO_INT 12U
  221. #define GPIOJ_LED1_RED 13U
  222. #define GPIOJ_WIFI_RST 14U
  223. #define GPIOJ_DSI_RESET 15U
  224. #define GPIOK_PIN0 0U
  225. #define GPIOK_PIN1 1U
  226. #define GPIOK_PIN2 2U
  227. #define GPIOK_PIN3 3U
  228. #define GPIOK_PIN4 4U
  229. #define GPIOK_PIN5 5U
  230. #define GPIOK_PIN6 6U
  231. #define GPIOK_PIN7 7U
  232. #define GPIOK_PIN8 8U
  233. #define GPIOK_PIN9 9U
  234. #define GPIOK_PIN10 10U
  235. #define GPIOK_PIN11 11U
  236. #define GPIOK_PIN12 12U
  237. #define GPIOK_PIN13 13U
  238. #define GPIOK_PIN14 14U
  239. #define GPIOK_PIN15 15U
  240. /*
  241. * IO lines assignments.
  242. */
  243. #define LINE_BUTTON_USER PAL_LINE(GPIOA, 0U)
  244. #define LINE_RMII_REF_CLK PAL_LINE(GPIOA, 1U)
  245. #define LINE_RMII_MDIO PAL_LINE(GPIOA, 2U)
  246. #define LINE_ULPI_D0 PAL_LINE(GPIOA, 3U)
  247. #define LINE_ARD_A1 PAL_LINE(GPIOA, 4U)
  248. #define LINE_ULPI_CK PAL_LINE(GPIOA, 5U)
  249. #define LINE_ARD_A0 PAL_LINE(GPIOA, 6U)
  250. #define LINE_RMII_CRS_DV PAL_LINE(GPIOA, 7U)
  251. #define LINE_CEC_CLK PAL_LINE(GPIOA, 8U)
  252. #define LINE_VCP_TX PAL_LINE(GPIOA, 9U)
  253. #define LINE_VCP_RX PAL_LINE(GPIOA, 10U)
  254. #define LINE_ARD_D10 PAL_LINE(GPIOA, 11U)
  255. #define LINE_ARD_D13 PAL_LINE(GPIOA, 12U)
  256. #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
  257. #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
  258. #define LINE_CEC PAL_LINE(GPIOA, 15U)
  259. #define LINE_ULPI_D1 PAL_LINE(GPIOB, 0U)
  260. #define LINE_ULPI_D2 PAL_LINE(GPIOB, 1U)
  261. #define LINE_QSPI_CLK PAL_LINE(GPIOB, 2U)
  262. #define LINE_SD_D2 PAL_LINE(GPIOB, 3U)
  263. #define LINE_SD_D3 PAL_LINE(GPIOB, 4U)
  264. #define LINE_ULPI_D7 PAL_LINE(GPIOB, 5U)
  265. #define LINE_QSPI_NCS PAL_LINE(GPIOB, 6U)
  266. #define LINE_AUDIO_SDA PAL_LINE(GPIOB, 7U)
  267. #define LINE_LCD_SDA PAL_LINE(GPIOB, 7U)
  268. #define LINE_ARD_D15 PAL_LINE(GPIOB, 8U)
  269. #define LINE_ARD_D14 PAL_LINE(GPIOB, 9U)
  270. #define LINE_ULPI_D3 PAL_LINE(GPIOB, 10U)
  271. #define LINE_ULPI_D4 PAL_LINE(GPIOB, 11U)
  272. #define LINE_ULPI_D5 PAL_LINE(GPIOB, 12U)
  273. #define LINE_ULPI_D6 PAL_LINE(GPIOB, 13U)
  274. #define LINE_ARD_D12 PAL_LINE(GPIOB, 14U)
  275. #define LINE_ARD_D11 PAL_LINE(GPIOB, 15U)
  276. #define LINE_ULPI_STP PAL_LINE(GPIOC, 0U)
  277. #define LINE_RMII_MDC PAL_LINE(GPIOC, 1U)
  278. #define LINE_ARD_A2 PAL_LINE(GPIOC, 2U)
  279. #define LINE_DFSDM_DATIN1 PAL_LINE(GPIOC, 3U)
  280. #define LINE_RMII_RXD0 PAL_LINE(GPIOC, 4U)
  281. #define LINE_RMII_RXD1 PAL_LINE(GPIOC, 5U)
  282. #define LINE_ARD_D1 PAL_LINE(GPIOC, 6U)
  283. #define LINE_ARD_D0 PAL_LINE(GPIOC, 7U)
  284. #define LINE_ARD_D5 PAL_LINE(GPIOC, 8U)
  285. #define LINE_QSPI_D0 PAL_LINE(GPIOC, 9U)
  286. #define LINE_QSPI_D1 PAL_LINE(GPIOC, 10U)
  287. #define LINE_DFSDM_DATIN5 PAL_LINE(GPIOC, 11U)
  288. #define LINE_WIFI_RX PAL_LINE(GPIOC, 12U)
  289. #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
  290. #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
  291. #define LINE_FMC_D2 PAL_LINE(GPIOD, 0U)
  292. #define LINE_FMC_D3 PAL_LINE(GPIOD, 1U)
  293. #define LINE_WIFI_TX PAL_LINE(GPIOD, 2U)
  294. #define LINE_DFSDM_CKOUT PAL_LINE(GPIOD, 3U)
  295. #define LINE_OTG_HS_OVER_CURRENT PAL_LINE(GPIOD, 4U)
  296. #define LINE_RMII_RXER PAL_LINE(GPIOD, 5U)
  297. #define LINE_SD_CLK PAL_LINE(GPIOD, 6U)
  298. #define LINE_SD_CMD PAL_LINE(GPIOD, 7U)
  299. #define LINE_FMC_D13 PAL_LINE(GPIOD, 8U)
  300. #define LINE_FMC_D14 PAL_LINE(GPIOD, 9U)
  301. #define LINE_FMC_D15 PAL_LINE(GPIOD, 10U)
  302. #define LINE_SPDIF_I2S PAL_LINE(GPIOD, 11U)
  303. #define LINE_AUDIO_SCL PAL_LINE(GPIOD, 12U)
  304. #define LINE_LCD_SCL PAL_LINE(GPIOD, 12U)
  305. #define LINE_QSPI_D3 PAL_LINE(GPIOD, 13U)
  306. #define LINE_FMC_D0 PAL_LINE(GPIOD, 14U)
  307. #define LINE_FMC_D1 PAL_LINE(GPIOD, 15U)
  308. #define LINE_FMC_NBL0 PAL_LINE(GPIOE, 0U)
  309. #define LINE_FMC_NBL1 PAL_LINE(GPIOE, 1U)
  310. #define LINE_QSPI_D2 PAL_LINE(GPIOE, 2U)
  311. #define LINE_SAI1_SDB PAL_LINE(GPIOE, 3U)
  312. #define LINE_SAI1_FSA PAL_LINE(GPIOE, 4U)
  313. #define LINE_SAI1_SCKA PAL_LINE(GPIOE, 5U)
  314. #define LINE_SAI1_SDA PAL_LINE(GPIOE, 6U)
  315. #define LINE_FMC_D4 PAL_LINE(GPIOE, 7U)
  316. #define LINE_FMC_D5 PAL_LINE(GPIOE, 8U)
  317. #define LINE_FMC_D6 PAL_LINE(GPIOE, 9U)
  318. #define LINE_FMC_D7 PAL_LINE(GPIOE, 10U)
  319. #define LINE_FMC_D8 PAL_LINE(GPIOE, 11U)
  320. #define LINE_FMC_D9 PAL_LINE(GPIOE, 12U)
  321. #define LINE_FMC_D10 PAL_LINE(GPIOE, 13U)
  322. #define LINE_FMC_11 PAL_LINE(GPIOE, 14U)
  323. #define LINE_FMC_D12 PAL_LINE(GPIOE, 15U)
  324. #define LINE_FMC_A0 PAL_LINE(GPIOF, 0U)
  325. #define LINE_FMC_A1 PAL_LINE(GPIOF, 1U)
  326. #define LINE_FMC_A2 PAL_LINE(GPIOF, 2U)
  327. #define LINE_FMC_A3 PAL_LINE(GPIOF, 3U)
  328. #define LINE_FMC_A4 PAL_LINE(GPIOF, 4U)
  329. #define LINE_FMC_A5 PAL_LINE(GPIOF, 5U)
  330. #define LINE_ARD_D3 PAL_LINE(GPIOF, 6U)
  331. #define LINE_ARD_D6 PAL_LINE(GPIOF, 7U)
  332. #define LINE_ARD_A4 PAL_LINE(GPIOF, 8U)
  333. #define LINE_ARD_A5 PAL_LINE(GPIOF, 9U)
  334. #define LINE_ARD_A3 PAL_LINE(GPIOF, 10U)
  335. #define LINE_FMC_SDNRAS PAL_LINE(GPIOF, 11U)
  336. #define LINE_FMC_A6 PAL_LINE(GPIOF, 12U)
  337. #define LINE_FMC_A7 PAL_LINE(GPIOF, 13U)
  338. #define LINE_FMC_A8 PAL_LINE(GPIOF, 14U)
  339. #define LINE_FMC_A9 PAL_LINE(GPIOF, 15U)
  340. #define LINE_FMC_A10 PAL_LINE(GPIOG, 0U)
  341. #define LINE_FMC_A11 PAL_LINE(GPIOG, 1U)
  342. #define LINE_FMC_A12 PAL_LINE(GPIOG, 2U)
  343. #define LINE_EXT_SCL PAL_LINE(GPIOG, 3U)
  344. #define LINE_FMC_BA0 PAL_LINE(GPIOG, 4U)
  345. #define LINE_FMC_BA1 PAL_LINE(GPIOG, 5U)
  346. #define LINE_EXT_SDA PAL_LINE(GPIOG, 6U)
  347. #define LINE_SAI1_MCLKA PAL_LINE(GPIOG, 7U)
  348. #define LINE_FMC_SDCLK PAL_LINE(GPIOG, 8U)
  349. #define LINE_SD_D0 PAL_LINE(GPIOG, 9U)
  350. #define LINE_SD_D1 PAL_LINE(GPIOG, 10U)
  351. #define LINE_RMII_TX_EN PAL_LINE(GPIOG, 11U)
  352. #define LINE_SPDIF_RX PAL_LINE(GPIOG, 12U)
  353. #define LINE_RMII_TXD0 PAL_LINE(GPIOG, 13U)
  354. #define LINE_RMII_TXD1 PAL_LINE(GPIOG, 14U)
  355. #define LINE_FMC_SDNCAS PAL_LINE(GPIOG, 15U)
  356. #define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
  357. #define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
  358. #define LINE_FMC_SDCKE0 PAL_LINE(GPIOH, 2U)
  359. #define LINE_FMC_SDNE0 PAL_LINE(GPIOH, 3U)
  360. #define LINE_ULPI_NXT PAL_LINE(GPIOH, 4U)
  361. #define LINE_FMC_SDNWE PAL_LINE(GPIOH, 5U)
  362. #define LINE_ARD_D9 PAL_LINE(GPIOH, 6U)
  363. #define LINE_EXT_RST PAL_LINE(GPIOH, 7U)
  364. #define LINE_FMC_D16 PAL_LINE(GPIOH, 8U)
  365. #define LINE_FMC_D17 PAL_LINE(GPIOH, 9U)
  366. #define LINE_FMC_D18 PAL_LINE(GPIOH, 10U)
  367. #define LINE_FMC_D19 PAL_LINE(GPIOH, 11U)
  368. #define LINE_FMC_D20 PAL_LINE(GPIOH, 12U)
  369. #define LINE_FMC_D21 PAL_LINE(GPIOH, 13U)
  370. #define LINE_FMC_D22 PAL_LINE(GPIOH, 14U)
  371. #define LINE_FMC_D23 PAL_LINE(GPIOH, 15U)
  372. #define LINE_FMC_D24 PAL_LINE(GPIOI, 0U)
  373. #define LINE_FMC_D25 PAL_LINE(GPIOI, 1U)
  374. #define LINE_FMC_D26 PAL_LINE(GPIOI, 2U)
  375. #define LINE_FMC_D27 PAL_LINE(GPIOI, 3U)
  376. #define LINE_FMC_NBL2 PAL_LINE(GPIOI, 4U)
  377. #define LINE_FMC_NBL3 PAL_LINE(GPIOI, 5U)
  378. #define LINE_FMC_D28 PAL_LINE(GPIOI, 6U)
  379. #define LINE_FMC_D29 PAL_LINE(GPIOI, 7U)
  380. #define LINE_FMC_D30 PAL_LINE(GPIOI, 9U)
  381. #define LINE_FMC_D31 PAL_LINE(GPIOI, 10U)
  382. #define LINE_ULPI_DIR PAL_LINE(GPIOI, 11U)
  383. #define LINE_LCD_INT PAL_LINE(GPIOI, 13U)
  384. #define LINE_LCD_BL_CTRL PAL_LINE(GPIOI, 14U)
  385. #define LINE_SD_DETECT PAL_LINE(GPIOI, 15U)
  386. #define LINE_ARD_D4 PAL_LINE(GPIOJ, 0U)
  387. #define LINE_ARD_D2 PAL_LINE(GPIOJ, 1U)
  388. #define LINE_DSI_TE PAL_LINE(GPIOJ, 2U)
  389. #define LINE_ARD_D7 PAL_LINE(GPIOJ, 3U)
  390. #define LINE_ARD_D8 PAL_LINE(GPIOJ, 4U)
  391. #define LINE_LED2_GREEN PAL_LINE(GPIOJ, 5U)
  392. #define LINE_AUDIO_INT PAL_LINE(GPIOJ, 12U)
  393. #define LINE_LED1_RED PAL_LINE(GPIOJ, 13U)
  394. #define LINE_WIFI_RST PAL_LINE(GPIOJ, 14U)
  395. #define LINE_DSI_RESET PAL_LINE(GPIOJ, 15U)
  396. /*===========================================================================*/
  397. /* Driver pre-compile time settings. */
  398. /*===========================================================================*/
  399. /*===========================================================================*/
  400. /* Derived constants and error checks. */
  401. /*===========================================================================*/
  402. /*===========================================================================*/
  403. /* Driver data structures and types. */
  404. /*===========================================================================*/
  405. /*===========================================================================*/
  406. /* Driver macros. */
  407. /*===========================================================================*/
  408. /*
  409. * I/O ports initial setup, this configuration is established soon after reset
  410. * in the initialization code.
  411. * Please refer to the STM32 Reference Manual for details.
  412. */
  413. #define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
  414. #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
  415. #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
  416. #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
  417. #define PIN_ODR_LOW(n) (0U << (n))
  418. #define PIN_ODR_HIGH(n) (1U << (n))
  419. #define PIN_OTYPE_PUSHPULL(n) (0U << (n))
  420. #define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
  421. #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U))
  422. #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U))
  423. #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U))
  424. #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U))
  425. #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
  426. #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
  427. #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
  428. #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
  429. /*
  430. * GPIOA setup:
  431. *
  432. * PA0 - BUTTON_USER (input floating).
  433. * PA1 - RMII_REF_CLK (alternate 11).
  434. * PA2 - RMII_MDIO (alternate 11).
  435. * PA3 - ULPI_D0 (alternate 10).
  436. * PA4 - ARD_A1 (input pullup).
  437. * PA5 - ULPI_CK (alternate 10).
  438. * PA6 - ARD_A0 (input pullup).
  439. * PA7 - RMII_CRS_DV (alternate 11).
  440. * PA8 - CEC_CLK (alternate 0).
  441. * PA9 - VCP_TX (alternate 7).
  442. * PA10 - VCP_RX (alternate 7).
  443. * PA11 - ARD_D10 (input pullup).
  444. * PA12 - ARD_D13 (input pullup).
  445. * PA13 - SWDIO (alternate 0).
  446. * PA14 - SWCLK (alternate 0).
  447. * PA15 - CEC (alternate 3).
  448. */
  449. #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON_USER) | \
  450. PIN_MODE_ALTERNATE(GPIOA_RMII_REF_CLK) |\
  451. PIN_MODE_ALTERNATE(GPIOA_RMII_MDIO) | \
  452. PIN_MODE_ALTERNATE(GPIOA_ULPI_D0) | \
  453. PIN_MODE_INPUT(GPIOA_ARD_A1) | \
  454. PIN_MODE_ALTERNATE(GPIOA_ULPI_CK) | \
  455. PIN_MODE_INPUT(GPIOA_ARD_A0) | \
  456. PIN_MODE_ALTERNATE(GPIOA_RMII_CRS_DV) |\
  457. PIN_MODE_ALTERNATE(GPIOA_CEC_CLK) | \
  458. PIN_MODE_ALTERNATE(GPIOA_VCP_TX) | \
  459. PIN_MODE_ALTERNATE(GPIOA_VCP_RX) | \
  460. PIN_MODE_INPUT(GPIOA_ARD_D10) | \
  461. PIN_MODE_INPUT(GPIOA_ARD_D13) | \
  462. PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
  463. PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
  464. PIN_MODE_ALTERNATE(GPIOA_CEC))
  465. #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON_USER) |\
  466. PIN_OTYPE_PUSHPULL(GPIOA_RMII_REF_CLK) |\
  467. PIN_OTYPE_PUSHPULL(GPIOA_RMII_MDIO) | \
  468. PIN_OTYPE_PUSHPULL(GPIOA_ULPI_D0) | \
  469. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A1) | \
  470. PIN_OTYPE_PUSHPULL(GPIOA_ULPI_CK) | \
  471. PIN_OTYPE_PUSHPULL(GPIOA_ARD_A0) | \
  472. PIN_OTYPE_PUSHPULL(GPIOA_RMII_CRS_DV) |\
  473. PIN_OTYPE_PUSHPULL(GPIOA_CEC_CLK) | \
  474. PIN_OTYPE_PUSHPULL(GPIOA_VCP_TX) | \
  475. PIN_OTYPE_PUSHPULL(GPIOA_VCP_RX) | \
  476. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D10) | \
  477. PIN_OTYPE_PUSHPULL(GPIOA_ARD_D13) | \
  478. PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \
  479. PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \
  480. PIN_OTYPE_PUSHPULL(GPIOA_CEC))
  481. #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_BUTTON_USER) | \
  482. PIN_OSPEED_HIGH(GPIOA_RMII_REF_CLK) | \
  483. PIN_OSPEED_HIGH(GPIOA_RMII_MDIO) | \
  484. PIN_OSPEED_HIGH(GPIOA_ULPI_D0) | \
  485. PIN_OSPEED_VERYLOW(GPIOA_ARD_A1) | \
  486. PIN_OSPEED_HIGH(GPIOA_ULPI_CK) | \
  487. PIN_OSPEED_VERYLOW(GPIOA_ARD_A0) | \
  488. PIN_OSPEED_HIGH(GPIOA_RMII_CRS_DV) | \
  489. PIN_OSPEED_HIGH(GPIOA_CEC_CLK) | \
  490. PIN_OSPEED_HIGH(GPIOA_VCP_TX) | \
  491. PIN_OSPEED_HIGH(GPIOA_VCP_RX) | \
  492. PIN_OSPEED_VERYLOW(GPIOA_ARD_D10) | \
  493. PIN_OSPEED_VERYLOW(GPIOA_ARD_D13) | \
  494. PIN_OSPEED_HIGH(GPIOA_SWDIO) | \
  495. PIN_OSPEED_HIGH(GPIOA_SWCLK) | \
  496. PIN_OSPEED_HIGH(GPIOA_CEC))
  497. #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON_USER) |\
  498. PIN_PUPDR_FLOATING(GPIOA_RMII_REF_CLK) |\
  499. PIN_PUPDR_PULLUP(GPIOA_RMII_MDIO) | \
  500. PIN_PUPDR_FLOATING(GPIOA_ULPI_D0) | \
  501. PIN_PUPDR_PULLUP(GPIOA_ARD_A1) | \
  502. PIN_PUPDR_FLOATING(GPIOA_ULPI_CK) | \
  503. PIN_PUPDR_PULLUP(GPIOA_ARD_A0) | \
  504. PIN_PUPDR_FLOATING(GPIOA_RMII_CRS_DV) |\
  505. PIN_PUPDR_FLOATING(GPIOA_CEC_CLK) | \
  506. PIN_PUPDR_FLOATING(GPIOA_VCP_TX) | \
  507. PIN_PUPDR_FLOATING(GPIOA_VCP_RX) | \
  508. PIN_PUPDR_PULLUP(GPIOA_ARD_D10) | \
  509. PIN_PUPDR_PULLUP(GPIOA_ARD_D13) | \
  510. PIN_PUPDR_FLOATING(GPIOA_SWDIO) | \
  511. PIN_PUPDR_FLOATING(GPIOA_SWCLK) | \
  512. PIN_PUPDR_FLOATING(GPIOA_CEC))
  513. #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON_USER) | \
  514. PIN_ODR_HIGH(GPIOA_RMII_REF_CLK) | \
  515. PIN_ODR_HIGH(GPIOA_RMII_MDIO) | \
  516. PIN_ODR_HIGH(GPIOA_ULPI_D0) | \
  517. PIN_ODR_HIGH(GPIOA_ARD_A1) | \
  518. PIN_ODR_HIGH(GPIOA_ULPI_CK) | \
  519. PIN_ODR_HIGH(GPIOA_ARD_A0) | \
  520. PIN_ODR_HIGH(GPIOA_RMII_CRS_DV) | \
  521. PIN_ODR_HIGH(GPIOA_CEC_CLK) | \
  522. PIN_ODR_HIGH(GPIOA_VCP_TX) | \
  523. PIN_ODR_HIGH(GPIOA_VCP_RX) | \
  524. PIN_ODR_HIGH(GPIOA_ARD_D10) | \
  525. PIN_ODR_HIGH(GPIOA_ARD_D13) | \
  526. PIN_ODR_HIGH(GPIOA_SWDIO) | \
  527. PIN_ODR_HIGH(GPIOA_SWCLK) | \
  528. PIN_ODR_HIGH(GPIOA_CEC))
  529. #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON_USER, 0U) | \
  530. PIN_AFIO_AF(GPIOA_RMII_REF_CLK, 11U) | \
  531. PIN_AFIO_AF(GPIOA_RMII_MDIO, 11U) | \
  532. PIN_AFIO_AF(GPIOA_ULPI_D0, 10U) | \
  533. PIN_AFIO_AF(GPIOA_ARD_A1, 0U) | \
  534. PIN_AFIO_AF(GPIOA_ULPI_CK, 10U) | \
  535. PIN_AFIO_AF(GPIOA_ARD_A0, 0U) | \
  536. PIN_AFIO_AF(GPIOA_RMII_CRS_DV, 11U))
  537. #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_CEC_CLK, 0U) | \
  538. PIN_AFIO_AF(GPIOA_VCP_TX, 7U) | \
  539. PIN_AFIO_AF(GPIOA_VCP_RX, 7U) | \
  540. PIN_AFIO_AF(GPIOA_ARD_D10, 0U) | \
  541. PIN_AFIO_AF(GPIOA_ARD_D13, 0U) | \
  542. PIN_AFIO_AF(GPIOA_SWDIO, 0U) | \
  543. PIN_AFIO_AF(GPIOA_SWCLK, 0U) | \
  544. PIN_AFIO_AF(GPIOA_CEC, 3U))
  545. /*
  546. * GPIOB setup:
  547. *
  548. * PB0 - ULPI_D1 (alternate 10).
  549. * PB1 - ULPI_D2 (alternate 10).
  550. * PB2 - QSPI_CLK (input pullup).
  551. * PB3 - SD_D2 (alternate 10).
  552. * PB4 - SD_D3 (alternate 10).
  553. * PB5 - ULPI_D7 (alternate 10).
  554. * PB6 - QSPI_NCS (input pullup).
  555. * PB7 - AUDIO_SDA LCD_SDA (alternate 11).
  556. * PB8 - ARD_D15 (input pullup).
  557. * PB9 - ARD_D14 (input pullup).
  558. * PB10 - ULPI_D3 (alternate 10).
  559. * PB11 - ULPI_D4 (alternate 10).
  560. * PB12 - ULPI_D5 (alternate 10).
  561. * PB13 - ULPI_D6 (alternate 10).
  562. * PB14 - ARD_D12 (input pullup).
  563. * PB15 - ARD_D11 (input pullup).
  564. */
  565. #define VAL_GPIOB_MODER (PIN_MODE_ALTERNATE(GPIOB_ULPI_D1) | \
  566. PIN_MODE_ALTERNATE(GPIOB_ULPI_D2) | \
  567. PIN_MODE_INPUT(GPIOB_QSPI_CLK) | \
  568. PIN_MODE_ALTERNATE(GPIOB_SD_D2) | \
  569. PIN_MODE_ALTERNATE(GPIOB_SD_D3) | \
  570. PIN_MODE_ALTERNATE(GPIOB_ULPI_D7) | \
  571. PIN_MODE_INPUT(GPIOB_QSPI_NCS) | \
  572. PIN_MODE_ALTERNATE(GPIOB_AUDIO_SDA) | \
  573. PIN_MODE_INPUT(GPIOB_ARD_D15) | \
  574. PIN_MODE_INPUT(GPIOB_ARD_D14) | \
  575. PIN_MODE_ALTERNATE(GPIOB_ULPI_D3) | \
  576. PIN_MODE_ALTERNATE(GPIOB_ULPI_D4) | \
  577. PIN_MODE_ALTERNATE(GPIOB_ULPI_D5) | \
  578. PIN_MODE_ALTERNATE(GPIOB_ULPI_D6) | \
  579. PIN_MODE_INPUT(GPIOB_ARD_D12) | \
  580. PIN_MODE_INPUT(GPIOB_ARD_D11))
  581. #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_ULPI_D1) | \
  582. PIN_OTYPE_PUSHPULL(GPIOB_ULPI_D2) | \
  583. PIN_OTYPE_PUSHPULL(GPIOB_QSPI_CLK) | \
  584. PIN_OTYPE_PUSHPULL(GPIOB_SD_D2) | \
  585. PIN_OTYPE_PUSHPULL(GPIOB_SD_D3) | \
  586. PIN_OTYPE_PUSHPULL(GPIOB_ULPI_D7) | \
  587. PIN_OTYPE_PUSHPULL(GPIOB_QSPI_NCS) | \
  588. PIN_OTYPE_PUSHPULL(GPIOB_AUDIO_SDA) | \
  589. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D15) | \
  590. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D14) | \
  591. PIN_OTYPE_PUSHPULL(GPIOB_ULPI_D3) | \
  592. PIN_OTYPE_PUSHPULL(GPIOB_ULPI_D4) | \
  593. PIN_OTYPE_PUSHPULL(GPIOB_ULPI_D5) | \
  594. PIN_OTYPE_PUSHPULL(GPIOB_ULPI_D6) | \
  595. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D12) | \
  596. PIN_OTYPE_PUSHPULL(GPIOB_ARD_D11))
  597. #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_ULPI_D1) | \
  598. PIN_OSPEED_HIGH(GPIOB_ULPI_D2) | \
  599. PIN_OSPEED_HIGH(GPIOB_QSPI_CLK) | \
  600. PIN_OSPEED_HIGH(GPIOB_SD_D2) | \
  601. PIN_OSPEED_HIGH(GPIOB_SD_D3) | \
  602. PIN_OSPEED_HIGH(GPIOB_ULPI_D7) | \
  603. PIN_OSPEED_HIGH(GPIOB_QSPI_NCS) | \
  604. PIN_OSPEED_HIGH(GPIOB_AUDIO_SDA) | \
  605. PIN_OSPEED_VERYLOW(GPIOB_ARD_D15) | \
  606. PIN_OSPEED_VERYLOW(GPIOB_ARD_D14) | \
  607. PIN_OSPEED_HIGH(GPIOB_ULPI_D3) | \
  608. PIN_OSPEED_HIGH(GPIOB_ULPI_D4) | \
  609. PIN_OSPEED_HIGH(GPIOB_ULPI_D5) | \
  610. PIN_OSPEED_HIGH(GPIOB_ULPI_D6) | \
  611. PIN_OSPEED_VERYLOW(GPIOB_ARD_D12) | \
  612. PIN_OSPEED_VERYLOW(GPIOB_ARD_D11))
  613. #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_ULPI_D1) | \
  614. PIN_PUPDR_FLOATING(GPIOB_ULPI_D2) | \
  615. PIN_PUPDR_PULLUP(GPIOB_QSPI_CLK) | \
  616. PIN_PUPDR_FLOATING(GPIOB_SD_D2) | \
  617. PIN_PUPDR_FLOATING(GPIOB_SD_D3) | \
  618. PIN_PUPDR_PULLUP(GPIOB_ULPI_D7) | \
  619. PIN_PUPDR_PULLUP(GPIOB_QSPI_NCS) | \
  620. PIN_PUPDR_FLOATING(GPIOB_AUDIO_SDA) | \
  621. PIN_PUPDR_PULLUP(GPIOB_ARD_D15) | \
  622. PIN_PUPDR_PULLUP(GPIOB_ARD_D14) | \
  623. PIN_PUPDR_FLOATING(GPIOB_ULPI_D3) | \
  624. PIN_PUPDR_FLOATING(GPIOB_ULPI_D4) | \
  625. PIN_PUPDR_FLOATING(GPIOB_ULPI_D5) | \
  626. PIN_PUPDR_FLOATING(GPIOB_ULPI_D6) | \
  627. PIN_PUPDR_PULLUP(GPIOB_ARD_D12) | \
  628. PIN_PUPDR_PULLUP(GPIOB_ARD_D11))
  629. #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_ULPI_D1) | \
  630. PIN_ODR_HIGH(GPIOB_ULPI_D2) | \
  631. PIN_ODR_HIGH(GPIOB_QSPI_CLK) | \
  632. PIN_ODR_HIGH(GPIOB_SD_D2) | \
  633. PIN_ODR_HIGH(GPIOB_SD_D3) | \
  634. PIN_ODR_HIGH(GPIOB_ULPI_D7) | \
  635. PIN_ODR_HIGH(GPIOB_QSPI_NCS) | \
  636. PIN_ODR_HIGH(GPIOB_AUDIO_SDA) | \
  637. PIN_ODR_HIGH(GPIOB_ARD_D15) | \
  638. PIN_ODR_HIGH(GPIOB_ARD_D14) | \
  639. PIN_ODR_HIGH(GPIOB_ULPI_D3) | \
  640. PIN_ODR_HIGH(GPIOB_ULPI_D4) | \
  641. PIN_ODR_HIGH(GPIOB_ULPI_D5) | \
  642. PIN_ODR_HIGH(GPIOB_ULPI_D6) | \
  643. PIN_ODR_HIGH(GPIOB_ARD_D12) | \
  644. PIN_ODR_HIGH(GPIOB_ARD_D11))
  645. #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_ULPI_D1, 10U) | \
  646. PIN_AFIO_AF(GPIOB_ULPI_D2, 10U) | \
  647. PIN_AFIO_AF(GPIOB_QSPI_CLK, 0U) | \
  648. PIN_AFIO_AF(GPIOB_SD_D2, 10U) | \
  649. PIN_AFIO_AF(GPIOB_SD_D3, 10U) | \
  650. PIN_AFIO_AF(GPIOB_ULPI_D7, 10U) | \
  651. PIN_AFIO_AF(GPIOB_QSPI_NCS, 0U) | \
  652. PIN_AFIO_AF(GPIOB_AUDIO_SDA, 11U))
  653. #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_ARD_D15, 0U) | \
  654. PIN_AFIO_AF(GPIOB_ARD_D14, 0U) | \
  655. PIN_AFIO_AF(GPIOB_ULPI_D3, 10U) | \
  656. PIN_AFIO_AF(GPIOB_ULPI_D4, 10U) | \
  657. PIN_AFIO_AF(GPIOB_ULPI_D5, 10U) | \
  658. PIN_AFIO_AF(GPIOB_ULPI_D6, 10U) | \
  659. PIN_AFIO_AF(GPIOB_ARD_D12, 0U) | \
  660. PIN_AFIO_AF(GPIOB_ARD_D11, 0U))
  661. /*
  662. * GPIOC setup:
  663. *
  664. * PC0 - ULPI_STP (alternate 10).
  665. * PC1 - RMII_MDC (alternate 11).
  666. * PC2 - ARD_A2 (input pullup).
  667. * PC3 - DFSDM_DATIN1 (alternate 3).
  668. * PC4 - RMII_RXD0 (alternate 11).
  669. * PC5 - RMII_RXD1 (alternate 11).
  670. * PC6 - ARD_D1 (input pullup).
  671. * PC7 - ARD_D0 (input floating).
  672. * PC8 - ARD_D5 (input floating).
  673. * PC9 - QSPI_D0 (alternate 9).
  674. * PC10 - QSPI_D1 (alternate 9).
  675. * PC11 - DFSDM_DATIN5 (alternate 3).
  676. * PC12 - WIFI_RX (alternate 8).
  677. * PC13 - PIN13 (input pullup).
  678. * PC14 - OSC32_IN (input floating).
  679. * PC15 - OSC32_OUT (input floating).
  680. */
  681. #define VAL_GPIOC_MODER (PIN_MODE_ALTERNATE(GPIOC_ULPI_STP) | \
  682. PIN_MODE_ALTERNATE(GPIOC_RMII_MDC) | \
  683. PIN_MODE_INPUT(GPIOC_ARD_A2) | \
  684. PIN_MODE_ALTERNATE(GPIOC_DFSDM_DATIN1) |\
  685. PIN_MODE_ALTERNATE(GPIOC_RMII_RXD0) | \
  686. PIN_MODE_ALTERNATE(GPIOC_RMII_RXD1) | \
  687. PIN_MODE_INPUT(GPIOC_ARD_D1) | \
  688. PIN_MODE_INPUT(GPIOC_ARD_D0) | \
  689. PIN_MODE_INPUT(GPIOC_ARD_D5) | \
  690. PIN_MODE_ALTERNATE(GPIOC_QSPI_D0) | \
  691. PIN_MODE_ALTERNATE(GPIOC_QSPI_D1) | \
  692. PIN_MODE_ALTERNATE(GPIOC_DFSDM_DATIN5) |\
  693. PIN_MODE_ALTERNATE(GPIOC_WIFI_RX) | \
  694. PIN_MODE_INPUT(GPIOC_PIN13) | \
  695. PIN_MODE_INPUT(GPIOC_OSC32_IN) | \
  696. PIN_MODE_INPUT(GPIOC_OSC32_OUT))
  697. #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_ULPI_STP) | \
  698. PIN_OTYPE_PUSHPULL(GPIOC_RMII_MDC) | \
  699. PIN_OTYPE_PUSHPULL(GPIOC_ARD_A2) | \
  700. PIN_OTYPE_PUSHPULL(GPIOC_DFSDM_DATIN1) |\
  701. PIN_OTYPE_PUSHPULL(GPIOC_RMII_RXD0) | \
  702. PIN_OTYPE_PUSHPULL(GPIOC_RMII_RXD1) | \
  703. PIN_OTYPE_PUSHPULL(GPIOC_ARD_D1) | \
  704. PIN_OTYPE_PUSHPULL(GPIOC_ARD_D0) | \
  705. PIN_OTYPE_PUSHPULL(GPIOC_ARD_D5) | \
  706. PIN_OTYPE_PUSHPULL(GPIOC_QSPI_D0) | \
  707. PIN_OTYPE_PUSHPULL(GPIOC_QSPI_D1) | \
  708. PIN_OTYPE_PUSHPULL(GPIOC_DFSDM_DATIN5) |\
  709. PIN_OTYPE_PUSHPULL(GPIOC_WIFI_RX) | \
  710. PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \
  711. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \
  712. PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
  713. #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_ULPI_STP) | \
  714. PIN_OSPEED_HIGH(GPIOC_RMII_MDC) | \
  715. PIN_OSPEED_VERYLOW(GPIOC_ARD_A2) | \
  716. PIN_OSPEED_HIGH(GPIOC_DFSDM_DATIN1) | \
  717. PIN_OSPEED_HIGH(GPIOC_RMII_RXD0) | \
  718. PIN_OSPEED_HIGH(GPIOC_RMII_RXD1) | \
  719. PIN_OSPEED_VERYLOW(GPIOC_ARD_D1) | \
  720. PIN_OSPEED_VERYLOW(GPIOC_ARD_D0) | \
  721. PIN_OSPEED_VERYLOW(GPIOC_ARD_D5) | \
  722. PIN_OSPEED_HIGH(GPIOC_QSPI_D0) | \
  723. PIN_OSPEED_HIGH(GPIOC_QSPI_D1) | \
  724. PIN_OSPEED_HIGH(GPIOC_DFSDM_DATIN5) | \
  725. PIN_OSPEED_HIGH(GPIOC_WIFI_RX) | \
  726. PIN_OSPEED_HIGH(GPIOC_PIN13) | \
  727. PIN_OSPEED_VERYLOW(GPIOC_OSC32_IN) | \
  728. PIN_OSPEED_VERYLOW(GPIOC_OSC32_OUT))
  729. #define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(GPIOC_ULPI_STP) | \
  730. PIN_PUPDR_FLOATING(GPIOC_RMII_MDC) | \
  731. PIN_PUPDR_PULLUP(GPIOC_ARD_A2) | \
  732. PIN_PUPDR_FLOATING(GPIOC_DFSDM_DATIN1) |\
  733. PIN_PUPDR_FLOATING(GPIOC_RMII_RXD0) | \
  734. PIN_PUPDR_FLOATING(GPIOC_RMII_RXD1) | \
  735. PIN_PUPDR_PULLUP(GPIOC_ARD_D1) | \
  736. PIN_PUPDR_FLOATING(GPIOC_ARD_D0) | \
  737. PIN_PUPDR_FLOATING(GPIOC_ARD_D5) | \
  738. PIN_PUPDR_FLOATING(GPIOC_QSPI_D0) | \
  739. PIN_PUPDR_FLOATING(GPIOC_QSPI_D1) | \
  740. PIN_PUPDR_FLOATING(GPIOC_DFSDM_DATIN5) |\
  741. PIN_PUPDR_FLOATING(GPIOC_WIFI_RX) | \
  742. PIN_PUPDR_PULLUP(GPIOC_PIN13) | \
  743. PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \
  744. PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
  745. #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_ULPI_STP) | \
  746. PIN_ODR_HIGH(GPIOC_RMII_MDC) | \
  747. PIN_ODR_HIGH(GPIOC_ARD_A2) | \
  748. PIN_ODR_HIGH(GPIOC_DFSDM_DATIN1) | \
  749. PIN_ODR_HIGH(GPIOC_RMII_RXD0) | \
  750. PIN_ODR_HIGH(GPIOC_RMII_RXD1) | \
  751. PIN_ODR_HIGH(GPIOC_ARD_D1) | \
  752. PIN_ODR_HIGH(GPIOC_ARD_D0) | \
  753. PIN_ODR_HIGH(GPIOC_ARD_D5) | \
  754. PIN_ODR_HIGH(GPIOC_QSPI_D0) | \
  755. PIN_ODR_HIGH(GPIOC_QSPI_D1) | \
  756. PIN_ODR_HIGH(GPIOC_DFSDM_DATIN5) | \
  757. PIN_ODR_HIGH(GPIOC_WIFI_RX) | \
  758. PIN_ODR_HIGH(GPIOC_PIN13) | \
  759. PIN_ODR_HIGH(GPIOC_OSC32_IN) | \
  760. PIN_ODR_HIGH(GPIOC_OSC32_OUT))
  761. #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_ULPI_STP, 10U) | \
  762. PIN_AFIO_AF(GPIOC_RMII_MDC, 11U) | \
  763. PIN_AFIO_AF(GPIOC_ARD_A2, 0U) | \
  764. PIN_AFIO_AF(GPIOC_DFSDM_DATIN1, 3U) | \
  765. PIN_AFIO_AF(GPIOC_RMII_RXD0, 11U) | \
  766. PIN_AFIO_AF(GPIOC_RMII_RXD1, 11U) | \
  767. PIN_AFIO_AF(GPIOC_ARD_D1, 0U) | \
  768. PIN_AFIO_AF(GPIOC_ARD_D0, 0U))
  769. #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_ARD_D5, 0U) | \
  770. PIN_AFIO_AF(GPIOC_QSPI_D0, 9U) | \
  771. PIN_AFIO_AF(GPIOC_QSPI_D1, 9U) | \
  772. PIN_AFIO_AF(GPIOC_DFSDM_DATIN5, 3U) | \
  773. PIN_AFIO_AF(GPIOC_WIFI_RX, 8U) | \
  774. PIN_AFIO_AF(GPIOC_PIN13, 0U) | \
  775. PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \
  776. PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
  777. /*
  778. * GPIOD setup:
  779. *
  780. * PD0 - FMC_D2 (alternate 12).
  781. * PD1 - FMC_D3 (alternate 12).
  782. * PD2 - WIFI_TX (alternate 8).
  783. * PD3 - DFSDM_CKOUT (alternate 3).
  784. * PD4 - OTG_HS_OVER_CURRENT (input floating).
  785. * PD5 - RMII_RXER (alternate 7).
  786. * PD6 - SD_CLK (alternate 11).
  787. * PD7 - SD_CMD (alternate 11).
  788. * PD8 - FMC_D13 (alternate 12).
  789. * PD9 - FMC_D14 (alternate 12).
  790. * PD10 - FMC_D15 (alternate 12).
  791. * PD11 - SPDIF_I2S (alternate 10).
  792. * PD12 - AUDIO_SCL LCD_SCL (alternate 4).
  793. * PD13 - QSPI_D3 (input pullup).
  794. * PD14 - FMC_D0 (alternate 12).
  795. * PD15 - FMC_D1 (alternate 12).
  796. */
  797. #define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(GPIOD_FMC_D2) | \
  798. PIN_MODE_ALTERNATE(GPIOD_FMC_D3) | \
  799. PIN_MODE_ALTERNATE(GPIOD_WIFI_TX) | \
  800. PIN_MODE_ALTERNATE(GPIOD_DFSDM_CKOUT) |\
  801. PIN_MODE_INPUT(GPIOD_OTG_HS_OVER_CURRENT) |\
  802. PIN_MODE_ALTERNATE(GPIOD_RMII_RXER) | \
  803. PIN_MODE_ALTERNATE(GPIOD_SD_CLK) | \
  804. PIN_MODE_ALTERNATE(GPIOD_SD_CMD) | \
  805. PIN_MODE_ALTERNATE(GPIOD_FMC_D13) | \
  806. PIN_MODE_ALTERNATE(GPIOD_FMC_D14) | \
  807. PIN_MODE_ALTERNATE(GPIOD_FMC_D15) | \
  808. PIN_MODE_ALTERNATE(GPIOD_SPDIF_I2S) | \
  809. PIN_MODE_ALTERNATE(GPIOD_AUDIO_SCL) | \
  810. PIN_MODE_INPUT(GPIOD_QSPI_D3) | \
  811. PIN_MODE_ALTERNATE(GPIOD_FMC_D0) | \
  812. PIN_MODE_ALTERNATE(GPIOD_FMC_D1))
  813. #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_FMC_D2) | \
  814. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D3) | \
  815. PIN_OTYPE_PUSHPULL(GPIOD_WIFI_TX) | \
  816. PIN_OTYPE_PUSHPULL(GPIOD_DFSDM_CKOUT) |\
  817. PIN_OTYPE_PUSHPULL(GPIOD_OTG_HS_OVER_CURRENT) |\
  818. PIN_OTYPE_PUSHPULL(GPIOD_RMII_RXER) | \
  819. PIN_OTYPE_PUSHPULL(GPIOD_SD_CLK) | \
  820. PIN_OTYPE_PUSHPULL(GPIOD_SD_CMD) | \
  821. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D13) | \
  822. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D14) | \
  823. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D15) | \
  824. PIN_OTYPE_PUSHPULL(GPIOD_SPDIF_I2S) | \
  825. PIN_OTYPE_PUSHPULL(GPIOD_AUDIO_SCL) | \
  826. PIN_OTYPE_PUSHPULL(GPIOD_QSPI_D3) | \
  827. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D0) | \
  828. PIN_OTYPE_PUSHPULL(GPIOD_FMC_D1))
  829. #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_FMC_D2) | \
  830. PIN_OSPEED_HIGH(GPIOD_FMC_D3) | \
  831. PIN_OSPEED_HIGH(GPIOD_WIFI_TX) | \
  832. PIN_OSPEED_HIGH(GPIOD_DFSDM_CKOUT) | \
  833. PIN_OSPEED_HIGH(GPIOD_OTG_HS_OVER_CURRENT) |\
  834. PIN_OSPEED_HIGH(GPIOD_RMII_RXER) | \
  835. PIN_OSPEED_HIGH(GPIOD_SD_CLK) | \
  836. PIN_OSPEED_HIGH(GPIOD_SD_CMD) | \
  837. PIN_OSPEED_HIGH(GPIOD_FMC_D13) | \
  838. PIN_OSPEED_HIGH(GPIOD_FMC_D14) | \
  839. PIN_OSPEED_HIGH(GPIOD_FMC_D15) | \
  840. PIN_OSPEED_HIGH(GPIOD_SPDIF_I2S) | \
  841. PIN_OSPEED_HIGH(GPIOD_AUDIO_SCL) | \
  842. PIN_OSPEED_HIGH(GPIOD_QSPI_D3) | \
  843. PIN_OSPEED_HIGH(GPIOD_FMC_D0) | \
  844. PIN_OSPEED_HIGH(GPIOD_FMC_D1))
  845. #define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(GPIOD_FMC_D2) | \
  846. PIN_PUPDR_FLOATING(GPIOD_FMC_D3) | \
  847. PIN_PUPDR_FLOATING(GPIOD_WIFI_TX) | \
  848. PIN_PUPDR_FLOATING(GPIOD_DFSDM_CKOUT) |\
  849. PIN_PUPDR_FLOATING(GPIOD_OTG_HS_OVER_CURRENT) |\
  850. PIN_PUPDR_FLOATING(GPIOD_RMII_RXER) | \
  851. PIN_PUPDR_FLOATING(GPIOD_SD_CLK) | \
  852. PIN_PUPDR_FLOATING(GPIOD_SD_CMD) | \
  853. PIN_PUPDR_FLOATING(GPIOD_FMC_D13) | \
  854. PIN_PUPDR_FLOATING(GPIOD_FMC_D14) | \
  855. PIN_PUPDR_FLOATING(GPIOD_FMC_D15) | \
  856. PIN_PUPDR_FLOATING(GPIOD_SPDIF_I2S) | \
  857. PIN_PUPDR_FLOATING(GPIOD_AUDIO_SCL) | \
  858. PIN_PUPDR_PULLUP(GPIOD_QSPI_D3) | \
  859. PIN_PUPDR_FLOATING(GPIOD_FMC_D0) | \
  860. PIN_PUPDR_FLOATING(GPIOD_FMC_D1))
  861. #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_FMC_D2) | \
  862. PIN_ODR_HIGH(GPIOD_FMC_D3) | \
  863. PIN_ODR_HIGH(GPIOD_WIFI_TX) | \
  864. PIN_ODR_HIGH(GPIOD_DFSDM_CKOUT) | \
  865. PIN_ODR_HIGH(GPIOD_OTG_HS_OVER_CURRENT) |\
  866. PIN_ODR_HIGH(GPIOD_RMII_RXER) | \
  867. PIN_ODR_HIGH(GPIOD_SD_CLK) | \
  868. PIN_ODR_HIGH(GPIOD_SD_CMD) | \
  869. PIN_ODR_HIGH(GPIOD_FMC_D13) | \
  870. PIN_ODR_HIGH(GPIOD_FMC_D14) | \
  871. PIN_ODR_HIGH(GPIOD_FMC_D15) | \
  872. PIN_ODR_HIGH(GPIOD_SPDIF_I2S) | \
  873. PIN_ODR_HIGH(GPIOD_AUDIO_SCL) | \
  874. PIN_ODR_LOW(GPIOD_QSPI_D3) | \
  875. PIN_ODR_LOW(GPIOD_FMC_D0) | \
  876. PIN_ODR_LOW(GPIOD_FMC_D1))
  877. #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_FMC_D2, 12U) | \
  878. PIN_AFIO_AF(GPIOD_FMC_D3, 12U) | \
  879. PIN_AFIO_AF(GPIOD_WIFI_TX, 8U) | \
  880. PIN_AFIO_AF(GPIOD_DFSDM_CKOUT, 3U) | \
  881. PIN_AFIO_AF(GPIOD_OTG_HS_OVER_CURRENT, 0U) |\
  882. PIN_AFIO_AF(GPIOD_RMII_RXER, 7U) | \
  883. PIN_AFIO_AF(GPIOD_SD_CLK, 11U) | \
  884. PIN_AFIO_AF(GPIOD_SD_CMD, 11U))
  885. #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_FMC_D13, 12U) | \
  886. PIN_AFIO_AF(GPIOD_FMC_D14, 12U) | \
  887. PIN_AFIO_AF(GPIOD_FMC_D15, 12U) | \
  888. PIN_AFIO_AF(GPIOD_SPDIF_I2S, 10U) | \
  889. PIN_AFIO_AF(GPIOD_AUDIO_SCL, 4U) | \
  890. PIN_AFIO_AF(GPIOD_QSPI_D3, 0U) | \
  891. PIN_AFIO_AF(GPIOD_FMC_D0, 12U) | \
  892. PIN_AFIO_AF(GPIOD_FMC_D1, 12U))
  893. /*
  894. * GPIOE setup:
  895. *
  896. * PE0 - FMC_NBL0 (alternate 12).
  897. * PE1 - FMC_NBL1 (alternate 12).
  898. * PE2 - QSPI_D2 (input pullup).
  899. * PE3 - SAI1_SDB (alternate 6).
  900. * PE4 - SAI1_FSA (alternate 6).
  901. * PE5 - SAI1_SCKA (alternate 6).
  902. * PE6 - SAI1_SDA (alternate 6).
  903. * PE7 - FMC_D4 (alternate 12).
  904. * PE8 - FMC_D5 (alternate 12).
  905. * PE9 - FMC_D6 (alternate 12).
  906. * PE10 - FMC_D7 (alternate 12).
  907. * PE11 - FMC_D8 (alternate 12).
  908. * PE12 - FMC_D9 (alternate 12).
  909. * PE13 - FMC_D10 (alternate 12).
  910. * PE14 - FMC_11 (alternate 12).
  911. * PE15 - FMC_D12 (alternate 12).
  912. */
  913. #define VAL_GPIOE_MODER (PIN_MODE_ALTERNATE(GPIOE_FMC_NBL0) | \
  914. PIN_MODE_ALTERNATE(GPIOE_FMC_NBL1) | \
  915. PIN_MODE_INPUT(GPIOE_QSPI_D2) | \
  916. PIN_MODE_ALTERNATE(GPIOE_SAI1_SDB) | \
  917. PIN_MODE_ALTERNATE(GPIOE_SAI1_FSA) | \
  918. PIN_MODE_ALTERNATE(GPIOE_SAI1_SCKA) | \
  919. PIN_MODE_ALTERNATE(GPIOE_SAI1_SDA) | \
  920. PIN_MODE_ALTERNATE(GPIOE_FMC_D4) | \
  921. PIN_MODE_ALTERNATE(GPIOE_FMC_D5) | \
  922. PIN_MODE_ALTERNATE(GPIOE_FMC_D6) | \
  923. PIN_MODE_ALTERNATE(GPIOE_FMC_D7) | \
  924. PIN_MODE_ALTERNATE(GPIOE_FMC_D8) | \
  925. PIN_MODE_ALTERNATE(GPIOE_FMC_D9) | \
  926. PIN_MODE_ALTERNATE(GPIOE_FMC_D10) | \
  927. PIN_MODE_ALTERNATE(GPIOE_FMC_11) | \
  928. PIN_MODE_ALTERNATE(GPIOE_FMC_D12))
  929. #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_FMC_NBL0) | \
  930. PIN_OTYPE_PUSHPULL(GPIOE_FMC_NBL1) | \
  931. PIN_OTYPE_PUSHPULL(GPIOE_QSPI_D2) | \
  932. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_SDB) | \
  933. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_FSA) | \
  934. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_SCKA) | \
  935. PIN_OTYPE_PUSHPULL(GPIOE_SAI1_SDA) | \
  936. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D4) | \
  937. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D5) | \
  938. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D6) | \
  939. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D7) | \
  940. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D8) | \
  941. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D9) | \
  942. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D10) | \
  943. PIN_OTYPE_PUSHPULL(GPIOE_FMC_11) | \
  944. PIN_OTYPE_PUSHPULL(GPIOE_FMC_D12))
  945. #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_FMC_NBL0) | \
  946. PIN_OSPEED_HIGH(GPIOE_FMC_NBL1) | \
  947. PIN_OSPEED_HIGH(GPIOE_QSPI_D2) | \
  948. PIN_OSPEED_HIGH(GPIOE_SAI1_SDB) | \
  949. PIN_OSPEED_HIGH(GPIOE_SAI1_FSA) | \
  950. PIN_OSPEED_HIGH(GPIOE_SAI1_SCKA) | \
  951. PIN_OSPEED_HIGH(GPIOE_SAI1_SDA) | \
  952. PIN_OSPEED_HIGH(GPIOE_FMC_D4) | \
  953. PIN_OSPEED_HIGH(GPIOE_FMC_D5) | \
  954. PIN_OSPEED_HIGH(GPIOE_FMC_D6) | \
  955. PIN_OSPEED_HIGH(GPIOE_FMC_D7) | \
  956. PIN_OSPEED_HIGH(GPIOE_FMC_D8) | \
  957. PIN_OSPEED_HIGH(GPIOE_FMC_D9) | \
  958. PIN_OSPEED_HIGH(GPIOE_FMC_D10) | \
  959. PIN_OSPEED_HIGH(GPIOE_FMC_11) | \
  960. PIN_OSPEED_HIGH(GPIOE_FMC_D12))
  961. #define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(GPIOE_FMC_NBL0) | \
  962. PIN_PUPDR_FLOATING(GPIOE_FMC_NBL1) | \
  963. PIN_PUPDR_PULLUP(GPIOE_QSPI_D2) | \
  964. PIN_PUPDR_FLOATING(GPIOE_SAI1_SDB) | \
  965. PIN_PUPDR_FLOATING(GPIOE_SAI1_FSA) | \
  966. PIN_PUPDR_FLOATING(GPIOE_SAI1_SCKA) | \
  967. PIN_PUPDR_FLOATING(GPIOE_SAI1_SDA) | \
  968. PIN_PUPDR_FLOATING(GPIOE_FMC_D4) | \
  969. PIN_PUPDR_FLOATING(GPIOE_FMC_D5) | \
  970. PIN_PUPDR_FLOATING(GPIOE_FMC_D6) | \
  971. PIN_PUPDR_FLOATING(GPIOE_FMC_D7) | \
  972. PIN_PUPDR_FLOATING(GPIOE_FMC_D8) | \
  973. PIN_PUPDR_FLOATING(GPIOE_FMC_D9) | \
  974. PIN_PUPDR_FLOATING(GPIOE_FMC_D10) | \
  975. PIN_PUPDR_FLOATING(GPIOE_FMC_11) | \
  976. PIN_PUPDR_FLOATING(GPIOE_FMC_D12))
  977. #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_FMC_NBL0) | \
  978. PIN_ODR_HIGH(GPIOE_FMC_NBL1) | \
  979. PIN_ODR_HIGH(GPIOE_QSPI_D2) | \
  980. PIN_ODR_HIGH(GPIOE_SAI1_SDB) | \
  981. PIN_ODR_HIGH(GPIOE_SAI1_FSA) | \
  982. PIN_ODR_HIGH(GPIOE_SAI1_SCKA) | \
  983. PIN_ODR_HIGH(GPIOE_SAI1_SDA) | \
  984. PIN_ODR_HIGH(GPIOE_FMC_D4) | \
  985. PIN_ODR_HIGH(GPIOE_FMC_D5) | \
  986. PIN_ODR_HIGH(GPIOE_FMC_D6) | \
  987. PIN_ODR_HIGH(GPIOE_FMC_D7) | \
  988. PIN_ODR_HIGH(GPIOE_FMC_D8) | \
  989. PIN_ODR_HIGH(GPIOE_FMC_D9) | \
  990. PIN_ODR_HIGH(GPIOE_FMC_D10) | \
  991. PIN_ODR_HIGH(GPIOE_FMC_11) | \
  992. PIN_ODR_HIGH(GPIOE_FMC_D12))
  993. #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_FMC_NBL0, 12U) | \
  994. PIN_AFIO_AF(GPIOE_FMC_NBL1, 12U) | \
  995. PIN_AFIO_AF(GPIOE_QSPI_D2, 0U) | \
  996. PIN_AFIO_AF(GPIOE_SAI1_SDB, 6U) | \
  997. PIN_AFIO_AF(GPIOE_SAI1_FSA, 6U) | \
  998. PIN_AFIO_AF(GPIOE_SAI1_SCKA, 6U) | \
  999. PIN_AFIO_AF(GPIOE_SAI1_SDA, 6U) | \
  1000. PIN_AFIO_AF(GPIOE_FMC_D4, 12U))
  1001. #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_FMC_D5, 12U) | \
  1002. PIN_AFIO_AF(GPIOE_FMC_D6, 12U) | \
  1003. PIN_AFIO_AF(GPIOE_FMC_D7, 12U) | \
  1004. PIN_AFIO_AF(GPIOE_FMC_D8, 12U) | \
  1005. PIN_AFIO_AF(GPIOE_FMC_D9, 12U) | \
  1006. PIN_AFIO_AF(GPIOE_FMC_D10, 12U) | \
  1007. PIN_AFIO_AF(GPIOE_FMC_11, 12U) | \
  1008. PIN_AFIO_AF(GPIOE_FMC_D12, 12U))
  1009. /*
  1010. * GPIOF setup:
  1011. *
  1012. * PF0 - FMC_A0 (alternate 12).
  1013. * PF1 - FMC_A1 (alternate 12).
  1014. * PF2 - FMC_A2 (alternate 12).
  1015. * PF3 - FMC_A3 (alternate 12).
  1016. * PF4 - FMC_A4 (alternate 12).
  1017. * PF5 - FMC_A5 (alternate 12).
  1018. * PF6 - ARD_D3 (input pullup).
  1019. * PF7 - ARD_D6 (input pullup).
  1020. * PF8 - ARD_A4 (input pullup).
  1021. * PF9 - ARD_A5 (input pullup).
  1022. * PF10 - ARD_A3 (input pullup).
  1023. * PF11 - FMC_SDNRAS (alternate 12).
  1024. * PF12 - FMC_A6 (alternate 12).
  1025. * PF13 - FMC_A7 (alternate 12).
  1026. * PF14 - FMC_A8 (alternate 12).
  1027. * PF15 - FMC_A9 (alternate 12).
  1028. */
  1029. #define VAL_GPIOF_MODER (PIN_MODE_ALTERNATE(GPIOF_FMC_A0) | \
  1030. PIN_MODE_ALTERNATE(GPIOF_FMC_A1) | \
  1031. PIN_MODE_ALTERNATE(GPIOF_FMC_A2) | \
  1032. PIN_MODE_ALTERNATE(GPIOF_FMC_A3) | \
  1033. PIN_MODE_ALTERNATE(GPIOF_FMC_A4) | \
  1034. PIN_MODE_ALTERNATE(GPIOF_FMC_A5) | \
  1035. PIN_MODE_INPUT(GPIOF_ARD_D3) | \
  1036. PIN_MODE_INPUT(GPIOF_ARD_D6) | \
  1037. PIN_MODE_INPUT(GPIOF_ARD_A4) | \
  1038. PIN_MODE_INPUT(GPIOF_ARD_A5) | \
  1039. PIN_MODE_INPUT(GPIOF_ARD_A3) | \
  1040. PIN_MODE_ALTERNATE(GPIOF_FMC_SDNRAS) | \
  1041. PIN_MODE_ALTERNATE(GPIOF_FMC_A6) | \
  1042. PIN_MODE_ALTERNATE(GPIOF_FMC_A7) | \
  1043. PIN_MODE_ALTERNATE(GPIOF_FMC_A8) | \
  1044. PIN_MODE_ALTERNATE(GPIOF_FMC_A9))
  1045. #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_FMC_A0) | \
  1046. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A1) | \
  1047. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A2) | \
  1048. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A3) | \
  1049. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A4) | \
  1050. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A5) | \
  1051. PIN_OTYPE_PUSHPULL(GPIOF_ARD_D3) | \
  1052. PIN_OTYPE_PUSHPULL(GPIOF_ARD_D6) | \
  1053. PIN_OTYPE_PUSHPULL(GPIOF_ARD_A4) | \
  1054. PIN_OTYPE_PUSHPULL(GPIOF_ARD_A5) | \
  1055. PIN_OTYPE_PUSHPULL(GPIOF_ARD_A3) | \
  1056. PIN_OTYPE_PUSHPULL(GPIOF_FMC_SDNRAS) | \
  1057. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A6) | \
  1058. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A7) | \
  1059. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A8) | \
  1060. PIN_OTYPE_PUSHPULL(GPIOF_FMC_A9))
  1061. #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_FMC_A0) | \
  1062. PIN_OSPEED_HIGH(GPIOF_FMC_A1) | \
  1063. PIN_OSPEED_HIGH(GPIOF_FMC_A2) | \
  1064. PIN_OSPEED_HIGH(GPIOF_FMC_A3) | \
  1065. PIN_OSPEED_HIGH(GPIOF_FMC_A4) | \
  1066. PIN_OSPEED_HIGH(GPIOF_FMC_A5) | \
  1067. PIN_OSPEED_VERYLOW(GPIOF_ARD_D3) | \
  1068. PIN_OSPEED_VERYLOW(GPIOF_ARD_D6) | \
  1069. PIN_OSPEED_VERYLOW(GPIOF_ARD_A4) | \
  1070. PIN_OSPEED_VERYLOW(GPIOF_ARD_A5) | \
  1071. PIN_OSPEED_VERYLOW(GPIOF_ARD_A3) | \
  1072. PIN_OSPEED_HIGH(GPIOF_FMC_SDNRAS) | \
  1073. PIN_OSPEED_HIGH(GPIOF_FMC_A6) | \
  1074. PIN_OSPEED_HIGH(GPIOF_FMC_A7) | \
  1075. PIN_OSPEED_HIGH(GPIOF_FMC_A8) | \
  1076. PIN_OSPEED_HIGH(GPIOF_FMC_A9))
  1077. #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_FMC_A0) | \
  1078. PIN_PUPDR_FLOATING(GPIOF_FMC_A1) | \
  1079. PIN_PUPDR_FLOATING(GPIOF_FMC_A2) | \
  1080. PIN_PUPDR_FLOATING(GPIOF_FMC_A3) | \
  1081. PIN_PUPDR_FLOATING(GPIOF_FMC_A4) | \
  1082. PIN_PUPDR_FLOATING(GPIOF_FMC_A5) | \
  1083. PIN_PUPDR_PULLUP(GPIOF_ARD_D3) | \
  1084. PIN_PUPDR_PULLUP(GPIOF_ARD_D6) | \
  1085. PIN_PUPDR_PULLUP(GPIOF_ARD_A4) | \
  1086. PIN_PUPDR_PULLUP(GPIOF_ARD_A5) | \
  1087. PIN_PUPDR_PULLUP(GPIOF_ARD_A3) | \
  1088. PIN_PUPDR_FLOATING(GPIOF_FMC_SDNRAS) | \
  1089. PIN_PUPDR_FLOATING(GPIOF_FMC_A6) | \
  1090. PIN_PUPDR_FLOATING(GPIOF_FMC_A7) | \
  1091. PIN_PUPDR_FLOATING(GPIOF_FMC_A8) | \
  1092. PIN_PUPDR_FLOATING(GPIOF_FMC_A9))
  1093. #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_FMC_A0) | \
  1094. PIN_ODR_HIGH(GPIOF_FMC_A1) | \
  1095. PIN_ODR_HIGH(GPIOF_FMC_A2) | \
  1096. PIN_ODR_HIGH(GPIOF_FMC_A3) | \
  1097. PIN_ODR_HIGH(GPIOF_FMC_A4) | \
  1098. PIN_ODR_HIGH(GPIOF_FMC_A5) | \
  1099. PIN_ODR_HIGH(GPIOF_ARD_D3) | \
  1100. PIN_ODR_HIGH(GPIOF_ARD_D6) | \
  1101. PIN_ODR_HIGH(GPIOF_ARD_A4) | \
  1102. PIN_ODR_HIGH(GPIOF_ARD_A5) | \
  1103. PIN_ODR_HIGH(GPIOF_ARD_A3) | \
  1104. PIN_ODR_HIGH(GPIOF_FMC_SDNRAS) | \
  1105. PIN_ODR_HIGH(GPIOF_FMC_A6) | \
  1106. PIN_ODR_HIGH(GPIOF_FMC_A7) | \
  1107. PIN_ODR_HIGH(GPIOF_FMC_A8) | \
  1108. PIN_ODR_HIGH(GPIOF_FMC_A9))
  1109. #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_FMC_A0, 12U) | \
  1110. PIN_AFIO_AF(GPIOF_FMC_A1, 12U) | \
  1111. PIN_AFIO_AF(GPIOF_FMC_A2, 12U) | \
  1112. PIN_AFIO_AF(GPIOF_FMC_A3, 12U) | \
  1113. PIN_AFIO_AF(GPIOF_FMC_A4, 12U) | \
  1114. PIN_AFIO_AF(GPIOF_FMC_A5, 12U) | \
  1115. PIN_AFIO_AF(GPIOF_ARD_D3, 0U) | \
  1116. PIN_AFIO_AF(GPIOF_ARD_D6, 0U))
  1117. #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_ARD_A4, 0U) | \
  1118. PIN_AFIO_AF(GPIOF_ARD_A5, 0U) | \
  1119. PIN_AFIO_AF(GPIOF_ARD_A3, 0U) | \
  1120. PIN_AFIO_AF(GPIOF_FMC_SDNRAS, 12U) | \
  1121. PIN_AFIO_AF(GPIOF_FMC_A6, 12U) | \
  1122. PIN_AFIO_AF(GPIOF_FMC_A7, 12U) | \
  1123. PIN_AFIO_AF(GPIOF_FMC_A8, 12U) | \
  1124. PIN_AFIO_AF(GPIOF_FMC_A9, 12U))
  1125. /*
  1126. * GPIOG setup:
  1127. *
  1128. * PG0 - FMC_A10 (alternate 12).
  1129. * PG1 - FMC_A11 (alternate 12).
  1130. * PG2 - FMC_A12 (alternate 12).
  1131. * PG3 - EXT_SCL (input pullup).
  1132. * PG4 - FMC_BA0 (alternate 12).
  1133. * PG5 - FMC_BA1 (alternate 12).
  1134. * PG6 - EXT_SDA (input pullup).
  1135. * PG7 - SAI1_MCLKA (alternate 6).
  1136. * PG8 - FMC_SDCLK (alternate 12).
  1137. * PG9 - SD_D0 (alternate 11).
  1138. * PG10 - SD_D1 (alternate 11).
  1139. * PG11 - RMII_TX_EN (alternate 11).
  1140. * PG12 - SPDIF_RX (alternate 7).
  1141. * PG13 - RMII_TXD0 (alternate 11).
  1142. * PG14 - RMII_TXD1 (alternate 11).
  1143. * PG15 - FMC_SDNCAS (alternate 12).
  1144. */
  1145. #define VAL_GPIOG_MODER (PIN_MODE_ALTERNATE(GPIOG_FMC_A10) | \
  1146. PIN_MODE_ALTERNATE(GPIOG_FMC_A11) | \
  1147. PIN_MODE_ALTERNATE(GPIOG_FMC_A12) | \
  1148. PIN_MODE_INPUT(GPIOG_EXT_SCL) | \
  1149. PIN_MODE_ALTERNATE(GPIOG_FMC_BA0) | \
  1150. PIN_MODE_ALTERNATE(GPIOG_FMC_BA1) | \
  1151. PIN_MODE_INPUT(GPIOG_EXT_SDA) | \
  1152. PIN_MODE_ALTERNATE(GPIOG_SAI1_MCLKA) | \
  1153. PIN_MODE_ALTERNATE(GPIOG_FMC_SDCLK) | \
  1154. PIN_MODE_ALTERNATE(GPIOG_SD_D0) | \
  1155. PIN_MODE_ALTERNATE(GPIOG_SD_D1) | \
  1156. PIN_MODE_ALTERNATE(GPIOG_RMII_TX_EN) | \
  1157. PIN_MODE_ALTERNATE(GPIOG_SPDIF_RX) | \
  1158. PIN_MODE_ALTERNATE(GPIOG_RMII_TXD0) | \
  1159. PIN_MODE_ALTERNATE(GPIOG_RMII_TXD1) | \
  1160. PIN_MODE_ALTERNATE(GPIOG_FMC_SDNCAS))
  1161. #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_FMC_A10) | \
  1162. PIN_OTYPE_PUSHPULL(GPIOG_FMC_A11) | \
  1163. PIN_OTYPE_PUSHPULL(GPIOG_FMC_A12) | \
  1164. PIN_OTYPE_PUSHPULL(GPIOG_EXT_SCL) | \
  1165. PIN_OTYPE_PUSHPULL(GPIOG_FMC_BA0) | \
  1166. PIN_OTYPE_PUSHPULL(GPIOG_FMC_BA1) | \
  1167. PIN_OTYPE_PUSHPULL(GPIOG_EXT_SDA) | \
  1168. PIN_OTYPE_PUSHPULL(GPIOG_SAI1_MCLKA) | \
  1169. PIN_OTYPE_PUSHPULL(GPIOG_FMC_SDCLK) | \
  1170. PIN_OTYPE_PUSHPULL(GPIOG_SD_D0) | \
  1171. PIN_OTYPE_PUSHPULL(GPIOG_SD_D1) | \
  1172. PIN_OTYPE_PUSHPULL(GPIOG_RMII_TX_EN) | \
  1173. PIN_OTYPE_PUSHPULL(GPIOG_SPDIF_RX) | \
  1174. PIN_OTYPE_PUSHPULL(GPIOG_RMII_TXD0) | \
  1175. PIN_OTYPE_PUSHPULL(GPIOG_RMII_TXD1) | \
  1176. PIN_OTYPE_PUSHPULL(GPIOG_FMC_SDNCAS))
  1177. #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_HIGH(GPIOG_FMC_A10) | \
  1178. PIN_OSPEED_HIGH(GPIOG_FMC_A11) | \
  1179. PIN_OSPEED_HIGH(GPIOG_FMC_A12) | \
  1180. PIN_OSPEED_HIGH(GPIOG_EXT_SCL) | \
  1181. PIN_OSPEED_HIGH(GPIOG_FMC_BA0) | \
  1182. PIN_OSPEED_HIGH(GPIOG_FMC_BA1) | \
  1183. PIN_OSPEED_HIGH(GPIOG_EXT_SDA) | \
  1184. PIN_OSPEED_HIGH(GPIOG_SAI1_MCLKA) | \
  1185. PIN_OSPEED_HIGH(GPIOG_FMC_SDCLK) | \
  1186. PIN_OSPEED_HIGH(GPIOG_SD_D0) | \
  1187. PIN_OSPEED_HIGH(GPIOG_SD_D1) | \
  1188. PIN_OSPEED_HIGH(GPIOG_RMII_TX_EN) | \
  1189. PIN_OSPEED_HIGH(GPIOG_SPDIF_RX) | \
  1190. PIN_OSPEED_HIGH(GPIOG_RMII_TXD0) | \
  1191. PIN_OSPEED_HIGH(GPIOG_RMII_TXD1) | \
  1192. PIN_OSPEED_HIGH(GPIOG_FMC_SDNCAS))
  1193. #define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(GPIOG_FMC_A10) | \
  1194. PIN_PUPDR_FLOATING(GPIOG_FMC_A11) | \
  1195. PIN_PUPDR_FLOATING(GPIOG_FMC_A12) | \
  1196. PIN_PUPDR_PULLUP(GPIOG_EXT_SCL) | \
  1197. PIN_PUPDR_FLOATING(GPIOG_FMC_BA0) | \
  1198. PIN_PUPDR_FLOATING(GPIOG_FMC_BA1) | \
  1199. PIN_PUPDR_PULLUP(GPIOG_EXT_SDA) | \
  1200. PIN_PUPDR_PULLUP(GPIOG_SAI1_MCLKA) | \
  1201. PIN_PUPDR_FLOATING(GPIOG_FMC_SDCLK) | \
  1202. PIN_PUPDR_FLOATING(GPIOG_SD_D0) | \
  1203. PIN_PUPDR_FLOATING(GPIOG_SD_D1) | \
  1204. PIN_PUPDR_FLOATING(GPIOG_RMII_TX_EN) | \
  1205. PIN_PUPDR_FLOATING(GPIOG_SPDIF_RX) | \
  1206. PIN_PUPDR_FLOATING(GPIOG_RMII_TXD0) | \
  1207. PIN_PUPDR_FLOATING(GPIOG_RMII_TXD1) | \
  1208. PIN_PUPDR_FLOATING(GPIOG_FMC_SDNCAS))
  1209. #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_FMC_A10) | \
  1210. PIN_ODR_HIGH(GPIOG_FMC_A11) | \
  1211. PIN_ODR_HIGH(GPIOG_FMC_A12) | \
  1212. PIN_ODR_HIGH(GPIOG_EXT_SCL) | \
  1213. PIN_ODR_HIGH(GPIOG_FMC_BA0) | \
  1214. PIN_ODR_HIGH(GPIOG_FMC_BA1) | \
  1215. PIN_ODR_HIGH(GPIOG_EXT_SDA) | \
  1216. PIN_ODR_HIGH(GPIOG_SAI1_MCLKA) | \
  1217. PIN_ODR_HIGH(GPIOG_FMC_SDCLK) | \
  1218. PIN_ODR_HIGH(GPIOG_SD_D0) | \
  1219. PIN_ODR_HIGH(GPIOG_SD_D1) | \
  1220. PIN_ODR_HIGH(GPIOG_RMII_TX_EN) | \
  1221. PIN_ODR_HIGH(GPIOG_SPDIF_RX) | \
  1222. PIN_ODR_HIGH(GPIOG_RMII_TXD0) | \
  1223. PIN_ODR_HIGH(GPIOG_RMII_TXD1) | \
  1224. PIN_ODR_HIGH(GPIOG_FMC_SDNCAS))
  1225. #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_FMC_A10, 12U) | \
  1226. PIN_AFIO_AF(GPIOG_FMC_A11, 12U) | \
  1227. PIN_AFIO_AF(GPIOG_FMC_A12, 12U) | \
  1228. PIN_AFIO_AF(GPIOG_EXT_SCL, 0U) | \
  1229. PIN_AFIO_AF(GPIOG_FMC_BA0, 12U) | \
  1230. PIN_AFIO_AF(GPIOG_FMC_BA1, 12U) | \
  1231. PIN_AFIO_AF(GPIOG_EXT_SDA, 0U) | \
  1232. PIN_AFIO_AF(GPIOG_SAI1_MCLKA, 6U))
  1233. #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_FMC_SDCLK, 12U) | \
  1234. PIN_AFIO_AF(GPIOG_SD_D0, 11U) | \
  1235. PIN_AFIO_AF(GPIOG_SD_D1, 11U) | \
  1236. PIN_AFIO_AF(GPIOG_RMII_TX_EN, 11U) | \
  1237. PIN_AFIO_AF(GPIOG_SPDIF_RX, 7U) | \
  1238. PIN_AFIO_AF(GPIOG_RMII_TXD0, 11U) | \
  1239. PIN_AFIO_AF(GPIOG_RMII_TXD1, 11U) | \
  1240. PIN_AFIO_AF(GPIOG_FMC_SDNCAS, 12U))
  1241. /*
  1242. * GPIOH setup:
  1243. *
  1244. * PH0 - OSC_IN (input floating).
  1245. * PH1 - OSC_OUT (input floating).
  1246. * PH2 - FMC_SDCKE0 (alternate 12).
  1247. * PH3 - FMC_SDNE0 (alternate 12).
  1248. * PH4 - ULPI_NXT (alternate 10).
  1249. * PH5 - FMC_SDNWE (alternate 12).
  1250. * PH6 - ARD_D9 (input pullup).
  1251. * PH7 - EXT_RST (input floating).
  1252. * PH8 - FMC_D16 (alternate 12).
  1253. * PH9 - FMC_D17 (alternate 12).
  1254. * PH10 - FMC_D18 (alternate 12).
  1255. * PH11 - FMC_D19 (alternate 12).
  1256. * PH12 - FMC_D20 (alternate 12).
  1257. * PH13 - FMC_D21 (alternate 12).
  1258. * PH14 - FMC_D22 (alternate 12).
  1259. * PH15 - FMC_D23 (alternate 12).
  1260. */
  1261. #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \
  1262. PIN_MODE_INPUT(GPIOH_OSC_OUT) | \
  1263. PIN_MODE_ALTERNATE(GPIOH_FMC_SDCKE0) | \
  1264. PIN_MODE_ALTERNATE(GPIOH_FMC_SDNE0) | \
  1265. PIN_MODE_ALTERNATE(GPIOH_ULPI_NXT) | \
  1266. PIN_MODE_ALTERNATE(GPIOH_FMC_SDNWE) | \
  1267. PIN_MODE_INPUT(GPIOH_ARD_D9) | \
  1268. PIN_MODE_INPUT(GPIOH_EXT_RST) | \
  1269. PIN_MODE_ALTERNATE(GPIOH_FMC_D16) | \
  1270. PIN_MODE_ALTERNATE(GPIOH_FMC_D17) | \
  1271. PIN_MODE_ALTERNATE(GPIOH_FMC_D18) | \
  1272. PIN_MODE_ALTERNATE(GPIOH_FMC_D19) | \
  1273. PIN_MODE_ALTERNATE(GPIOH_FMC_D20) | \
  1274. PIN_MODE_ALTERNATE(GPIOH_FMC_D21) | \
  1275. PIN_MODE_ALTERNATE(GPIOH_FMC_D22) | \
  1276. PIN_MODE_ALTERNATE(GPIOH_FMC_D23))
  1277. #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \
  1278. PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \
  1279. PIN_OTYPE_PUSHPULL(GPIOH_FMC_SDCKE0) | \
  1280. PIN_OTYPE_PUSHPULL(GPIOH_FMC_SDNE0) | \
  1281. PIN_OTYPE_PUSHPULL(GPIOH_ULPI_NXT) | \
  1282. PIN_OTYPE_PUSHPULL(GPIOH_FMC_SDNWE) | \
  1283. PIN_OTYPE_PUSHPULL(GPIOH_ARD_D9) | \
  1284. PIN_OTYPE_OPENDRAIN(GPIOH_EXT_RST) | \
  1285. PIN_OTYPE_PUSHPULL(GPIOH_FMC_D16) | \
  1286. PIN_OTYPE_PUSHPULL(GPIOH_FMC_D17) | \
  1287. PIN_OTYPE_PUSHPULL(GPIOH_FMC_D18) | \
  1288. PIN_OTYPE_PUSHPULL(GPIOH_FMC_D19) | \
  1289. PIN_OTYPE_PUSHPULL(GPIOH_FMC_D20) | \
  1290. PIN_OTYPE_PUSHPULL(GPIOH_FMC_D21) | \
  1291. PIN_OTYPE_PUSHPULL(GPIOH_FMC_D22) | \
  1292. PIN_OTYPE_PUSHPULL(GPIOH_FMC_D23))
  1293. #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \
  1294. PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \
  1295. PIN_OSPEED_HIGH(GPIOH_FMC_SDCKE0) | \
  1296. PIN_OSPEED_HIGH(GPIOH_FMC_SDNE0) | \
  1297. PIN_OSPEED_HIGH(GPIOH_ULPI_NXT) | \
  1298. PIN_OSPEED_HIGH(GPIOH_FMC_SDNWE) | \
  1299. PIN_OSPEED_VERYLOW(GPIOH_ARD_D9) | \
  1300. PIN_OSPEED_HIGH(GPIOH_EXT_RST) | \
  1301. PIN_OSPEED_HIGH(GPIOH_FMC_D16) | \
  1302. PIN_OSPEED_HIGH(GPIOH_FMC_D17) | \
  1303. PIN_OSPEED_HIGH(GPIOH_FMC_D18) | \
  1304. PIN_OSPEED_HIGH(GPIOH_FMC_D19) | \
  1305. PIN_OSPEED_HIGH(GPIOH_FMC_D20) | \
  1306. PIN_OSPEED_HIGH(GPIOH_FMC_D21) | \
  1307. PIN_OSPEED_HIGH(GPIOH_FMC_D22) | \
  1308. PIN_OSPEED_HIGH(GPIOH_FMC_D23))
  1309. #define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \
  1310. PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \
  1311. PIN_PUPDR_FLOATING(GPIOH_FMC_SDCKE0) | \
  1312. PIN_PUPDR_FLOATING(GPIOH_FMC_SDNE0) | \
  1313. PIN_PUPDR_FLOATING(GPIOH_ULPI_NXT) | \
  1314. PIN_PUPDR_FLOATING(GPIOH_FMC_SDNWE) | \
  1315. PIN_PUPDR_PULLUP(GPIOH_ARD_D9) | \
  1316. PIN_PUPDR_FLOATING(GPIOH_EXT_RST) | \
  1317. PIN_PUPDR_FLOATING(GPIOH_FMC_D16) | \
  1318. PIN_PUPDR_FLOATING(GPIOH_FMC_D17) | \
  1319. PIN_PUPDR_FLOATING(GPIOH_FMC_D18) | \
  1320. PIN_PUPDR_FLOATING(GPIOH_FMC_D19) | \
  1321. PIN_PUPDR_FLOATING(GPIOH_FMC_D20) | \
  1322. PIN_PUPDR_FLOATING(GPIOH_FMC_D21) | \
  1323. PIN_PUPDR_FLOATING(GPIOH_FMC_D22) | \
  1324. PIN_PUPDR_FLOATING(GPIOH_FMC_D23))
  1325. #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \
  1326. PIN_ODR_HIGH(GPIOH_OSC_OUT) | \
  1327. PIN_ODR_HIGH(GPIOH_FMC_SDCKE0) | \
  1328. PIN_ODR_HIGH(GPIOH_FMC_SDNE0) | \
  1329. PIN_ODR_HIGH(GPIOH_ULPI_NXT) | \
  1330. PIN_ODR_HIGH(GPIOH_FMC_SDNWE) | \
  1331. PIN_ODR_HIGH(GPIOH_ARD_D9) | \
  1332. PIN_ODR_HIGH(GPIOH_EXT_RST) | \
  1333. PIN_ODR_HIGH(GPIOH_FMC_D16) | \
  1334. PIN_ODR_HIGH(GPIOH_FMC_D17) | \
  1335. PIN_ODR_HIGH(GPIOH_FMC_D18) | \
  1336. PIN_ODR_HIGH(GPIOH_FMC_D19) | \
  1337. PIN_ODR_HIGH(GPIOH_FMC_D20) | \
  1338. PIN_ODR_HIGH(GPIOH_FMC_D21) | \
  1339. PIN_ODR_HIGH(GPIOH_FMC_D22) | \
  1340. PIN_ODR_HIGH(GPIOH_FMC_D23))
  1341. #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \
  1342. PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \
  1343. PIN_AFIO_AF(GPIOH_FMC_SDCKE0, 12U) | \
  1344. PIN_AFIO_AF(GPIOH_FMC_SDNE0, 12U) | \
  1345. PIN_AFIO_AF(GPIOH_ULPI_NXT, 10U) | \
  1346. PIN_AFIO_AF(GPIOH_FMC_SDNWE, 12U) | \
  1347. PIN_AFIO_AF(GPIOH_ARD_D9, 0U) | \
  1348. PIN_AFIO_AF(GPIOH_EXT_RST, 0U))
  1349. #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_FMC_D16, 12U) | \
  1350. PIN_AFIO_AF(GPIOH_FMC_D17, 12U) | \
  1351. PIN_AFIO_AF(GPIOH_FMC_D18, 12U) | \
  1352. PIN_AFIO_AF(GPIOH_FMC_D19, 12U) | \
  1353. PIN_AFIO_AF(GPIOH_FMC_D20, 12U) | \
  1354. PIN_AFIO_AF(GPIOH_FMC_D21, 12U) | \
  1355. PIN_AFIO_AF(GPIOH_FMC_D22, 12U) | \
  1356. PIN_AFIO_AF(GPIOH_FMC_D23, 12U))
  1357. /*
  1358. * GPIOI setup:
  1359. *
  1360. * PI0 - FMC_D24 (alternate 12).
  1361. * PI1 - FMC_D25 (alternate 12).
  1362. * PI2 - FMC_D26 (alternate 12).
  1363. * PI3 - FMC_D27 (alternate 12).
  1364. * PI4 - FMC_NBL2 (alternate 12).
  1365. * PI5 - FMC_NBL3 (alternate 12).
  1366. * PI6 - FMC_D28 (alternate 12).
  1367. * PI7 - FMC_D29 (alternate 12).
  1368. * PI8 - PIN8 (input pullup).
  1369. * PI9 - FMC_D30 (alternate 12).
  1370. * PI10 - FMC_D31 (alternate 12).
  1371. * PI11 - ULPI_DIR (alternate 10).
  1372. * PI12 - PIN12 (input pullup).
  1373. * PI13 - LCD_INT (alternate 14).
  1374. * PI14 - LCD_BL_CTRL (alternate 14).
  1375. * PI15 - SD_DETECT (input pullup).
  1376. */
  1377. #define VAL_GPIOI_MODER (PIN_MODE_ALTERNATE(GPIOI_FMC_D24) | \
  1378. PIN_MODE_ALTERNATE(GPIOI_FMC_D25) | \
  1379. PIN_MODE_ALTERNATE(GPIOI_FMC_D26) | \
  1380. PIN_MODE_ALTERNATE(GPIOI_FMC_D27) | \
  1381. PIN_MODE_ALTERNATE(GPIOI_FMC_NBL2) | \
  1382. PIN_MODE_ALTERNATE(GPIOI_FMC_NBL3) | \
  1383. PIN_MODE_ALTERNATE(GPIOI_FMC_D28) | \
  1384. PIN_MODE_ALTERNATE(GPIOI_FMC_D29) | \
  1385. PIN_MODE_INPUT(GPIOI_PIN8) | \
  1386. PIN_MODE_ALTERNATE(GPIOI_FMC_D30) | \
  1387. PIN_MODE_ALTERNATE(GPIOI_FMC_D31) | \
  1388. PIN_MODE_ALTERNATE(GPIOI_ULPI_DIR) | \
  1389. PIN_MODE_INPUT(GPIOI_PIN12) | \
  1390. PIN_MODE_ALTERNATE(GPIOI_LCD_INT) | \
  1391. PIN_MODE_ALTERNATE(GPIOI_LCD_BL_CTRL) |\
  1392. PIN_MODE_INPUT(GPIOI_SD_DETECT))
  1393. #define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_FMC_D24) | \
  1394. PIN_OTYPE_PUSHPULL(GPIOI_FMC_D25) | \
  1395. PIN_OTYPE_PUSHPULL(GPIOI_FMC_D26) | \
  1396. PIN_OTYPE_PUSHPULL(GPIOI_FMC_D27) | \
  1397. PIN_OTYPE_PUSHPULL(GPIOI_FMC_NBL2) | \
  1398. PIN_OTYPE_PUSHPULL(GPIOI_FMC_NBL3) | \
  1399. PIN_OTYPE_PUSHPULL(GPIOI_FMC_D28) | \
  1400. PIN_OTYPE_PUSHPULL(GPIOI_FMC_D29) | \
  1401. PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | \
  1402. PIN_OTYPE_PUSHPULL(GPIOI_FMC_D30) | \
  1403. PIN_OTYPE_PUSHPULL(GPIOI_FMC_D31) | \
  1404. PIN_OTYPE_PUSHPULL(GPIOI_ULPI_DIR) | \
  1405. PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | \
  1406. PIN_OTYPE_PUSHPULL(GPIOI_LCD_INT) | \
  1407. PIN_OTYPE_PUSHPULL(GPIOI_LCD_BL_CTRL) |\
  1408. PIN_OTYPE_PUSHPULL(GPIOI_SD_DETECT))
  1409. #define VAL_GPIOI_OSPEEDR (PIN_OSPEED_HIGH(GPIOI_FMC_D24) | \
  1410. PIN_OSPEED_HIGH(GPIOI_FMC_D25) | \
  1411. PIN_OSPEED_HIGH(GPIOI_FMC_D26) | \
  1412. PIN_OSPEED_HIGH(GPIOI_FMC_D27) | \
  1413. PIN_OSPEED_HIGH(GPIOI_FMC_NBL2) | \
  1414. PIN_OSPEED_HIGH(GPIOI_FMC_NBL3) | \
  1415. PIN_OSPEED_HIGH(GPIOI_FMC_D28) | \
  1416. PIN_OSPEED_HIGH(GPIOI_FMC_D29) | \
  1417. PIN_OSPEED_HIGH(GPIOI_PIN8) | \
  1418. PIN_OSPEED_HIGH(GPIOI_FMC_D30) | \
  1419. PIN_OSPEED_HIGH(GPIOI_FMC_D31) | \
  1420. PIN_OSPEED_HIGH(GPIOI_ULPI_DIR) | \
  1421. PIN_OSPEED_HIGH(GPIOI_PIN12) | \
  1422. PIN_OSPEED_HIGH(GPIOI_LCD_INT) | \
  1423. PIN_OSPEED_HIGH(GPIOI_LCD_BL_CTRL) | \
  1424. PIN_OSPEED_HIGH(GPIOI_SD_DETECT))
  1425. #define VAL_GPIOI_PUPDR (PIN_PUPDR_FLOATING(GPIOI_FMC_D24) | \
  1426. PIN_PUPDR_FLOATING(GPIOI_FMC_D25) | \
  1427. PIN_PUPDR_FLOATING(GPIOI_FMC_D26) | \
  1428. PIN_PUPDR_FLOATING(GPIOI_FMC_D27) | \
  1429. PIN_PUPDR_FLOATING(GPIOI_FMC_NBL2) | \
  1430. PIN_PUPDR_FLOATING(GPIOI_FMC_NBL3) | \
  1431. PIN_PUPDR_FLOATING(GPIOI_FMC_D28) | \
  1432. PIN_PUPDR_FLOATING(GPIOI_FMC_D29) | \
  1433. PIN_PUPDR_PULLUP(GPIOI_PIN8) | \
  1434. PIN_PUPDR_FLOATING(GPIOI_FMC_D30) | \
  1435. PIN_PUPDR_FLOATING(GPIOI_FMC_D31) | \
  1436. PIN_PUPDR_FLOATING(GPIOI_ULPI_DIR) | \
  1437. PIN_PUPDR_PULLUP(GPIOI_PIN12) | \
  1438. PIN_PUPDR_FLOATING(GPIOI_LCD_INT) | \
  1439. PIN_PUPDR_FLOATING(GPIOI_LCD_BL_CTRL) |\
  1440. PIN_PUPDR_PULLUP(GPIOI_SD_DETECT))
  1441. #define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_FMC_D24) | \
  1442. PIN_ODR_HIGH(GPIOI_FMC_D25) | \
  1443. PIN_ODR_HIGH(GPIOI_FMC_D26) | \
  1444. PIN_ODR_HIGH(GPIOI_FMC_D27) | \
  1445. PIN_ODR_HIGH(GPIOI_FMC_NBL2) | \
  1446. PIN_ODR_HIGH(GPIOI_FMC_NBL3) | \
  1447. PIN_ODR_HIGH(GPIOI_FMC_D28) | \
  1448. PIN_ODR_HIGH(GPIOI_FMC_D29) | \
  1449. PIN_ODR_HIGH(GPIOI_PIN8) | \
  1450. PIN_ODR_HIGH(GPIOI_FMC_D30) | \
  1451. PIN_ODR_HIGH(GPIOI_FMC_D31) | \
  1452. PIN_ODR_HIGH(GPIOI_ULPI_DIR) | \
  1453. PIN_ODR_HIGH(GPIOI_PIN12) | \
  1454. PIN_ODR_HIGH(GPIOI_LCD_INT) | \
  1455. PIN_ODR_HIGH(GPIOI_LCD_BL_CTRL) | \
  1456. PIN_ODR_HIGH(GPIOI_SD_DETECT))
  1457. #define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_FMC_D24, 12U) | \
  1458. PIN_AFIO_AF(GPIOI_FMC_D25, 12U) | \
  1459. PIN_AFIO_AF(GPIOI_FMC_D26, 12U) | \
  1460. PIN_AFIO_AF(GPIOI_FMC_D27, 12U) | \
  1461. PIN_AFIO_AF(GPIOI_FMC_NBL2, 12U) | \
  1462. PIN_AFIO_AF(GPIOI_FMC_NBL3, 12U) | \
  1463. PIN_AFIO_AF(GPIOI_FMC_D28, 12U) | \
  1464. PIN_AFIO_AF(GPIOI_FMC_D29, 12U))
  1465. #define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | \
  1466. PIN_AFIO_AF(GPIOI_FMC_D30, 12U) | \
  1467. PIN_AFIO_AF(GPIOI_FMC_D31, 12U) | \
  1468. PIN_AFIO_AF(GPIOI_ULPI_DIR, 10U) | \
  1469. PIN_AFIO_AF(GPIOI_PIN12, 0U) | \
  1470. PIN_AFIO_AF(GPIOI_LCD_INT, 14U) | \
  1471. PIN_AFIO_AF(GPIOI_LCD_BL_CTRL, 14U) | \
  1472. PIN_AFIO_AF(GPIOI_SD_DETECT, 0U))
  1473. /*
  1474. * GPIOJ setup:
  1475. *
  1476. * PJ0 - ARD_D4 (input floating).
  1477. * PJ1 - ARD_D2 (input floating).
  1478. * PJ2 - DSI_TE (alternate 13).
  1479. * PJ3 - ARD_D7 (input floating).
  1480. * PJ4 - ARD_D8 (input floating).
  1481. * PJ5 - LED2_GREEN (output pushpull maximum).
  1482. * PJ6 - PIN6 (input floating).
  1483. * PJ7 - PIN7 (input floating).
  1484. * PJ8 - PIN8 (input floating).
  1485. * PJ9 - PIN9 (input floating).
  1486. * PJ10 - PIN10 (input floating).
  1487. * PJ11 - PIN11 (input floating).
  1488. * PJ12 - AUDIO_INT (input floating).
  1489. * PJ13 - LED1_RED (output pushpull maximum).
  1490. * PJ14 - WIFI_RST (input floating).
  1491. * PJ15 - DSI_RESET (input floating).
  1492. */
  1493. #define VAL_GPIOJ_MODER (PIN_MODE_INPUT(GPIOJ_ARD_D4) | \
  1494. PIN_MODE_INPUT(GPIOJ_ARD_D2) | \
  1495. PIN_MODE_ALTERNATE(GPIOJ_DSI_TE) | \
  1496. PIN_MODE_INPUT(GPIOJ_ARD_D7) | \
  1497. PIN_MODE_INPUT(GPIOJ_ARD_D8) | \
  1498. PIN_MODE_OUTPUT(GPIOJ_LED2_GREEN) | \
  1499. PIN_MODE_INPUT(GPIOJ_PIN6) | \
  1500. PIN_MODE_INPUT(GPIOJ_PIN7) | \
  1501. PIN_MODE_INPUT(GPIOJ_PIN8) | \
  1502. PIN_MODE_INPUT(GPIOJ_PIN9) | \
  1503. PIN_MODE_INPUT(GPIOJ_PIN10) | \
  1504. PIN_MODE_INPUT(GPIOJ_PIN11) | \
  1505. PIN_MODE_INPUT(GPIOJ_AUDIO_INT) | \
  1506. PIN_MODE_OUTPUT(GPIOJ_LED1_RED) | \
  1507. PIN_MODE_INPUT(GPIOJ_WIFI_RST) | \
  1508. PIN_MODE_INPUT(GPIOJ_DSI_RESET))
  1509. #define VAL_GPIOJ_OTYPER (PIN_OTYPE_PUSHPULL(GPIOJ_ARD_D4) | \
  1510. PIN_OTYPE_PUSHPULL(GPIOJ_ARD_D2) | \
  1511. PIN_OTYPE_PUSHPULL(GPIOJ_DSI_TE) | \
  1512. PIN_OTYPE_PUSHPULL(GPIOJ_ARD_D7) | \
  1513. PIN_OTYPE_PUSHPULL(GPIOJ_ARD_D8) | \
  1514. PIN_OTYPE_PUSHPULL(GPIOJ_LED2_GREEN) | \
  1515. PIN_OTYPE_PUSHPULL(GPIOJ_PIN6) | \
  1516. PIN_OTYPE_PUSHPULL(GPIOJ_PIN7) | \
  1517. PIN_OTYPE_PUSHPULL(GPIOJ_PIN8) | \
  1518. PIN_OTYPE_PUSHPULL(GPIOJ_PIN9) | \
  1519. PIN_OTYPE_PUSHPULL(GPIOJ_PIN10) | \
  1520. PIN_OTYPE_PUSHPULL(GPIOJ_PIN11) | \
  1521. PIN_OTYPE_PUSHPULL(GPIOJ_AUDIO_INT) | \
  1522. PIN_OTYPE_PUSHPULL(GPIOJ_LED1_RED) | \
  1523. PIN_OTYPE_PUSHPULL(GPIOJ_WIFI_RST) | \
  1524. PIN_OTYPE_PUSHPULL(GPIOJ_DSI_RESET))
  1525. #define VAL_GPIOJ_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOJ_ARD_D4) | \
  1526. PIN_OSPEED_VERYLOW(GPIOJ_ARD_D2) | \
  1527. PIN_OSPEED_HIGH(GPIOJ_DSI_TE) | \
  1528. PIN_OSPEED_VERYLOW(GPIOJ_ARD_D7) | \
  1529. PIN_OSPEED_VERYLOW(GPIOJ_ARD_D8) | \
  1530. PIN_OSPEED_HIGH(GPIOJ_LED2_GREEN) | \
  1531. PIN_OSPEED_VERYLOW(GPIOJ_PIN6) | \
  1532. PIN_OSPEED_VERYLOW(GPIOJ_PIN7) | \
  1533. PIN_OSPEED_VERYLOW(GPIOJ_PIN8) | \
  1534. PIN_OSPEED_VERYLOW(GPIOJ_PIN9) | \
  1535. PIN_OSPEED_VERYLOW(GPIOJ_PIN10) | \
  1536. PIN_OSPEED_VERYLOW(GPIOJ_PIN11) | \
  1537. PIN_OSPEED_VERYLOW(GPIOJ_AUDIO_INT) | \
  1538. PIN_OSPEED_HIGH(GPIOJ_LED1_RED) | \
  1539. PIN_OSPEED_VERYLOW(GPIOJ_WIFI_RST) | \
  1540. PIN_OSPEED_VERYLOW(GPIOJ_DSI_RESET))
  1541. #define VAL_GPIOJ_PUPDR (PIN_PUPDR_FLOATING(GPIOJ_ARD_D4) | \
  1542. PIN_PUPDR_FLOATING(GPIOJ_ARD_D2) | \
  1543. PIN_PUPDR_FLOATING(GPIOJ_DSI_TE) | \
  1544. PIN_PUPDR_FLOATING(GPIOJ_ARD_D7) | \
  1545. PIN_PUPDR_FLOATING(GPIOJ_ARD_D8) | \
  1546. PIN_PUPDR_FLOATING(GPIOJ_LED2_GREEN) | \
  1547. PIN_PUPDR_FLOATING(GPIOJ_PIN6) | \
  1548. PIN_PUPDR_FLOATING(GPIOJ_PIN7) | \
  1549. PIN_PUPDR_FLOATING(GPIOJ_PIN8) | \
  1550. PIN_PUPDR_FLOATING(GPIOJ_PIN9) | \
  1551. PIN_PUPDR_FLOATING(GPIOJ_PIN10) | \
  1552. PIN_PUPDR_FLOATING(GPIOJ_PIN11) | \
  1553. PIN_PUPDR_FLOATING(GPIOJ_AUDIO_INT) | \
  1554. PIN_PUPDR_FLOATING(GPIOJ_LED1_RED) | \
  1555. PIN_PUPDR_FLOATING(GPIOJ_WIFI_RST) | \
  1556. PIN_PUPDR_FLOATING(GPIOJ_DSI_RESET))
  1557. #define VAL_GPIOJ_ODR (PIN_ODR_HIGH(GPIOJ_ARD_D4) | \
  1558. PIN_ODR_HIGH(GPIOJ_ARD_D2) | \
  1559. PIN_ODR_HIGH(GPIOJ_DSI_TE) | \
  1560. PIN_ODR_HIGH(GPIOJ_ARD_D7) | \
  1561. PIN_ODR_HIGH(GPIOJ_ARD_D8) | \
  1562. PIN_ODR_LOW(GPIOJ_LED2_GREEN) | \
  1563. PIN_ODR_HIGH(GPIOJ_PIN6) | \
  1564. PIN_ODR_HIGH(GPIOJ_PIN7) | \
  1565. PIN_ODR_HIGH(GPIOJ_PIN8) | \
  1566. PIN_ODR_HIGH(GPIOJ_PIN9) | \
  1567. PIN_ODR_HIGH(GPIOJ_PIN10) | \
  1568. PIN_ODR_HIGH(GPIOJ_PIN11) | \
  1569. PIN_ODR_HIGH(GPIOJ_AUDIO_INT) | \
  1570. PIN_ODR_LOW(GPIOJ_LED1_RED) | \
  1571. PIN_ODR_HIGH(GPIOJ_WIFI_RST) | \
  1572. PIN_ODR_HIGH(GPIOJ_DSI_RESET))
  1573. #define VAL_GPIOJ_AFRL (PIN_AFIO_AF(GPIOJ_ARD_D4, 0U) | \
  1574. PIN_AFIO_AF(GPIOJ_ARD_D2, 0U) | \
  1575. PIN_AFIO_AF(GPIOJ_DSI_TE, 13U) | \
  1576. PIN_AFIO_AF(GPIOJ_ARD_D7, 0U) | \
  1577. PIN_AFIO_AF(GPIOJ_ARD_D8, 0U) | \
  1578. PIN_AFIO_AF(GPIOJ_LED2_GREEN, 0U) | \
  1579. PIN_AFIO_AF(GPIOJ_PIN6, 0U) | \
  1580. PIN_AFIO_AF(GPIOJ_PIN7, 0U))
  1581. #define VAL_GPIOJ_AFRH (PIN_AFIO_AF(GPIOJ_PIN8, 0U) | \
  1582. PIN_AFIO_AF(GPIOJ_PIN9, 0U) | \
  1583. PIN_AFIO_AF(GPIOJ_PIN10, 0U) | \
  1584. PIN_AFIO_AF(GPIOJ_PIN11, 0U) | \
  1585. PIN_AFIO_AF(GPIOJ_AUDIO_INT, 0U) | \
  1586. PIN_AFIO_AF(GPIOJ_LED1_RED, 0U) | \
  1587. PIN_AFIO_AF(GPIOJ_WIFI_RST, 0U) | \
  1588. PIN_AFIO_AF(GPIOJ_DSI_RESET, 0U))
  1589. /*
  1590. * GPIOK setup:
  1591. *
  1592. * PK0 - PIN0 (input floating).
  1593. * PK1 - PIN1 (input floating).
  1594. * PK2 - PIN2 (input floating).
  1595. * PK3 - PIN3 (input floating).
  1596. * PK4 - PIN4 (input floating).
  1597. * PK5 - PIN5 (input floating).
  1598. * PK6 - PIN6 (input floating).
  1599. * PK7 - PIN7 (input floating).
  1600. * PK8 - PIN8 (input floating).
  1601. * PK9 - PIN9 (input floating).
  1602. * PK10 - PIN10 (input floating).
  1603. * PK11 - PIN11 (input floating).
  1604. * PK12 - PIN12 (input floating).
  1605. * PK13 - PIN13 (input floating).
  1606. * PK14 - PIN14 (input floating).
  1607. * PK15 - PIN15 (input floating).
  1608. */
  1609. #define VAL_GPIOK_MODER (PIN_MODE_INPUT(GPIOK_PIN0) | \
  1610. PIN_MODE_INPUT(GPIOK_PIN1) | \
  1611. PIN_MODE_INPUT(GPIOK_PIN2) | \
  1612. PIN_MODE_INPUT(GPIOK_PIN3) | \
  1613. PIN_MODE_INPUT(GPIOK_PIN4) | \
  1614. PIN_MODE_INPUT(GPIOK_PIN5) | \
  1615. PIN_MODE_INPUT(GPIOK_PIN6) | \
  1616. PIN_MODE_INPUT(GPIOK_PIN7) | \
  1617. PIN_MODE_INPUT(GPIOK_PIN8) | \
  1618. PIN_MODE_INPUT(GPIOK_PIN9) | \
  1619. PIN_MODE_INPUT(GPIOK_PIN10) | \
  1620. PIN_MODE_INPUT(GPIOK_PIN11) | \
  1621. PIN_MODE_INPUT(GPIOK_PIN12) | \
  1622. PIN_MODE_INPUT(GPIOK_PIN13) | \
  1623. PIN_MODE_INPUT(GPIOK_PIN14) | \
  1624. PIN_MODE_INPUT(GPIOK_PIN15))
  1625. #define VAL_GPIOK_OTYPER (PIN_OTYPE_PUSHPULL(GPIOK_PIN0) | \
  1626. PIN_OTYPE_PUSHPULL(GPIOK_PIN1) | \
  1627. PIN_OTYPE_PUSHPULL(GPIOK_PIN2) | \
  1628. PIN_OTYPE_PUSHPULL(GPIOK_PIN3) | \
  1629. PIN_OTYPE_PUSHPULL(GPIOK_PIN4) | \
  1630. PIN_OTYPE_PUSHPULL(GPIOK_PIN5) | \
  1631. PIN_OTYPE_PUSHPULL(GPIOK_PIN6) | \
  1632. PIN_OTYPE_PUSHPULL(GPIOK_PIN7) | \
  1633. PIN_OTYPE_PUSHPULL(GPIOK_PIN8) | \
  1634. PIN_OTYPE_PUSHPULL(GPIOK_PIN9) | \
  1635. PIN_OTYPE_PUSHPULL(GPIOK_PIN10) | \
  1636. PIN_OTYPE_PUSHPULL(GPIOK_PIN11) | \
  1637. PIN_OTYPE_PUSHPULL(GPIOK_PIN12) | \
  1638. PIN_OTYPE_PUSHPULL(GPIOK_PIN13) | \
  1639. PIN_OTYPE_PUSHPULL(GPIOK_PIN14) | \
  1640. PIN_OTYPE_PUSHPULL(GPIOK_PIN15))
  1641. #define VAL_GPIOK_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOK_PIN0) | \
  1642. PIN_OSPEED_VERYLOW(GPIOK_PIN1) | \
  1643. PIN_OSPEED_VERYLOW(GPIOK_PIN2) | \
  1644. PIN_OSPEED_VERYLOW(GPIOK_PIN3) | \
  1645. PIN_OSPEED_VERYLOW(GPIOK_PIN4) | \
  1646. PIN_OSPEED_VERYLOW(GPIOK_PIN5) | \
  1647. PIN_OSPEED_VERYLOW(GPIOK_PIN6) | \
  1648. PIN_OSPEED_VERYLOW(GPIOK_PIN7) | \
  1649. PIN_OSPEED_VERYLOW(GPIOK_PIN8) | \
  1650. PIN_OSPEED_VERYLOW(GPIOK_PIN9) | \
  1651. PIN_OSPEED_VERYLOW(GPIOK_PIN10) | \
  1652. PIN_OSPEED_VERYLOW(GPIOK_PIN11) | \
  1653. PIN_OSPEED_VERYLOW(GPIOK_PIN12) | \
  1654. PIN_OSPEED_VERYLOW(GPIOK_PIN13) | \
  1655. PIN_OSPEED_VERYLOW(GPIOK_PIN14) | \
  1656. PIN_OSPEED_VERYLOW(GPIOK_PIN15))
  1657. #define VAL_GPIOK_PUPDR (PIN_PUPDR_FLOATING(GPIOK_PIN0) | \
  1658. PIN_PUPDR_FLOATING(GPIOK_PIN1) | \
  1659. PIN_PUPDR_FLOATING(GPIOK_PIN2) | \
  1660. PIN_PUPDR_FLOATING(GPIOK_PIN3) | \
  1661. PIN_PUPDR_FLOATING(GPIOK_PIN4) | \
  1662. PIN_PUPDR_FLOATING(GPIOK_PIN5) | \
  1663. PIN_PUPDR_FLOATING(GPIOK_PIN6) | \
  1664. PIN_PUPDR_FLOATING(GPIOK_PIN7) | \
  1665. PIN_PUPDR_FLOATING(GPIOK_PIN8) | \
  1666. PIN_PUPDR_FLOATING(GPIOK_PIN9) | \
  1667. PIN_PUPDR_FLOATING(GPIOK_PIN10) | \
  1668. PIN_PUPDR_FLOATING(GPIOK_PIN11) | \
  1669. PIN_PUPDR_FLOATING(GPIOK_PIN12) | \
  1670. PIN_PUPDR_FLOATING(GPIOK_PIN13) | \
  1671. PIN_PUPDR_FLOATING(GPIOK_PIN14) | \
  1672. PIN_PUPDR_FLOATING(GPIOK_PIN15))
  1673. #define VAL_GPIOK_ODR (PIN_ODR_HIGH(GPIOK_PIN0) | \
  1674. PIN_ODR_HIGH(GPIOK_PIN1) | \
  1675. PIN_ODR_HIGH(GPIOK_PIN2) | \
  1676. PIN_ODR_HIGH(GPIOK_PIN3) | \
  1677. PIN_ODR_HIGH(GPIOK_PIN4) | \
  1678. PIN_ODR_HIGH(GPIOK_PIN5) | \
  1679. PIN_ODR_HIGH(GPIOK_PIN6) | \
  1680. PIN_ODR_HIGH(GPIOK_PIN7) | \
  1681. PIN_ODR_HIGH(GPIOK_PIN8) | \
  1682. PIN_ODR_HIGH(GPIOK_PIN9) | \
  1683. PIN_ODR_HIGH(GPIOK_PIN10) | \
  1684. PIN_ODR_HIGH(GPIOK_PIN11) | \
  1685. PIN_ODR_HIGH(GPIOK_PIN12) | \
  1686. PIN_ODR_HIGH(GPIOK_PIN13) | \
  1687. PIN_ODR_HIGH(GPIOK_PIN14) | \
  1688. PIN_ODR_HIGH(GPIOK_PIN15))
  1689. #define VAL_GPIOK_AFRL (PIN_AFIO_AF(GPIOK_PIN0, 0U) | \
  1690. PIN_AFIO_AF(GPIOK_PIN1, 0U) | \
  1691. PIN_AFIO_AF(GPIOK_PIN2, 0U) | \
  1692. PIN_AFIO_AF(GPIOK_PIN3, 0U) | \
  1693. PIN_AFIO_AF(GPIOK_PIN4, 0U) | \
  1694. PIN_AFIO_AF(GPIOK_PIN5, 0U) | \
  1695. PIN_AFIO_AF(GPIOK_PIN6, 0U) | \
  1696. PIN_AFIO_AF(GPIOK_PIN7, 0U))
  1697. #define VAL_GPIOK_AFRH (PIN_AFIO_AF(GPIOK_PIN8, 0U) | \
  1698. PIN_AFIO_AF(GPIOK_PIN9, 0U) | \
  1699. PIN_AFIO_AF(GPIOK_PIN10, 0U) | \
  1700. PIN_AFIO_AF(GPIOK_PIN11, 0U) | \
  1701. PIN_AFIO_AF(GPIOK_PIN12, 0U) | \
  1702. PIN_AFIO_AF(GPIOK_PIN13, 0U) | \
  1703. PIN_AFIO_AF(GPIOK_PIN14, 0U) | \
  1704. PIN_AFIO_AF(GPIOK_PIN15, 0U))
  1705. /*===========================================================================*/
  1706. /* External declarations. */
  1707. /*===========================================================================*/
  1708. #if !defined(_FROM_ASM_)
  1709. #ifdef __cplusplus
  1710. extern "C" {
  1711. #endif
  1712. void boardInit(void);
  1713. #ifdef __cplusplus
  1714. }
  1715. #endif
  1716. #endif /* _FROM_ASM_ */
  1717. #endif /* BOARD_H */