/****************************************************************************** * Function: void USBCheckStdRequest(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This routine checks the setup data packet to see if it * knows how to handle it * * Note: None *****************************************************************************/ void USBCheckStdRequest(void) { if(SetupPkt.RequestType != STANDARD) return; switch(SetupPkt.bRequest) { case SET_ADR: ctrl_trf_session_owner = MUID_USB9; usb_device_state = ADR_PENDING_STATE; // Update state only /* See USBCtrlTrfInHandler() in usbctrltrf.c for the next step */ break; case GET_DSC: USBStdGetDscHandler(); break; case SET_CFG: USBStdSetCfgHandler(); break; case GET_CFG: ctrl_trf_session_owner = MUID_USB9; pSrc.bRam = (byte*)&usb_active_cfg; // Set Source usb_stat.ctrl_trf_mem = _RAM; // Set memory type LSB(wCount) = 1; // Set data count break; case GET_STATUS: USBStdGetStatusHandler(); break; case CLR_FEATURE: case SET_FEATURE: USBStdFeatureReqHandler(); break; case GET_INTF: ctrl_trf_session_owner = MUID_USB9; pSrc.bRam = (byte*)&usb_alt_intf+SetupPkt.bIntfID; // Set source usb_stat.ctrl_trf_mem = _RAM; // Set memory type LSB(wCount) = 1; // Set data count break; case SET_INTF: ctrl_trf_session_owner = MUID_USB9; usb_alt_intf[SetupPkt.bIntfID] = SetupPkt.bAltID; break; case SET_DSC: case SYNCH_FRAME: default: break; }//end switch }//end USBCheckStdRequest
/****************************************************************************** * Function: void USBCheckStdRequest(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: This routine checks the setup data packet to see if it * knows how to handle it * * Note: None *****************************************************************************/ void USBCheckStdRequest(void) { if(SetupPkt.RequestType != STANDARD) return; switch(SetupPkt.bRequest) { case SET_ADR: ctrl_trf_session_owner = MUID_USB9; usb_device_state = ADR_PENDING_STATE; // Update state only /* See USBCtrlTrfInHandler() in usbctrltrf.c for the next step */ break; case GET_DSC: ctrl_trf_session_owner = MUID_USB9; if(SetupPkt.bDscType == DSC_DEV) { pSrc.bRom = (rom byte*)&device_dsc; wCount._word = sizeof(device_dsc); // Set data count } else if(SetupPkt.bDscType == DSC_CFG) { pSrc.bRom = (rom byte*)&cfg01; wCount._word = sizeof(cfg01); // Set data count } else if(SetupPkt.bDscType == DSC_STR) { pSrc.bRom = (rom byte*)&sd000; wCount._word = sizeof(sd000); // Set data count } else /* * This is required to stall the DEVICE_QUALIFIER request */ ctrl_trf_session_owner = MUID_NULL; usb_stat.ctrl_trf_mem = _ROM; // Set memory type break; case SET_CFG: USBStdSetCfgHandler(); break; case GET_CFG: ctrl_trf_session_owner = MUID_USB9; pSrc.bRam = (byte*)&usb_active_cfg; // Set Source usb_stat.ctrl_trf_mem = _RAM; // Set memory type LSB(wCount) = 1; // Set data count break; //case GET_STATUS: // USBStdGetStatusHandler(); // break; //case CLR_FEATURE: //case SET_FEATURE: // USBStdFeatureReqHandler(); // break; //case GET_INTF: // ctrl_trf_session_owner = MUID_USB9; // pSrc.bRam = (byte*)&usb_alt_intf+SetupPkt.bIntfID; // Set source // usb_stat.ctrl_trf_mem = _RAM; // Set memory type // LSB(wCount) = 1; // Set data count // break; //case SET_INTF: // ctrl_trf_session_owner = MUID_USB9; // usb_alt_intf[SetupPkt.bIntfID] = SetupPkt.bAltID; // break; //case SET_DSC: //case SYNCH_FRAME: default: break; }//end switch }//end USBCheckStdRequest