How to write interrupt service routine in codewarrior 8.1 for MPC555?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to write interrupt service routine in codewarrior 8.1 for MPC555?

3,002 Views
Aaron_zhang
Contributor I
hello,I am trying to write my own ISR,but MPC555's Interrupt is somewhat different .
 
1. Its external interrupt sources share one Interrupt vector address--0x00000500 or 0xFFF00500, so i get confused.I wonder if there are two or more interrupt sources share  0x00000500, how does PowerPC choose the right ISR from many ISRs?
 
2. I write a PIT code here.It's not completed. Could someone tell me how to write the PIT's ISR?
 
 
UINT32 pitctr = 0;    // Counter of PIT interrupts
 
void init555(int freq)
{
USIU.SYPCR.R = 0xffffff03;            // Disable watchdog timer. 
USIU.PLPRCRK.R = 0x55ccaa33; //Unlock PLPRC with special key
if (freq == 56)
{
USIU.PLPRCR.R = 0x00d3d000;   // 14x PLL operation on normal power mode
}
else
{
USIU.PLPRCR.R = 0x0093d000;   // 10x PLL operation on normal power mode
}
UIMB.UMCR.B.HSPEED = 0;        // Make IMB clock = System Clock  
}
 
void initPIT()
{                                                     // SPECIFIC INITIALIZATIONS FOR PIT:
 USIU.PITC.B.PITC = 1000;          //Load desired count value
 USIU.PISCR.B.PITF = 1;             // Freeze enabled to stop PIT during debug mode
 USIU.PISCR.B.PTE  = 1;             // Enable PIT to start counting
 
                                                      // LEVEL ASSIGNMENT:
 USIU.PISCR.B.PIRQ = 0x80;       // Assign PIT interrupt to Level 0
 
                                                       // ENABLE INTERRUPT
 USIU.PISCR.B.PIE = 1;                // Enable PIT interrupt
 
                                                      // SET APPROPRIATE MASK
 USIU.SIMASK.R = 0x40000000;  // Enable level 0 interrupt; others disabled
}

void main()
{
 int i=0;
 init555(40);                                     // Perform minimal chip initialization
 initPIT();                                         // Initialize PIT
   
 asm(" mtspr EIE, r0");                   // Enable interrupts
 while (1) { i++; }                             // loop forever
}
 
/****************************ISR*********************************************/
void pitISR()                                 // PIT interrupt service routine
{
 USIU.PISCR.B.PS = 1;                // Negate interrupt request
 pitctr++;                                        // Increment PIT interrupt counter
}
 
 
Labels (1)
0 Kudos
2 Replies

695 Views
tim_milliken
Contributor III
Have a look at AN2109 and AN2472. They should help you get on track.
Tim 
0 Kudos

695 Views
Aaron_zhang
Contributor I
Is anyone else here?
who can help me?
0 Kudos