本文整理汇总了C++中SetEPRxValid函数的典型用法代码示例。如果您正苦于以下问题:C++ SetEPRxValid函数的具体用法?C++ SetEPRxValid怎么用?C++ SetEPRxValid使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetEPRxValid函数的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: 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;
}
示例3: 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();
}
示例4: 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;
}
示例5: EP3_OUT_Callback
void EP3_OUT_Callback(void)
{
/* Get the received data buffer and update the counter */
USB_Rx_Cnt = USB_SIL_Read(EP3_OUT, USB_Rx_Buffer);
/* USB data will be immediately processed, this allow next USB traffic beeing
NAKed till the end of the USART Xfet */
//#ifdef DEBUG_ENABLE_BY_USART2
//TxDString("[USB]USB_Rx_Cnt = "); TxDHex16(USB_Rx_Cnt); TxDString("\r\n");
//#endif
if(gbFlashDownloadStart == TRUE){
ClearTimeOutBuffer();
WriteFlash64(USB_Rx_Buffer, USB_Rx_Cnt);
}
gwpUSARTBuffer[gwUSARTWritePtr++&USART_BUFFER_SIZE] = USB_Rx_Buffer[0];
//TxDString("gwUSARTWritePtr = "); TxDHex32(gwpUSARTBuffer[gwUSARTWritePtr-1]); TxDString("\r\n");
#ifndef STM32F10X_CL
/* Enable the receive of data on EP3 */
SetEPRxValid(ENDP3);
#endif /* STM32F10X_CL */
}
示例6: Mass_Storage_Out
/*******************************************************************************
* Function Name : Mass_Storage_Out
* Description : Mass Storage OUT transfer.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void Mass_Storage_Out (void)
{
uint8_t CMD;
CMD = CBW.CB[0];
Data_Len = USB_SIL_Read(EP5_OUT, Bulk_Data_Buff);
switch (Bot_State)
{
case BOT_IDLE:
CBW_Decode();
break;
case BOT_DATA_OUT:
if (CMD == SCSI_WRITE10)
{
SCSI_Write10_Cmd(CBW.bLUN , SCSI_LBA , SCSI_BlkLen);
break;
}
Bot_Abort(DIR_OUT);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
default:
Bot_Abort(BOTH_DIR);
Set_Scsi_Sense_Data(CBW.bLUN, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
Set_CSW (CSW_PHASE_ERROR, SEND_CSW_DISABLE);
break;
}
//az
#ifndef STM32F10X_CL
/* Enable the receive of data on EP3 */
SetEPRxValid(ENDP5);
#endif /* STM32F10X_CL */
}
示例7: 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() */
示例8: 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 ***/
示例9: EP3_OUT_Callback
//
// PCから仮想COMポート側へデータを送信する.
//
void EP3_OUT_Callback(void)
{
uint16_t USB_Rx_Cnt;
#if LED_DEBUG
led2_blink(0);
#endif
/* Get the received data buffer and update the counter */
USB_Rx_Cnt = USB_SIL_Read(EP3_OUT, USB_Rx_Buffer);
/* USB data will be immediately processed, this allow next USB traffic beeing
NAKed till the end of the USART Xfet */
USBenqueue(USB_Rx_Buffer, USB_Rx_Cnt);
// if(USB_Rx_Cnt) led2_blink(0);
#ifndef STM32F10X_CL
if( USBgetfreesize() >= 64 ) {
/* Enable the receive of data on EP3 */
SetEPRxValid(ENDP3);
flag_EP3_OUT_PENDING=0;
}else{
// 受信バッファの空きがないときは一旦ペンディングする.
flag_EP3_OUT_PENDING=1;
}
#endif /* STM32F10X_CL */
}
示例10: 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;
}
示例11: 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);
}
示例12: EP1_OUT_Callback
/*******************************************************************************
* Function Name : EP1_OUT_Callback.
* Description : EP1 OUT Callback Routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void EP1_OUT_Callback(void)
{
u8 DataLen; //保存接收数据的长度
u8 DataBuffer[64]; //保存接收数据的缓冲区
DataLen = GetEPRxCount(ENDP1); //获取收到的长度
PMAToUserBufferCopy(DataBuffer, ENDP1_RXADDR, DataLen); //复制数据
SetEPRxValid(ENDP1); //设置端点有效,以接收下一次数据
if(DataLen==1) //收到一字节的输出报告
{
//D0位表示数字键盘灯,D1位表示大写字母锁定灯
// if(DataBuffer[0]&0x01) //数字键盘灯亮
// {
// GPIOC->BSRR=(1<<6); //亮LED3
// }
// else
// {
// GPIOC->BRR=(1<<6); //灭LED3
// }
// if(DataBuffer[0]&0x02) //大写字母锁定键
// {
// GPIOC->BSRR=(1<<7); //亮LED2
// }
// else
// {
// GPIOC->BRR=(1<<7); //灭LED2
// }
}
}
示例13: MIOS32_USB_COM_RxBufferGet
/////////////////////////////////////////////////////////////////////////////
//! Gets a byte from the receive buffer
//! \param[in] usb_com USB_COM number (not supported yet, should always be 0)
//! \return -1 if USB_COM not available
//! \return -2 if no new byte available
//! \return >= 0: received byte
//! \note Applications shouldn't call this function directly, instead please use \ref MIOS32_COM layer functions
/////////////////////////////////////////////////////////////////////////////
s32 MIOS32_USB_COM_RxBufferGet(u8 usb_com)
{
#if MIOS32_USB_COM_NUM == 0
return -1; // no USB_COM available
#else
if( usb_com >= MIOS32_USB_COM_NUM )
return -1; // USB_COM not available
if( !rx_buffer_new_data_ctr )
return -2; // nothing new in buffer
// get byte - this operation should be atomic!
// MIOS32_IRQ_Disable();
// TODO: access buffer directly, so that we don't need to copy into temporary buffer
u8 buffer_out[MIOS32_USB_COM_DATA_OUT_SIZE];
PMAToUserBufferCopy(buffer_out, MIOS32_USB_ENDP3_RXADDR, GetEPRxCount(ENDP3));
u8 b = buffer_out[rx_buffer_ix++];
if( !--rx_buffer_new_data_ctr )
SetEPRxValid(ENDP3);
// MIOS32_IRQ_Enable();
return b; // return received byte
#endif
}
示例14: 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;
}
示例15: EP3_OUT_Callback
/*******************************************************************************
* Function Name : EP3_OUT_Callback
* Description :
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void EP3_OUT_Callback(void)
{
uint32_t USB_RX_DataLength = 0, USB_RX_TotalLength, USB_RX_DataLength2 = 0;
/* Get the received data buffer and update the counter */
USB_RX_DataLength = USB_SIL_Read(EP3_OUT, USB_RX_Tail, BUFFER_CONTIGUOUS_FREE_SPACE(USB_RX), &USB_RX_TotalLength, 0);
BUFFER_MOVE_TAIL(USB_RX, USB_RX_DataLength);
if(USB_RX_TotalLength > USB_RX_DataLength)
{
USB_RX_DataLength2 = USB_SIL_Read(EP3_OUT, USB_RX_Tail, BUFFER_CONTIGUOUS_FREE_SPACE(USB_RX), &USB_RX_TotalLength, USB_RX_DataLength);
BUFFER_MOVE_TAIL(USB_RX, USB_RX_DataLength2);
}
/* USB data will be immediately processed, this allow next USB traffic being
NAKed till the end of the USART Xfer */
// send back to USB
uint16_t RXLen = BUFFER_DATA_LENGTH(USB_RX);
uint16_t TXLen = USB_RX_USB_TX_Copy(RXLen);
#ifndef STM32F10X_CL
/* Enable the receive of data on EP3 */
#endif /* STM32F10X_CL */
SetEPRxValid(ENDP3);
}