Page 432 - Programming Microcontrollers in C
P. 432

Handling Interrupts   417

                                       addu R2,R3\n ldw R2,(R2,0)\n \
                                       jsr R2\n ldm R1-R15,(R0)\n \
                                       addi R0,32\n addi R0,28\n rfi\n”)

                   void unused_vector(void)
                   {}


                   void handler(void)
                   {

                       Do_Interrupt();
                   }
                              Listing 8-9: Autovector Interrupt Handler
                              Following the table initialization, there is an assembly language
                          sequence.  This sequence is #defined as the function
                          Do_Interrupt(), which is called in the interrupt service routine
                          handler(). The first five assembly instructions clear 120 bytes on
                          the stack, enough to save the contents of registers 1 through 15, and

                              Table 8-1 Exception Vector Assignments

                                  Vector          Vector                Assignment
                                Number(s)      Offset (Hex)
                                    0              000
                   Reset
                                    1              004               Misaligned access
                                    2              008                 Access error
                                    3              00C                 Divide by zero
                                    4              010                Illegal instruction
                                    5              014               Privilege violation
                                    6              018                Trace exception
                                    7              01C              Breakpoint exception
                                    8              020              Unrecoverable error
                                    9              024                   Soft reset
                                   10              028                INT autovector
                                   11              02C                FINT autovector
                                   12              030             Hardware accelerator
                                   13              034                  (Reserved)
                                   14              038
                                   15              03C
                                  16-19          040-04C        Trap #0-3 Instruction Vectors
                                  20-31          050-07C                 Reserved
                                 32-127          080-1FC           Reserved for vectored
                                                                   interrupt controller use
   427   428   429   430   431   432   433   434   435   436   437