本文整理汇总了C++中SetDeviceAddress函数的典型用法代码示例。如果您正苦于以下问题:C++ SetDeviceAddress函数的具体用法?C++ SetDeviceAddress怎么用?C++ SetDeviceAddress使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetDeviceAddress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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() */
示例5: 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 ***/
示例6: In0_Process
/*******************************************************************************
* Function Name : In0_Process
* Description : Process the IN token on all default endpoint.
* Input : None.
* Output : None.
* Return : Post0_Process.
*******************************************************************************/
uint8_t In0_Process(void) {
uint32_t ControlState = pInformation->ControlState;
if((ControlState == IN_DATA) || (ControlState == LAST_IN_DATA)) {
DataStageIn();
/* ControlState may be changed outside the function */
ControlState = pInformation->ControlState;
}
else if(ControlState == WAIT_STATUS_IN) {
if((pInformation->USBbRequest == SET_ADDRESS) && (Type_Recipient == (STANDARD_REQUEST | DEVICE_RECIPIENT))) {
SetDeviceAddress(pInformation->USBwValue0);
pUser_Standard_Requests->User_SetDeviceAddress();
}
(*pProperty->Process_Status_IN)();
ControlState = STALLED;
}
else {
ControlState = STALLED;
}
pInformation->ControlState = ControlState;
return Post0_Process();
}
示例7: 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;
}
示例8: 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*/
/* Current Feature initialization */
pInformation->Current_Feature = Joystick_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);
SetEPTxCount(ENDP1, 4);
SetEPRxStatus(ENDP1, EP_RX_DIS);
SetEPTxStatus(ENDP1, EP_TX_NAK);
bDeviceState = ATTACHED;
/* Set this device to response on default address */
SetDeviceAddress(0);
}
示例9: 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;
}
示例10: 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();
}
示例11: 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;
}
示例12: composite_cdc_hid_Reset
/*******************************************************************************
* Function Name : CustomHID_Reset.
* Description : Custom HID reset routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
static void composite_cdc_hid_Reset(void)
{
/* Set CustomHID_DEVICE as not configured */
pInformation->Current_Configuration = 0;
pInformation->Current_Interface = 0;/*the default Interface*/
/* Current Feature initialization */
pInformation->Current_Feature = Composite_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_BULK);
SetEPTxAddr(ENDP1, ENDP1_TXADDR);
SetEPRxAddr(ENDP1, ENDP1_RXADDR);
SetEPTxCount(ENDP1, 0x40);
SetEPRxCount(ENDP1, 0x40);
SetEPRxStatus(ENDP1, EP_RX_VALID);
SetEPTxStatus(ENDP1, EP_TX_NAK);
/* 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_INTERRUPT);
SetEPTxAddr(ENDP3, ENDP3_TXADDR);
SetEPRxAddr(ENDP3, ENDP3_RXADDR);
SetEPTxCount(ENDP3, 16);
SetEPRxCount(ENDP3, 16);
SetEPRxStatus(ENDP3, EP_RX_VALID);
SetEPTxStatus(ENDP3, EP_TX_NAK);
/* Set this device to response on default address */
SetDeviceAddress(0);
bDeviceState = ATTACHED;
}
示例13: 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;
}
示例14: Speaker_Reset
/*******************************************************************************
* Function Name : Speaker_Reset.
* Description : Speaker reset routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Speaker_Reset()
{
/* Set Speaker device as not configured state */
pInformation->Current_Configuration = 0;
/* Current Feature initialization */
pInformation->Current_Feature = Speaker_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_ISOCHRONOUS);
SetEPDoubleBuff(ENDP4);
SetEPDblBuffAddr(ENDP1, ENDP1_BUF0Addr, ENDP1_BUF1Addr);
SetEPDblBuffCount(ENDP1, EP_DBUF_IN, PACKET_SIZE);
ClearDTOG_RX(ENDP1);
ClearDTOG_TX(ENDP1);
SetEPRxStatus(ENDP1, EP_RX_DIS);
SetEPTxStatus(ENDP1, EP_TX_VALID);
SetEPType(ENDP2, EP_INTERRUPT);
SetEPTxAddr(ENDP2, ENDP2_TXADDR);
SetEPTxCount(ENDP2, 0x40);
SetEPRxStatus(ENDP2, EP_RX_DIS);
SetEPTxStatus(ENDP2, EP_TX_NAK);
SetEPType(ENDP3, EP_INTERRUPT);
SetEPTxAddr(ENDP3, ENDP3_TXADDR);
SetEPTxCount(ENDP3, 0x40);
SetEPRxStatus(ENDP3, EP_RX_DIS);
SetEPTxStatus(ENDP3, EP_TX_NAK);
SetEPRxValid(ENDP0);
/* 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;
}