> I'm thinking of writing a generic IRQ handler instead of a
> direct branch to VIC-vector register from vector table,
You mean something like this ....
irq_isr:
/* Save IRQ context, including the APCS registers, and r4-6 */
sub lr, lr, #4
stmfd sp!, {r0-r6, ip, lr}
/* Save the SPSR_irq register */
mrs r4, spsr
/* Read the VICVectAddr */
ldr r5, VICVECTADDR
ldr r6, [r5]
/* Change to SYS mode and enable IRQ */
msr cpsr_c, #SYS_MODE
/* Debug:
* Comment out the change to system mode with IRQs enabled
* and uncomment the following to leave IRQs disabled. IRQs
* are then handled non-nested (with more overhead than normal)
*/
/* msr cpsr_c, #SYS_MODE|IRQ_DISABLE*/
/* Save the banked SYS mode link register */
stmfd sp!, {lr}
/* Call the C-coded handler */
mov lr, pc
mov pc, r6
/* Restore SYS mode link register */
ldmfd sp!, {lr}
/* Change to IRQ mode and disable IRQ */
msr cpsr_c, #IRQ_MODE|IRQ_DISABLE
/* Restore the SPSR */
msr spsr, r4
/* Acknowledge the VIC */
mov r0, #0
str r0, [r5]
/* Restore IRQ context and return from interrupt */
ldmfd sp!, {r0-r6, ip, pc}^
VICVECTADDR: .word 0xFFFFF030Message
Re: [lpc2000] {To TomW} GCC-Bug in IRQs
2006-03-25 by David Hawkins
Attachments
- No local attachments were found for this message.