TMS320C66x study notes universal parallel port interrupt service program example
[Copy link]
The following pseudo code is a template for writing a uPP interrupt service routing (ISR) function. Note that the UPP combines all events into a single CPU interrupt, and a new interrupt will not call the ISR if the previous interrupt has not yet returned from the ISR. To allow further calls to the ISR, the End Interrupt UPP register (UPEOI) must be written with a zero value. Therefore, the ISR should check for multiple events, and continue to check again after processing each event until no more events are found. Then, it must write UPEOI = 0 before returning.
Function upp_isr
{
interrupt_status = UPIER
while (interrupt_status != 0)
{
if (interrupt_status.EOLI)
{
UPIER.EOLI = 1 // clear EOLI
// Handle EOLI...
}
if (interrupt_status.EOWI)
{
UPIER.EOWI = 1 // clear EOWI
// Handle EOWI...
}
if (interrupt_status.ERRI)
{
UPIER.ERRI = 1 // clear ERRI
// Handle ERRI...
}
if (interrupt_status.UORI)
{
UPIER.UORI = 1 // clear UORI
// Handle UORI...
}
if (interrupt_status.DPEI)
{
UPIER.DPEI = 1 // clear DPEI
// Handle DPEI...
}
if (interrupt_status.EOLQ)
{
UPIER.EOLQ = 1 // clear EOLQ
// Handle EOLQ...
}
if (interrupt_status.EOWQ)
{
UPIER.EOWQ = 1 // clear EOWQ
// Handle EOWQ...
}
if (interrupt_status.ERRQ)
{
UPIER.ERRQ = 1 // clear ERRQ
// Handle ERRQ...
}
if (interrupt_status.UORQ)
{
UPIER.UORQ = 1 // clear UORQ
// Handle UORQ...
}
if (interrupt_stat us.DPEQ)
{
UPIER.DPEQ = 1 // clear DPEQ
// Handle DPEQ...
}
// loop again if any interrupts are left
interrupt_status = UPIER
} // end of while
// write end of interrupt vector to allow future calls
UPEOI = 0
} // end of function
|