当前位置: 首页>>代码示例>>C++>>正文


C++ DCD_EP_Tx函数代码示例

本文整理汇总了C++中DCD_EP_Tx函数的典型用法代码示例。如果您正苦于以下问题:C++ DCD_EP_Tx函数的具体用法?C++ DCD_EP_Tx怎么用?C++ DCD_EP_Tx使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DCD_EP_Tx函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: usbd_cdc_transfer

static inline uint8_t usbd_cdc_transfer(void *pdev)
{
	if (sended != 0 || rndis_tx_ptr == NULL || rndis_tx_size <= 0) return USBD_OK;
	if (rndis_first_tx)
	{
		static uint8_t first[RNDIS_DATA_IN_SZ];
		rndis_data_packet_t *hdr;

		hdr = (rndis_data_packet_t *)first;
		memset(hdr, 0, sizeof(rndis_data_packet_t));
		hdr->MessageType = REMOTE_NDIS_PACKET_MSG;
		hdr->MessageLength = sizeof(rndis_data_packet_t) + rndis_tx_size;
		hdr->DataOffset = sizeof(rndis_data_packet_t) - offsetof(rndis_data_packet_t, DataOffset);
		hdr->DataLength = rndis_tx_size;

		sended = RNDIS_DATA_IN_SZ - sizeof(rndis_data_packet_t);
		if (sended > rndis_tx_size) sended = rndis_tx_size;
		memcpy(first + sizeof(rndis_data_packet_t), rndis_tx_ptr, sended);

		DCD_EP_Tx(pdev, RNDIS_DATA_IN_EP, (uint8_t *)&first, sizeof(rndis_data_packet_t) + sended);
	}
	else
	{
		int n = rndis_tx_size;
		if (n > RNDIS_DATA_IN_SZ) n = RNDIS_DATA_IN_SZ;
		DCD_EP_Tx(pdev, RNDIS_DATA_IN_EP, rndis_tx_ptr, n);
		sended = n;
	}
	return USBD_OK;
}
开发者ID:nandojve,项目名称:lrndis,代码行数:30,代码来源:usbd_rndis_core.c

示例2: usbd_cdc_DataIn

/**
  * @brief  usbd_audio_DataIn
  *         Data sent on non-control IN endpoint
  * @param  pdev: device instance
  * @param  epnum: endpoint number
  * @retval status
  */
