Hi people,
Is it possible to write the following assembler code that I find in CodeWarrior6-Manual (to control the Interrupt priority in software) with C code? Can you show me how to do? Actually it doesn't seem possible to control how to save the interrupted routines with C code and CodeWarrior6. Is it possible to control the generated code by compiler in order to manage the ISR? If isn't possible I'll have to use a code as the following (I don't like to use assembler!!). For ISRs that require a significant number of instruction cycles to complete, it is possible to reduce the interrupt servicing overhead if all interrupts can be considered to have the same priority. This is shown in the following generic ISR. ; Interrupt Service Routine for Long Interrupt ; DSP56800 core (Interrupts Remain Masked, 11 Overhead Cycles) JSR ISR ; located in interrupt vector table ISR ; Long ISR BFCLR #$0200,SR; re-enable interrupts with new mask ; (interrupt code) RTI For ISRs that require a significant number of instruction cycles to complete, it is possible for the user to still program interrupt priorities in software. This is shown in the following generic ISR. ; Generic Long ISR on the DSP56100 architecture (5 Overhead Cycles) JSR ISR ; Instr located in Interrupt Vector Table ; (instructions) ISR ;(interrupt code) ; Interrupt Service Routine RTI ; Generic ISR - DSP56800 core (20 Overhead Cycles) JSR ISR ; Instr located in Interrupt Vector Table ; (instructions) ISR ; ISR LEA (SP)+ MOVE N,X:(SP)+ ; Save "N" register for usage by ISR MOVE X:IPR,N ; Save interrupted task's IPR MOVE N,X:(SP) MOVE #xxxx,X:IPR ; Load new mask - defines which can interrupt ; this ISR BFCLR #$0200,SR ; Re-enable interrupts with new mask ; (interrupt code) POP N ; Restore interrupted task's IPR MOVE N,X:IPR POP N ; Restore saved register used by ISR RTI Thank you Alessandro |