Motorola MSC8101 ADS User's Guide Page 151

  • Download
  • Add to my manuals
  • Print
  • Page
    / 346
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 150
Interrupt Programming Examples
Interrupts and Interrupt Priorities 7-17
memcpy((void*)(VBA + 0x0c00), &PIC_Code,0x50);
//clear whole SIC branch table
memset(SIC_BranchTable, 0 , sizeof(SIC_BranchTable));
//clear any previous SIC interrupt in Irq Pending Register B:
QMM->Iprb = 0x0001;
//Configure Edge/Level-Triggered Irq Priority Register E to enable IRQ16:
//Irq16 (SIC), level-triggered, Irq priority level=3
QMM->Elire = (QMM->Elire & 0xFFF0) | 0x0003;
IMM->ic_sipnr_l = 0xFFFFFFFF; //clear any previous interrupts in SIC-reg.
IMM->ic_simr_l = 0x00000000; //disable all interrupts
asm("ei"); //enable interrupts
}
#pragma interrupt PIC_Code
void PIC_Code()
{
/* This function must be copied to the location ’VBA+0x0C00’ within the PIC
Irq routing table. Ensure that max. 50 bytes (64-(6+6+2)) of assembly code
are included into this function. */
//asm("jsr _QCtxtSave");
//6 bytes for JSR, created by #pragma to push registers into stack
asm("di");
SIC_IrqHandler();
asm("ei");
//asm("jsr _QCtxtRestore"); //6 bytes for JSR, created by #pragma to pop
//registers from stack
//asm("rte"); //2 bytes, created by #pragma to return from
//interrupt
}
/************************************************/
/* SIC_IrqHandler */
/************************************************/
void SIC_IrqHandler()
{
/*Ensure that the SIC interrupt branch
table is allocated (global) with ’UWORD SIC_BranchTable[64]’.*/
UBYTE sivec;
sivec=(IMM->ic_sivec>>26);//IMM->ic_sivec bits 0-31 wheras only bits 0-5 matters
SIC_BranchTable[ sivec].Interrupt(SIC_BranchTable[ sivec].Serial);
}
/* asm("move.l _IMM,r0"); //IMM base address
asm("move.l #$00010C04,r1"); //SIVEC offset
Page view 150
1 2 ... 146 147 148 149 150 151 152 153 154 155 156 ... 345 346

Comments to this Manuals

No comments