diff options
| author | wangqiang <[email protected]> | 2019-07-05 13:49:03 +0800 |
|---|---|---|
| committer | wangqiang <[email protected]> | 2019-07-05 13:49:03 +0800 |
| commit | d93fdb1ea868183f9ead1e3865f6db3d85d73696 (patch) | |
| tree | bff142f3f450312fd2dcb6dab090c31f92ab90f2 | |
| parent | 09d18dccf6560a8ba1d89b1116a75db8845f9822 (diff) | |
Board.c增加了DMA初始化相关设置
| -rw-r--r-- | bsp/imxrt/imxrt1064-nxp-evk/board/board.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/bsp/imxrt/imxrt1064-nxp-evk/board/board.c b/bsp/imxrt/imxrt1064-nxp-evk/board/board.c index 44fb588f34..a56282ea00 100644 --- a/bsp/imxrt/imxrt1064-nxp-evk/board/board.c +++ b/bsp/imxrt/imxrt1064-nxp-evk/board/board.c @@ -13,6 +13,22 @@ #include "board.h" #include "pin_mux.h" +#ifdef BSP_USING_DMA +#include "fsl_dmamux.h" +#include "fsl_edma.h" +#endif + +#define NVIC_PRIORITYGROUP_0 0x00000007U /*!< 0 bits for pre-emption priority + 4 bits for subpriority */ +#define NVIC_PRIORITYGROUP_1 0x00000006U /*!< 1 bits for pre-emption priority + 3 bits for subpriority */ +#define NVIC_PRIORITYGROUP_2 0x00000005U /*!< 2 bits for pre-emption priority + 2 bits for subpriority */ +#define NVIC_PRIORITYGROUP_3 0x00000004U /*!< 3 bits for pre-emption priority + 1 bits for subpriority */ +#define NVIC_PRIORITYGROUP_4 0x00000003U /*!< 4 bits for pre-emption priority + 0 bits for subpriority */ + /* MPU configuration. */ static void BOARD_ConfigMPU(void) { @@ -52,7 +68,7 @@ static void BOARD_ConfigMPU(void) MPU->RBAR = ARM_MPU_RBAR(6, 0x20200000U); MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_256KB); -#if defined(SDRAM_MPU_INIT) +#if defined(BSP_USING_SDRAM) /* Region 7 setting */ MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U); MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB); @@ -83,15 +99,32 @@ void SysTick_Handler(void) rt_interrupt_leave(); } -/* This function will initial STM32 board. */ +#ifdef BSP_USING_DMA +void imxrt_dma_init(void) +{ + edma_config_t config; + + DMAMUX_Init(DMAMUX); + EDMA_GetDefaultConfig(&config); + EDMA_Init(DMA0, &config); +} +#endif +/** + * This function will initial rt1050 board. + */ void rt_hw_board_init() { BOARD_ConfigMPU(); BOARD_InitPins(); BOARD_BootClockRUN(); + NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND); +#ifdef BSP_USING_DMA + imxrt_dma_init(); +#endif + #ifdef RT_USING_HEAP rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END); #endif |
