本文整理汇总了C++中SetEPRxCount函数的典型用法代码示例。如果您正苦于以下问题:C++ SetEPRxCount函数的具体用法?C++ SetEPRxCount怎么用?C++ SetEPRxCount使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetEPRxCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MASS_Reset
/*******************************************************************************
MASS_Reset: Mass Storage reset routine.
*******************************************************************************/
void MASS_Reset()
{
Device_Info.Current_Configuration = 0; // Set the device as not configured
pInformation->Current_Feature = MASS_ConfigDescriptor[7]; // Current Feature initialization
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;
}
示例2: HID_Reset
/*******************************************************************************
* Function Name : HID_Reset.
* Description : HID reset routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void HID_Reset(void)
{
/* Set HID_DEVICE as not configured */
pInformation->Current_Configuration = 0;
pInformation->Current_Interface = 0;/*the default Interface*/
/* Current Feature initialization */
pInformation->Current_Feature = RHID_ConfigDescriptor[7];
SetBTABLE(BTABLE_ADDRESS);
/* Initialize Endpoint 0 */
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);
/* Initialize Endpoint 1 */
SetEPType(ENDP1, EP_INTERRUPT);
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
SetEPRxAddr(ENDP1, ENDP1_RXADDR);
SetEPTxCount(ENDP1, EP1TxCount);
SetEPRxCount(ENDP1, EP1RxCount);
SetEPRxStatus(ENDP1, EP_RX_VALID);
SetEPTxStatus(ENDP1, EP_TX_NAK);
/* Set this device to response on default address */
SetDeviceAddress(0);
bDeviceState = ATTACHED;
}
示例3: Bulk_Reset
/************************************************************************************//**
** \brief USB device reset routine.
** \return none.
**
****************************************************************************************/
void Bulk_Reset(void)
{
/* set device as not configured */
pInformation->Current_Configuration = 0;
/* current feature initialization */
pInformation->Current_Feature = Bulk_ConfigDescriptor[7];
/* set device's the default Interface*/
pInformation->Current_Interface = 0;
/* set based address in USB RAM */
SetBTABLE(BTABLE_ADDRESS);
/* initialize endpoint 0 CONTROL (mandatory) */
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);
/* initialize endpoint 1 IN + OUT */
SetEPType(ENDP1, EP_BULK);
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
SetEPRxAddr(ENDP1, ENDP1_RXADDR);
SetEPTxCount(ENDP1, BULK_DATA_SIZE);
SetEPRxCount(ENDP1, BULK_DATA_SIZE);
SetEPRxStatus(ENDP1, EP_RX_VALID);
SetEPTxStatus(ENDP1, EP_TX_NAK);
/* set this device to respond on default address */
SetDeviceAddress(0);
/* update device state */
bDeviceState = ATTACHED;
} /*** end of Bulk_Reset ***/
示例4: Virtual_Com_Port_Reset
/*******************************************************************************
* Function Name : Virtual_Com_Port_Reset
* Description : Virtual_Com_Port Mouse reset routine
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Virtual_Com_Port_Reset(void)
{
/* Set Virtual_Com_Port DEVICE as not configured */
pInformation->Current_Configuration = 0;
/* Current Feature initialization */
pInformation->Current_Feature = Virtual_Com_Port_ConfigDescriptor[7];
/* Set Virtual_Com_Port DEVICE with the default Interface*/
pInformation->Current_Interface = 0;
#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, VIRTUAL_COM_PORT_DATA_SIZE);
/* Init EP2 IN as Interrupt endpoint */
OTG_DEV_EP_Init(EP2_IN, OTG_DEV_EP_TYPE_INT, VIRTUAL_COM_PORT_INT_SIZE);
/* Init EP3 OUT as Bulk endpoint */
OTG_DEV_EP_Init(EP3_OUT, OTG_DEV_EP_TYPE_BULK, VIRTUAL_COM_PORT_DATA_SIZE);
#else
SetBTABLE(BTABLE_ADDRESS);
/* Initialize Endpoint 0 */
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);
/* 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_INTERRUPT);
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
SetEPRxStatus(ENDP2, EP_RX_DIS);
SetEPTxStatus(ENDP2, EP_TX_NAK);
/* Initialize Endpoint 3 */
SetEPType(ENDP3, EP_BULK);
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
SetEPRxCount(ENDP3, VIRTUAL_COM_PORT_DATA_SIZE);
SetEPRxStatus(ENDP3, EP_RX_VALID);
SetEPTxStatus(ENDP3, EP_TX_DIS);
/* Set this device to response on default address */
SetDeviceAddress(0);
#endif /* STM32F10X_CL */
bDeviceState = ATTACHED;
}
示例5: MASS_Reset
/*******************************************************************************
* 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();
}
示例6: SomeDev_Reset
// Ресет USB
void SomeDev_Reset()
{
// Установка девайса в несконфигурированное состояние
Device_Info.Current_Configuration = 0;
// Инициализация CurrentFeature
pInformation->Current_Feature = SomeDev_ConfigDescriptor[7];
#ifdef STM32F10X_CL
// EP0 уже сконфигурирован в USB_SIL_Init()
// $USBCONFIG - инициализация ендпойнтов
// EP1 IN - Bulk endpoint
OTG_DEV_EP_Init(EP1_IN, OTG_DEV_EP_TYPE_BULK, BULK_MAX_PACKET_SIZE);
// EP2 OUT - Bulk endpoint
OTG_DEV_EP_Init(EP2_OUT, OTG_DEV_EP_TYPE_BULK, BULK_MAX_PACKET_SIZE);
#else
// $USBCONFIG - инициализация ендпойнтов
SetBTABLE(BTABLE_ADDRESS);
// Инициализация 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);
// Инициализация Endpoint 1
SetEPType(ENDP1, EP_BULK);
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
SetEPTxStatus(ENDP1, EP_TX_NAK);
SetEPRxStatus(ENDP1, EP_RX_DIS);
// Инициализация 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);
// Установка дефолтного адреса
SetDeviceAddress(0);
#endif /}
bDeviceState = ATTACHED;
}
示例7: usbReset
void usbReset(void) {
pInformation->Current_Configuration = 0;
/* current feature is current bmAttributes */
pInformation->Current_Feature = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELF_POWERED);
_SetBTABLE(USB_BTABLE_ADDRESS);
/* setup control endpoint 0 */
_SetEPType(ENDP0, EP_CONTROL);
_SetEPTxStatus(ENDP0, EP_TX_STALL);
_SetEPRxAddr(ENDP0,VCOM_CTRL_RX_ADDR);
_SetEPTxAddr(ENDP0,VCOM_CTRL_TX_ADDR);
Clear_Status_Out(ENDP0);
SetEPRxCount(ENDP0, pProperty->MaxPacketSize);
SetEPRxValid(ENDP0);
/* setup management endpoint 1 */
SetEPType (VCOM_NOTIFICATION_ENDP, EP_INTERRUPT);
SetEPTxAddr (VCOM_NOTIFICATION_ENDP, VCOM_NOTIFICATION_ADDR);
SetEPTxStatus (VCOM_NOTIFICATION_ENDP, EP_TX_NAK);
SetEPRxStatus (VCOM_NOTIFICATION_ENDP, EP_RX_DIS);
/* setup data endpoint OUT (rx) */
/* SetEPType (VCOM_RX_ENDP, EP_BULK); */
/* SetEPRxAddr (VCOM_RX_ENDP, VCOM_RX_ADDR); */
/* SetEPRxCount (VCOM_RX_ENDP, VCOM_RX_EPSIZE); */
/* // SetEPTxStatus (VCOM_RX_ENDP, EP_TX_DIS); */
/* SetEPRxStatus (VCOM_RX_ENDP, EP_RX_VALID); */
SetEPType (3, EP_BULK);
SetEPRxAddr (3, 0x110);
SetEPRxCount (3,64);
// SetEPTxStatus (VCOM_RX_ENDP, EP_TX_DIS);
SetEPRxStatus (3, EP_RX_VALID);
/* setup data endpoint IN (tx) */
SetEPType (VCOM_TX_ENDP, EP_BULK);
SetEPTxAddr (VCOM_TX_ENDP, VCOM_TX_ADDR);
SetEPTxStatus (VCOM_TX_ENDP, EP_TX_NAK);
SetEPRxStatus (VCOM_TX_ENDP, EP_RX_DIS);
bDeviceState = ATTACHED;
SetDeviceAddress(0);
/* reset the rx fifo */
recvBufIn = 0;
recvBufOut = 0;
maxNewBytes = VCOM_RX_EPSIZE;
countTx = 0;
}
示例8: DFU_Reset
/*******************************************************************************
* Function Name : DFU_Reset
* Description :
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void DFU_Reset(void)
{
/* Set DFU_DEVICE as not configured */
Device_Info.Current_Configuration = 0;
_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);
SetEPTxCount(ENDP0, Device_Property.MaxPacketSize);
Clear_Status_Out(ENDP0);
SetEPRxValid(ENDP0);
/* Set this device to response on default address */
SetDeviceAddress(0);
/* if(!DFU_Button_Read())
{
DeviceState=STATE_dfuIDLE;
DeviceStatus[4]=DeviceState;
DeviceStatus[1]=0;
DeviceStatus[2]=0;
DeviceStatus[3]=0;
}*/
} /* DFU_Reset() */
示例9: stm32_usbd_ep_set_OUT_epsize
vsf_err_t stm32_usbd_ep_set_OUT_epsize(uint8_t idx, uint16_t epsize)
{
bool ep0;
int8_t index;
index = stm32_usbd_get_ep(idx);
if (index < 0)
{
return VSFERR_FAIL;
}
ep0 = 0 == idx;
idx = (uint8_t)index;
if ((EP_Cfg_Ptr - epsize) < STM32_USBD_EP_NUM * 8)
{
return VSFERR_NOT_ENOUGH_RESOURCES;
}
stm32_usbd_OUT_epsize[idx] = epsize;
SetEPRxCount(idx, epsize);
// fix for 16-bit aligned memory
EP_Cfg_Ptr -= epsize & 1 ? epsize + 1 : epsize;
SetEPRxAddr(idx, EP_Cfg_Ptr);
if (ep0)
{
SetEPRxStatus(idx, EP_RX_VALID);
}
else
{
SetEPRxStatus(idx, EP_RX_NAK);
}
return VSFERR_NONE;
}
示例10: DFU_Reset
/*******************************************************************************
* Function Name : DFU_Reset.
* Description : DFU reset routine
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void DFU_Reset(void)
{
/* Set DFU_DEVICE as not configured */
Device_Info.Current_Configuration = 0;
/* Current Feature initialization */
pInformation->Current_Feature = DFU_ConfigDescriptor[7];
#ifdef STM32F10X_CL
/* EP0 is already configured in DFU_Init by OTG_DEV_Init() function
No Other endpoints needed for this firmware */
#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);
SetEPTxCount(ENDP0, Device_Property.MaxPacketSize);
Clear_Status_Out(ENDP0);
SetEPRxValid(ENDP0);
/* Set this device to response on default address */
SetDeviceAddress(0);
#endif /* STM32F10X_CL */
/* Set the new control state of the device to Attached */
bDeviceState = ATTACHED;
}
示例11: Post0_Process
/*******************************************************************************
* Function Name : Post0_Process
* Description : Stall the Endpoint 0 in case of error.
* Input : None.
* Output : None.
* Return : - 0 if the control State is in PAUSE
* - 1 if not.
*******************************************************************************/
uint8_t Post0_Process(void) {
#ifdef STM32F10X_CL
USB_OTG_EP* ep;
#endif /* STM32F10X_CL */
SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
if(pInformation->ControlState == STALLED) {
vSetEPRxStatus(EP_RX_STALL);
vSetEPTxStatus(EP_TX_STALL);
}
#ifdef STM32F10X_CL
else if((pInformation->ControlState == OUT_DATA) || (pInformation->ControlState == WAIT_STATUS_OUT)) {
ep = PCD_GetInEP(0);
ep->is_in = 0;
OTGD_FS_EP0StartXfer(ep);
vSetEPTxStatus(EP_TX_VALID);
}
else if((pInformation->ControlState == IN_DATA) || (pInformation->ControlState == WAIT_STATUS_IN)) {
ep = PCD_GetInEP(0);
ep->is_in = 1;
OTGD_FS_EP0StartXfer(ep);
}
#endif /* STM32F10X_CL */
return (pInformation->ControlState == PAUSE);
}
示例12: Joystick_Reset
/*******************************************************************************
* Function Name : Joystick_Reset.
* Description : Joystick Mouse reset routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Joystick_Reset(void)
{
/* Set Joystick_DEVICE as not configured */
pInformation->Current_Configuration = 0;
pInformation->Current_Interface = 0;/*the default Interface*/
SetBTABLE(BTABLE_ADDRESS);
/* Initialize Endpoint 0 */
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);
/* Initialize Endpoint 1 */
SetEPType(ENDP1, EP_INTERRUPT);
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
SetEPTxCount(ENDP1, 4);
SetEPRxStatus(ENDP1, EP_RX_DIS);
SetEPTxStatus(ENDP1, EP_TX_NAK);
/* Set this device to response on default address */
SetDeviceAddress(0);
}
示例13: DFU_Reset
/*******************************************************************************
* Function Name : DFU_Reset.
* Description : DFU reset routine
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void DFU_Reset(void)
{
/* Set DFU_DEVICE as not configured */
Device_Info.Current_Configuration = 0;
/* Current Feature initialization */
pInformation->Current_Feature = DFU_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);
SetEPTxCount(ENDP0, Device_Property.MaxPacketSize);
Clear_Status_Out(ENDP0);
SetEPRxValid(ENDP0);
/* Set this device to response on default address */
SetDeviceAddress(0);
/* Set the new control state of the device to Attached */
bDeviceState = ATTACHED;
}
示例14: Virtual_Com_Port_Reset
/*******************************************************************************
* Function Name : Virtual_Com_Port_Reset
* Description : Virtual_Com_Port Mouse reset routine
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Virtual_Com_Port_Reset(void)
{
/* Set Virtual_Com_Port DEVICE as not configured */
pInformation->Current_Configuration = 0;
/* Current Feature initialization */
pInformation->Current_Feature = Virtual_Com_Port_ConfigDescriptor[7];
/* Set Virtual_Com_Port DEVICE with the default Interface*/
pInformation->Current_Interface = 0;
SetBTABLE(BTABLE_ADDRESS);
/* Initialize Endpoint 0 */
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);
/* 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_INTERRUPT);
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
SetEPRxStatus(ENDP2, EP_RX_DIS);
SetEPTxStatus(ENDP2, EP_TX_NAK);
/* Initialize Endpoint 3 */
SetEPType(ENDP3, EP_BULK);
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
SetEPRxCount(ENDP3, VIRTUAL_COM_PORT_DATA_SIZE);
SetEPRxStatus(ENDP3, EP_RX_VALID);
SetEPTxStatus(ENDP3, EP_TX_DIS);
/* Set this device to response on default address */
SetDeviceAddress(0);
bDeviceState = ATTACHED;
}
示例15: USBdev_Reset
/*******************************************************************************
Function Name : USBdev_Reset.
Description : USB device reset routine.
Input : None.
Output : None.
Return : None.
*******************************************************************************/
void USBdev_Reset() {
// Set DEVICE as not configured
pInformation->Current_Configuration = 0;
// Current Feature initialization
pInformation->Current_Feature = VCOM_ConfigDescriptor[7];
// Set DEVICE with the default Interface
pInformation->Current_Interface = 0;
// BTABLE_ADDRESS = 0
USB->BTABLE = BTABLE_ADDRESS;
// Initialize Endpoint 0
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);
// 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_INTERRUPT);
SetEPTxAddr(ENDP2,ENDP2_TXADDR);
SetEPRxStatus(ENDP2,EP_RX_DIS);
SetEPTxStatus(ENDP2,EP_TX_NAK);
// Initialize Endpoint 3
SetEPType(ENDP3,EP_BULK);
SetEPRxAddr(ENDP3,ENDP3_RXADDR);
SetEPRxCount(ENDP3,VCOM_INT_SIZE);
SetEPRxStatus(ENDP3,EP_RX_VALID);
SetEPTxStatus(ENDP3,EP_TX_DIS);
// Set this device to response on default address
SetDeviceAddress(0);
bDeviceState = ATTACHED;
}