#include "t549.h" /**************************************************************************/ /*Name: setvec.c (for near mode ) */ /*Purpose: Installs a isr routine for an interrupt. */ /*Parameters: int_num - Interrupt number */ /* see VECTAB.ASM for more information */ /* handler - pointer to the isr routine to be installed */ /*Returns: Nothing */ /*Notes: */ /* The interrupt locations may be remapped to a location of */ /* your choice */ /* by setting the proper value for the IPTR located on the */ /* PMST register */ /* See TMS320c54X manual for more information on interrupts. */ /*Compile with: cl500 -mn setvec.c */ /**************************************************************************/ extern int INTRLOC; void dm2pm(void *prog_dest, void *data_source, unsigned n); void setvec(Uint int_num, void * handler) { void *prog_dest, *data_source; unsigned int pmst, interruptLocation; interruptLocation = (unsigned int)&INTRLOC; pmst = C5XX_PMST; pmst = (interruptLocation & 0xff80) | (pmst & 0x7f); C5XX_PMST = pmst; prog_dest = (void *) (interruptLocation + ((int_num * 4) + 1)); dm2pm(prog_dest, &handler, 1); /*install handler */ } void __foo__() { nop_isr(); }