Source code files – Motorola USB08 User Manual

Page 106

Advertising
background image

Designer Reference Manual

USB08 Evaluation Board

106

Source Code Files

MOTOROLA

Source Code Files

// SET_CONFIGURATION Standard Device Request Handler

// called by handleSETUP();

//

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_DEFAULT)) {

forceSTALL();

}

else {

if(SetupBuffer.wValue.lo > 0) {

// no need to remember the Configuration Value

// since we support only one Configuration anyway

USB_State = US_CONFIGURED;

// Activate Interrupt Endpoints, reset STALL and 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 empty DATA1 at next IN Transaction

UCR0 = BM_T0SEQ + BM_TX0E + 0;

}

}

//----------------------------------------------------------------------------

Advertising