
Designer Reference Manual USB08 Evaluation Board
112 Source Code Files MOTOROLA
Source Code Files
// USB Interrupt Handle r
// All Interrupt Source s of the JB8’s integrated USB pe ri phe ral
// will be treated by this ISR
//
@interrupt void isrUSB( ) {
if(UIR1 & BM_EOPF) { // End of Packet detected?
SuspendCounter = 0; // reset 3ms-Suspend Counter
UIR2 = BM_EOPFR; // reset EOP Intr Flag
}
else if(UIR1 & BM_RXD0F) { // has EP0 received some data?
if(USR0 & BM_SETUP) // was it a SETUP Packet?
handleSETUP();
else // or a normal OUT Packet
handleOUT();
}
else if(UIR1 & BM_TXD0F) { // has EP0 sent Data?
handleIN();
}
else if(UIR1 & BM_TXD1F) { // has EP1 sent Data?
handleIN1();
}
else if(UIR1 & BM_RXD2F) { // has EP2 received Data?
handleOUT2();
}
else if(UIR1 & BM_RSTF) { // USB Reset Signal Sta te detected?
initUSB(); // Soft Reset of USB Systems
UCR3 |= BM_ENABLE1+BM_E NABLE2; // Enable EP1 and EP2
UIR0 = BM_TXD0IE + BM_R XD0IE + // EP0 Rx/Tx Intr Enabl e and
BM_TXD1IE + BM_RXD2I E + // EP1 Tx and EP2 Rx Intr En able
BM_EOPIE; // and End-of-Packet Intr En able
UCR0 |= BM_RX0E; // EP0 Receive Enable
USB_State = US_DEFAULT; // Device is powered an d reset
}
}
//===================== ======================== ======================= ========