/******************************************************************************* * Function Name : MASS_Reset * Description : Mass Storage reset routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ void MASS_Reset() { /* Set the device as not configured */ Device_Info.Current_Configuration = 0; /* Current Feature initialization */ pInformation->Current_Feature = MASS_ConfigDescriptor[7]; #ifdef STM32F10X_CL /* EP0 is already configured by USB_SIL_Init() function */ /* Init EP1 IN as Bulk endpoint */ OTG_DEV_EP_Init(EP1_IN, OTG_DEV_EP_TYPE_BULK, BULK_MAX_PACKET_SIZE); /* Init EP2 OUT as Bulk endpoint */ OTG_DEV_EP_Init(EP2_OUT, OTG_DEV_EP_TYPE_BULK, BULK_MAX_PACKET_SIZE); #else SetBTABLE(BTABLE_ADDRESS); /* Initialize Endpoint 0 */ SetEPType(ENDP0, EP_CONTROL); SetEPTxStatus(ENDP0, EP_TX_NAK); SetEPRxAddr(ENDP0, ENDP0_RXADDR); SetEPRxCount(ENDP0, Device_Property.MaxPacketSize); SetEPTxAddr(ENDP0, ENDP0_TXADDR); Clear_Status_Out(ENDP0); SetEPRxValid(ENDP0); /* Initialize Endpoint 1 */ SetEPType(ENDP1, EP_BULK); SetEPTxAddr(ENDP1, ENDP1_TXADDR); SetEPTxStatus(ENDP1, EP_TX_NAK); SetEPRxStatus(ENDP1, EP_RX_DIS); /* Initialize Endpoint 2 */ SetEPType(ENDP2, EP_BULK); SetEPRxAddr(ENDP2, ENDP2_RXADDR); SetEPRxCount(ENDP2, Device_Property.MaxPacketSize); SetEPRxStatus(ENDP2, EP_RX_VALID); SetEPTxStatus(ENDP2, EP_TX_DIS); SetEPRxCount(ENDP0, Device_Property.MaxPacketSize); SetEPRxValid(ENDP0); /* Set the device to response on default address */ SetDeviceAddress(0); #endif /* STM32F10X_CL */ bDeviceState = ATTACHED; CBW.dSignature = BOT_CBW_SIGNATURE; Bot_State = BOT_IDLE; USB_NotConfigured_LED(); }
/******************************************************************************* * Function Name : MASS_Reset * Description : Mass Storage reset routine. * Input : None. * Output : None. * Return : None. *******************************************************************************/ void MASS_Reset() { /* Set the device as not configured */ Device_Info.Current_Configuration = 0; /* Current Feature initialization */ pInformation->Current_Feature = MASS_ConfigDescriptor[7]; SetBTABLE(BTABLE_ADDRESS); /* Initialize Endpoint 0 */ SetEPType(ENDP0, EP_CONTROL); SetEPTxStatus(ENDP0, EP_TX_NAK); SetEPRxAddr(ENDP0, ENDP0_RXADDR); SetEPRxCount(ENDP0, Device_Property.MaxPacketSize); SetEPTxAddr(ENDP0, ENDP0_TXADDR); Clear_Status_Out(ENDP0); SetEPRxValid(ENDP0); /* Initialize Endpoint 1 */ SetEPType(ENDP1, EP_BULK); SetEPTxAddr(ENDP1, ENDP1_TXADDR); SetEPTxStatus(ENDP1, EP_TX_NAK); SetEPRxStatus(ENDP1, EP_RX_DIS); /* Initialize Endpoint 2 */ SetEPType(ENDP2, EP_BULK); SetEPRxAddr(ENDP2, ENDP2_RXADDR); SetEPRxCount(ENDP2, Device_Property.MaxPacketSize); SetEPRxStatus(ENDP2, EP_RX_VALID); SetEPTxStatus(ENDP2, EP_TX_DIS); SetEPRxCount(ENDP0, Device_Property.MaxPacketSize); SetEPRxValid(ENDP0); /* Set the device to response on default address */ SetDeviceAddress(0); bDeviceState = ATTACHED; CBW.dSignature = BOT_CBW_SIGNATURE; Bot_State = BOT_IDLE; USB_NotConfigured_LED(); }