1
0

board.c 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. /*
  2. * Copyright (c) 2006-2023, 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. #ifdef BSP_USING_DMA
  16. #include "fsl_dmamux.h"
  17. #include "fsl_edma.h"
  18. #endif
  19. #define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority
  20. 4 bits for subpriority */
  21. #define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority
  22. 3 bits for subpriority */
  23. #define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 bits for pre-emption priority
  24. 2 bits for subpriority */
  25. #define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 bits for pre-emption priority
  26. 1 bits for subpriority */
  27. #define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 bits for pre-emption priority
  28. 0 bits for subpriority */
  29. /* MPU configuration. */
  30. void BOARD_ConfigMPU(void)
  31. {
  32. #if defined(__CC_ARM) || defined(__ARMCC_VERSION)
  33. extern uint32_t Image$$RW_m_ncache$$Base[];
  34. /* RW_m_ncache_unused is a auxiliary region which is used to get the whole size of noncache section */
  35. extern uint32_t Image$$RW_m_ncache_unused$$Base[];
  36. extern uint32_t Image$$RW_m_ncache_unused$$ZI$$Limit[];
  37. uint32_t nonCacheStart = (uint32_t)Image$$RW_m_ncache$$Base;
  38. uint32_t size = ((uint32_t)Image$$RW_m_ncache_unused$$Base == nonCacheStart) ?
  39. 0 :
  40. ((uint32_t)Image$$RW_m_ncache_unused$$ZI$$Limit - nonCacheStart);
  41. #elif defined(__MCUXPRESSO)
  42. extern uint32_t __base_NCACHE_REGION;
  43. extern uint32_t __top_NCACHE_REGION;
  44. uint32_t nonCacheStart = (uint32_t)(&__base_NCACHE_REGION);
  45. uint32_t size = (uint32_t)(&__top_NCACHE_REGION) - nonCacheStart;
  46. #elif defined(__ICCARM__) || defined(__GNUC__)
  47. extern uint32_t __NCACHE_REGION_START[];
  48. extern uint32_t __NCACHE_REGION_SIZE[];
  49. uint32_t nonCacheStart = (uint32_t)__NCACHE_REGION_START;
  50. uint32_t size = (uint32_t)__NCACHE_REGION_SIZE;
  51. #endif
  52. volatile uint32_t i = 0;
  53. /* Disable I cache and D cache */
  54. if (SCB_CCR_IC_Msk == (SCB_CCR_IC_Msk & SCB->CCR))
  55. {
  56. SCB_DisableICache();
  57. }
  58. if (SCB_CCR_DC_Msk == (SCB_CCR_DC_Msk & SCB->CCR))
  59. {
  60. SCB_DisableDCache();
  61. }
  62. /* Disable MPU */
  63. ARM_MPU_Disable();
  64. /* MPU configure:
  65. * Use ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable,
  66. * SubRegionDisable, Size)
  67. * API in mpu_armv7.h.
  68. * param DisableExec Instruction access (XN) disable bit,0=instruction fetches enabled, 1=instruction fetches
  69. * disabled.
  70. * param AccessPermission Data access permissions, allows you to configure read/write access for User and
  71. * Privileged mode.
  72. * Use MACROS defined in mpu_armv7.h:
  73. * ARM_MPU_AP_NONE/ARM_MPU_AP_PRIV/ARM_MPU_AP_URO/ARM_MPU_AP_FULL/ARM_MPU_AP_PRO/ARM_MPU_AP_RO
  74. * Combine TypeExtField/IsShareable/IsCacheable/IsBufferable to configure MPU memory access attributes.
  75. * TypeExtField IsShareable IsCacheable IsBufferable Memory Attribtue Shareability Cache
  76. * 0 x 0 0 Strongly Ordered shareable
  77. * 0 x 0 1 Device shareable
  78. * 0 0 1 0 Normal not shareable Outer and inner write
  79. * through no write allocate
  80. * 0 0 1 1 Normal not shareable Outer and inner write
  81. * back no write allocate
  82. * 0 1 1 0 Normal shareable Outer and inner write
  83. * through no write allocate
  84. * 0 1 1 1 Normal shareable Outer and inner write
  85. * back no write allocate
  86. * 1 0 0 0 Normal not shareable outer and inner
  87. * noncache
  88. * 1 1 0 0 Normal shareable outer and inner
  89. * noncache
  90. * 1 0 1 1 Normal not shareable outer and inner write
  91. * back write/read acllocate
  92. * 1 1 1 1 Normal shareable outer and inner write
  93. * back write/read acllocate
  94. * 2 x 0 0 Device not shareable
  95. * Above are normal use settings, if your want to see more details or want to config different inner/outter cache
  96. * policy.
  97. * please refer to Table 4-55 /4-56 in arm cortex-M7 generic user guide <dui0646b_cortex_m7_dgug.pdf>
  98. * param SubRegionDisable Sub-region disable field. 0=sub-region is enabled, 1=sub-region is disabled.
  99. * param Size Region size of the region to be configured. use ARM_MPU_REGION_SIZE_xxx MACRO in
  100. * mpu_armv7.h.
  101. */
  102. /*
  103. * Add default region to deny access to whole address space to workaround speculative prefetch.
  104. * Refer to Arm errata 1013783-B for more details.
  105. *
  106. */
  107. /* Region 0 setting: Instruction access disabled, No data access permission. */
  108. MPU->RBAR = ARM_MPU_RBAR(0, 0x00000000U);
  109. MPU->RASR = ARM_MPU_RASR(1, ARM_MPU_AP_NONE, 0, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_4GB);
  110. /* Region 1 setting: Memory with Device type, not shareable, non-cacheable. */
  111. MPU->RBAR = ARM_MPU_RBAR(1, 0x80000000U);
  112. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);
  113. /* Region 2 setting: Memory with Device type, not shareable, non-cacheable. */
  114. MPU->RBAR = ARM_MPU_RBAR(2, 0x60000000U);
  115. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);
  116. #if defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)
  117. /* Region 3 setting: Memory with Normal type, not shareable, outer/inner write back. */
  118. MPU->RBAR = ARM_MPU_RBAR(3, 0x60000000U);
  119. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_RO, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_8MB);
  120. #endif
  121. /* Region 4 setting: Memory with Device type, not shareable, non-cacheable. */
  122. MPU->RBAR = ARM_MPU_RBAR(4, 0x00000000U);
  123. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);
  124. /* Region 5 setting: Memory with Normal type, not shareable, outer/inner write back */
  125. MPU->RBAR = ARM_MPU_RBAR(5, 0x00000000U);
  126. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_64KB);
  127. /* Region 6 setting: Memory with Normal type, not shareable, outer/inner write back */
  128. MPU->RBAR = ARM_MPU_RBAR(6, 0x20000000U);
  129. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_64KB);
  130. /* Region 7 setting: Memory with Normal type, not shareable, outer/inner write back */
  131. MPU->RBAR = ARM_MPU_RBAR(7, 0x20200000U);
  132. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB);
  133. /* Region 8 setting: Memory with Normal type, not shareable, outer/inner write back */
  134. MPU->RBAR = ARM_MPU_RBAR(8, 0x80000000U);
  135. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);
  136. while ((size >> i) > 0x1U)
  137. {
  138. i++;
  139. }
  140. if (i != 0)
  141. {
  142. /* The MPU region size should be 2^N, 5<=N<=32, region base should be multiples of size. */
  143. assert(!(nonCacheStart % size));
  144. assert(size == (uint32_t)(1 << i));
  145. assert(i >= 5);
  146. /* Region 9 setting: Memory with Normal type, not shareable, non-cacheable */
  147. MPU->RBAR = ARM_MPU_RBAR(9, nonCacheStart);
  148. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 0, 0, 0, 0, i - 1);
  149. }
  150. /* Region 10 setting: Memory with Device type, not shareable, non-cacheable */
  151. MPU->RBAR = ARM_MPU_RBAR(10, 0x40000000);
  152. MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_4MB);
  153. /* Enable MPU */
  154. ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk);
  155. /* Enable I cache and D cache */
  156. SCB_EnableDCache();
  157. SCB_EnableICache();
  158. }
  159. /* This is the timer interrupt service routine. */
  160. void SysTick_Handler(void)
  161. {
  162. /* enter interrupt */
  163. rt_interrupt_enter();
  164. rt_tick_increase();
  165. /* leave interrupt */
  166. rt_interrupt_leave();
  167. }
  168. #ifdef BSP_USING_DMA
  169. void imxrt_dma_init(void)
  170. {
  171. edma_config_t config;
  172. DMAMUX_Init(DMAMUX);
  173. EDMA_GetDefaultConfig(&config);
  174. EDMA_Init(DMA0, &config);
  175. }
  176. #endif
  177. #ifdef BSP_USING_ETH
  178. void imxrt_enet_pins_init(void)
  179. {
  180. IOMUXC_SetPinMux(
  181. IOMUXC_GPIO_AD_B0_04_GPIO1_IO04, /* GPIO_AD_B0_04 is configured as GPIO1_IO04 */
  182. 0U); /* Software Input On Field: Input Path is determined by functionality */
  183. /* Software Input On Field: Input Path is determined by functionality */
  184. IOMUXC_SetPinMux(
  185. IOMUXC_GPIO_AD_B0_08_ENET_REF_CLK1, /* GPIO_AD_B0_08 is configured as ENET_REF_CLK1 */
  186. 1U); /* Software Input On Field: Force input path of pad GPIO_AD_B0_08 */
  187. IOMUXC_SetPinMux(
  188. IOMUXC_GPIO_AD_B0_09_ENET_RDATA01, /* GPIO_AD_B0_09 is configured as ENET_RDATA01 */
  189. 0U); /* Software Input On Field: Input Path is determined by functionality */
  190. IOMUXC_SetPinMux(
  191. IOMUXC_GPIO_AD_B0_10_ENET_RDATA00, /* GPIO_AD_B0_10 is configured as ENET_RDATA00 */
  192. 0U); /* Software Input On Field: Input Path is determined by functionality */
  193. IOMUXC_SetPinMux(
  194. IOMUXC_GPIO_AD_B0_11_ENET_RX_EN, /* GPIO_AD_B0_11 is configured as ENET_RX_EN */
  195. 0U); /* Software Input On Field: Input Path is determined by functionality */
  196. IOMUXC_SetPinMux(
  197. IOMUXC_GPIO_AD_B0_12_ENET_RX_ER, /* GPIO_AD_B0_12 is configured as ENET_RX_ER */
  198. 0U); /* Software Input On Field: Input Path is determined by functionality */
  199. IOMUXC_SetPinMux(
  200. IOMUXC_GPIO_AD_B0_13_ENET_TX_EN, /* GPIO_AD_B0_13 is configured as ENET_TX_EN */
  201. 0U); /* Software Input On Field: Input Path is determined by functionality */
  202. IOMUXC_SetPinMux(
  203. IOMUXC_GPIO_AD_B0_14_ENET_TDATA00, /* GPIO_AD_B0_14 is configured as ENET_TDATA00 */
  204. 0U); /* Software Input On Field: Input Path is determined by functionality */
  205. IOMUXC_SetPinMux(
  206. IOMUXC_GPIO_AD_B0_15_ENET_TDATA01, /* GPIO_AD_B0_15 is configured as ENET_TDATA01 */
  207. 0U); /* Software Input On Field: Input Path is determined by functionality */
  208. IOMUXC_SetPinMux(
  209. IOMUXC_GPIO_AD_B1_06_GPIO1_IO22, /* GPIO_AD_B1_06 is configured as GPIO1_IO22 */
  210. 0U); /* Software Input On Field: Input Path is determined by functionality */
  211. IOMUXC_SetPinMux(
  212. IOMUXC_GPIO_EMC_40_ENET_MDIO, /* GPIO_EMC_40 is configured as ENET_MDIO */
  213. 0U); /* Software Input On Field: Input Path is determined by functionality */
  214. IOMUXC_SetPinMux(
  215. IOMUXC_GPIO_EMC_41_ENET_MDC, /* GPIO_EMC_41 is configured as ENET_MDC */
  216. 0U); /* Software Input On Field: Input Path is determined by functionality */
  217. IOMUXC_SetPinConfig(
  218. IOMUXC_GPIO_AD_B0_04_GPIO1_IO04, /* GPIO_AD_B0_04 PAD functional properties : */
  219. 0xB0A9U); /* Slew Rate Field: Fast Slew Rate
  220. Drive Strength Field: R0/5
  221. Speed Field: medium(100MHz)
  222. Open Drain Enable Field: Open Drain Disabled
  223. Pull / Keep Enable Field: Pull/Keeper Enabled
  224. Pull / Keep Select Field: Pull
  225. Pull Up / Down Config. Field: 100K Ohm Pull Up
  226. Hyst. Enable Field: Hysteresis Disabled */
  227. IOMUXC_SetPinConfig(
  228. IOMUXC_GPIO_AD_B0_08_ENET_REF_CLK1, /* GPIO_AD_B0_08 PAD functional properties : */
  229. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  230. Drive Strength Field: R0/5
  231. Speed Field: max(200MHz)
  232. Open Drain Enable Field: Open Drain Disabled
  233. Pull / Keep Enable Field: Pull/Keeper Enabled
  234. Pull / Keep Select Field: Pull
  235. Pull Up / Down Config. Field: 100K Ohm Pull Up
  236. Hyst. Enable Field: Hysteresis Disabled */
  237. IOMUXC_SetPinConfig(
  238. IOMUXC_GPIO_AD_B0_09_ENET_RDATA01, /* GPIO_AD_B0_09 PAD functional properties : */
  239. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  240. Drive Strength Field: R0/5
  241. Speed Field: max(200MHz)
  242. Open Drain Enable Field: Open Drain Disabled
  243. Pull / Keep Enable Field: Pull/Keeper Enabled
  244. Pull / Keep Select Field: Pull
  245. Pull Up / Down Config. Field: 100K Ohm Pull Up
  246. Hyst. Enable Field: Hysteresis Disabled */
  247. IOMUXC_SetPinConfig(
  248. IOMUXC_GPIO_AD_B0_10_ENET_RDATA00, /* GPIO_AD_B0_10 PAD functional properties : */
  249. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  250. Drive Strength Field: R0/5
  251. Speed Field: max(200MHz)
  252. Open Drain Enable Field: Open Drain Disabled
  253. Pull / Keep Enable Field: Pull/Keeper Enabled
  254. Pull / Keep Select Field: Pull
  255. Pull Up / Down Config. Field: 100K Ohm Pull Up
  256. Hyst. Enable Field: Hysteresis Disabled */
  257. IOMUXC_SetPinConfig(
  258. IOMUXC_GPIO_AD_B0_11_ENET_RX_EN, /* GPIO_AD_B0_11 PAD functional properties : */
  259. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  260. Drive Strength Field: R0/5
  261. Speed Field: max(200MHz)
  262. Open Drain Enable Field: Open Drain Disabled
  263. Pull / Keep Enable Field: Pull/Keeper Enabled
  264. Pull / Keep Select Field: Pull
  265. Pull Up / Down Config. Field: 100K Ohm Pull Up
  266. Hyst. Enable Field: Hysteresis Disabled */
  267. IOMUXC_SetPinConfig(
  268. IOMUXC_GPIO_AD_B0_12_ENET_RX_ER, /* GPIO_AD_B0_12 PAD functional properties : */
  269. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  270. Drive Strength Field: R0/5
  271. Speed Field: max(200MHz)
  272. Open Drain Enable Field: Open Drain Disabled
  273. Pull / Keep Enable Field: Pull/Keeper Enabled
  274. Pull / Keep Select Field: Pull
  275. Pull Up / Down Config. Field: 100K Ohm Pull Up
  276. Hyst. Enable Field: Hysteresis Disabled */
  277. IOMUXC_SetPinConfig(
  278. IOMUXC_GPIO_AD_B0_13_ENET_TX_EN, /* GPIO_AD_B0_13 PAD functional properties : */
  279. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  280. Drive Strength Field: R0/5
  281. Speed Field: max(200MHz)
  282. Open Drain Enable Field: Open Drain Disabled
  283. Pull / Keep Enable Field: Pull/Keeper Enabled
  284. Pull / Keep Select Field: Pull
  285. Pull Up / Down Config. Field: 100K Ohm Pull Up
  286. Hyst. Enable Field: Hysteresis Disabled */
  287. IOMUXC_SetPinConfig(
  288. IOMUXC_GPIO_AD_B0_14_ENET_TDATA00, /* GPIO_AD_B0_14 PAD functional properties : */
  289. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  290. Drive Strength Field: R0/5
  291. Speed Field: max(200MHz)
  292. Open Drain Enable Field: Open Drain Disabled
  293. Pull / Keep Enable Field: Pull/Keeper Enabled
  294. Pull / Keep Select Field: Pull
  295. Pull Up / Down Config. Field: 100K Ohm Pull Up
  296. Hyst. Enable Field: Hysteresis Disabled */
  297. IOMUXC_SetPinConfig(
  298. IOMUXC_GPIO_AD_B0_15_ENET_TDATA01, /* GPIO_AD_B0_15 PAD functional properties : */
  299. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  300. Drive Strength Field: R0/5
  301. Speed Field: max(200MHz)
  302. Open Drain Enable Field: Open Drain Disabled
  303. Pull / Keep Enable Field: Pull/Keeper Enabled
  304. Pull / Keep Select Field: Pull
  305. Pull Up / Down Config. Field: 100K Ohm Pull Up
  306. Hyst. Enable Field: Hysteresis Disabled */
  307. IOMUXC_SetPinConfig(
  308. IOMUXC_GPIO_AD_B1_06_GPIO1_IO22, /* GPIO_AD_B1_06 PAD functional properties : */
  309. 0xB0A9U); /* Slew Rate Field: Fast Slew Rate
  310. Drive Strength Field: R0/5
  311. Speed Field: medium(100MHz)
  312. Open Drain Enable Field: Open Drain Disabled
  313. Pull / Keep Enable Field: Pull/Keeper Enabled
  314. Pull / Keep Select Field: Pull
  315. Pull Up / Down Config. Field: 100K Ohm Pull Up
  316. Hyst. Enable Field: Hysteresis Disabled */
  317. IOMUXC_SetPinConfig(
  318. IOMUXC_GPIO_EMC_40_ENET_MDIO, /* GPIO_EMC_40 PAD functional properties : */
  319. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  320. Drive Strength Field: R0/5
  321. Speed Field: max(200MHz)
  322. Open Drain Enable Field: Open Drain Disabled
  323. Pull / Keep Enable Field: Pull/Keeper Enabled
  324. Pull / Keep Select Field: Pull
  325. Pull Up / Down Config. Field: 100K Ohm Pull Up
  326. Hyst. Enable Field: Hysteresis Disabled */
  327. IOMUXC_SetPinConfig(
  328. IOMUXC_GPIO_EMC_41_ENET_MDC, /* GPIO_EMC_41 PAD functional properties : */
  329. 0xB0E9U); /* Slew Rate Field: Fast Slew Rate
  330. Drive Strength Field: R0/5
  331. Speed Field: max(200MHz)
  332. Open Drain Enable Field: Open Drain Disabled
  333. Pull / Keep Enable Field: Pull/Keeper Enabled
  334. Pull / Keep Select Field: Pull
  335. Pull Up / Down Config. Field: 100K Ohm Pull Up
  336. Hyst. Enable Field: Hysteresis Disabled */
  337. }
  338. #ifndef BSP_USING_PHY
  339. void imxrt_enet_phy_reset_by_gpio(void)
  340. {
  341. gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
  342. GPIO_PinInit(GPIO1, 9, &gpio_config);
  343. GPIO_PinInit(GPIO1, 10, &gpio_config);
  344. /* pull up the ENET_INT before RESET. */
  345. GPIO_WritePinOutput(GPIO1, 10, 1);
  346. GPIO_WritePinOutput(GPIO1, 9, 0);
  347. rt_thread_delay(100);
  348. GPIO_WritePinOutput(GPIO1, 9, 1);
  349. }
  350. #endif /* BSP_USING_PHY */
  351. #endif /* BSP_USING_ETH */
  352. #ifdef BSP_USING_PHY
  353. void imxrt_phy_pins_init( void )
  354. {
  355. // IOMUXC_SetPinMux(
  356. // IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 is configured as GPIO1_IO09 */
  357. // 0U); /* Software Input On Field: Input Path is determined by functionality */
  358. // IOMUXC_SetPinConfig(
  359. // IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_B0_00 PAD functional properties : */
  360. // 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  361. // Drive Strength Field: R0/6
  362. // Speed Field: medium(100MHz)
  363. // Open Drain Enable Field: Open Drain Disabled
  364. // Pull / Keep Enable Field: Pull/Keeper Enabled
  365. // Pull / Keep Select Field: Keeper
  366. // Pull Up / Down Config. Field: 100K Ohm Pull Down
  367. // Hyst. Enable Field: Hysteresis Disabled */
  368. IOMUXC_SetPinMux(
  369. IOMUXC_GPIO_AD_B0_04_GPIO1_IO04, /* GPIO_AD_B0_09 is configured as GPIO1_IO09 */
  370. 0U); /* Software Input On Field: Input Path is determined by functionality */
  371. IOMUXC_SetPinConfig(
  372. IOMUXC_GPIO_AD_B0_04_GPIO1_IO04, /* GPIO_B0_00 PAD functional properties : */
  373. 0x10B0u); /* Slew Rate Field: Slow Slew Rate
  374. Drive Strength Field: R0/6
  375. Speed Field: medium(100MHz)
  376. Open Drain Enable Field: Open Drain Disabled
  377. Pull / Keep Enable Field: Pull/Keeper Enabled
  378. Pull / Keep Select Field: Keeper
  379. Pull Up / Down Config. Field: 100K Ohm Pull Down
  380. Hyst. Enable Field: Hysteresis Disabled */
  381. }
  382. #endif /* BSP_USING_PHY */
  383. /**
  384. * This function will initial rt1050 board.
  385. */
  386. void rt_hw_board_init()
  387. {
  388. BOARD_ConfigMPU();
  389. BOARD_InitPins();
  390. BOARD_BootClockRUN();
  391. NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
  392. SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
  393. #ifdef BSP_USING_DMA
  394. imxrt_dma_init();
  395. #endif
  396. #ifdef BSP_USING_ETH
  397. imxrt_enet_pins_init();
  398. #endif
  399. #ifdef BSP_USING_PHY
  400. imxrt_phy_pins_init();
  401. #endif
  402. #ifdef RT_USING_HEAP
  403. rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
  404. #endif
  405. #ifdef RT_USING_COMPONENTS_INIT
  406. rt_components_board_init();
  407. #endif
  408. #ifdef RT_USING_CONSOLE
  409. rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
  410. #endif
  411. }