uint8_t  usbd_cdc_DataIn (void *pdev, uint8_t epnum)
{
	(void)pdev;
	(void)epnum;
  uint16_t USB_Tx_ptr;
  uint16_t USB_Tx_length;
  
  if (USB_Tx_State == USB_CDC_BUSY)
  {
    if (APP_Rx_length == 0) 
    {
      USB_Tx_State = USB_CDC_IDLE;
    }
    else 
    {
      if (APP_Rx_length > CDC_DATA_IN_PACKET_SIZE){
        USB_Tx_ptr = APP_Rx_ptr_out;
        USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
        
        APP_Rx_ptr_out += CDC_DATA_IN_PACKET_SIZE;
        APP_Rx_length -= CDC_DATA_IN_PACKET_SIZE;    
      }
      else 
      {
        USB_Tx_ptr = APP_Rx_ptr_out;
        USB_Tx_length = APP_Rx_length;
        
        APP_Rx_ptr_out += APP_Rx_length;
        APP_Rx_length = 0;
        if(USB_Tx_length == CDC_DATA_IN_PACKET_SIZE)
        {
          USB_Tx_State = USB_CDC_ZLP;
        }
      }
      
      /* Prepare the available data buffer to be sent on IN endpoint */
      DCD_EP_Tx (pdev,
                 CDC_IN_EP,
                 (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
                 USB_Tx_length);
      return USBD_OK;
    }
  }  
  
  /* Avoid any asynchronous transfer during ZLP */
  if (USB_Tx_State == USB_CDC_ZLP)
  {
    /*Send ZLP to indicate the end of the current transfer */
    DCD_EP_Tx (pdev,
               CDC_IN_EP,
               NULL,
               0);
    
    USB_Tx_State = USB_CDC_IDLE;
  }
  return USBD_OK;
}
开发者ID:Aeroprobing,项目名称:Betaflight,代码行数:64,代码来源:usbd_cdc_core.c

示例3: usbd_cdc_DataIn

/**
  * @brief  usbd_audio_DataIn
  *         Data sent on non-control IN endpoint
  * @param  pdev: device instance
  * @param  epnum: endpoint number
  * @retval status
  */
uint8_t  usbd_cdc_DataIn (void *pdev, uint8_t epnum)
{
  uint16_t USB_Tx_ptr;
  uint16_t USB_Tx_length;
  
  if (USB_Tx_State == 1)
  {
    if (APP_Rx_length == 0) 
    {
      if (last_packet ==1)
      {
        last_packet =0;
        
        /*Send zero-length packet*/
        DCD_EP_Tx (pdev, CDC_IN_EP, 0, 0);
      }
      else
      {
        USB_Tx_State = 0;
      }
    }
    else 
    {
      if (APP_Rx_length > CDC_DATA_IN_PACKET_SIZE){
        USB_Tx_ptr = APP_Rx_ptr_out;
        USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
        
        APP_Rx_ptr_out += CDC_DATA_IN_PACKET_SIZE;
        APP_Rx_length -= CDC_DATA_IN_PACKET_SIZE;    
      }
      else 
      {
        USB_Tx_ptr = APP_Rx_ptr_out;
        USB_Tx_length = APP_Rx_length;
        
        APP_Rx_ptr_out += APP_Rx_length;
        APP_Rx_length = 0;
        if (APP_Rx_length == CDC_DATA_IN_PACKET_SIZE) last_packet = 1;
      }
      
      /* Prepare the available data buffer to be sent on IN endpoint */
      DCD_EP_Tx (pdev,
                 CDC_IN_EP,
                 (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
                 USB_Tx_length);
    }
  }  
  
  return USBD_OK;
}
开发者ID:HuanDeng,项目名称:Qproject,代码行数:57,代码来源:usbd_cdc_core.c

示例4: USBD_CDC_DataIn

/**
 * @brief  USBD_CDC_DataIn
 *         Data sent on non-control IN endpoint
 * @param  pdev: device instance
 * @param  epnum: endpoint number
 * @retval status
 */
static uint8_t  USBD_CDC_DataIn (void *pdev, uint8_t epnum)
{
	uint16_t i;

	if (USBD_CDC_InFlight != 0) {
		USBD_CDC_InFlight = 0;
	}

	if (ringbuffer_isempty(&USBD_CDC_D2H_FIFO) == 0)
	{
		for (i = 0; i < CDC_DATA_IN_PACKET_SIZE && ringbuffer_isempty(&USBD_CDC_D2H_FIFO) == 0; i++) {
			USBD_CDC_D2H_Buff[i] = ringbuffer_pop(&USBD_CDC_D2H_FIFO);
		}
		dbgwdg_feed();
		DCD_EP_Tx (pdev,
					USBD_Dev_CDC_D2H_EP,
					(uint8_t*)USBD_CDC_D2H_Buff,
					i);
		USBD_CDC_InFlight = 1;
	}

	if (USBD_CDC_InFlight == 0) {
		DCD_EP_Flush(pdev, epnum);
	}

	return USBD_OK;
}
开发者ID:Poopi,项目名称:UsbXlater,代码行数:34,代码来源:usbd_dev_cdc.c

示例5: usbd_cdc_DataIn

/**
  * @brief  usbd_audio_DataIn
  *         Data sent on non-control IN endpoint
  * @param  pdev: device instance
  * @param  epnum: endpoint number
  * @retval status
  */
static uint8_t  usbd_cdc_DataIn (void *pdev, uint8_t epnum)
{
  uint32_t USB_Tx_length;

  usbd_cdc_Change_Open_State(1);

  if (!USB_Tx_State)
    return USBD_OK;

  USB_Tx_length = ring_data_contig(USB_TX_BUFFER_SIZE, USB_Tx_Buffer_head, USB_Tx_Buffer_tail);

  if (USB_Tx_length) {
    USB_Tx_length = MIN(USB_Tx_length, CDC_DATA_IN_PACKET_SIZE);
  } else if (usbd_Last_Tx_Packet_size(pdev, epnum) != CDC_DATA_IN_PACKET_SIZE) {
    USB_Tx_State = 0;
    return USBD_OK;
  }

  /* Prepare the available data buffer to be sent on IN endpoint */
  DCD_EP_Tx (pdev,
             CDC_IN_EP,
             (uint8_t*)&USB_Tx_Buffer[USB_Tx_Buffer_tail],
             USB_Tx_length);

  USB_Tx_Buffer_tail = ring_wrap(USB_TX_BUFFER_SIZE, USB_Tx_Buffer_tail + USB_Tx_length);
  return USBD_OK;
}
开发者ID:Xcping2013,项目名称:firmware,代码行数:34,代码来源:usbd_cdc_core.c

示例6: usbd_cdc_DataIn

/**
  * @brief  usbd_audio_DataIn
  *         Data sent on non-control IN endpoint
  * @param  pdev: device instance
  * @param  epnum: endpoint number
  * @retval status
  */
static uint8_t  usbd_cdc_DataIn (void *pdev, uint8_t epnum)
{
  if (USB_Tx_State == 1)
  {
    unsigned char USB_TX_Buffer[CDC_DATA_IN_PACKET_SIZE];
    int USB_Tx_length = 0;

    // try and fill the buffer
    int c;
    while (USB_Tx_length<CDC_DATA_IN_PACKET_SIZE &&
           ((c = jshGetCharToTransmit(EV_USBSERIAL)) >= 0) ) { // get byte to transmit
      USB_TX_Buffer[USB_Tx_length++] = c;
    }

    // if nothing, set state to 0
    if (USB_Tx_length==0) {
      USB_Tx_State = 0;
      return USBD_OK;
    }
      
    /* Prepare the available data buffer to be sent on IN endpoint */
    DCD_EP_Tx (pdev,
               CDC_IN_EP,
               (uint8_t*)USB_TX_Buffer,
               USB_Tx_length);
  }  
  
  return USBD_OK;
}
开发者ID:FyberLabs,项目名称:Espruino,代码行数:36,代码来源:usbd_cdc_core.c

示例7: Handle_USBAsynchXfer

/**
  * @brief  Handle_USBAsynchXfer
  *         Send data to USB
  * @param  pdev: instance
  * @retval None
  */
static void Handle_USBAsynchXfer (void *pdev)
{
  if(USB_Tx_State != 1)
  {
    unsigned char USB_TX_Buffer[CDC_DATA_IN_PACKET_SIZE];
    int USB_Tx_length = 0;

    // try and fill the buffer
    int c;
    while (USB_Tx_length<CDC_DATA_IN_PACKET_SIZE &&
           ((c = jshGetCharToTransmit(EV_USBSERIAL)) >=0) ) { // get byte to transmit
      USB_TX_Buffer[USB_Tx_length++] = c;
    }

    // if nothing, set state to 0
    if (USB_Tx_length==0) {
      USB_Tx_State = 0; 
      return;
    }
    USB_Tx_State = 1; 

    DCD_EP_Tx (pdev,
               CDC_IN_EP,
               (uint8_t*)USB_TX_Buffer,
               USB_Tx_length);
  }  
  
}
开发者ID:FyberLabs,项目名称:Espruino,代码行数:34,代码来源:usbd_cdc_core.c

示例8: SCSI_ProcessRead

/**
* @brief  SCSI_ProcessRead
*         Handle Read Process
* @param  lun: Logical unit number
* @retval status
*/
static int8_t SCSI_ProcessRead (uint8_t lun)
{
  uint32_t len;
  
  len = MIN(SCSI_blk_len , MSC_MEDIA_PACKET); 
  
  if( USBD_STORAGE_fops->Read(lun ,
                              MSC_BOT_Data, 
                              SCSI_blk_addr / SCSI_blk_size, 
                              len / SCSI_blk_size) < 0)
  {
    
    SCSI_SenseCode(lun, HARDWARE_ERROR, UNRECOVERED_READ_ERROR);
    return -1; 
  }
  
  
  DCD_EP_Tx (cdev, 
             MSC_IN_EP,
             MSC_BOT_Data,
             len);
  
  
  SCSI_blk_addr   += len; 
  SCSI_blk_len    -= len;  
  
  /* case 6 : Hi = Di */
  MSC_BOT_csw.dDataResidue -= len;
  
  if (SCSI_blk_len == 0)
  {
    MSC_BOT_State = BOT_LAST_DATA_IN;
  }
  return 0;
}
开发者ID:Dobraku,项目名称:opentx,代码行数:41,代码来源:usbd_msc_scsi.c

示例9: Handle_USBAsynchXfer

/**
  * @brief  Handle_USBAsynchXfer
  *         Send data to USB
  * @param  pdev: instance
  * @retval None
  */
static void Handle_USBAsynchXfer (void *pdev)
{
  if(USB_Tx_State != 1)
  {
    u8_t *data_p;
    u16_t len = ringbuf_available_linear(&usb_vcd_ringbuf_tx, &data_p);

    if (len == 0)
    {
      USB_Tx_State = 0; 
      return;
    }
    
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
     APP_Rx_length &= ~0x03;
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
    
    if (len > CDC_DATA_IN_PACKET_SIZE)
    {
      len = CDC_DATA_IN_PACKET_SIZE;
    }
    USB_Tx_State = 1; 

    DCD_EP_Tx (pdev,
               CDC_IN_EP,
               data_p,
               len);
    ringbuf_get(&usb_vcd_ringbuf_tx, 0, len);
  }  
  
}
开发者ID:anirudh-shekhawat,项目名称:generic_embedded,代码行数:37,代码来源:usbd_cdc_core_modified.c

示例10: usbd_cdc_DataIn

/**
  * @brief  usbd_audio_DataIn
  *         Data sent on non-control IN endpoint
  * @param  pdev: device instance
  * @param  epnum: endpoint number
  * @retval status
  */
static uint8_t  usbd_cdc_DataIn (void *pdev, uint8_t epnum)
{
  if (USB_Tx_State == 1)
  {
    u8_t *data_p;
    u16_t len = ringbuf_available_linear(&usb_vcd_ringbuf_tx, &data_p);
    if (len == 0)
    {
      USB_Tx_State = 0;
    }
    else 
    {
      if (len > CDC_DATA_IN_PACKET_SIZE){
        len = CDC_DATA_IN_PACKET_SIZE;
      }
      /* Prepare the available data buffer to be sent on IN endpoint */
      DCD_EP_Tx (pdev,
                 CDC_IN_EP,
                 data_p,
                 len);
      ringbuf_get(&usb_vcd_ringbuf_tx, 0, len);
    }
  }  

  return USBD_OK;
}
开发者ID:anirudh-shekhawat,项目名称:generic_embedded,代码行数:33,代码来源:usbd_cdc_core_modified.c

示例11: Handle_USBAsynchXfer

/**
  * @brief  Handle_USBAsynchXfer
  *         Send data to USB
  * @param  pdev: instance
  * @retval None
  */
static void Handle_USBAsynchXfer (void *pdev)
{
  uint16_t USB_Tx_ptr;
  uint16_t USB_Tx_length;
  
  if(USB_Tx_State != 1)
  {
    if (APP_Rx_ptr_out == APP_RX_DATA_SIZE)
    {
      APP_Rx_ptr_out = 0;
    }
    
    if(APP_Rx_ptr_out == APP_Rx_ptr_in) 
    {
      USB_Tx_State = 0; 
      return;
    }
    
    if(APP_Rx_ptr_out > APP_Rx_ptr_in) /* rollback */
    { 
      APP_Rx_length = APP_RX_DATA_SIZE - APP_Rx_ptr_out;
    
    }
    else 
    {
      APP_Rx_length = APP_Rx_ptr_in - APP_Rx_ptr_out;
     
    }
#ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
     APP_Rx_length &= ~0x03;
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
    
    if (APP_Rx_length > CDC_DATA_IN_PACKET_SIZE)
    {
      USB_Tx_ptr = APP_Rx_ptr_out;
      USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
      
      APP_Rx_ptr_out += CDC_DATA_IN_PACKET_SIZE;	
      APP_Rx_length -= CDC_DATA_IN_PACKET_SIZE;
    }
    else
    {
      USB_Tx_ptr = APP_Rx_ptr_out;
      USB_Tx_length = APP_Rx_length;
      
      APP_Rx_ptr_out += APP_Rx_length;
      APP_Rx_length = 0;
    }
    USB_Tx_State = 1; 

    DCD_EP_Tx (pdev,
               CDC_IN_EP,
               (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
               USB_Tx_length);
  }  
  
}
开发者ID:ssidko,项目名称:WorkProjects,代码行数:63,代码来源:usbd_cdc_core.c

示例12: USBD_CtlContinueSendData

//--------------------------------------------------------------
USBD_Status USBD_CtlContinueSendData(USB_OTG_CORE_HANDLE * pdev, uint8_t * pbuf, uint16_t len)
{
    USBD_Status ret = USBD_OK;

    DCD_EP_Tx(pdev, 0, pbuf, len);


    return ret;
}
开发者ID:nano-bio,项目名称:TempControl,代码行数:10,代码来源:usbd_ioreq.c

示例13: Handle_USBAsynchXfer

/**
  * @brief  Handle_USBAsynchXfer
  *         Send data to USB
  * @param  pdev: instance
  * @retval None
  */
static void Handle_USBAsynchXfer (void *pdev)
{
  uint16_t USB_Tx_ptr;
  uint16_t USB_Tx_length;
  
  if(USB_Tx_State != 1)
  {
    if (APP_Rx_ptr_out == APP_RX_DATA_SIZE)
    {
      APP_Rx_ptr_out = 0;
    }
    
    if(APP_Rx_ptr_out == APP_Rx_ptr_in) 
    {
      USB_Tx_State = 0; 
      return;
    }
    
    if(APP_Rx_ptr_out > APP_Rx_ptr_in) /* rollback */
    { 
      APP_Rx_length = APP_RX_DATA_SIZE - APP_Rx_ptr_out;
      
    }
    else 
    {
      APP_Rx_length = APP_Rx_ptr_in - APP_Rx_ptr_out;
      
    }
    
    if (APP_Rx_length > CDC_DATA_IN_PACKET_SIZE)
    {
      USB_Tx_ptr = APP_Rx_ptr_out;
      USB_Tx_length = CDC_DATA_IN_PACKET_SIZE;
      
      APP_Rx_ptr_out += CDC_DATA_IN_PACKET_SIZE;	
      APP_Rx_length -= CDC_DATA_IN_PACKET_SIZE;
    }
    else
    {
      USB_Tx_ptr = APP_Rx_ptr_out;
      USB_Tx_length = APP_Rx_length;
      
      APP_Rx_ptr_out += APP_Rx_length;
      APP_Rx_length = 0;
      if (USB_Tx_length == CDC_DATA_IN_PACKET_SIZE) last_packet = 1; //IBA
      if (APP_Rx_ptr_in == 64) APP_Rx_ptr_in=0;
    }
    USB_Tx_State = 1; 
    
    DCD_EP_Tx (pdev,
               CDC_IN_EP,
               (uint8_t*)&APP_Rx_Buffer[USB_Tx_ptr],
               USB_Tx_length);
  }  
  
}
开发者ID:HuanDeng,项目名称:Qproject,代码行数:62,代码来源:usbd_cdc_core.c

示例14: Usb_Send

/**********************************************************************************************************
*函 数 名: Usb_Send
*功能说明: USB发送数据
*形    参: 发送数据缓冲区指针 数据长度
*返 回 值: 无
**********************************************************************************************************/
void Usb_Send(uint8_t *dataToSend, uint8_t length)
{
    if(connectFlag)
    {
        DCD_EP_Tx(&USB_OTG_dev, 1, dataToSend, length);
        DCD_SetEPStatus(&USB_OTG_dev,1, USB_OTG_EP_TX_VALID);
    }

    errorCheckCnt = 0;
}
开发者ID:dxxdxpdxy,项目名称:BlueSkyFlightControl,代码行数:16,代码来源:drv_usb.c

示例15: USBD_CtlSendStatus

//--------------------------------------------------------------
USBD_Status USBD_CtlSendStatus(USB_OTG_CORE_HANDLE * pdev)
{
    USBD_Status ret = USBD_OK;
    pdev->dev.device_state = USB_OTG_EP0_STATUS_IN;
    DCD_EP_Tx(pdev, 0, NULL, 0);

    USB_OTG_EP0_OutStart(pdev);

    return ret;
}
开发者ID:nano-bio,项目名称:TempControl,代码行数:11,代码来源:usbd_ioreq.c


注:本文中的DCD_EP_Tx函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。