RESULT MASS_NoData_Setup(u8 RequestNo) 这个函数的内容 是根据什么来写的 例子: RESULT MASS_NoData_Setup(u8 RequestNo) { if ((Type_Recipient == (CLASS_REQUEST | INTERFACE_RECIPIENT)) && (RequestNo == MASS_STORAGE_RESET) && (pInformation->USBwValue == 0) && (pInformation->USBwIndex == 0) && (pInformation->USBwLength == 0x00)) { /* Initialize Endpoint 1 */ ClearDTOG_TX(ENDP1);
/* Initialize Endpoint 2 */ ClearDTOG_RX(ENDP2);
/*intialise the CBW signature to enable the clear feature*/ CBW.dSignature = BOT_CBW_SIGNATURE; Bot_State = BOT_IDLE;
return USB_SUCCESS; } return USB_UNSUPPORT; } 例子2 RESULT Joystick_Data_Setup(u8 RequestNo) { u8 *(*CopyRoutine)(u16);
CopyRoutine = NULL;
if ((RequestNo == GET_DESCRIPTOR) && (Type_Recipient == (STANDARD_REQUEST | INTERFACE_RECIPIENT)) && (pInformation->USBwIndex0 == 0)) {
if (pInformation->USBwValue1 == REPORT_DESCRIPTOR) { CopyRoutine = Joystick_GetReportDescriptor; } else if (pInformation->USBwValue1 == HID_DESCRIPTOR_TYPE) { CopyRoutine = Joystick_GetHIDDescriptor; }
} /* End of GET_DESCRIPTOR */
/*** GET_PROTOCOL ***/ else if ((Type_Recipient == (CLASS_REQUEST | INTERFACE_RECIPIENT)) && RequestNo == GET_PROTOCOL) { CopyRoutine = Joystick_GetProtocolValue; }
if (CopyRoutine == NULL) { return USB_UNSUPPORT; }
pInformation->Ctrl_Info.CopyData = CopyRoutine; pInformation->Ctrl_Info.Usb_wOffset = 0; (*CopyRoutine)(0); return USB_SUCCESS; }
|