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


C++ SetEPRxStatus函数代码示例

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


在下文中一共展示了SetEPRxStatus函数的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;
}
开发者ID:xjtuecho,项目名称:MiniDSO,代码行数:38,代码来源:USB_prop.c

示例2: Mass_Storage_In

/*******************************************************************************
* Function Name  : Mass_Storage_In
* Description    : Mass Storage IN transfer.
* Input          : None.
* Output         : None.
* Return         : None.
//设备->USB
*******************************************************************************/
void Mass_Storage_In (void)
{
	USB_STATUS_REG|=0X10;//标记轮询
	//printf("Bot_State_in:%d",Bot_State);
	switch (Bot_State)
	{
		case BOT_CSW_Send:
		case BOT_ERROR:
			Bot_State = BOT_IDLE;
			SetEPRxStatus(ENDP4, EP_RX_VALID);/* enable the Endpoint to recive the next cmd*/
			break;
		case BOT_DATA_IN:  //USB从设备读数据
			switch (CBW.CB[0])
			{
				case SCSI_READ10:
					USB_STATUS_REG|=0X02;//标记正在读数据
					SCSI_Read10_Cmd(CBW.bLUN , SCSI_LBA , SCSI_BlkLen);
					break;
			}
			break;
		case BOT_DATA_IN_LAST:
			Set_CSW (CSW_CMD_PASSED, SEND_CSW_ENABLE);
			SetEPRxStatus(ENDP4, EP_RX_VALID);
			break;
		
		default:
			break;
	}
}
开发者ID:blackmiaool,项目名称:cattyware,代码行数:37,代码来源:usb_bot.c

示例3: 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;
}
开发者ID:FlameN,项目名称:STM32RUNO,代码行数:67,代码来源:usb_prop.c

示例4: 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;
}
开发者ID:GorosVi,项目名称:vsprog,代码行数:33,代码来源:STM32_USBD.c

示例5: Mass_Storage_In

/*******************************************************************************
* Function Name  : Mass_Storage_In
* Description    : Mass Storage IN transfer.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
void Mass_Storage_In (void)
{
 	USB_STATUS_REG|=0X10;//标记轮询
	switch (Bot_State)
	{
		case BOT_CSW_Send:
		case BOT_ERROR:
			Bot_State = BOT_IDLE;
			SetEPRxStatus(ENDP2, EP_RX_VALID);/* enable the Endpoint to receive the next cmd*/
			if (GetEPRxStatus(EP2_OUT) == EP_RX_STALL)
			{
				SetEPRxStatus(EP2_OUT, EP_RX_VALID);/* enable the Endpoint to receive the next cmd*/
			}
		break;
		case BOT_DATA_IN:
			switch (CBW.CB[0])
			{
				case SCSI_READ10:
					USB_STATUS_REG|=0X02;//标记正在读数据
					SCSI_Read10_Cmd(CBW.bLUN , SCSI_LBA , SCSI_BlkLen);
					break;
			}
		break;
		case BOT_DATA_IN_LAST:
			Set_CSW (CSW_CMD_PASSED, SEND_CSW_ENABLE); 
			SetEPRxStatus(ENDP2, EP_RX_VALID);
			break;
		default:
		break;
	}
}
开发者ID:joyceandpig,项目名称:STM32_USB_MASS,代码行数:38,代码来源:usb_bot.c

示例6: 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);

    /* Initialize Endpoint 2 */
    SetEPType(ENDP2, EP_INTERRUPT);
    SetEPRxAddr(ENDP2, ENDP2_RXADDR);
    SetEPRxCount(ENDP2, 64);
    SetEPRxStatus(ENDP2, EP_RX_VALID);
    SetEPTxStatus(ENDP2, EP_TX_DIS);
    /* Set this device to response on default address */
    SetDeviceAddress(0);
    bDeviceState = ATTACHED;
}
开发者ID:cuipeng,项目名称:powerman,代码行数:42,代码来源:usb_prop.c

示例7: Mass_Storage_In

/*******************************************************************************
* Function Name  : Mass_Storage_In
* Description    : Mass Storage IN transfer.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
void Mass_Storage_In (void)
{
  switch (Bot_State)
  {
    case BOT_CSW_Send:
    case BOT_ERROR:
      Bot_State = BOT_IDLE;
      SetEPRxStatus(ENDP2, EP_RX_VALID);/* enable the Endpoint to recive the next cmd*/
      break;
    case BOT_DATA_IN:
      switch (CBW.CB[0])
      {
        case SCSI_READ10:
          SCSI_Read10_Cmd(SCSI_LBA , SCSI_BlkLen);
          break;
      }
      break;
    case BOT_DATA_IN_LAST:
      Set_CSW (CSW_CMD_PASSED, SEND_CSW_ENABLE);
      SetEPRxStatus(ENDP2, EP_RX_VALID);
      break;

    default:
      break;
  }
}
开发者ID:matthiasbock,项目名称:DSOQuad_SourceCode,代码行数:33,代码来源:USB_bot.c

