...write an IRQ interrupt service routine in C?
Do I need to do anything special to implement an IRQ interrupt service routine in C?
If you are using a CPU or board support package then use the supplied functions ctl_set_isr and ctl_unmask_isr to program the interrupt controller of the device.
If you are not using a CPU or board support package then you will have to write the irq_handler in ARM assembly code.
Additionally you will need to call the function libarm_enable_irq to enable interrupts.
-
Thanks Paul, I'm on an ADuC7020, so I've been studying the code in Analog_ADuC7000.c. So is it safe to say that my example is in ctl_start_timer?
void
ctl_start_timer(CTL_ISR_FN_t isr)
{
T0LD = TIMER_RECHARGE;
#if __TARGET_PROCESSOR == ADuC7060 || __TARGET_PROCESSOR == ADuC7061
T0CON = 0xC4 | (2 << T0CON_T0CLKSEL_BIT); /* 10.24MHz, Timer 0 enable, periodic, core clock / 16 */
#else
T0CON = 0xC4; /* Timer 0 enable, periodic, core clock / 16 */
#endif
userTimerISR = isr;
ctl_set_isr(TIMER0_INT, 0, CTL_ISR_TRIGGER_FIXED, timerISR, 0);
ctl_unmask_isr(TIMER0_INT);
}
Please sign in to leave a comment.
Comments
3 comments