V1.9
This commit is contained in:
@@ -215,39 +215,41 @@ void USBD_Reset(void)
|
||||
_ClearDTOG_TX(ENDP0);
|
||||
|
||||
|
||||
SetEPType(ENDP1, EP_BULK);
|
||||
SetEPTxStatus(ENDP1, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP1, ENDP1_RXADDR);
|
||||
SetEPRxCount(ENDP1, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP1, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP1);
|
||||
_ClearDTOG_RX(ENDP1);
|
||||
SetEPType(ENDP1, EP_BULK);
|
||||
SetEPTxStatus(ENDP1, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP1, ENDP1_RXADDR);
|
||||
SetEPRxCount(ENDP1, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP1, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP1);
|
||||
_ClearDTOG_RX(ENDP1);
|
||||
|
||||
SetEPType(ENDP2, EP_BULK);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPRxStatus(ENDP2,EP_RX_DIS);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
SetEPType(ENDP2, EP_BULK);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPRxStatus(ENDP2,EP_RX_DIS);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
|
||||
SetEPType(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
|
||||
SetEPRxCount(ENDP3, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP3, EP_RX_VALID);
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
SetEPType(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
|
||||
SetEPRxCount(ENDP3, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP3, EP_RX_VALID);
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
|
||||
SetEPType(ENDP4, EP_BULK);
|
||||
SetEPTxStatus(ENDP4, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP4, ENDP4_TXADDR);
|
||||
SetEPRxStatus(ENDP4,EP_RX_DIS);
|
||||
_ClearDTOG_RX(ENDP4);
|
||||
_ClearDTOG_TX(ENDP4);
|
||||
SetEPType(ENDP4, EP_BULK);
|
||||
SetEPTxStatus(ENDP4, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP4, ENDP4_TXADDR);
|
||||
SetEPRxStatus(ENDP4,EP_RX_DIS);
|
||||
_ClearDTOG_RX(ENDP4);
|
||||
_ClearDTOG_TX(ENDP4);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
SetDeviceAddress(0);
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
USBD_Endp2_Busy = 0;
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -24,6 +24,8 @@ __attribute__ ((aligned(4))) uint8_t Data_Buffer[DEF_RING_BUFFER_SIZE];
|
||||
|
||||
uint8_t Request = 0;
|
||||
|
||||
|
||||
extern uint8_t USBD_Endp2_Busy;
|
||||
volatile uint8_t HID_Idle_Value[2] = {0};
|
||||
volatile uint8_t HID_Protocol_Value[2] = {0};
|
||||
|
||||
@@ -237,24 +239,26 @@ void USBD_Reset(void)
|
||||
_ClearDTOG_RX(ENDP0);
|
||||
_ClearDTOG_TX(ENDP0);
|
||||
|
||||
SetEPType(ENDP1, EP_INTERRUPT);
|
||||
SetEPTxStatus(ENDP1, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP1, ENDP1_RXADDR);
|
||||
SetEPRxCount(ENDP1, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP1, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP1);
|
||||
_ClearDTOG_RX(ENDP1);
|
||||
SetEPType(ENDP1, EP_INTERRUPT);
|
||||
SetEPTxStatus(ENDP1, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP1, ENDP1_RXADDR);
|
||||
SetEPRxCount(ENDP1, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP1, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP1);
|
||||
_ClearDTOG_RX(ENDP1);
|
||||
|
||||
SetEPType(ENDP2, EP_INTERRUPT);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
SetEPRxStatus(ENDP2,EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
SetEPType(ENDP2, EP_INTERRUPT);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
SetEPRxStatus(ENDP2,EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
USBD_Endp2_Busy = 0;
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -80,13 +80,13 @@ void Set_USBConfig( )
|
||||
*/
|
||||
void Enter_LowPowerMode(void)
|
||||
{
|
||||
bDeviceState = SUSPENDED;
|
||||
printf("usb enter low power mode\r\n");
|
||||
USBD_Sleep_Status |= 0x02;
|
||||
if (USBD_Sleep_Status == 0x03)
|
||||
{
|
||||
MCU_Sleep_Wakeup_Operate();
|
||||
}
|
||||
bDeviceState = SUSPENDED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -119,20 +119,18 @@ void USB_Interrupts_Config(void)
|
||||
|
||||
EXTI_ClearITPendingBit(EXTI_Line18);
|
||||
EXTI_InitStructure.EXTI_Line = EXTI_Line18;
|
||||
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Event;
|
||||
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
|
||||
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
|
||||
EXTI_Init(&EXTI_InitStructure);
|
||||
|
||||
EXTI->INTENR |= EXTI_INTENR_MR18;
|
||||
|
||||
NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
|
||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
|
||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
|
||||
NVIC_InitStructure.NVIC_IRQChannel = USBWakeUp_IRQn;
|
||||
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
|
||||
NVIC_Init(&NVIC_InitStructure);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -226,21 +226,24 @@ void USBD_Reset(void)
|
||||
_ClearDTOG_RX(ENDP0);
|
||||
_ClearDTOG_TX(ENDP0);
|
||||
|
||||
SetEPType(ENDP1, EP_INTERRUPT);
|
||||
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
|
||||
SetEPTxStatus(ENDP1, EP_TX_NAK);
|
||||
_ClearDTOG_TX(ENDP1);
|
||||
_ClearDTOG_RX(ENDP1);
|
||||
SetEPType(ENDP1, EP_INTERRUPT);
|
||||
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
|
||||
SetEPTxStatus(ENDP1, EP_TX_NAK);
|
||||
_ClearDTOG_TX(ENDP1);
|
||||
_ClearDTOG_RX(ENDP1);
|
||||
|
||||
SetEPType(ENDP2, EP_INTERRUPT);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
SetEPType(ENDP2, EP_INTERRUPT);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
USBD_Endp1_Busy = 0;
|
||||
USBD_Endp2_Busy = 0;
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -661,11 +661,17 @@ void MS_Scan_Handle( void )
|
||||
*/
|
||||
void MCU_Sleep_Wakeup_Operate( void )
|
||||
{
|
||||
printf( "Sleep\r\n" );
|
||||
__disable_irq();
|
||||
RCC_APB1PeriphClockCmd( RCC_APB1Periph_PWR, ENABLE);
|
||||
EXTI_ClearFlag( EXTI_Line12 | EXTI_Line13 | EXTI_Line14 | EXTI_Line15 );
|
||||
EXTI_ClearFlag( EXTI_Line4 | EXTI_Line5 | EXTI_Line6 | EXTI_Line7 );
|
||||
|
||||
// printf( "Sleep\r\n" );
|
||||
__WFE( );
|
||||
|
||||
PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFE);
|
||||
|
||||
SystemInit();
|
||||
SystemCoreClockUpdate();
|
||||
Set_USBConfig();
|
||||
|
||||
if( EXTI_GetFlagStatus( EXTI_Line12 | EXTI_Line13 | EXTI_Line14 | EXTI_Line15 ) != RESET )
|
||||
{
|
||||
@@ -677,8 +683,13 @@ void MCU_Sleep_Wakeup_Operate( void )
|
||||
EXTI_ClearFlag( EXTI_Line4 | EXTI_Line5 | EXTI_Line6 | EXTI_Line7 );
|
||||
Resume(RESUME_INTERNAL);
|
||||
}
|
||||
// printf( "Wake\r\n" );
|
||||
}
|
||||
else if(EXTI_GetFlagStatus(EXTI_Line18) != RESET )
|
||||
{
|
||||
EXTI_ClearFlag( EXTI_Line18 );
|
||||
printf("USB Wake Up\n");
|
||||
}
|
||||
__enable_irq( );
|
||||
printf( "Wake\r\n" );}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -185,40 +185,40 @@ 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(ENDP2, EP_BULK);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
SetEPRxStatus(ENDP2,EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
SetEPType(ENDP2, EP_BULK);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
SetEPRxStatus(ENDP2,EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
|
||||
SetEPType(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
|
||||
SetEPRxCount(ENDP3, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP3, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
SetEPType(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
|
||||
SetEPRxCount(ENDP3, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP3, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
bDeviceState = ATTACHED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -185,40 +185,40 @@ 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(ENDP2, EP_BULK);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
SetEPRxStatus(ENDP2,EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
SetEPType(ENDP2, EP_BULK);
|
||||
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
|
||||
SetEPTxStatus(ENDP2, EP_TX_NAK);
|
||||
SetEPRxStatus(ENDP2,EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP2);
|
||||
_ClearDTOG_RX(ENDP2);
|
||||
|
||||
SetEPType(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
|
||||
SetEPRxCount(ENDP3, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP3, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
SetEPType(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_DIS);
|
||||
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
|
||||
SetEPRxCount(ENDP3, DEF_USBD_MAX_PACK_SIZE);
|
||||
SetEPRxStatus(ENDP3, EP_RX_VALID );
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
bDeviceState = ATTACHED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
||||
@@ -193,7 +193,7 @@ void USBD_init(void)
|
||||
/*******************************************************************************
|
||||
* @fn USBD_Reset
|
||||
*
|
||||
* @brief Virtual_Com_Port Mouse reset routine
|
||||
* @brief USBD reset routine
|
||||
*
|
||||
* @return None.
|
||||
*/
|
||||
@@ -215,33 +215,33 @@ void USBD_Reset(void)
|
||||
_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(ENDP3, EP_BULK);
|
||||
SetEPTxStatus(ENDP3, EP_TX_NAK);
|
||||
SetEPTxAddr(ENDP3, ENDP3_TXADDR);
|
||||
SetEPRxStatus(ENDP3, EP_RX_DIS);
|
||||
_ClearDTOG_TX(ENDP3);
|
||||
_ClearDTOG_RX(ENDP3);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
|
||||
SetDeviceAddress(0);
|
||||
USBD_Endp3_Busy = 0;
|
||||
|
||||
bDeviceState = ATTACHED;
|
||||
bDeviceState = ATTACHED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user