V1.9
This commit is contained in:
@@ -22,7 +22,7 @@ uint8_t USBD_Endp3_Busy;
|
||||
uint16_t USB_Rx_Cnt = 0;
|
||||
uint8_t HID_Buffer[DEF_USBD_MAX_PACK_SIZE];
|
||||
/*********************************************************************
|
||||
* @fn EP2_IN_Callback
|
||||
* @fn EP1_IN_Callback
|
||||
*
|
||||
* @brief Endpoint 1 IN.
|
||||
*
|
||||
|
||||
@@ -210,57 +210,59 @@ void USBD_init(void)
|
||||
*/
|
||||
void USBD_Reset(void)
|
||||
{
|
||||
pInformation->Current_Configuration = 0;
|
||||
pInformation->Current_Feature = USBD_ConfigDescriptor[7];
|
||||
pInformation->Current_Interface = 0;
|
||||
pInformation->Current_Configuration = 0;
|
||||
pInformation->Current_Feature = USBD_ConfigDescriptor[7];
|
||||
pInformation->Current_Interface = 0;
|
||||
|
||||
SetBTABLE(BTABLE_ADDRESS);
|
||||
SetBTABLE(BTABLE_ADDRESS);
|
||||
|
||||
SetEPType(ENDP0, EP_CONTROL);
|
||||
SetEPTxStatus(ENDP0, EP_TX_STALL);
|
||||
SetEPRxAddr(ENDP0, ENDP0_RXADDR);
|
||||
SetEPTxAddr(ENDP0, ENDP0_TXADDR);
|
||||
Clear_Status_Out(ENDP0);
|
||||
SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
|
||||
SetEPRxValid(ENDP0);
|
||||
_ClearDTOG_RX(ENDP0);
|
||||
_ClearDTOG_TX(ENDP0);
|
||||
SetEPType(ENDP0, EP_CONTROL);
|
||||
SetEPTxStatus(ENDP0, EP_TX_STALL);
|
||||
SetEPRxAddr(ENDP0, ENDP0_RXADDR);
|
||||
SetEPTxAddr(ENDP0, ENDP0_TXADDR);
|
||||
Clear_Status_Out(ENDP0);
|
||||
SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
|
||||
SetEPRxValid(ENDP0);
|
||||
_ClearDTOG_RX(ENDP0);
|
||||
_ClearDTOG_TX(ENDP0);
|
||||
|
||||
SetEPType(ENDP1, EP_INTERRUPT);
|
||||
SetEPTxStatus(ENDP1, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
|
||||
SetEPRxStatus(ENDP1, EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP1);
|
||||
_ClearDTOG_RX(ENDP1);
|
||||
SetEPType(ENDP1, EP_INTERRUPT);
|
||||
SetEPTxStatus(ENDP1, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
|
||||
SetEPRxStatus(ENDP1, EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP1);
|
||||
_ClearDTOG_RX(ENDP1);
|
||||
|
||||
SetEPType(ENDP2, EP_BULK);
|
||||
SetEPTxStatus(ENDP2, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP2, ENDP2_RXADDR);
|
||||
SetEPRxCount(ENDP2, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP2,EP_RX_VALID);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
SetEPType(ENDP2, EP_BULK);
|
||||
SetEPTxStatus(ENDP2, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP2, ENDP2_RXADDR);
|
||||
SetEPRxCount(ENDP2, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP2,EP_RX_VALID);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
|
||||
SetEPType(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP3, ENDP3_TXADDR);
|
||||
SetEPRxStatus(ENDP3, EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
USBD_Endp3_Busy = 0;
|
||||
|
||||
SetEPType(ENDP4, EP_INTERRUPT);
|
||||
SetEPTxStatus(ENDP4, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP4, ENDP4_TXADDR);
|
||||
SetEPRxAddr(ENDP4, ENDP4_RXADDR);
|
||||
SetEPRxCount(ENDP4, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP4, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP4);
|
||||
_ClearDTOG_RX(ENDP4);
|
||||
SetEPType(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP3, ENDP3_TXADDR);
|
||||
SetEPRxStatus(ENDP3, EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
USBD_Endp3_Busy = 0;
|
||||
|
||||
SetDeviceAddress(0);
|
||||
SetEPType(ENDP4, EP_INTERRUPT);
|
||||
SetEPTxStatus(ENDP4, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP4, ENDP4_TXADDR);
|
||||
SetEPRxAddr(ENDP4, ENDP4_RXADDR);
|
||||
SetEPRxCount(ENDP4, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP4, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP4);
|
||||
_ClearDTOG_RX(ENDP4);
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
SetDeviceAddress(0);
|
||||
|
||||
USBD_Endp3_Busy = 0;
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
||||
Reference in New Issue
Block a user