RV32M1中断处理流程

(1) IRQ_Handler   @ startup_RV32M1_ri5cy.s

jal x0,  SystemIrqHandler

(2)SystemIrqHandler() @systmem_RV32M1_ri5cy.c

isrTable[intnum]();

isrTable 定义如下:

__attribute__((section("user_vectors"))) const irq_handler_t isrTable[] =
{
    DMA0_0_4_8_12_IRQHandler,
    DMA0_1_5_9_13_IRQHandler,
    DMA0_2_6_10_14_IRQHandler,
    DMA0_3_7_11_15_IRQHandler,
    DMA0_Error_IRQHandler,
    CMC0_IRQHandler,
    MUA_IRQHandler,
    USB0_IRQHandler,
    USDHC0_IRQHandler,
    I2S0_IRQHandler,
    FLEXIO0_IRQHandler,
    EMVSIM0_IRQHandler,
    LPIT0_IRQHandler,
    LPSPI0_IRQHandler,
    LPSPI1_IRQHandler,
    LPI2C0_IRQHandler,
    LPI2C1_IRQHandler,
    LPUART0_IRQHandler,
    PORTA_IRQHandler,
    TPM0_IRQHandler,
    LPDAC0_IRQHandler,
    ADC0_IRQHandler,
    LPCMP0_IRQHandler,
    RTC_IRQHandler,
    INTMUX0_0_IRQHandler,
    INTMUX0_1_IRQHandler,
    INTMUX0_2_IRQHandler,
    INTMUX0_3_IRQHandler,
    INTMUX0_4_IRQHandler,
    INTMUX0_5_IRQHandler,
    INTMUX0_6_IRQHandler,
    INTMUX0_7_IRQHandler,
    EWM_IRQHandler,
    FTFE_Command_Complete_IRQHandler,
    FTFE_Read_Collision_IRQHandler,
    LLWU0_IRQHandler,
    SPM_IRQHandler,
    WDOG0_IRQHandler,
    SCG_IRQHandler,
    LPTMR0_IRQHandler,
    LPTMR1_IRQHandler,
    TPM1_IRQHandler,
    TPM2_IRQHandler,
    LPI2C2_IRQHandler,
    LPSPI2_IRQHandler,
    LPUART1_IRQHandler,
    LPUART2_IRQHandler,
    PORTB_IRQHandler,
    PORTC_IRQHandler,
    PORTD_IRQHandler,
    CAU3_Task_Complete_IRQHandler,
    CAU3_Security_Violation_IRQHandler,
    TRNG_IRQHandler,
    LPIT1_IRQHandler,
    LPTMR2_IRQHandler,
    TPM3_IRQHandler,
    LPI2C3_IRQHandler,
    LPSPI3_IRQHandler,
    LPUART3_IRQHandler,
    PORTE_IRQHandler,
    LPCMP1_IRQHandler,
    RF0_0_IRQHandler,
    RF0_1_IRQHandler,
};

以I2C中断为例

DEFINE_IRQ_HANDLER(LPI2C3_IRQHandler, LPI2C3_DriverIRQHandler);

#define DEFINE_IRQ_HANDLER(irq_handler, driver_irq_handler) \
    void __attribute__((weak)) irq_handler(void) { driver_irq_handler();}

因此调用

(3)LPI2C3_DriverIRQHandler@fsl_lpi2c.c

void LPI2C3_DriverIRQHandler(void)
{
    LPI2C_CommonIRQHandler(LPI2C3, 3);
}

static void LPI2C_CommonIRQHandler(LPI2C_Type *base, uint32_t instance)
{
    /* Check for master IRQ. */
    if ((base->MCR & LPI2C_MCR_MEN_MASK) && s_lpi2cMasterIsr)
    {
        /* Master mode. */
        s_lpi2cMasterIsr(base, s_lpi2cMasterHandle[instance]);
    }

    /* Check for slave IRQ. */
    if ((base->SCR & LPI2C_SCR_SEN_MASK) && s_lpi2cSlaveIsr)
    {
        /* Slave mode. */
        s_lpi2cSlaveIsr(base, s_lpi2cSlaveHandle[instance]);
    }
}

考虑Master mode情况, 在LPI2C_MasterTransferCreateHandle()中

s_lpi2cMasterIsr = LPI2C_MasterTransferHandleIRQ;

该函数是I2C以句柄方式发送数据中断服务函数

 

 

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值