Jameco Electronics 2000 Network Card User Manual


 
User’s Manual 321
C.3 Interrupts
When enabled for User mode access, a peripheral interrupt (if it is capable of generating
an interrupt) can only be requested at Interrupt Priority Level -2 or -1. Interrupts (and RSTs
and SYSCALL) all enter the System mode automatically. There will be times, however, that
an interrupt should be handled in the User mode. The solution to this is for the System
mode interrupt vector to reenter User mode before calling the User mode interrupt handler.
An example of both system and user interrupt handling is shown in Figure C-1.
Figure C-1. Interrupt Handing in System/User Mode
Some sample code for both System mode interrupts and User mode interrupts is shown
below.
system_isr: ; jumped to from interrupt vector table
... handle interrupt ...
sures ; reenter previous mode
ret
user_isr: ; jumped to from interrupt vector table
push su ; preserve current SU stack
setusr ; enter user mode
... handle interrupt ...
pop su ; restore previous SU stack
sures ; reenter previous mode
ret
INTERRUPT UNDER SYSTEM CONTROL
Application code (user)
ISR (system)
Application code (user)
INTERRUPT UNDER USER CONTROL
Application code (user)
Application ISR (user)
Application code (user)
ISR (system)