ok how can i response to the MSD_RESET as i try that
void USBCheckMSDRequest(void)
{
byte recipient;
byte bIntfID;
word wValue;
recipient = SetupPacket.bmRequestType & 0x1F;
bIntfID = SetupPacket.wIndex0;
if(recipient != USB_SETUP_RECIPIENT_INTERFACE) return;
if(bIntfID != 0) return;
switch(SetupPacket.bRequest)
{
case MSD_RESET:
//First make sure all request parameters are correct:
//MSD BOT specs require wValue to be == 0x0000 and wLength == 0x0000
if(((SetupPacket.wValue0 != 0) && (SetupPacket.wValue1 !=0)) || (SetupPacket.wLength != 0))
{
return; //Return without handling the request (results in STALL)
}
requestHandled = 1;
//The MSD reset should re-initialize status
//so as to prepare for a new CBW. Any currently ongoing command
//block should be aborted, but the STALL and DTS states need to be
//maintained (host will re-initialize these seperately using
//CLEAR_FEATURE, endpoint halt).
MSD_State = MSD_WAIT;
MSDCommandState = MSD_COMMAND_WAIT;
MSDReadState = MSD_READ10_WAIT;
MSDWriteState = MSD_WRITE10_WAIT;
MSDCBWValid = True;
//Need to re-arm MSD bulk OUT endpoint, if it isn't currently armed,
//to be able to receive next CBW. If it is already armed, don't need
//to do anything, since we can already receive the next CBW (or we are
//STALLed, and the host will issue clear halt first).
if(!(ep1Bo.Stat & UOWN))
{
MSDInitEndpoint();
}
break;
case GET_MAX_LUN:
//portd=255;
//First make sure all request parameters are correct:
//MSD BOT specs require wValue to be == 0x0000, and wLengh == 1
if(((SetupPacket.wValue0 != 0) && (SetupPacket.wValue1 !=0)) || (SetupPacket.wLength != 1))
{
break; //Return without handling the request (results in STALL)
}
requestHandled = 1;
//If the host asks for the maximum number of logical units
// then send out a packet with that information
controlTransferBuffer[0] = MAX_LUN;
outPtr = (byte*)&controlTransferBuffer;
wCount = 1;
transferType=0;
break;
}
}
as when i tried to let for example do
portd=255;
when entering the MSD_RESET condition as an indicator it didn't change it still portd=0;
all i wanna know when the host send MSD_RESET or he didn't send it at all?