Hello Junjun,
The information below is valid for single core MPC55xx/56xx. In case of dualcore the additional core INTC is initialized in a bit different way.
The project generated by the wizard configures INTC to the software vector mode. In order to use Hw vector mode I'd suggest you to use cookbook example as a template project instead of Wizard generated one: e.g:
<CW for MPC55xx and MPC56xx 2.x>\(CodeWarrior_Examples)\555x-CW\INTC-HWvector\
The CodeWarrior project initializes IVOR4 - External input interrupt during the startup. The default IVOR4 handler is INTC_INTCInterruptHandler(). This handler includes:
- interrupt prolog
- read the Interrupt controller acknowledge register (IACKR)
- branch into particular service routine in the interrupt handlers table
- signalization of end of the servicing of the interrupt request (EOIR).
- interrupt epilog
- return from interrupt
The interrupt handlers vector table is located in RAM - INTCInterruptsHandlerTable[ ] and includes the addresses of the handlers for all the interrupt requests supported by the INTC interrupt controller. The default size of the table is 308*4 ( macro INTC_INTERRUPTS_REQUEST_VECTOR_TABLE_SIZE) for all derivatives. If the real number of external interrupts for the particular derivative is different you can update this macro.
In order to assign a custom interrupt handler you should:
- Initialize particular interrupt handler vector table entry in the code before the interrupts are enabled e.g.:
INTC_InstallINTCInterruptHandler(SwIrq4ISR, 4, 2); //Software Interrupt
where
SwIrq4ISR is address of the interrupt handler
4 is interrupt vector number (see the MCU reference manual, INTC Interrupt controller section, "Interrupt vector table")
2 is PSR priority assigned to the interrupt source
2. Enable interrupts by decreasing value of current priority register (CPR) E.g.
INTC.CPR.R = 0;
Hope this will help
Stanish