Designer Reference Manual USB08 Evaluation Board
106 Source Code Files MOTOROLA
Source Code Files
// SET_CONFIGURATION Standar d De vi ce Request Handler
// called by handleSETU P();
//
void setConfiguration() {
if( SetupBuffer.wIndex.hi | |
SetupBuffer.wIndex.lo | |
SetupBuffer.wLength.hi ||
SetupBuffer.wLength.lo ||
SetupBuffer.wValue.hi | |
(SetupBuffer.wValue.lo > 1) ||
(USB_State == US_DEFAUL T)) {
forceSTALL();
}
else {
if(SetupBuffer.wValue.l o > 0) {
// no need to remember the Configuration Value
// since we support only one Configuration anyway
USB_State = US_CONFIGURED;
// Activate Interrupt E ndpoints, reset STALL an d DATA-Toggle
UCR1 = BM_TX1E + 0; // EP1 Tx Enable, Data Size is 0
UCR2 = BM_RX2E; // EP2 Rx Enable
}
else {
// Zero means: go back to Adressed State
USB_State = US_ADDRESSED;
UCR1 = 0; // deactivate EP1
UCR2 = 0; // deactivate EP2
}
// prepare to send empt y DATA1 at next IN Trans action
UCR0 = BM_T0SEQ + BM_TX 0E + 0;
}
}
//--------------------- ------------------------ ------------------------- ------