示例8: 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;
}
开发者ID:norayn,项目名称:serv_controller,代码行数:60,代码来源:_usb_prop.c

示例9: 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();
}
开发者ID:caoqing32,项目名称:galee-devo7e,代码行数:66,代码来源:usb_prop.c

示例10: Standard_ClearFeature

/*******************************************************************************
* Function Name  : Standard_ClearFeature.
* Description    : Clear or disable a specific feature.
* Input          : None.
* Output         : None.
* Return         : - Return USB_SUCCESS, if the request is performed.
*                  - Return USB_UNSUPPORT, if the request is invalid.
*******************************************************************************/
RESULT Standard_ClearFeature(void) {
	uint32_t Type_Rec = Type_Recipient;
	uint32_t Status;

	if (Type_Rec == (STANDARD_REQUEST | DEVICE_RECIPIENT)) {
		// Device Clear Feature
		ClrBit(pInformation->Current_Feature, 5);
		return USB_SUCCESS;
	} else if (Type_Rec == (STANDARD_REQUEST | ENDPOINT_RECIPIENT)) {
		// EndPoint Clear Feature
		DEVICE* pDev;
		uint32_t Related_Endpoint;
		uint32_t wIndex0;
		uint32_t rEP;

		if ((pInformation->USBwValue != ENDPOINT_STALL) || (pInformation->USBwIndex1 != 0)) {
			return USB_UNSUPPORT;
		}
		pDev = &Device_Table;
		wIndex0 = pInformation->USBwIndex0;
		rEP = wIndex0 & ~0x80;
		Related_Endpoint = ENDP0 + rEP;
		if (ValBit(pInformation->USBwIndex0, 7)) {
			// Get Status of endpoint & stall the request if the related_ENdpoint is Disabled
			Status = GetEPTxStatus(Related_Endpoint);
		} else {
			Status = GetEPRxStatus(Related_Endpoint);
		}
		if ((rEP >= pDev->Total_Endpoint) || (Status == 0) || (pInformation->Current_Configuration == 0)) {
			return USB_UNSUPPORT;
		}
		if (wIndex0 & 0x80) {
			// IN endpoint
			if (GetTxStallStatus(Related_Endpoint )) {
				ClearDTOG_TX(Related_Endpoint);
				SetEPTxStatus(Related_Endpoint, EP_TX_VALID);
			}
		} else {
			// OUT endpoint
			if (GetRxStallStatus(Related_Endpoint)) {
				if (Related_Endpoint == ENDP0) {
					// After clear the STALL, enable the default endpoint receiver
					SetEPRxCount(Related_Endpoint, Device_Property.MaxPacketSize);
					SetEPRxStatus(Related_Endpoint, EP_RX_VALID);
				} else {
					ClearDTOG_RX(Related_Endpoint);
					SetEPRxStatus(Related_Endpoint, EP_RX_VALID);
				}
			}
		}
		pUser_Standard_Requests->User_ClearFeature();

		return USB_SUCCESS;
	}

	return USB_UNSUPPORT;
}
开发者ID:9zigen,项目名称:stm32,代码行数:65,代码来源:usb_core.c

示例11: DCD_EP_Close

/**
  * @brief called when an EP is disabled
  * @param  pdev: device instance
  * @param  ep_addr: endpoint address
  * @retval : status
  */
uint32_t DCD_EP_Close(USB_CORE_HANDLE *pdev , uint8_t  ep_addr)
{
  USB_EP *ep;
  
  if ((ep_addr&0x80) == 0x80)
  {
    ep = &pdev->dev.in_ep[ep_addr & 0x7F];
  }
  else
  {
    ep = &pdev->dev.out_ep[ep_addr & 0x7F];
  }
  
  if (ep->doublebuffer == 0) 
  {
    if (ep->is_in)
    {
      ClearDTOG_TX(ep->num);
      /* Configure DISABLE status for the Endpoint*/
      SetEPTxStatus(ep->num, EP_TX_DIS); 
    }
    else
    {
      ClearDTOG_RX(ep->num);
      /* Configure DISABLE status for the Endpoint*/
      SetEPRxStatus(ep->num, EP_RX_DIS);
    }
  }
  /*Double Buffer*/
  else
  { 
    if (ep->is_in==0)
    {
      /* Clear the data toggle bits for the endpoint IN/OUT*/
      ClearDTOG_RX(ep->num);
      ClearDTOG_TX(ep->num);
      
      /* Reset value of the data toggle bits for the endpoint out*/
      ToggleDTOG_TX(ep->num);
      
      SetEPRxStatus(ep->num, EP_RX_DIS);
      SetEPTxStatus(ep->num, EP_TX_DIS);
    }
    else
    {
      /* Clear the data toggle bits for the endpoint IN/OUT*/
      ClearDTOG_RX(ep->num);
      ClearDTOG_TX(ep->num);
      ToggleDTOG_RX(ep->num);
      /* Configure DISABLE status for the Endpoint*/
      SetEPTxStatus(ep->num, EP_TX_DIS);
      SetEPRxStatus(ep->num, EP_RX_DIS);
    }
  } 
  return USB_OK;
}
开发者ID:royazriel,项目名称:RoboMow,代码行数:62,代码来源:usb_dcd.c

