From 1c26e68beb912444207d0de438fd2b0142ffd0f1 Mon Sep 17 00:00:00 2001 From: jzlv Date: Thu, 5 Aug 2021 20:43:13 +0800 Subject: [PATCH] [refactor] rename NVIC as CPU_Interrupt --- drivers/bl602_driver/hal_drv/src/hal_dma.c | 6 +++--- drivers/bl602_driver/hal_drv/src/hal_gpio.c | 4 ++-- drivers/bl602_driver/hal_drv/src/hal_mtimer.c | 4 ++-- drivers/bl602_driver/hal_drv/src/hal_uart.c | 8 ++++---- .../risc-v/Core/Include/cmsis_compatible_gcc.h | 4 ++-- drivers/bl602_driver/std_drv/src/bl602_dma.c | 14 +++++++------- drivers/bl702_driver/hal_drv/src/hal_adc.c | 2 +- drivers/bl702_driver/hal_drv/src/hal_dma.c | 4 ++-- drivers/bl702_driver/hal_drv/src/hal_emac.c | 2 +- drivers/bl702_driver/hal_drv/src/hal_gpio.c | 4 ++-- drivers/bl702_driver/hal_drv/src/hal_keyscan.c | 4 ++-- drivers/bl702_driver/hal_drv/src/hal_mtimer.c | 4 ++-- drivers/bl702_driver/hal_drv/src/hal_pm.c | 4 ++-- drivers/bl702_driver/hal_drv/src/hal_power.c | 9 +++++---- drivers/bl702_driver/hal_drv/src/hal_pwm.c | 6 +++--- drivers/bl702_driver/hal_drv/src/hal_qdec.c | 16 ++++++++-------- drivers/bl702_driver/hal_drv/src/hal_spi.c | 2 +- drivers/bl702_driver/hal_drv/src/hal_timer.c | 8 ++++---- drivers/bl702_driver/hal_drv/src/hal_uart.c | 8 ++++---- drivers/bl702_driver/hal_drv/src/hal_usb.c | 6 +++--- .../risc-v/Core/Include/cmsis_compatible_gcc.h | 4 ++-- drivers/bl702_driver/std_drv/src/bl702_dma.c | 14 +++++++------- examples/camera/camera_interleave_pbuf/main.c | 2 +- 23 files changed, 70 insertions(+), 69 deletions(-) diff --git a/drivers/bl602_driver/hal_drv/src/hal_dma.c b/drivers/bl602_driver/hal_drv/src/hal_dma.c index 39dc8334..1be855fc 100644 --- a/drivers/bl602_driver/hal_drv/src/hal_dma.c +++ b/drivers/bl602_driver/hal_drv/src/hal_dma.c @@ -70,7 +70,7 @@ int dma_open(struct device *dev, uint16_t oflag) /* Disable all interrupt */ DMA_IntMask(dma_device->ch, DMA_INT_ALL, MASK); /* Enable uart interrupt*/ - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); DMA_Disable(); @@ -111,7 +111,7 @@ int dma_control(struct device *dev, int cmd, void *args) DMA_IntMask(dma_device->ch, DMA_INT_ERR, UNMASK); /* Enable uart interrupt*/ - NVIC_EnableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Enable(DMA_ALL_IRQn); break; case DEVICE_CTRL_CLR_INT /* constant-expression */: @@ -120,7 +120,7 @@ int dma_control(struct device *dev, int cmd, void *args) DMA_IntMask(dma_device->ch, DMA_INT_ERR, MASK); /* Enable uart interrupt*/ - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); break; case DEVICE_CTRL_GET_INT /* constant-expression */: diff --git a/drivers/bl602_driver/hal_drv/src/hal_gpio.c b/drivers/bl602_driver/hal_drv/src/hal_gpio.c index b8cc1f57..8d222224 100644 --- a/drivers/bl602_driver/hal_drv/src/hal_gpio.c +++ b/drivers/bl602_driver/hal_drv/src/hal_gpio.c @@ -84,7 +84,7 @@ void gpio_set_mode(uint32_t pin, uint32_t mode) break; default: - NVIC_DisableIRQ(GPIO_INT0_IRQn); + CPU_Interrupt_Disable(GPIO_INT0_IRQn); GLB_GPIO_IntMask(pin, MASK); gpio_cfg.gpioMode = GPIO_MODE_INPUT; @@ -135,7 +135,7 @@ void gpio_set_mode(uint32_t pin, uint32_t mode) return; } - NVIC_EnableIRQ(GPIO_INT0_IRQn); + CPU_Interrupt_Enable(GPIO_INT0_IRQn); break; } diff --git a/drivers/bl602_driver/hal_drv/src/hal_mtimer.c b/drivers/bl602_driver/hal_drv/src/hal_mtimer.c index 6d8bd092..c8c2c2b6 100644 --- a/drivers/bl602_driver/hal_drv/src/hal_mtimer.c +++ b/drivers/bl602_driver/hal_drv/src/hal_mtimer.c @@ -42,7 +42,7 @@ static void Systick_Handler(void) */ void mtimer_set_alarm_time(uint64_t ticks, void (*interruptfun)(void)) { - NVIC_DisableIRQ(MTIME_IRQn); + CPU_Interrupt_Disable(MTIME_IRQn); uint32_t ulCurrentTimeHigh, ulCurrentTimeLow; volatile uint32_t *const pulTimeHigh = (volatile uint32_t *const)(CLIC_CTRL_ADDR + CLIC_MTIME + 4); @@ -71,7 +71,7 @@ void mtimer_set_alarm_time(uint64_t ticks, void (*interruptfun)(void)) next_compare_tick += (uint64_t)current_set_ticks; Interrupt_Handler_Register(MTIME_IRQn, Systick_Handler); - NVIC_EnableIRQ(MTIME_IRQn); + CPU_Interrupt_Enable(MTIME_IRQn); } /** diff --git a/drivers/bl602_driver/hal_drv/src/hal_uart.c b/drivers/bl602_driver/hal_drv/src/hal_uart.c index 5f45d7af..76339b40 100644 --- a/drivers/bl602_driver/hal_drv/src/hal_uart.c +++ b/drivers/bl602_driver/hal_drv/src/hal_uart.c @@ -170,9 +170,9 @@ int uart_control(struct device *dev, int cmd, void *args) } if (uart_device->id == UART0_ID) { - NVIC_EnableIRQ(UART0_IRQn); + CPU_Interrupt_Enable(UART0_IRQn); } else if (uart_device->id == UART1_ID) { - NVIC_EnableIRQ(UART1_IRQn); + CPU_Interrupt_Enable(UART1_IRQn); } break; @@ -190,9 +190,9 @@ int uart_control(struct device *dev, int cmd, void *args) } if (uart_device->id == UART0_ID) { - NVIC_DisableIRQ(UART0_IRQn); + CPU_Interrupt_Disable(UART0_IRQn); } else if (uart_device->id == UART1_ID) { - NVIC_DisableIRQ(UART1_IRQn); + CPU_Interrupt_Disable(UART1_IRQn); } break; diff --git a/drivers/bl602_driver/risc-v/Core/Include/cmsis_compatible_gcc.h b/drivers/bl602_driver/risc-v/Core/Include/cmsis_compatible_gcc.h index 5bc58b4a..d7bc21f9 100644 --- a/drivers/bl602_driver/risc-v/Core/Include/cmsis_compatible_gcc.h +++ b/drivers/bl602_driver/risc-v/Core/Include/cmsis_compatible_gcc.h @@ -120,9 +120,9 @@ extern void clic_disable_interrupt(uint32_t source); extern void clic_set_pending(uint32_t source); extern void clic_clear_pending(uint32_t source); -#define NVIC_EnableIRQ clic_enable_interrupt +#define CPU_Interrupt_Enable clic_enable_interrupt -#define NVIC_DisableIRQ clic_disable_interrupt +#define CPU_Interrupt_Disable clic_disable_interrupt #define NVIC_ClearPendingIRQ clic_clear_pending diff --git a/drivers/bl602_driver/std_drv/src/bl602_dma.c b/drivers/bl602_driver/std_drv/src/bl602_dma.c index b1af4bae..961014f3 100644 --- a/drivers/bl602_driver/std_drv/src/bl602_dma.c +++ b/drivers/bl602_driver/std_drv/src/bl602_dma.c @@ -547,7 +547,7 @@ BL_Err_Type DMA_LLI_PpStruct_Set_Transfer_Len(DMA_LLI_PP_Struct *dmaPpStruct, ui *******************************************************************************/ void DMA_LLI_PpBuf_Start_New_Transmit(DMA_LLI_PP_Buf *dmaPpBuf) { - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); if (dmaPpBuf->lliListHeader[dmaPpBuf->idleIndex] != NULL) { DMA_LLI_Update(dmaPpBuf->dmaChan, (uint32_t)dmaPpBuf->lliListHeader[dmaPpBuf->idleIndex]); @@ -555,7 +555,7 @@ void DMA_LLI_PpBuf_Start_New_Transmit(DMA_LLI_PP_Buf *dmaPpBuf) dmaPpBuf->idleIndex = (dmaPpBuf->idleIndex == 0) ? 1 : 0; } - NVIC_EnableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Enable(DMA_ALL_IRQn); } /****************************************************************************/ /** @@ -568,10 +568,10 @@ void DMA_LLI_PpBuf_Start_New_Transmit(DMA_LLI_PP_Buf *dmaPpBuf) *******************************************************************************/ DMA_LLI_Ctrl_Type *DMA_LLI_PpBuf_Remove_Completed_List(DMA_LLI_PP_Buf *dmaPpBuf) { - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); dmaPpBuf->lliListHeader[!dmaPpBuf->idleIndex] = NULL; - NVIC_EnableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Enable(DMA_ALL_IRQn); return dmaPpBuf->lliListHeader[!dmaPpBuf->idleIndex]; } @@ -587,7 +587,7 @@ DMA_LLI_Ctrl_Type *DMA_LLI_PpBuf_Remove_Completed_List(DMA_LLI_PP_Buf *dmaPpBuf) void DMA_LLI_PpBuf_Append(DMA_LLI_PP_Buf *dmaPpBuf, DMA_LLI_Ctrl_Type *dmaLliList) { DMA_LLI_Ctrl_Type *pLliList = NULL; - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); pLliList = dmaPpBuf->lliListHeader[dmaPpBuf->idleIndex]; @@ -608,7 +608,7 @@ void DMA_LLI_PpBuf_Append(DMA_LLI_PP_Buf *dmaPpBuf, DMA_LLI_Ctrl_Type *dmaLliLis } if (DMA_Channel_Is_Busy(dmaPpBuf->dmaChan) == RESET) { - /* DMA stopped: maybe stop just a few minutes ago(not enter INT due to NVIC_DisableIRQ) + /* DMA stopped: maybe stop just a few minutes ago(not enter INT due to CPU_Interrupt_Disable) or has already stopped before this function is called */ if (dmaPpBuf->lliListHeader[!dmaPpBuf->idleIndex] == NULL) { /* DMA has already stopped before this function is called */ @@ -616,7 +616,7 @@ void DMA_LLI_PpBuf_Append(DMA_LLI_PP_Buf *dmaPpBuf, DMA_LLI_Ctrl_Type *dmaLliLis } } - NVIC_EnableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Enable(DMA_ALL_IRQn); } /****************************************************************************/ /** diff --git a/drivers/bl702_driver/hal_drv/src/hal_adc.c b/drivers/bl702_driver/hal_drv/src/hal_adc.c index 0453da49..99494c56 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_adc.c +++ b/drivers/bl702_driver/hal_drv/src/hal_adc.c @@ -184,7 +184,7 @@ int adc_control(struct device *dev, int cmd, void *args) if (mask & ADC_EVEN_INT_NEG_SATURATION_IT) { ADC_IntMask(ADC_EVEN_INT_NEG_SATURATION, UNMASK); } - NVIC_EnableIRQ(GPADC_DMA_IRQn); + CPU_Interrupt_Enable(GPADC_DMA_IRQn); break; case DEVICE_CTRL_CLR_INT /* constant-expression */: diff --git a/drivers/bl702_driver/hal_drv/src/hal_dma.c b/drivers/bl702_driver/hal_drv/src/hal_dma.c index 0aee117a..8eab8bc1 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_dma.c +++ b/drivers/bl702_driver/hal_drv/src/hal_dma.c @@ -70,7 +70,7 @@ int dma_open(struct device *dev, uint16_t oflag) /* Disable all interrupt */ DMA_IntMask(dma_device->ch, DMA_INT_ALL, MASK); /* Enable uart interrupt*/ - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); DMA_Disable(); @@ -90,7 +90,7 @@ int dma_open(struct device *dev, uint16_t oflag) Interrupt_Handler_Register(DMA_ALL_IRQn, DMA0_IRQ); /* Enable uart interrupt*/ - NVIC_EnableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Enable(DMA_ALL_IRQn); return 0; } /** diff --git a/drivers/bl702_driver/hal_drv/src/hal_emac.c b/drivers/bl702_driver/hal_drv/src/hal_emac.c index b5855ddc..394b6f3e 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_emac.c +++ b/drivers/bl702_driver/hal_drv/src/hal_emac.c @@ -344,7 +344,7 @@ int emac_init(emac_device_t *emac_cfg) EMAC_Int_Callback_Install(EMAC_INT_RX_BUSY_IDX, emac_rx_busy_callback); - NVIC_EnableIRQ(EMAC_IRQn); + CPU_Interrupt_Enable(EMAC_IRQn); EMAC_ClrIntStatus(EMAC_INT_ALL); EMAC_IntMask(EMAC_INT_ALL, UNMASK); diff --git a/drivers/bl702_driver/hal_drv/src/hal_gpio.c b/drivers/bl702_driver/hal_drv/src/hal_gpio.c index 16acf588..9ef60cf3 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_gpio.c +++ b/drivers/bl702_driver/hal_drv/src/hal_gpio.c @@ -83,7 +83,7 @@ void gpio_set_mode(uint32_t pin, uint32_t mode) case GPIO_HZ_MODE: GLB_GPIO_Set_HZ(pin); default: - NVIC_DisableIRQ(GPIO_INT0_IRQn); + CPU_Interrupt_Disable(GPIO_INT0_IRQn); GLB_GPIO_IntMask(pin, MASK); gpio_cfg.gpioMode = GPIO_MODE_INPUT; @@ -134,7 +134,7 @@ void gpio_set_mode(uint32_t pin, uint32_t mode) return; } - NVIC_EnableIRQ(GPIO_INT0_IRQn); + CPU_Interrupt_Enable(GPIO_INT0_IRQn); break; } diff --git a/drivers/bl702_driver/hal_drv/src/hal_keyscan.c b/drivers/bl702_driver/hal_drv/src/hal_keyscan.c index 05868c18..dacc506d 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_keyscan.c +++ b/drivers/bl702_driver/hal_drv/src/hal_keyscan.c @@ -85,12 +85,12 @@ int keyscan_control(struct device *dev, int cmd, void *args) Interrupt_Handler_Register(KYS_IRQn, KeyScan_IRQ); #endif BL_WR_REG(KYS_BASE, KYS_KS_INT_EN, 1); - NVIC_EnableIRQ(KYS_IRQn); + CPU_Interrupt_Enable(KYS_IRQn); break; case DEVICE_CTRL_CLR_INT /* constant-expression */: Interrupt_Handler_Register(KYS_IRQn, NULL); BL_WR_REG(KYS_BASE, KYS_KS_INT_EN, 0); - NVIC_DisableIRQ(KYS_IRQn); + CPU_Interrupt_Disable(KYS_IRQn); break; case DEVICE_CTRL_GET_INT: return (BL_RD_REG(KYS_BASE, KYS_KS_INT_STS) & 0xf); diff --git a/drivers/bl702_driver/hal_drv/src/hal_mtimer.c b/drivers/bl702_driver/hal_drv/src/hal_mtimer.c index 81a81731..a243e20f 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_mtimer.c +++ b/drivers/bl702_driver/hal_drv/src/hal_mtimer.c @@ -42,7 +42,7 @@ static void Systick_Handler(void) */ void mtimer_set_alarm_time(uint64_t ticks, void (*interruptfun)(void)) { - NVIC_DisableIRQ(MTIME_IRQn); + CPU_Interrupt_Disable(MTIME_IRQn); uint32_t ulCurrentTimeHigh, ulCurrentTimeLow; volatile uint32_t *const pulTimeHigh = (volatile uint32_t *const)(CLIC_CTRL_ADDR + CLIC_MTIME + 4); @@ -71,7 +71,7 @@ void mtimer_set_alarm_time(uint64_t ticks, void (*interruptfun)(void)) next_compare_tick += (uint64_t)current_set_ticks; Interrupt_Handler_Register(MTIME_IRQn, Systick_Handler); - NVIC_EnableIRQ(MTIME_IRQn); + CPU_Interrupt_Enable(MTIME_IRQn); } /** diff --git a/drivers/bl702_driver/hal_drv/src/hal_pm.c b/drivers/bl702_driver/hal_drv/src/hal_pm.c index 2c72b2a7..9380e620 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_pm.c +++ b/drivers/bl702_driver/hal_drv/src/hal_pm.c @@ -134,8 +134,8 @@ void pm_hbn_irq_register(void (*hbn_irq)(uint8_t event)) hbn_irq_callback = hbn_irq; Interrupt_Handler_Register(HBN_OUT0_IRQn, HBN_OUT0_IRQ); Interrupt_Handler_Register(HBN_OUT1_IRQn, HBN_OUT1_IRQ); - NVIC_EnableIRQ(HBN_OUT0_IRQn); - NVIC_EnableIRQ(HBN_OUT1_IRQn); + CPU_Interrupt_Enable(HBN_OUT0_IRQn); + CPU_Interrupt_Enable(HBN_OUT1_IRQn); } static void HBN_OUT0_IRQ(void) diff --git a/drivers/bl702_driver/hal_drv/src/hal_power.c b/drivers/bl702_driver/hal_drv/src/hal_power.c index b794bca3..b29b93b0 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_power.c +++ b/drivers/bl702_driver/hal_drv/src/hal_power.c @@ -32,7 +32,7 @@ #include "power_config.h" #include "hal_power.h" -#define ALWAYS_DISABLE_AON_PAD_9 (0) +#define ALWAYS_DISABLE_AON_PAD_9 (0) /** * @brief gating peripheral clock for power saving @@ -1074,7 +1074,6 @@ static ATTR_TCM_SECTION void PDS_Power_On_Flash(PDS_APP_CFG_Type *cfg) void ATTR_TCM_SECTION PDS_Mode_Enter(PDS_APP_CFG_Type *cfg) { PDS_DEFAULT_LV_CFG_Type *pPdsCfg = NULL; - uint32_t tmpVal = 0, tmpVal2 = 0; if (cfg->useXtal32k) { HBN_32K_Sel(HBN_32K_XTAL); @@ -1106,6 +1105,8 @@ void ATTR_TCM_SECTION PDS_Mode_Enter(PDS_APP_CFG_Type *cfg) } #if ALWAYS_DISABLE_AON_PAD_9 + uint32_t tmpVal = 0, tmpVal2 = 0; + /* always disable and mask aon_pad_GPIO9, mask/unmask and ie_enable/ie_disable */ tmpVal = BL_RD_REG(HBN_BASE, HBN_IRQ_MODE); tmpVal2 = BL_GET_REG_BITS_VAL(tmpVal, HBN_PIN_WAKEUP_MASK); @@ -1428,7 +1429,7 @@ int lp_enter_pds(uint32_t sleep_time, void (*preCbFun)(void), void (*postCbFun)( HBN_Clear_IRQ(HBN_INT_GPIO13); /* enable PDS interrupt to wakeup CPU (PDS1:CPU not powerdown, CPU __WFI) */ - NVIC_EnableIRQ(PDS_WAKEUP_IRQn); + CPU_Interrupt_Enable(PDS_WAKEUP_IRQn); /* clear and mask PDS int */ PDS_IntMask(PDS_INT_WAKEUP, UNMASK); @@ -1456,7 +1457,7 @@ int lp_enter_pds(uint32_t sleep_time, void (*preCbFun)(void), void (*postCbFun)( * * @note now default hbn level is hbn1 */ -int lp_enter_hbn(uint32_t sleepTime , uint8_t hbn_level) +int lp_enter_hbn(uint32_t sleepTime, uint8_t hbn_level) { HBN_APP_CFG_Type cfg = { .useXtal32k = 0, /*!< Wheather use xtal 32K as 32K clock source,otherwise use rc32k */ diff --git a/drivers/bl702_driver/hal_drv/src/hal_pwm.c b/drivers/bl702_driver/hal_drv/src/hal_pwm.c index 38e729dd..e546b384 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_pwm.c +++ b/drivers/bl702_driver/hal_drv/src/hal_pwm.c @@ -76,7 +76,7 @@ int pwm_open(struct device *dev, uint16_t oflag) BL_WR_REG(PWMx, PWM_INTERRUPT, BL_SET_REG_BITS_VAL(tmpVal, PWM_INT_PERIOD_CNT, pwm_device->it_pulse_count)); Interrupt_Handler_Register(PWM_IRQn, PWM_IRQ); PWM_IntMask(pwm_device->ch, PWM_INT_PULSE_CNT, UNMASK); - NVIC_EnableIRQ(PWM_IRQn); + CPU_Interrupt_Enable(PWM_IRQn); } return 0; @@ -122,10 +122,10 @@ int pwm_control(struct device *dev, int cmd, void *args) if ((uint32_t)args) { PWM_IntMask(pwm_device->ch, PWM_INT_PULSE_CNT, UNMASK); - NVIC_EnableIRQ(PWM_IRQn); + CPU_Interrupt_Enable(PWM_IRQn); } else { PWM_IntMask(pwm_device->ch, PWM_INT_PULSE_CNT, MASK); - NVIC_DisableIRQ(PWM_IRQn); + CPU_Interrupt_Disable(PWM_IRQn); } break; diff --git a/drivers/bl702_driver/hal_drv/src/hal_qdec.c b/drivers/bl702_driver/hal_drv/src/hal_qdec.c index d959e735..b000d99f 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_qdec.c +++ b/drivers/bl702_driver/hal_drv/src/hal_qdec.c @@ -81,7 +81,7 @@ int qdec_open(struct device *dev, uint16_t oflag) QDEC_SetIntMask(qdec_device->id, QDEC_INT_SAMPLE, MASK); QDEC_SetIntMask(qdec_device->id, QDEC_INT_ERROR, MASK); QDEC_SetIntMask(qdec_device->id, QDEC_INT_OVERFLOW, MASK); - // NVIC_EnableIRQ(QDEC1_IRQn); + // CPU_Interrupt_Enable(QDEC1_IRQn); } #endif #ifdef BSP_USING_QDEC2 @@ -91,7 +91,7 @@ int qdec_open(struct device *dev, uint16_t oflag) QDEC_SetIntMask(qdec_device->id, QDEC_INT_SAMPLE, MASK); QDEC_SetIntMask(qdec_device->id, QDEC_INT_ERROR, MASK); QDEC_SetIntMask(qdec_device->id, QDEC_INT_OVERFLOW, MASK); - // NVIC_EnableIRQ(QDEC2_IRQn); + // CPU_Interrupt_Enable(QDEC2_IRQn); } #endif } @@ -128,22 +128,22 @@ int qdec_control(struct device *dev, int cmd, void *args) QDEC_SetIntMask(qdec_device->id, QDEC_INT_OVERFLOW, UNMASK); } if (qdec_device->id == QDEC0_ID) { - NVIC_EnableIRQ(QDEC0_IRQn); + CPU_Interrupt_Enable(QDEC0_IRQn); } else if (qdec_device->id == QDEC1_ID) { - NVIC_EnableIRQ(QDEC1_IRQn); + CPU_Interrupt_Enable(QDEC1_IRQn); } else if (qdec_device->id == QDEC2_ID) { - NVIC_EnableIRQ(QDEC2_IRQn); + CPU_Interrupt_Enable(QDEC2_IRQn); } break; } case DEVICE_CTRL_CLR_INT: { if (qdec_device->id == QDEC0_ID) { - NVIC_DisableIRQ(QDEC0_IRQn); + CPU_Interrupt_Disable(QDEC0_IRQn); } else if (qdec_device->id == QDEC1_ID) { - NVIC_DisableIRQ(QDEC1_IRQn); + CPU_Interrupt_Disable(QDEC1_IRQn); } else if (qdec_device->id == QDEC2_ID) { - NVIC_DisableIRQ(QDEC2_IRQn); + CPU_Interrupt_Disable(QDEC2_IRQn); } break; } diff --git a/drivers/bl702_driver/hal_drv/src/hal_spi.c b/drivers/bl702_driver/hal_drv/src/hal_spi.c index 251f9a16..f194e236 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_spi.c +++ b/drivers/bl702_driver/hal_drv/src/hal_spi.c @@ -54,7 +54,7 @@ int spi_open(struct device *dev, uint16_t oflag) SPI_IntMask(spi_device->id, SPI_INT_ALL, MASK); /* Enable uart interrupt*/ - NVIC_DisableIRQ(SPI_IRQn); + CPU_Interrupt_Disable(SPI_IRQn); SPI_Disable(spi_device->id, spi_device->mode); diff --git a/drivers/bl702_driver/hal_drv/src/hal_timer.c b/drivers/bl702_driver/hal_drv/src/hal_timer.c index d2c86e99..76c7c7ae 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_timer.c +++ b/drivers/bl702_driver/hal_drv/src/hal_timer.c @@ -204,10 +204,10 @@ int timer_control(struct device *dev, int cmd, void *args) if (timer_device->id == TIMER_CH0) { NVIC_ClearPendingIRQ(TIMER_CH0_IRQn); - NVIC_EnableIRQ(TIMER_CH0_IRQn); + CPU_Interrupt_Enable(TIMER_CH0_IRQn); } else if (timer_device->id == TIMER_CH1) { NVIC_ClearPendingIRQ(TIMER_CH1_IRQn); - NVIC_EnableIRQ(TIMER_CH1_IRQn); + CPU_Interrupt_Enable(TIMER_CH1_IRQn); } break; @@ -223,9 +223,9 @@ int timer_control(struct device *dev, int cmd, void *args) offset++; } if (timer_device->id == TIMER_CH0) { - NVIC_DisableIRQ(TIMER_CH0_IRQn); + CPU_Interrupt_Disable(TIMER_CH0_IRQn); } else if (timer_device->id == TIMER_CH1) { - NVIC_DisableIRQ(TIMER_CH1_IRQn); + CPU_Interrupt_Disable(TIMER_CH1_IRQn); } break; } diff --git a/drivers/bl702_driver/hal_drv/src/hal_uart.c b/drivers/bl702_driver/hal_drv/src/hal_uart.c index 09a9eb67..4800d50c 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_uart.c +++ b/drivers/bl702_driver/hal_drv/src/hal_uart.c @@ -151,9 +151,9 @@ int uart_control(struct device *dev, int cmd, void *args) offset++; } if (uart_device->id == UART0_ID) - NVIC_EnableIRQ(UART0_IRQn); + CPU_Interrupt_Enable(UART0_IRQn); else if (uart_device->id == UART1_ID) - NVIC_EnableIRQ(UART1_IRQn); + CPU_Interrupt_Enable(UART1_IRQn); break; } @@ -166,9 +166,9 @@ int uart_control(struct device *dev, int cmd, void *args) offset++; } if (uart_device->id == UART0_ID) - NVIC_DisableIRQ(UART0_IRQn); + CPU_Interrupt_Disable(UART0_IRQn); else if (uart_device->id == UART1_ID) - NVIC_DisableIRQ(UART1_IRQn); + CPU_Interrupt_Disable(UART1_IRQn); break; } diff --git a/drivers/bl702_driver/hal_drv/src/hal_usb.c b/drivers/bl702_driver/hal_drv/src/hal_usb.c index 55a9798d..3615976a 100644 --- a/drivers/bl702_driver/hal_drv/src/hal_usb.c +++ b/drivers/bl702_driver/hal_drv/src/hal_usb.c @@ -214,7 +214,7 @@ int usb_open(struct device *dev, uint16_t oflag) usb_xcvr_config(DISABLE); usb_xcvr_config(ENABLE); - NVIC_DisableIRQ(USB_IRQn); + CPU_Interrupt_Disable(USB_IRQn); usbCfg.DeviceAddress = 0; usbCfg.EnumInEn = ENABLE; @@ -278,7 +278,7 @@ int usb_open(struct device *dev, uint16_t oflag) USB_Clr_IntStatus(USB_INT_ALL); Interrupt_Handler_Register(USB_IRQn, USB_FS_IRQ); - NVIC_EnableIRQ(USB_IRQn); + CPU_Interrupt_Enable(USB_IRQn); USB_Enable(); return 0; @@ -292,7 +292,7 @@ int usb_open(struct device *dev, uint16_t oflag) int usb_close(struct device *dev) { /* disable all interrupts and force USB reset */ - NVIC_DisableIRQ(USB_IRQn); + CPU_Interrupt_Disable(USB_IRQn); USB_IntMask(USB_INT_LPM_WAKEUP, MASK); USB_IntMask(USB_INT_LPM_PACKET, MASK); diff --git a/drivers/bl702_driver/risc-v/Core/Include/cmsis_compatible_gcc.h b/drivers/bl702_driver/risc-v/Core/Include/cmsis_compatible_gcc.h index 5bc58b4a..d7bc21f9 100644 --- a/drivers/bl702_driver/risc-v/Core/Include/cmsis_compatible_gcc.h +++ b/drivers/bl702_driver/risc-v/Core/Include/cmsis_compatible_gcc.h @@ -120,9 +120,9 @@ extern void clic_disable_interrupt(uint32_t source); extern void clic_set_pending(uint32_t source); extern void clic_clear_pending(uint32_t source); -#define NVIC_EnableIRQ clic_enable_interrupt +#define CPU_Interrupt_Enable clic_enable_interrupt -#define NVIC_DisableIRQ clic_disable_interrupt +#define CPU_Interrupt_Disable clic_disable_interrupt #define NVIC_ClearPendingIRQ clic_clear_pending diff --git a/drivers/bl702_driver/std_drv/src/bl702_dma.c b/drivers/bl702_driver/std_drv/src/bl702_dma.c index 77f716b5..d985ccc1 100644 --- a/drivers/bl702_driver/std_drv/src/bl702_dma.c +++ b/drivers/bl702_driver/std_drv/src/bl702_dma.c @@ -476,7 +476,7 @@ BL_Err_Type DMA_LLI_PpStruct_Set_Transfer_Len(DMA_LLI_PP_Struct *dmaPpStruct, ui *******************************************************************************/ void DMA_LLI_PpBuf_Start_New_Transmit(DMA_LLI_PP_Buf *dmaPpBuf) { - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); if (dmaPpBuf->lliListHeader[dmaPpBuf->idleIndex] != NULL) { DMA_LLI_Update(dmaPpBuf->dmaChan, (uint32_t)dmaPpBuf->lliListHeader[dmaPpBuf->idleIndex]); @@ -484,7 +484,7 @@ void DMA_LLI_PpBuf_Start_New_Transmit(DMA_LLI_PP_Buf *dmaPpBuf) dmaPpBuf->idleIndex = (dmaPpBuf->idleIndex == 0) ? 1 : 0; } - NVIC_EnableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Enable(DMA_ALL_IRQn); } /****************************************************************************/ /** @@ -497,10 +497,10 @@ void DMA_LLI_PpBuf_Start_New_Transmit(DMA_LLI_PP_Buf *dmaPpBuf) *******************************************************************************/ DMA_LLI_Ctrl_Type *DMA_LLI_PpBuf_Remove_Completed_List(DMA_LLI_PP_Buf *dmaPpBuf) { - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); dmaPpBuf->lliListHeader[!dmaPpBuf->idleIndex] = NULL; - NVIC_EnableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Enable(DMA_ALL_IRQn); return dmaPpBuf->lliListHeader[!dmaPpBuf->idleIndex]; } @@ -516,7 +516,7 @@ DMA_LLI_Ctrl_Type *DMA_LLI_PpBuf_Remove_Completed_List(DMA_LLI_PP_Buf *dmaPpBuf) void DMA_LLI_PpBuf_Append(DMA_LLI_PP_Buf *dmaPpBuf, DMA_LLI_Ctrl_Type *dmaLliList) { DMA_LLI_Ctrl_Type *pLliList = NULL; - NVIC_DisableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Disable(DMA_ALL_IRQn); pLliList = dmaPpBuf->lliListHeader[dmaPpBuf->idleIndex]; @@ -537,7 +537,7 @@ void DMA_LLI_PpBuf_Append(DMA_LLI_PP_Buf *dmaPpBuf, DMA_LLI_Ctrl_Type *dmaLliLis } if (DMA_Channel_Is_Busy(dmaPpBuf->dmaChan) == RESET) { - /* DMA stopped: maybe stop just a few minutes ago(not enter INT due to NVIC_DisableIRQ) + /* DMA stopped: maybe stop just a few minutes ago(not enter INT due to CPU_Interrupt_Disable) or has already stopped before this function is called */ if (dmaPpBuf->lliListHeader[!dmaPpBuf->idleIndex] == NULL) { /* DMA has already stopped before this function is called */ @@ -545,7 +545,7 @@ void DMA_LLI_PpBuf_Append(DMA_LLI_PP_Buf *dmaPpBuf, DMA_LLI_Ctrl_Type *dmaLliLis } } - NVIC_EnableIRQ(DMA_ALL_IRQn); + CPU_Interrupt_Enable(DMA_ALL_IRQn); } /****************************************************************************/ /** diff --git a/examples/camera/camera_interleave_pbuf/main.c b/examples/camera/camera_interleave_pbuf/main.c index 686b9ce2..9dbe1ca8 100644 --- a/examples/camera/camera_interleave_pbuf/main.c +++ b/examples/camera/camera_interleave_pbuf/main.c @@ -192,7 +192,7 @@ int ATTR_TCM_SECTION main(void) CAM_IntMask(CAM_INT_ALL, MASK); CAM_Int_Callback_set(CAM_INT_NORMAL_0, &CAM_Interrupt_Normal); CAM_IntMask(CAM_INT_NORMAL_0, UNMASK); - NVIC_EnableIRQ(CAM_IRQn); + CPU_Interrupt_Enable(CAM_IRQn); System_NVIC_SetPriority(CAM_IRQn, 4, 1); if (SUCCESS != image_sensor_init(DISABLE, &camera_cfg, &mjpeg_cfg)) {