__inline unsigned int AT91F_AIC_ConfigureIt ( AT91PS_AIC pAic, // arg pointer to the AIC registers unsigned int irq_id, // arg interrupt number to initialize unsigned int priority, // arg priority to give to the interrupt unsigned int src_type, // arg activation and sense of activation void (*newHandler) (void) ) // arg address of the interrupt handler { unsigned int oldHandler; unsigned int mask ;
oldHandler = pAic->AIC_SVR[irq_id];
mask = 0x1 << irq_id ; //* Disable the interrupt on the interrupt controller pAic->AIC_IDCR = mask ; //* Save the interrupt handler routine pointer and the interrupt priority pAic->AIC_SVR[irq_id] = (unsigned int) newHandler ; //* Store the Source Mode Register pAic->AIC_SMR[irq_id] = src_type | priority ; //* Clear the interrupt on the interrupt controller pAic->AIC_ICCR = mask ;
return oldHandler; } 这个函数具体在做什么?什么时候调用?为什么要返回oldHandler? |