示例12: PIOS_USB_CDC_DATA_EP_OUT_Callback

static void PIOS_USB_CDC_DATA_EP_OUT_Callback(void)
{
	struct pios_usb_cdc_dev * usb_cdc_dev = (struct pios_usb_cdc_dev *)pios_usb_cdc_id;

	bool valid = PIOS_USB_CDC_validate(usb_cdc_dev);
	PIOS_Assert(valid);

	uint32_t DataLength;

	/* Get the number of received data on the selected Endpoint */
	DataLength = GetEPRxCount(usb_cdc_dev->cfg->data_rx_ep);
	if (DataLength > sizeof(usb_cdc_dev->rx_packet_buffer)) {
		usb_cdc_dev->rx_oversize++;
		DataLength = sizeof(usb_cdc_dev->rx_packet_buffer);
	}

	/* Use the memory interface function to read from the selected endpoint */
	PMAToUserBufferCopy((uint8_t *) usb_cdc_dev->rx_packet_buffer,
			GetEPRxAddr(usb_cdc_dev->cfg->data_rx_ep),
			DataLength);

	if (!usb_cdc_dev->rx_in_cb) {
		/* No Rx call back registered, disable the receiver */
		SetEPRxStatus(usb_cdc_dev->cfg->data_rx_ep, EP_RX_NAK);
		return;
	}

	uint16_t headroom;
	bool need_yield = false;
	uint16_t rc;
	rc = (usb_cdc_dev->rx_in_cb)(usb_cdc_dev->rx_in_context,
				usb_cdc_dev->rx_packet_buffer,
				DataLength,
				&headroom,
				&need_yield);

	if (rc < DataLength) {
		/* Lost bytes on rx */
		usb_cdc_dev->rx_dropped += (DataLength - rc);
	}

	if (headroom >= sizeof(usb_cdc_dev->rx_packet_buffer)) {
		/* We have room for a maximum length message */
		SetEPRxStatus(usb_cdc_dev->cfg->data_rx_ep, EP_RX_VALID);
	} else {
		/* Not enough room left for a message, apply backpressure */
		SetEPRxStatus(usb_cdc_dev->cfg->data_rx_ep, EP_RX_NAK);
	}

#if defined(PIOS_INCLUDE_FREERTOS)
	if (need_yield) {
		vPortYieldFromISR();
	}
#endif	/* PIOS_INCLUDE_FREERTOS */
}
开发者ID:Crash1,项目名称:TauLabs,代码行数:55,代码来源:pios_usb_cdc.c

示例13: 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;
}
开发者ID:CM-9xx,项目名称:cm9xx,代码行数:52,代码来源:usb_callbacks.c

示例14: DCD_SetEPStatus

/**
  * @brief Set the EP Status
  * @param   pdev : Selected device
  *         Status : new Status
  *         epnum : EP address
  * @retval : None
  */
void DCD_SetEPStatus (USB_CORE_HANDLE *pdev , uint8_t epnum , uint32_t Status)
{
  USB_EP *ep;
  if ((0x80 & epnum) == 0x80)
  {
    ep = &pdev->dev.in_ep[epnum & 0x7F];    
  }
  else
  {
    ep = &pdev->dev.out_ep[epnum];
  } 
  
  if (ep->is_in)
  {
    SetEPTxStatus(ep->num, (uint16_t)Status);
  }
  else
  {
    SetEPRxStatus(ep->num, (uint16_t)Status);
  }
    
  if ((Status == EP_RX_STALL) || (Status == EP_TX_STALL))
  {
    ep->is_stall =1;
  }
}
开发者ID:royazriel,项目名称:RoboMow,代码行数:33,代码来源:usb_dcd.c

示例15: SCSI_Write10_Cmd

/*******************************************************************************
* Function Name  : SCSI_Write10_Cmd
* Description    : SCSI Write10 Command routine.
* Input          : None.
* Output         : None.
* Return         : None.
*******************************************************************************/
void SCSI_Write10_Cmd(u32 LBA , u32 BlockNbr)
{

  if (Bot_State == BOT_IDLE)
  {
    if (!(SCSI_Address_Management(SCSI_WRITE10 , LBA, BlockNbr)))/*address out of range*/
    {
      return;
    }

    if ((CBW.bmFlags & 0x80) == 0)
    {
      Bot_State = BOT_DATA_OUT;
      SetEPRxStatus(ENDP2, EP_RX_VALID);
    }
    else
    {
      Bot_Abort(DIR_IN);
      Set_Scsi_Sense_Data(ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
      Set_CSW (CSW_CMD_FAILED, SEND_CSW_DISABLE);
    }
    return;
  }
  else if (Bot_State == BOT_DATA_OUT)
  {
    Write_Memory(LBA , BlockNbr);
  }
}
开发者ID:PetteriAimonen,项目名称:dsoquad-BIOS,代码行数:35,代码来源:USB_scsi.c


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