From dfe3d953d97ab02b1b68aa854af7e8a5c74c5bb9 Mon Sep 17 00:00:00 2001 From: liu2guang <1004383796@qq.com> Date: Tue, 8 May 2018 02:29:00 +0800 Subject: [PATCH] =?UTF-8?q?[BSP][RT1050]=20Fix=20RT1050=20PIN=20125~127=20?= =?UTF-8?q?reg=20addr=20error.=20|=20=E4=BF=AE=E5=A4=8DPIN=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8125~127=E5=BC=95=E8=84=9A=E5=AF=84=E5=AD=98=E5=99=A8?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E9=94=99=E8=AF=AF.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/imxrt1052-evk/drivers/drv_pin.c | 52 +++++++---------------------- 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/bsp/imxrt1052-evk/drivers/drv_pin.c b/bsp/imxrt1052-evk/drivers/drv_pin.c index f426ae6929..7d553f5f3d 100644 --- a/bsp/imxrt1052-evk/drivers/drv_pin.c +++ b/bsp/imxrt1052-evk/drivers/drv_pin.c @@ -246,10 +246,6 @@ void GPIO1_Combined_0_15_IRQHandler(void) gpio_isr(GPIO1, gpio_pin); } -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif - rt_interrupt_leave(); } @@ -264,10 +260,6 @@ void GPIO1_Combined_16_31_IRQHandler(void) gpio_isr(GPIO1, gpio_pin); } -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif - rt_interrupt_leave(); } @@ -282,10 +274,6 @@ void GPIO2_Combined_0_15_IRQHandler(void) gpio_isr(GPIO2, gpio_pin); } -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif - rt_interrupt_leave(); } @@ -300,10 +288,6 @@ void GPIO2_Combined_16_31_IRQHandler(void) gpio_isr(GPIO2, gpio_pin); } -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif - rt_interrupt_leave(); } @@ -318,10 +302,6 @@ void GPIO3_Combined_0_15_IRQHandler(void) gpio_isr(GPIO3, gpio_pin); } -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif - rt_interrupt_leave(); } @@ -336,10 +316,6 @@ void GPIO3_Combined_16_31_IRQHandler(void) gpio_isr(GPIO3, gpio_pin); } -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif - rt_interrupt_leave(); } @@ -354,10 +330,6 @@ void GPIO4_Combined_0_15_IRQHandler(void) gpio_isr(GPIO4, gpio_pin); } -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif - rt_interrupt_leave(); } void GPIO4_Combined_16_31_IRQHandler(void) @@ -371,10 +343,6 @@ void GPIO4_Combined_16_31_IRQHandler(void) gpio_isr(GPIO4, gpio_pin); } -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif - rt_interrupt_leave(); } @@ -388,10 +356,7 @@ void GPIO5_Combined_0_15_IRQHandler(void) { gpio_isr(GPIO5, gpio_pin); } - -#if defined __CORTEX_M && (__CORTEX_M == 4U) - __DSB(); -#endif + rt_interrupt_leave(); } @@ -478,7 +443,7 @@ static void rt1052_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) { CLOCK_EnableClock(kCLOCK_IomuxcSnvs); - IOMUXC_SetPinMux(0x401F8000U + (pin-125)*4, 0x5U, 0, 0, 0, 1); + IOMUXC_SetPinMux(0x400A8000U + (pin-125)*4, 0x5U, 0, 0, 0, 1); } gpio.outputLogic = 0; @@ -521,8 +486,15 @@ static void rt1052_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) } break; } - - IOMUXC_SetPinConfig(0, 0, 0, 0, 0x401F8200U + pin*4, config_value); + + if(rt1052_pin_map[pin].gpio != GPIO5) + { + IOMUXC_SetPinConfig(0, 0, 0, 0, 0x401F8200U + pin*4, config_value); + } + else + { + IOMUXC_SetPinConfig(0, 0, 0, 0, 0x400A8018U + (pin-125)*4, config_value); + } GPIO_PinInit(rt1052_pin_map[pin].gpio, rt1052_pin_map[pin].gpio_pin, &gpio); } @@ -628,7 +600,7 @@ static rt_err_t rt1052_pin_irq_enable(struct rt_device *device, rt_base_t pin, r else { CLOCK_EnableClock(kCLOCK_IomuxcSnvs); - IOMUXC_SetPinMux(0x401F8000U + (pin-125)*4, 0x5U, 0, 0, 0, 0); + IOMUXC_SetPinMux(0x400A8000U + (pin-125)*4, 0x5U, 0, 0, 0, 0); } gpio.direction = kGPIO_DigitalInput;