board.c 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2009-01-05 Bernard first implementation
  9. */
  10. #include <rthw.h>
  11. #include <rtthread.h>
  12. #include "board.h"
  13. #include "pin_mux.h"
  14. #include "fsl_iomuxc.h"
  15. #include "fsl_gpio.h"
  16. #ifdef BSP_USING_DMA
  17. #include "fsl_dmamux.h"
  18. #include "fsl_edma.h"
  19. #endif
  20. #define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority
  21. 4 bits for subpriority */
  22. #define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority
  23. 3 bits for subpriority */
  24. #define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 bits for pre-emption priority
  25. 2 bits for subpriority */
  26. #define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 bits for pre-emption priority
  27. 1 bits for subpriority */
  28. #define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 bits for pre-emption priority
  29. 0 bits for subpriority */
  30. /* MPU configuration. */
  31. static void BOARD_ConfigMPU(void)
  32. {
  33. /* Disable I cache and D cache */
  34. SCB_DisableICache();
  35. SCB_DisableDCache();
  36. /* Disable MPU */
  37. ARM_MPU_Disable();
  38. /* Region 0 setting */
  39. MPU->RBAR = ARM_MPU_RBAR(0, 0xC0000000U);
  40. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);
  41. /* Region 1 setting */
  42. MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U);
  43. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);
  44. /* Region 2 setting */
  45. // spi flash: normal type, cacheable, no bufferable, no shareable
  46. MPU->RBAR = ARM_MPU_RBAR(2, 0x60000000U);
  47. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 0, 0, ARM_MPU_REGION_SIZE_512MB);
  48. /* Region 3 setting */
  49. MPU->RBAR = ARM_MPU_RBAR(3, 0x00000000U);
  50. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);
  51. /* Region 4 setting */
  52. MPU->RBAR = ARM_MPU_RBAR(4, 0x00000000U);
  53. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB);
  54. /* Region 5 setting */
  55. MPU->RBAR = ARM_MPU_RBAR(5, 0x20000000U);
  56. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB);
  57. /* Region 6 setting */
  58. MPU->RBAR = ARM_MPU_RBAR(6, 0x20200000U);
  59. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_256KB);
  60. #if defined(BSP_USING_SDRAM)
  61. /* Region 7 setting */
  62. MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U);
  63. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);
  64. /* Region 8 setting */
  65. MPU->RBAR = ARM_MPU_RBAR(8, 0x81E00000U);
  66. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 1, 0, 0, 0, ARM_MPU_REGION_SIZE_2MB);
  67. #endif
  68. /* Enable MPU */
  69. ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk);
  70. /* Enable I cache and D cache */
  71. SCB_EnableDCache();
  72. SCB_EnableICache();
  73. }
  74. /* This is the timer interrupt service routine. */
  75. void SysTick_Handler(void)
  76. {
  77. /* enter interrupt */
  78. rt_interrupt_enter();
  79. rt_tick_increase();
  80. /* leave interrupt */
  81. rt_interrupt_leave();
  82. }
  83. #ifdef BSP_USING_DMA
  84. void imxrt_dma_init(void)
  85. {
  86. edma_config_t config;
  87. DMAMUX_Init(DMAMUX);
  88. EDMA_GetDefaultConfig(&config);
  89. EDMA_Init(DMA0, &config);
  90. }
  91. #endif
  92. #ifdef BSP_USING_LPUART
  93. void imxrt_uart_pins_init(void)
  94. {
  95. #ifdef BSP_USING_LPUART1
  96. IOMUXC_SetPinMux(
  97. IOMUXC_GPIO_AD_B0_12_LPUART1_TX, /* GPIO_AD_B0_12 is configured as LPUART1_TX */
  98. 0U); /* Software Input On Field: Input Path is determined by functionality */
  99. IOMUXC_SetPinMux(
  100. IOMUXC_GPIO_AD_B0_13_LPUART1_RX, /* GPIO_AD_B0_13 is configured as LPUART1_RX */
  101. 0U); /* Software Input On Field: Input Path is determined by functionality */
  102. IOMUXC_SetPinConfig(
  103. IOMUXC_GPIO_AD_B0_12_LPUART1_TX, /* GPIO_AD_B0_12 PAD functional properties : */
  104. 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  105. Drive Strength Field: R0/6
  106. Speed Field: medium(100MHz)
  107. Open Drain Enable Field: Open Drain Disabled
  108. Pull / Keep Enable Field: Pull/Keeper Enabled
  109. Pull / Keep Select Field: Keeper
  110. Pull Up / Down Config. Field: 100K Ohm Pull Down
  111. Hyst. Enable Field: Hysteresis Disabled */
  112. IOMUXC_SetPinConfig(
  113. IOMUXC_GPIO_AD_B0_13_LPUART1_RX, /* GPIO_AD_B0_13 PAD functional properties : */
  114. 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  115. Drive Strength Field: R0/6
  116. Speed Field: medium(100MHz)
  117. Open Drain Enable Field: Open Drain Disabled
  118. Pull / Keep Enable Field: Pull/Keeper Enabled
  119. Pull / Keep Select Field: Keeper
  120. Pull Up / Down Config. Field: 100K Ohm Pull Down
  121. Hyst. Enable Field: Hysteresis Disabled */
  122. #endif
  123. #ifdef BSP_USING_LPUART2
  124. IOMUXC_SetPinMux(
  125. IOMUXC_GPIO_AD_B1_02_LPUART2_TX,
  126. 0U);
  127. IOMUXC_SetPinMux(
  128. IOMUXC_GPIO_AD_B1_03_LPUART2_RX,
  129. 0U);
  130. IOMUXC_SetPinConfig(
  131. IOMUXC_GPIO_AD_B1_02_LPUART2_TX,
  132. 0x10B0u);
  133. IOMUXC_SetPinConfig(
  134. IOMUXC_GPIO_AD_B1_03_LPUART2_RX,
  135. 0x10B0u);
  136. #endif
  137. #ifdef BSP_USING_LPUART3
  138. IOMUXC_SetPinMux(
  139. IOMUXC_GPIO_AD_B1_06_LPUART3_TX,
  140. 0U);
  141. IOMUXC_SetPinMux(
  142. IOMUXC_GPIO_AD_B1_07_LPUART3_RX,
  143. 0U);
  144. IOMUXC_SetPinConfig(
  145. IOMUXC_GPIO_AD_B1_06_LPUART3_TX,
  146. 0x10B0u);
  147. IOMUXC_SetPinConfig(
  148. IOMUXC_GPIO_AD_B1_07_LPUART3_RX,
  149. 0x10B0u);
  150. #endif
  151. #ifdef BSP_USING_LPUART4
  152. IOMUXC_SetPinMux(
  153. IOMUXC_GPIO_B1_00_LPUART4_TX,
  154. 0U);
  155. IOMUXC_SetPinMux(
  156. IOMUXC_GPIO_B1_01_LPUART4_RX,
  157. 0U);
  158. IOMUXC_SetPinConfig(
  159. IOMUXC_GPIO_B1_00_LPUART4_TX,
  160. 0x10B0u);
  161. IOMUXC_SetPinConfig(
  162. IOMUXC_GPIO_B1_01_LPUART4_RX,
  163. 0x10B0u);
  164. #endif
  165. #ifdef BSP_USING_LPUART5
  166. IOMUXC_SetPinMux(
  167. IOMUXC_GPIO_B1_12_LPUART5_TX,
  168. 0U);
  169. IOMUXC_SetPinMux(
  170. IOMUXC_GPIO_B1_13_LPUART5_RX,
  171. 0U);
  172. IOMUXC_SetPinConfig(
  173. IOMUXC_GPIO_B1_12_LPUART5_TX,
  174. 0x10B0u);
  175. IOMUXC_SetPinConfig(
  176. IOMUXC_GPIO_B1_13_LPUART5_RX,
  177. 0x10B0u);
  178. #endif
  179. #ifdef BSP_USING_LPUART6
  180. IOMUXC_SetPinMux(
  181. IOMUXC_GPIO_AD_B0_02_LPUART6_TX,
  182. 0U);
  183. IOMUXC_SetPinMux(
  184. IOMUXC_GPIO_AD_B0_03_LPUART6_RX,
  185. 0U);
  186. IOMUXC_SetPinConfig(
  187. IOMUXC_GPIO_AD_B0_02_LPUART6_TX,
  188. 0x10B0u);
  189. IOMUXC_SetPinConfig(
  190. IOMUXC_GPIO_AD_B0_03_LPUART6_RX,
  191. 0x10B0u);
  192. #endif
  193. #ifdef BSP_USING_LPUART7
  194. IOMUXC_SetPinMux(
  195. IOMUXC_GPIO_EMC_31_LPUART7_TX,
  196. 0U);
  197. IOMUXC_SetPinMux(
  198. IOMUXC_GPIO_EMC_32_LPUART7_RX,
  199. 0U);
  200. IOMUXC_SetPinConfig(
  201. IOMUXC_GPIO_EMC_31_LPUART7_TX,
  202. 0x10B0u);
  203. IOMUXC_SetPinConfig(
  204. IOMUXC_GPIO_EMC_32_LPUART7_RX,
  205. 0x10B0u);
  206. #endif
  207. #ifdef BSP_USING_LPUART8
  208. IOMUXC_SetPinMux(
  209. IOMUXC_GPIO_AD_B1_10_LPUART8_TX,
  210. 0U);
  211. IOMUXC_SetPinMux(
  212. IOMUXC_GPIO_AD_B1_11_LPUART8_RX,
  213. 0U);
  214. IOMUXC_SetPinConfig(
  215. IOMUXC_GPIO_AD_B1_10_LPUART8_TX,
  216. 0x10B0u);
  217. IOMUXC_SetPinConfig(
  218. IOMUXC_GPIO_AD_B1_11_LPUART8_RX,
  219. 0x10B0u);
  220. #endif
  221. }
  222. #endif /* BSP_USING_LPUART */
  223. #ifdef BSP_USING_I2C
  224. static void imxrt_i2c_pins_init(void)
  225. {
  226. #ifdef BSP_USING_I2C1
  227. IOMUXC_SetPinMux(
  228. IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, /* GPIO_AD_B1_00 is configured as LPI2C1_SCL */
  229. 1U); /* Software Input On Field: Force input path of pad GPIO_AD_B1_00 */
  230. IOMUXC_SetPinMux(
  231. IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, /* GPIO_AD_B1_01 is configured as LPI2C1_SDA */
  232. 1U); /* Software Input On Field: Force input path of pad GPIO_AD_B1_01 */
  233. IOMUXC_SetPinConfig(
  234. IOMUXC_GPIO_AD_B1_00_LPI2C1_SCL, /* GPIO_AD_B1_00 PAD functional properties : */
  235. 0xD8B0u); /* Slew Rate Field: Slow Slew Rate
  236. Drive Strength Field: R0/6
  237. Speed Field: medium(100MHz)
  238. Open Drain Enable Field: Open Drain Enabled
  239. Pull / Keep Enable Field: Pull/Keeper Enabled
  240. Pull / Keep Select Field: Keeper
  241. Pull Up / Down Config. Field: 22K Ohm Pull Up
  242. Hyst. Enable Field: Hysteresis Disabled */
  243. IOMUXC_SetPinConfig(
  244. IOMUXC_GPIO_AD_B1_01_LPI2C1_SDA, /* GPIO_AD_B1_01 PAD functional properties : */
  245. 0xD8B0u); /* Slew Rate Field: Slow Slew Rate
  246. Drive Strength Field: R0/6
  247. Speed Field: medium(100MHz)
  248. Open Drain Enable Field: Open Drain Enabled
  249. Pull / Keep Enable Field: Pull/Keeper Enabled
  250. Pull / Keep Select Field: Keeper
  251. Pull Up / Down Config. Field: 22K Ohm Pull Up
  252. Hyst. Enable Field: Hysteresis Disabled */
  253. #endif
  254. #ifdef BSP_USING_I2C3
  255. IOMUXC_SetPinMux(
  256. IOMUXC_GPIO_AD_B1_07_LPI2C3_SCL, /* GPIO_AD_B1_00 is configured as LPI2C1_SCL */
  257. 1U); /* Software Input On Field: Force input path of pad GPIO_AD_B1_00 */
  258. IOMUXC_SetPinMux(
  259. IOMUXC_GPIO_AD_B1_06_LPI2C3_SDA, /* GPIO_AD_B1_01 is configured as LPI2C1_SDA */
  260. 1U); /* Software Input On Field: Force input path of pad GPIO_AD_B1_01 */
  261. IOMUXC_SetPinConfig(
  262. IOMUXC_GPIO_AD_B1_07_LPI2C3_SCL, /* GPIO_AD_B1_00 PAD functional properties : */
  263. 0xD8B0u); /* Slew Rate Field: Slow Slew Rate
  264. Drive Strength Field: R0/6
  265. Speed Field: medium(100MHz)
  266. Open Drain Enable Field: Open Drain Enabled
  267. Pull / Keep Enable Field: Pull/Keeper Enabled
  268. Pull / Keep Select Field: Keeper
  269. Pull Up / Down Config. Field: 22K Ohm Pull Up
  270. Hyst. Enable Field: Hysteresis Disabled */
  271. IOMUXC_SetPinConfig(
  272. IOMUXC_GPIO_AD_B1_06_LPI2C3_SDA, /* GPIO_AD_B1_01 PAD functional properties : */
  273. 0xD8B0u); /* Slew Rate Field: Slow Slew Rate
  274. Drive Strength Field: R0/6
  275. Speed Field: medium(100MHz)
  276. Open Drain Enable Field: Open Drain Enabled
  277. Pull / Keep Enable Field: Pull/Keeper Enabled
  278. Pull / Keep Select Field: Keeper
  279. Pull Up / Down Config. Field: 22K Ohm Pull Up
  280. Hyst. Enable Field: Hysteresis Disabled */
  281. #endif
  282. #ifdef BSP_USING_I2C4
  283. IOMUXC_SetPinMux(
  284. IOMUXC_GPIO_AD_B0_12_LPI2C4_SCL, /* GPIO_AD_B1_00 is configured as LPI2C1_SCL */
  285. 1U); /* Software Input On Field: Force input path of pad GPIO_AD_B1_00 */
  286. IOMUXC_SetPinMux(
  287. IOMUXC_GPIO_AD_B0_13_LPI2C4_SDA, /* GPIO_AD_B1_01 is configured as LPI2C1_SDA */
  288. 1U); /* Software Input On Field: Force input path of pad GPIO_AD_B1_01 */
  289. IOMUXC_SetPinConfig(
  290. IOMUXC_GPIO_AD_B0_12_LPI2C4_SCL, /* GPIO_AD_B1_00 PAD functional properties : */
  291. 0xD8B0u); /* Slew Rate Field: Slow Slew Rate
  292. Drive Strength Field: R0/6
  293. Speed Field: medium(100MHz)
  294. Open Drain Enable Field: Open Drain Enabled
  295. Pull / Keep Enable Field: Pull/Keeper Enabled
  296. Pull / Keep Select Field: Keeper
  297. Pull Up / Down Config. Field: 22K Ohm Pull Up
  298. Hyst. Enable Field: Hysteresis Disabled */
  299. IOMUXC_SetPinConfig(
  300. IOMUXC_GPIO_AD_B0_13_LPI2C4_SDA, /* GPIO_AD_B1_01 PAD functional properties : */
  301. 0xD8B0u); /* Slew Rate Field: Slow Slew Rate
  302. Drive Strength Field: R0/6
  303. Speed Field: medium(100MHz)
  304. Open Drain Enable Field: Open Drain Enabled
  305. Pull / Keep Enable Field: Pull/Keeper Enabled
  306. Pull / Keep Select Field: Keeper
  307. Pull Up / Down Config. Field: 22K Ohm Pull Up
  308. Hyst. Enable Field: Hysteresis Disabled */
  309. #endif
  310. }
  311. #endif /* BSP_USING_I2C */
  312. #ifdef BSP_USING_LCD
  313. static void imxrt_lcd_pins_init(void)
  314. {
  315. IOMUXC_SetPinMux(
  316. IOMUXC_GPIO_AD_B0_02_GPIO1_IO02, /* GPIO_AD_B0_02 is configured as GPIO1_IO02 */
  317. 0U); /* Software Input On Field: Input Path is determined by functionality */
  318. IOMUXC_SetPinMux(
  319. IOMUXC_GPIO_B1_15_GPIO2_IO31, /* GPIO_B1_15 is configured as GPIO2_IO31 */
  320. 0U); /* Software Input On Field: Input Path is determined by functionality */
  321. IOMUXC_SetPinMux(
  322. IOMUXC_GPIO_B0_00_LCD_CLK, /* GPIO_B0_00 is configured as LCD_CLK */
  323. 0U); /* Software Input On Field: Input Path is determined by functionality */
  324. IOMUXC_SetPinMux(
  325. IOMUXC_GPIO_B0_01_LCD_ENABLE, /* GPIO_B0_01 is configured as LCD_ENABLE */
  326. 0U); /* Software Input On Field: Input Path is determined by functionality */
  327. IOMUXC_SetPinMux(
  328. IOMUXC_GPIO_B0_02_LCD_HSYNC, /* GPIO_B0_02 is configured as LCD_HSYNC */
  329. 0U); /* Software Input On Field: Input Path is determined by functionality */
  330. IOMUXC_SetPinMux(
  331. IOMUXC_GPIO_B0_03_LCD_VSYNC, /* GPIO_B0_03 is configured as LCD_VSYNC */
  332. 0U); /* Software Input On Field: Input Path is determined by functionality */
  333. IOMUXC_SetPinMux(
  334. IOMUXC_GPIO_B0_04_LCD_DATA00, /* GPIO_B0_04 is configured as LCD_DATA00 */
  335. 0U); /* Software Input On Field: Input Path is determined by functionality */
  336. IOMUXC_SetPinMux(
  337. IOMUXC_GPIO_B0_05_LCD_DATA01, /* GPIO_B0_05 is configured as LCD_DATA01 */
  338. 0U); /* Software Input On Field: Input Path is determined by functionality */
  339. IOMUXC_SetPinMux(
  340. IOMUXC_GPIO_B0_06_LCD_DATA02, /* GPIO_B0_06 is configured as LCD_DATA02 */
  341. 0U); /* Software Input On Field: Input Path is determined by functionality */
  342. IOMUXC_SetPinMux(
  343. IOMUXC_GPIO_B0_07_LCD_DATA03, /* GPIO_B0_07 is configured as LCD_DATA03 */
  344. 0U); /* Software Input On Field: Input Path is determined by functionality */
  345. IOMUXC_SetPinMux(
  346. IOMUXC_GPIO_B0_08_LCD_DATA04, /* GPIO_B0_08 is configured as LCD_DATA04 */
  347. 0U); /* Software Input On Field: Input Path is determined by functionality */
  348. IOMUXC_SetPinMux(
  349. IOMUXC_GPIO_B0_09_LCD_DATA05, /* GPIO_B0_09 is configured as LCD_DATA05 */
  350. 0U); /* Software Input On Field: Input Path is determined by functionality */
  351. IOMUXC_SetPinMux(
  352. IOMUXC_GPIO_B0_10_LCD_DATA06, /* GPIO_B0_10 is configured as LCD_DATA06 */
  353. 0U); /* Software Input On Field: Input Path is determined by functionality */
  354. IOMUXC_SetPinMux(
  355. IOMUXC_GPIO_B0_11_LCD_DATA07, /* GPIO_B0_11 is configured as LCD_DATA07 */
  356. 0U); /* Software Input On Field: Input Path is determined by functionality */
  357. IOMUXC_SetPinMux(
  358. IOMUXC_GPIO_B0_12_LCD_DATA08, /* GPIO_B0_12 is configured as LCD_DATA08 */
  359. 0U); /* Software Input On Field: Input Path is determined by functionality */
  360. IOMUXC_SetPinMux(
  361. IOMUXC_GPIO_B0_13_LCD_DATA09, /* GPIO_B0_13 is configured as LCD_DATA09 */
  362. 0U); /* Software Input On Field: Input Path is determined by functionality */
  363. IOMUXC_SetPinMux(
  364. IOMUXC_GPIO_B0_14_LCD_DATA10, /* GPIO_B0_14 is configured as LCD_DATA10 */
  365. 0U); /* Software Input On Field: Input Path is determined by functionality */
  366. IOMUXC_SetPinMux(
  367. IOMUXC_GPIO_B0_15_LCD_DATA11, /* GPIO_B0_15 is configured as LCD_DATA11 */
  368. 0U); /* Software Input On Field: Input Path is determined by functionality */
  369. IOMUXC_SetPinMux(
  370. IOMUXC_GPIO_B1_00_LCD_DATA12, /* GPIO_B1_00 is configured as LCD_DATA12 */
  371. 0U); /* Software Input On Field: Input Path is determined by functionality */
  372. IOMUXC_SetPinMux(
  373. IOMUXC_GPIO_B1_01_LCD_DATA13, /* GPIO_B1_01 is configured as LCD_DATA13 */
  374. 0U); /* Software Input On Field: Input Path is determined by functionality */
  375. IOMUXC_SetPinMux(
  376. IOMUXC_GPIO_B1_02_LCD_DATA14, /* GPIO_B1_02 is configured as LCD_DATA14 */
  377. 0U); /* Software Input On Field: Input Path is determined by functionality */
  378. IOMUXC_SetPinMux(
  379. IOMUXC_GPIO_B1_03_LCD_DATA15, /* GPIO_B1_03 is configured as LCD_DATA15 */
  380. 0U); /* Software Input On Field: Input Path is determined by functionality */
  381. IOMUXC_SetPinConfig(
  382. IOMUXC_GPIO_AD_B0_02_GPIO1_IO02, /* GPIO_AD_B0_02 PAD functional properties : */
  383. 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  384. Drive Strength Field: R0/6
  385. Speed Field: medium(100MHz)
  386. Open Drain Enable Field: Open Drain Disabled
  387. Pull / Keep Enable Field: Pull/Keeper Enabled
  388. Pull / Keep Select Field: Keeper
  389. Pull Up / Down Config. Field: 100K Ohm Pull Down
  390. Hyst. Enable Field: Hysteresis Disabled */
  391. IOMUXC_SetPinConfig(
  392. IOMUXC_GPIO_B1_15_GPIO2_IO31, /* GPIO_B1_15 PAD functional properties : */
  393. 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  394. Drive Strength Field: R0/6
  395. Speed Field: medium(100MHz)
  396. Open Drain Enable Field: Open Drain Disabled
  397. Pull / Keep Enable Field: Pull/Keeper Enabled
  398. Pull / Keep Select Field: Keeper
  399. Pull Up / Down Config. Field: 100K Ohm Pull Down
  400. Hyst. Enable Field: Hysteresis Disabled */
  401. IOMUXC_SetPinConfig(
  402. IOMUXC_GPIO_AD_B0_12_LPUART1_TX, /* GPIO_AD_B0_12 PAD functional properties : */
  403. 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  404. Drive Strength Field: R0/6
  405. Speed Field: medium(100MHz)
  406. Open Drain Enable Field: Open Drain Disabled
  407. Pull / Keep Enable Field: Pull/Keeper Enabled
  408. Pull / Keep Select Field: Keeper
  409. Pull Up / Down Config. Field: 100K Ohm Pull Down
  410. Hyst. Enable Field: Hysteresis Disabled */
  411. IOMUXC_SetPinConfig(
  412. IOMUXC_GPIO_AD_B0_13_LPUART1_RX, /* GPIO_AD_B0_13 PAD functional properties : */
  413. 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  414. Drive Strength Field: R0/6
  415. Speed Field: medium(100MHz)
  416. Open Drain Enable Field: Open Drain Disabled
  417. Pull / Keep Enable Field: Pull/Keeper Enabled
  418. Pull / Keep Select Field: Keeper
  419. Pull Up / Down Config. Field: 100K Ohm Pull Down
  420. Hyst. Enable Field: Hysteresis Disabled */
  421. IOMUXC_SetPinConfig(
  422. IOMUXC_GPIO_B0_00_LCD_CLK, /* GPIO_B0_00 PAD functional properties : */
  423. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  424. Drive Strength Field: R0/6
  425. Speed Field: medium(100MHz)
  426. Open Drain Enable Field: Open Drain Disabled
  427. Pull / Keep Enable Field: Pull/Keeper Enabled
  428. Pull / Keep Select Field: Pull
  429. Pull Up / Down Config. Field: 100K Ohm Pull Up
  430. Hyst. Enable Field: Hysteresis Enabled */
  431. IOMUXC_SetPinConfig(
  432. IOMUXC_GPIO_B0_01_LCD_ENABLE, /* GPIO_B0_01 PAD functional properties : */
  433. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  434. Drive Strength Field: R0/6
  435. Speed Field: medium(100MHz)
  436. Open Drain Enable Field: Open Drain Disabled
  437. Pull / Keep Enable Field: Pull/Keeper Enabled
  438. Pull / Keep Select Field: Pull
  439. Pull Up / Down Config. Field: 100K Ohm Pull Up
  440. Hyst. Enable Field: Hysteresis Enabled */
  441. IOMUXC_SetPinConfig(
  442. IOMUXC_GPIO_B0_02_LCD_HSYNC, /* GPIO_B0_02 PAD functional properties : */
  443. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  444. Drive Strength Field: R0/6
  445. Speed Field: medium(100MHz)
  446. Open Drain Enable Field: Open Drain Disabled
  447. Pull / Keep Enable Field: Pull/Keeper Enabled
  448. Pull / Keep Select Field: Pull
  449. Pull Up / Down Config. Field: 100K Ohm Pull Up
  450. Hyst. Enable Field: Hysteresis Enabled */
  451. IOMUXC_SetPinConfig(
  452. IOMUXC_GPIO_B0_03_LCD_VSYNC, /* GPIO_B0_03 PAD functional properties : */
  453. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  454. Drive Strength Field: R0/6
  455. Speed Field: medium(100MHz)
  456. Open Drain Enable Field: Open Drain Disabled
  457. Pull / Keep Enable Field: Pull/Keeper Enabled
  458. Pull / Keep Select Field: Pull
  459. Pull Up / Down Config. Field: 100K Ohm Pull Up
  460. Hyst. Enable Field: Hysteresis Enabled */
  461. IOMUXC_SetPinConfig(
  462. IOMUXC_GPIO_B0_04_LCD_DATA00, /* GPIO_B0_04 PAD functional properties : */
  463. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  464. Drive Strength Field: R0/6
  465. Speed Field: medium(100MHz)
  466. Open Drain Enable Field: Open Drain Disabled
  467. Pull / Keep Enable Field: Pull/Keeper Enabled
  468. Pull / Keep Select Field: Pull
  469. Pull Up / Down Config. Field: 100K Ohm Pull Up
  470. Hyst. Enable Field: Hysteresis Enabled */
  471. IOMUXC_SetPinConfig(
  472. IOMUXC_GPIO_B0_05_LCD_DATA01, /* GPIO_B0_05 PAD functional properties : */
  473. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  474. Drive Strength Field: R0/6
  475. Speed Field: medium(100MHz)
  476. Open Drain Enable Field: Open Drain Disabled
  477. Pull / Keep Enable Field: Pull/Keeper Enabled
  478. Pull / Keep Select Field: Pull
  479. Pull Up / Down Config. Field: 100K Ohm Pull Up
  480. Hyst. Enable Field: Hysteresis Enabled */
  481. IOMUXC_SetPinConfig(
  482. IOMUXC_GPIO_B0_06_LCD_DATA02, /* GPIO_B0_06 PAD functional properties : */
  483. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  484. Drive Strength Field: R0/6
  485. Speed Field: medium(100MHz)
  486. Open Drain Enable Field: Open Drain Disabled
  487. Pull / Keep Enable Field: Pull/Keeper Enabled
  488. Pull / Keep Select Field: Pull
  489. Pull Up / Down Config. Field: 100K Ohm Pull Up
  490. Hyst. Enable Field: Hysteresis Enabled */
  491. IOMUXC_SetPinConfig(
  492. IOMUXC_GPIO_B0_07_LCD_DATA03, /* GPIO_B0_07 PAD functional properties : */
  493. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  494. Drive Strength Field: R0/6
  495. Speed Field: medium(100MHz)
  496. Open Drain Enable Field: Open Drain Disabled
  497. Pull / Keep Enable Field: Pull/Keeper Enabled
  498. Pull / Keep Select Field: Pull
  499. Pull Up / Down Config. Field: 100K Ohm Pull Up
  500. Hyst. Enable Field: Hysteresis Enabled */
  501. IOMUXC_SetPinConfig(
  502. IOMUXC_GPIO_B0_08_LCD_DATA04, /* GPIO_B0_08 PAD functional properties : */
  503. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  504. Drive Strength Field: R0/6
  505. Speed Field: medium(100MHz)
  506. Open Drain Enable Field: Open Drain Disabled
  507. Pull / Keep Enable Field: Pull/Keeper Enabled
  508. Pull / Keep Select Field: Pull
  509. Pull Up / Down Config. Field: 100K Ohm Pull Up
  510. Hyst. Enable Field: Hysteresis Enabled */
  511. IOMUXC_SetPinConfig(
  512. IOMUXC_GPIO_B0_09_LCD_DATA05, /* GPIO_B0_09 PAD functional properties : */
  513. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  514. Drive Strength Field: R0/6
  515. Speed Field: medium(100MHz)
  516. Open Drain Enable Field: Open Drain Disabled
  517. Pull / Keep Enable Field: Pull/Keeper Enabled
  518. Pull / Keep Select Field: Pull
  519. Pull Up / Down Config. Field: 100K Ohm Pull Up
  520. Hyst. Enable Field: Hysteresis Enabled */
  521. IOMUXC_SetPinConfig(
  522. IOMUXC_GPIO_B0_10_LCD_DATA06, /* GPIO_B0_10 PAD functional properties : */
  523. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  524. Drive Strength Field: R0/6
  525. Speed Field: medium(100MHz)
  526. Open Drain Enable Field: Open Drain Disabled
  527. Pull / Keep Enable Field: Pull/Keeper Enabled
  528. Pull / Keep Select Field: Pull
  529. Pull Up / Down Config. Field: 100K Ohm Pull Up
  530. Hyst. Enable Field: Hysteresis Enabled */
  531. IOMUXC_SetPinConfig(
  532. IOMUXC_GPIO_B0_11_LCD_DATA07, /* GPIO_B0_11 PAD functional properties : */
  533. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  534. Drive Strength Field: R0/6
  535. Speed Field: medium(100MHz)
  536. Open Drain Enable Field: Open Drain Disabled
  537. Pull / Keep Enable Field: Pull/Keeper Enabled
  538. Pull / Keep Select Field: Pull
  539. Pull Up / Down Config. Field: 100K Ohm Pull Up
  540. Hyst. Enable Field: Hysteresis Enabled */
  541. IOMUXC_SetPinConfig(
  542. IOMUXC_GPIO_B0_12_LCD_DATA08, /* GPIO_B0_12 PAD functional properties : */
  543. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  544. Drive Strength Field: R0/6
  545. Speed Field: medium(100MHz)
  546. Open Drain Enable Field: Open Drain Disabled
  547. Pull / Keep Enable Field: Pull/Keeper Enabled
  548. Pull / Keep Select Field: Pull
  549. Pull Up / Down Config. Field: 100K Ohm Pull Up
  550. Hyst. Enable Field: Hysteresis Enabled */
  551. IOMUXC_SetPinConfig(
  552. IOMUXC_GPIO_B0_13_LCD_DATA09, /* GPIO_B0_13 PAD functional properties : */
  553. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  554. Drive Strength Field: R0/6
  555. Speed Field: medium(100MHz)
  556. Open Drain Enable Field: Open Drain Disabled
  557. Pull / Keep Enable Field: Pull/Keeper Enabled
  558. Pull / Keep Select Field: Pull
  559. Pull Up / Down Config. Field: 100K Ohm Pull Up
  560. Hyst. Enable Field: Hysteresis Enabled */
  561. IOMUXC_SetPinConfig(
  562. IOMUXC_GPIO_B0_14_LCD_DATA10, /* GPIO_B0_14 PAD functional properties : */
  563. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  564. Drive Strength Field: R0/6
  565. Speed Field: medium(100MHz)
  566. Open Drain Enable Field: Open Drain Disabled
  567. Pull / Keep Enable Field: Pull/Keeper Enabled
  568. Pull / Keep Select Field: Pull
  569. Pull Up / Down Config. Field: 100K Ohm Pull Up
  570. Hyst. Enable Field: Hysteresis Enabled */
  571. IOMUXC_SetPinConfig(
  572. IOMUXC_GPIO_B0_15_LCD_DATA11, /* GPIO_B0_15 PAD functional properties : */
  573. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  574. Drive Strength Field: R0/6
  575. Speed Field: medium(100MHz)
  576. Open Drain Enable Field: Open Drain Disabled
  577. Pull / Keep Enable Field: Pull/Keeper Enabled
  578. Pull / Keep Select Field: Pull
  579. Pull Up / Down Config. Field: 100K Ohm Pull Up
  580. Hyst. Enable Field: Hysteresis Enabled */
  581. IOMUXC_SetPinConfig(
  582. IOMUXC_GPIO_B1_00_LCD_DATA12, /* GPIO_B1_00 PAD functional properties : */
  583. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  584. Drive Strength Field: R0/6
  585. Speed Field: medium(100MHz)
  586. Open Drain Enable Field: Open Drain Disabled
  587. Pull / Keep Enable Field: Pull/Keeper Enabled
  588. Pull / Keep Select Field: Pull
  589. Pull Up / Down Config. Field: 100K Ohm Pull Up
  590. Hyst. Enable Field: Hysteresis Enabled */
  591. IOMUXC_SetPinConfig(
  592. IOMUXC_GPIO_B1_01_LCD_DATA13, /* GPIO_B1_01 PAD functional properties : */
  593. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  594. Drive Strength Field: R0/6
  595. Speed Field: medium(100MHz)
  596. Open Drain Enable Field: Open Drain Disabled
  597. Pull / Keep Enable Field: Pull/Keeper Enabled
  598. Pull / Keep Select Field: Pull
  599. Pull Up / Down Config. Field: 100K Ohm Pull Up
  600. Hyst. Enable Field: Hysteresis Enabled */
  601. IOMUXC_SetPinConfig(
  602. IOMUXC_GPIO_B1_02_LCD_DATA14, /* GPIO_B1_02 PAD functional properties : */
  603. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  604. Drive Strength Field: R0/6
  605. Speed Field: medium(100MHz)
  606. Open Drain Enable Field: Open Drain Disabled
  607. Pull / Keep Enable Field: Pull/Keeper Enabled
  608. Pull / Keep Select Field: Pull
  609. Pull Up / Down Config. Field: 100K Ohm Pull Up
  610. Hyst. Enable Field: Hysteresis Enabled */
  611. IOMUXC_SetPinConfig(
  612. IOMUXC_GPIO_B1_03_LCD_DATA15, /* GPIO_B1_03 PAD functional properties : */
  613. 0x01B0B0u); /* Slew Rate Field: Slow Slew Rate
  614. Drive Strength Field: R0/6
  615. Speed Field: medium(100MHz)
  616. Open Drain Enable Field: Open Drain Disabled
  617. Pull / Keep Enable Field: Pull/Keeper Enabled
  618. Pull / Keep Select Field: Pull
  619. Pull Up / Down Config. Field: 100K Ohm Pull Up
  620. Hyst. Enable Field: Hysteresis Enabled */
  621. }
  622. #endif
  623. #ifdef BSP_USING_ETH
  624. void imxrt_enet_pins_init(void)
  625. {
  626. CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
  627. IOMUXC_SetPinMux(
  628. IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 is configured as GPIO1_IO09 */
  629. 0U); /* Software Input On Field: Input Path is determined by functionality */
  630. IOMUXC_SetPinMux(
  631. IOMUXC_GPIO_AD_B0_10_GPIO1_IO10, /* GPIO_AD_B0_10 is configured as GPIO1_IO10 */
  632. 0U);
  633. IOMUXC_SetPinMux(
  634. IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 is configured as ENET_RX_DATA00 */
  635. 0U); /* Software Input On Field: Input Path is determined by functionality */
  636. IOMUXC_SetPinMux(
  637. IOMUXC_GPIO_B1_05_ENET_RX_DATA01, /* GPIO_B1_05 is configured as ENET_RX_DATA01 */
  638. 0U); /* Software Input On Field: Input Path is determined by functionality */
  639. IOMUXC_SetPinMux(
  640. IOMUXC_GPIO_B1_06_ENET_RX_EN, /* GPIO_B1_06 is configured as ENET_RX_EN */
  641. 0U); /* Software Input On Field: Input Path is determined by functionality */
  642. IOMUXC_SetPinMux(
  643. IOMUXC_GPIO_B1_07_ENET_TX_DATA00, /* GPIO_B1_07 is configured as ENET_TX_DATA00 */
  644. 0U); /* Software Input On Field: Input Path is determined by functionality */
  645. IOMUXC_SetPinMux(
  646. IOMUXC_GPIO_B1_08_ENET_TX_DATA01, /* GPIO_B1_08 is configured as ENET_TX_DATA01 */
  647. 0U); /* Software Input On Field: Input Path is determined by functionality */
  648. IOMUXC_SetPinMux(
  649. IOMUXC_GPIO_B1_09_ENET_TX_EN, /* GPIO_B1_09 is configured as ENET_TX_EN */
  650. 0U); /* Software Input On Field: Input Path is determined by functionality */
  651. IOMUXC_SetPinMux(
  652. IOMUXC_GPIO_B1_10_ENET_REF_CLK, /* GPIO_B1_10 is configured as ENET_REF_CLK */
  653. 1U); /* Software Input On Field: Force input path of pad GPIO_B1_10 */
  654. IOMUXC_SetPinMux(
  655. IOMUXC_GPIO_B1_11_ENET_RX_ER, /* GPIO_B1_11 is configured as ENET_RX_ER */
  656. 0U); /* Software Input On Field: Input Path is determined by functionality */
  657. IOMUXC_SetPinMux(
  658. IOMUXC_GPIO_EMC_40_ENET_MDC, /* GPIO_EMC_40 is configured as ENET_MDC */
  659. 0U); /* Software Input On Field: Input Path is determined by functionality */
  660. IOMUXC_SetPinMux(
  661. IOMUXC_GPIO_EMC_41_ENET_MDIO, /* GPIO_EMC_41 is configured as ENET_MDIO */
  662. 0U); /* Software Input On Field: Input Path is determined by functionality */
  663. IOMUXC_SetPinConfig(
  664. IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 PAD functional properties : */
  665. 0xB0A9u); /* Slew Rate Field: Fast Slew Rate
  666. Drive Strength Field: R0/5
  667. Speed Field: medium(100MHz)
  668. Open Drain Enable Field: Open Drain Disabled
  669. Pull / Keep Enable Field: Pull/Keeper Enabled
  670. Pull / Keep Select Field: Pull
  671. Pull Up / Down Config. Field: 100K Ohm Pull Up
  672. Hyst. Enable Field: Hysteresis Disabled */
  673. IOMUXC_SetPinConfig(
  674. IOMUXC_GPIO_AD_B0_10_GPIO1_IO10, /* GPIO_AD_B0_10 PAD functional properties : */
  675. 0xB0A9u); /* Slew Rate Field: Fast Slew Rate
  676. Drive Strength Field: R0/5
  677. Speed Field: medium(100MHz)
  678. Open Drain Enable Field: Open Drain Disabled
  679. Pull / Keep Enable Field: Pull/Keeper Enabled
  680. Pull / Keep Select Field: Pull
  681. Pull Up / Down Config. Field: 100K Ohm Pull Up
  682. Hyst. Enable Field: Hysteresis Disabled */
  683. IOMUXC_SetPinConfig(
  684. IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 PAD functional properties : */
  685. 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
  686. Drive Strength Field: R0/5
  687. Speed Field: max(200MHz)
  688. Open Drain Enable Field: Open Drain Disabled
  689. Pull / Keep Enable Field: Pull/Keeper Enabled
  690. Pull / Keep Select Field: Pull
  691. Pull Up / Down Config. Field: 100K Ohm Pull Up
  692. Hyst. Enable Field: Hysteresis Disabled */
  693. IOMUXC_SetPinConfig(
  694. IOMUXC_GPIO_B1_05_ENET_RX_DATA01, /* GPIO_B1_05 PAD functional properties : */
  695. 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
  696. Drive Strength Field: R0/5
  697. Speed Field: max(200MHz)
  698. Open Drain Enable Field: Open Drain Disabled
  699. Pull / Keep Enable Field: Pull/Keeper Enabled
  700. Pull / Keep Select Field: Pull
  701. Pull Up / Down Config. Field: 100K Ohm Pull Up
  702. Hyst. Enable Field: Hysteresis Disabled */
  703. IOMUXC_SetPinConfig(
  704. IOMUXC_GPIO_B1_06_ENET_RX_EN, /* GPIO_B1_06 PAD functional properties : */
  705. 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
  706. Drive Strength Field: R0/5
  707. Speed Field: max(200MHz)
  708. Open Drain Enable Field: Open Drain Disabled
  709. Pull / Keep Enable Field: Pull/Keeper Enabled
  710. Pull / Keep Select Field: Pull
  711. Pull Up / Down Config. Field: 100K Ohm Pull Up
  712. Hyst. Enable Field: Hysteresis Disabled */
  713. IOMUXC_SetPinConfig(
  714. IOMUXC_GPIO_B1_07_ENET_TX_DATA00, /* GPIO_B1_07 PAD functional properties : */
  715. 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
  716. Drive Strength Field: R0/5
  717. Speed Field: max(200MHz)
  718. Open Drain Enable Field: Open Drain Disabled
  719. Pull / Keep Enable Field: Pull/Keeper Enabled
  720. Pull / Keep Select Field: Pull
  721. Pull Up / Down Config. Field: 100K Ohm Pull Up
  722. Hyst. Enable Field: Hysteresis Disabled */
  723. IOMUXC_SetPinConfig(
  724. IOMUXC_GPIO_B1_08_ENET_TX_DATA01, /* GPIO_B1_08 PAD functional properties : */
  725. 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
  726. Drive Strength Field: R0/5
  727. Speed Field: max(200MHz)
  728. Open Drain Enable Field: Open Drain Disabled
  729. Pull / Keep Enable Field: Pull/Keeper Enabled
  730. Pull / Keep Select Field: Pull
  731. Pull Up / Down Config. Field: 100K Ohm Pull Up
  732. Hyst. Enable Field: Hysteresis Disabled */
  733. IOMUXC_SetPinConfig(
  734. IOMUXC_GPIO_B1_09_ENET_TX_EN, /* GPIO_B1_09 PAD functional properties : */
  735. 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
  736. Drive Strength Field: R0/5
  737. Speed Field: max(200MHz)
  738. Open Drain Enable Field: Open Drain Disabled
  739. Pull / Keep Enable Field: Pull/Keeper Enabled
  740. Pull / Keep Select Field: Pull
  741. Pull Up / Down Config. Field: 100K Ohm Pull Up
  742. Hyst. Enable Field: Hysteresis Disabled */
  743. IOMUXC_SetPinConfig(
  744. IOMUXC_GPIO_B1_10_ENET_REF_CLK, /* GPIO_B1_10 PAD functional properties : */
  745. 0x31u); /* Slew Rate Field: Fast Slew Rate
  746. Drive Strength Field: R0/6
  747. Speed Field: low(50MHz)
  748. Open Drain Enable Field: Open Drain Disabled
  749. Pull / Keep Enable Field: Pull/Keeper Disabled
  750. Pull / Keep Select Field: Keeper
  751. Pull Up / Down Config. Field: 100K Ohm Pull Down
  752. Hyst. Enable Field: Hysteresis Disabled */
  753. IOMUXC_SetPinConfig(
  754. IOMUXC_GPIO_B1_11_ENET_RX_ER, /* GPIO_B1_11 PAD functional properties : */
  755. 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
  756. Drive Strength Field: R0/5
  757. Speed Field: max(200MHz)
  758. Open Drain Enable Field: Open Drain Disabled
  759. Pull / Keep Enable Field: Pull/Keeper Enabled
  760. Pull / Keep Select Field: Pull
  761. Pull Up / Down Config. Field: 100K Ohm Pull Up
  762. Hyst. Enable Field: Hysteresis Disabled */
  763. IOMUXC_SetPinConfig(
  764. IOMUXC_GPIO_EMC_40_ENET_MDC, /* GPIO_EMC_40 PAD functional properties : */
  765. 0xB0E9u); /* Slew Rate Field: Fast Slew Rate
  766. Drive Strength Field: R0/5
  767. Speed Field: max(200MHz)
  768. Open Drain Enable Field: Open Drain Disabled
  769. Pull / Keep Enable Field: Pull/Keeper Enabled
  770. Pull / Keep Select Field: Pull
  771. Pull Up / Down Config. Field: 100K Ohm Pull Up
  772. Hyst. Enable Field: Hysteresis Disabled */
  773. IOMUXC_SetPinConfig(
  774. IOMUXC_GPIO_EMC_41_ENET_MDIO, /* GPIO_EMC_41 PAD functional properties : */
  775. 0xB829u); /* Slew Rate Field: Fast Slew Rate
  776. Drive Strength Field: R0/5
  777. Speed Field: low(50MHz)
  778. Open Drain Enable Field: Open Drain Enabled
  779. Pull / Keep Enable Field: Pull/Keeper Enabled
  780. Pull / Keep Select Field: Pull
  781. Pull Up / Down Config. Field: 100K Ohm Pull Up
  782. Hyst. Enable Field: Hysteresis Disabled */
  783. }
  784. #ifndef BSP_USING_PHY
  785. void imxrt_enet_phy_reset_by_gpio(void)
  786. {
  787. gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
  788. GPIO_PinInit(GPIO1, 9, &gpio_config);
  789. GPIO_PinInit(GPIO1, 10, &gpio_config);
  790. /* pull up the ENET_INT before RESET. */
  791. GPIO_WritePinOutput(GPIO1, 10, 1);
  792. GPIO_WritePinOutput(GPIO1, 9, 0);
  793. rt_thread_delay(100);
  794. GPIO_WritePinOutput(GPIO1, 9, 1);
  795. }
  796. #endif /* BSP_USING_PHY */
  797. #endif /* BSP_USING_ETH */
  798. #ifdef BSP_USING_PHY
  799. void imxrt_phy_pins_init( void )
  800. {
  801. IOMUXC_SetPinMux(
  802. IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 is configured as GPIO1_IO09 */
  803. 0U); /* Software Input On Field: Input Path is determined by functionality */
  804. IOMUXC_SetPinConfig(
  805. IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_B0_00 PAD functional properties : */
  806. 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  807. Drive Strength Field: R0/6
  808. Speed Field: medium(100MHz)
  809. Open Drain Enable Field: Open Drain Disabled
  810. Pull / Keep Enable Field: Pull/Keeper Enabled
  811. Pull / Keep Select Field: Keeper
  812. Pull Up / Down Config. Field: 100K Ohm Pull Down
  813. Hyst. Enable Field: Hysteresis Disabled */
  814. }
  815. #endif /* BSP_USING_PHY */
  816. /**
  817. * This function will initial rt1050 board.
  818. */
  819. void rt_hw_board_init()
  820. {
  821. BOARD_ConfigMPU();
  822. BOARD_InitPins();
  823. BOARD_BootClockRUN();
  824. NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
  825. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
  826. #ifdef BSP_USING_LPUART
  827. imxrt_uart_pins_init();
  828. #endif
  829. #ifdef BSP_USING_I2C
  830. imxrt_i2c_pins_init();
  831. #endif
  832. #ifdef BSP_USING_ETH
  833. imxrt_enet_pins_init();
  834. #endif
  835. #ifdef BSP_USING_PHY
  836. imxrt_phy_pins_init();
  837. #endif
  838. #ifdef BSP_USING_LCD
  839. imxrt_lcd_pins_init();
  840. #endif
  841. #ifdef BSP_USING_DMA
  842. imxrt_dma_init();
  843. #endif
  844. #ifdef RT_USING_HEAP
  845. rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
  846. #endif
  847. #ifdef RT_USING_COMPONENTS_INIT
  848. rt_components_board_init();
  849. #endif
  850. #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
  851. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  852. #endif
  853. }