Source Code Files
Contents
USB08 Evaluation Board
Designer Reference Manual
MOTOROLA
Source Code Files
105
//----------------------------------------------------------------------------
#define ENDPOINT_HALT0x00
#define RT_ENDPOINT0x02
// CLEAR_FEATURE Standard Device Request Handler
// called by handleSETUP();
//
void clearFeature() {
if( SetupBuffer.wValue.hi ||
SetupBuffer.wIndex.hi ||
SetupBuffer.wLength.hi ||
SetupBuffer.wLength.lo)
// check 0-fields
forceSTALL();
else if((SetupBuffer.bmRequestType == RT_ENDPOINT) &&
(SetupBuffer.wValue.lo == ENDPOINT_HALT) &&
((SetupBuffer.wIndex.lo==0x81) || (SetupBuffer.wIndex.lo==0x02))) {
// clear EP1/2 Force STALL Bit
if(SetupBuffer.wIndex.lo == 0x81) {// EP1
UCR1 &= ~(BBM_STALL1); // clear STALL, Sequence = DATA0
}
else {
// EP2
UCR2 &= ~BM_STALL2;
// clear STALL
R2Sequence = 0;
// Sequence = DATA0
}
// prepare to send empty DATA1 at next IN Transaction
UCR0 = BM B 0;
}
else forceSTALL();
}
//----------------------------------------------------------------------------
// SET_ADDRESS Standard Device Request Handler
// called by handleSETUP();
//
void setAddress() {
if( SetupBuffer.wIndex.hi ||
SetupBuffer.wIndex.lo ||
SetupBuffer.wLength.hi ||
SetupBuffer.wLength.lo ||
SetupBuffer.wValue.hi ||
(SetupBuffer.wValue.lo & 0x80))
forceSTALL();
else {
// prepare to send empty DATA1 at next IN Transaction
UCR0 = BM B 0;
}
}
//----------------------------------------------------------------------------