board.h 109 KB

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