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


C++ Endpoint_SelectEndpoint函数代码示例

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


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

示例1: RNDIS_Task

void RNDIS_Task(void)
{
	Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPADDR);

	if (USB_DeviceState != DEVICE_STATE_Configured)
	  return;

	HandleUSB();
}
开发者ID:QrackEE,项目名称:avrcraft,代码行数:9,代码来源:RNDISEthernet.c

示例2: CDC_Device_SendString

uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
                              const char* const String)
{
    if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
        return ENDPOINT_RWSTREAM_DeviceDisconnected;

    Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
    return Endpoint_Write_Stream_LE(String, strlen(String), NULL);
}
开发者ID:hwchiu0810,项目名称:micro,代码行数:9,代码来源:CDCClassDevice.c

示例3: main

/** Main program entry point. This routine contains the overall program flow, including initial
 *  setup of all components and the main program loop.
 */
int main(void)
{
	SetupHardware();

	GlobalInterruptEnable();

	uint8_t sending = 0;

	for (;;) {

		while (1) {
                	int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
			if (ReceivedByte < 0) 
				break;

			if (!configured) continue;

			if (!sending) {
				PORTC.OUTSET = PIN1_bm;
				sending = 1;
			}

			PORTD.OUTTGL = PIN5_bm;
                	while(!USART_IsTXDataRegisterEmpty(&USART));
                	USART_PutChar(&USART, ReceivedByte & 0xff);
		}

		if (sending) {
			USART_ClearTXComplete(&USART);
               		while(!USART_IsTXComplete(&USART));
			PORTC.OUTCLR = PIN1_bm;
			sending = 0;	
		}

                Endpoint_SelectEndpoint(VirtualSerial_CDC_Interface.Config.DataINEndpoint.Address);

                /* Check if a packet is already enqueued to the host - if so, we shouldn't try to send more data
                 * until it completes as there is a chance nothing is listening and a lengthy timeout could occur */

		if (configured && Endpoint_IsINReady()) {
			uint8_t maxbytes = CDC_TXRX_EPSIZE;
                	while (USART_RXBufferData_Available(&USART_data) && maxbytes-->0) {
                        	uint8_t b = USART_RXBuffer_GetByte(&USART_data);
				CDC_Device_SendByte(&VirtualSerial_CDC_Interface, b);
				PORTD.OUTTGL = PIN5_bm;
                	}
                }

		CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
		USB_USBTask();

		if (loop++) continue;
		if (!configured) continue;

		PORTD.OUTTGL = PIN5_bm;
	}
}
开发者ID:drthth,项目名称:busware,代码行数:60,代码来源:VirtualSerial.c

示例4: uart_isdata

uint8_t uart_isdata(void) {
	if (usb_rxpacket_leftb) {
		Endpoint_SelectEndpoint(CDC_RX_EPNUM);
		return usb_rxpacket_leftb;
	}
	usb_process();
	usb_rxpacket_leftb = CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface);
	return usb_rxpacket_leftb;
}
开发者ID:urjaman,项目名称:frser-spi-u2,代码行数:9,代码来源:fast-usbserial.c

示例5: Endpoint_StallTransaction

void Endpoint_StallTransaction(void)
{
	USB_Endpoint_SelectedHandle->CTRL |= USB_EP_STALL_bm;

	if ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_TYPE_gm) == USB_EP_TYPE_CONTROL_gc)
	{
		Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint ^ ENDPOINT_DIR_IN);
		USB_Endpoint_SelectedHandle->CTRL |= USB_EP_STALL_bm;
	}
}
开发者ID:40000ft,项目名称:lufa,代码行数:10,代码来源:Endpoint_XMEGA.c

示例6: V2Protocol_SignOn

/** Handler for the CMD_SIGN_ON command, returning the programmer ID string to the host. */
static void V2Protocol_SignOn(void)
{
	Endpoint_ClearOUT();

	if ( use_libusb == true ) {
		Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM__LIBUSB);

	} else {
		Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM__DEFAULT);
	}

	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	Endpoint_Write_8(CMD_SIGN_ON);
	Endpoint_Write_8(STATUS_CMD_OK);
	Endpoint_Write_8(sizeof(PROGRAMMER_ID) - 1);
	Endpoint_Write_Stream_LE(PROGRAMMER_ID, (sizeof(PROGRAMMER_ID) - 1), NULL);
	Endpoint_ClearIN();
}
开发者ID:madworm,项目名称:avrispmkII_LUFA,代码行数:20,代码来源:V2Protocol.c

示例7: PRNT_Device_SendData

uint8_t PRNT_Device_SendData(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo,
                             const void* const Buffer,
                             const uint16_t Length)
{
	if (USB_DeviceState != DEVICE_STATE_Configured)
	  return ENDPOINT_RWSTREAM_DeviceDisconnected;

	Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address);
	return Endpoint_Write_Stream_LE(Buffer, Length, NULL);
}
开发者ID:40000ft,项目名称:lufa,代码行数:10,代码来源:PrinterClassDevice.c

示例8: ISR

ISR(USB_COM_vect, ISR_BLOCK)
{
	uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();

	USB_USBTask();

	USB_INT_Clear(USB_INT_ENDPOINT_SETUP);
	
	Endpoint_SelectEndpoint(PrevSelectedEndpoint);
}
开发者ID:Diggen85,项目名称:a-culfw,代码行数:10,代码来源:USBInterrupt.c

示例9: MS_Device_USBTask

void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
	if (USB_DeviceState != DEVICE_STATE_Configured)
	  return;

	Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);

	if (Endpoint_IsOUTReceived())
	{
		if (MS_Device_ReadInCommandBlock(MSInterfaceInfo))
		{
			if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
			  Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);

			bool SCSICommandResult = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo);

			MSInterfaceInfo->State.CommandStatus.Status              = (SCSICommandResult) ? MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
			MSInterfaceInfo->State.CommandStatus.Signature           = CPU_TO_LE32(MS_CSW_SIGNATURE);
			MSInterfaceInfo->State.CommandStatus.Tag                 = MSInterfaceInfo->State.CommandBlock.Tag;
			MSInterfaceInfo->State.CommandStatus.DataTransferResidue = MSInterfaceInfo->State.CommandBlock.DataTransferLength;

			if (!(SCSICommandResult) && (le32_to_cpu(MSInterfaceInfo->State.CommandStatus.DataTransferResidue)))
			  Endpoint_StallTransaction();

			MS_Device_ReturnCommandStatus(MSInterfaceInfo);
		}
	}

	if (MSInterfaceInfo->State.IsMassStoreReset)
	{
		Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
		Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);

		Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address);
		Endpoint_ClearStall();
		Endpoint_ResetDataToggle();
		Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address);
		Endpoint_ClearStall();
		Endpoint_ResetDataToggle();

		MSInterfaceInfo->State.IsMassStoreReset = false;
	}
}
开发者ID:40000ft,项目名称:lufa,代码行数:43,代码来源:MassStorageClassDevice.c

示例10: V2Protocol_ResetProtection

/** Handler for the CMD_RESET_PROTECTION command, implemented as a dummy ACK function as
 *  no target short-circuit protection is currently implemented.
 */
static void V2Protocol_ResetProtection(void)
{
	Endpoint_ClearOUT();
	Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
	Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);

	Endpoint_Write_Byte(CMD_RESET_PROTECTION);
	Endpoint_Write_Byte(STATUS_CMD_OK);
	Endpoint_ClearIN();
}
开发者ID:softants,项目名称:lufa-lib,代码行数:13,代码来源:V2Protocol.c

示例11: CDC_Device_SendData_P

uint8_t CDC_Device_SendData_P(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
                            const void* const Buffer,
                            const uint16_t Length)
{
	if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
	  return ENDPOINT_RWSTREAM_DeviceDisconnected;

	Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address);
	return Endpoint_Write_PStream_LE(Buffer, Length, NULL);
}
开发者ID:tewarid,项目名称:ArduinoUnoUsbDfu,代码行数:10,代码来源:CDCClassDevice.c

示例12: MS_Device_ReadInCommandBlock

static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
	uint16_t BytesProcessed;

	Endpoint_SelectEndpoint(MSInterfaceInfo->Config.PortNumber, MSInterfaceInfo->Config.DataOUTEndpointNumber);
	
	BytesProcessed = 0;
	while (Endpoint_Read_Stream_LE(MSInterfaceInfo->Config.PortNumber,
																 &MSInterfaceInfo->State.CommandBlock,
	                               (sizeof(MS_CommandBlockWrapper_t) - 16), &BytesProcessed) ==
	                               ENDPOINT_RWSTREAM_IncompleteTransfer)
	{
		if (MSInterfaceInfo->State.IsMassStoreReset)
		  return false;
	}

	if ((MSInterfaceInfo->State.CommandBlock.Signature         != CPU_TO_LE32(MS_CBW_SIGNATURE))     ||
	    (MSInterfaceInfo->State.CommandBlock.LUN               >= MSInterfaceInfo->Config.TotalLUNs) ||
		(MSInterfaceInfo->State.CommandBlock.Flags              & 0x1F)                              ||
		(MSInterfaceInfo->State.CommandBlock.SCSICommandLength == 0)                                 ||
		(MSInterfaceInfo->State.CommandBlock.SCSICommandLength >  16))
	{
		Endpoint_StallTransaction(MSInterfaceInfo->Config.PortNumber);
		Endpoint_SelectEndpoint(MSInterfaceInfo->Config.PortNumber, MSInterfaceInfo->Config.DataINEndpointNumber);
		Endpoint_StallTransaction(MSInterfaceInfo->Config.PortNumber);

		return false;
	}

	BytesProcessed = 0;
	while (Endpoint_Read_Stream_LE(MSInterfaceInfo->Config.PortNumber,
															    &MSInterfaceInfo->State.CommandBlock.SCSICommandData,
	                                MSInterfaceInfo->State.CommandBlock.SCSICommandLength, &BytesProcessed) ==
	                                ENDPOINT_RWSTREAM_IncompleteTransfer)
	{
		if (MSInterfaceInfo->State.IsMassStoreReset)
		  return false;
	}

//	Endpoint_ClearOUT();

	return true;
}
开发者ID:JeremyHsiao,项目名称:TinyBlueRat_LPCv1_03,代码行数:43,代码来源:MassStorageClassDevice.c

示例13: CDC_Device_SendString

uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
                              const char* const Data,
                              const uint16_t Length)
{
	if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
	  return ENDPOINT_RWSTREAM_DeviceDisconnected;
	
	Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
	return Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
}
开发者ID:123jefferson,项目名称:MiniBloq-Sparki,代码行数:10,代码来源:CDC.c

示例14: ReceiveNextReport

/** Reads the next OUT report from the host from the OUT endpoint, if one has been sent. */
void ReceiveNextReport(void)
{
  static struct
  {
    struct
    {
      unsigned char type;
      unsigned char length;
    } header;
    unsigned char buffer[EPSIZE];
  } packet = { .header.type = BYTE_OUT_REPORT };

  uint16_t length = 0;

	/* Select the OUT Report Endpoint */
	Endpoint_SelectEndpoint(OUT_EPNUM);

	/* Check if OUT Endpoint contains a packet */
	if (Endpoint_IsOUTReceived())
	{
		/* Check to see if the packet contains data */
		if (Endpoint_IsReadWriteAllowed())
		{
      /* Read OUT Report Data */
      uint8_t ErrorCode = Endpoint_Read_Stream_LE(packet.buffer, sizeof(packet.buffer), &length);
      if(ErrorCode == ENDPOINT_RWSTREAM_NoError)
      {
        length = sizeof(packet.buffer);
      }
		}

		/* Handshake the OUT Endpoint - clear endpoint and ready for next report */
		Endpoint_ClearOUT();

		if(length)
		{
		  packet.header.length = length & 0xFF;
      Serial_SendData(&packet, sizeof(packet.header) + packet.header.length);
		}
	}
}

/** Function to manage HID report generation and transmission to the host, when in report mode. */
void HID_Task(void)
{
	/* Device must be connected and configured for the task to run */
	if (USB_DeviceState != DEVICE_STATE_Configured)
	  return;

  /* Send the next keypress report to the host */
	SendNextReport();

	/* Process the LED report sent from the host */
	ReceiveNextReport();
}
开发者ID:RalphFox,项目名称:GIMX-firmwares,代码行数:56,代码来源:emu.c

示例15: TEMPLATE_FUNC_NAME

uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer,
                            uint16_t Length)
{
	uint8_t* DataStream     = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
	bool     LastPacketFull = false;

	Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN);

	if (Length > USB_ControlRequest.wLength)
	  Length = USB_ControlRequest.wLength;
	else if (!(Length))
	  Endpoint_ClearIN();

	while (Length || LastPacketFull)
	{
		uint8_t USB_DeviceState_LCL = USB_DeviceState;

		if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
		  return ENDPOINT_RWCSTREAM_DeviceDisconnected;
		else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
		  return ENDPOINT_RWCSTREAM_BusSuspended;
		else if (Endpoint_IsSETUPReceived())
		  return ENDPOINT_RWCSTREAM_HostAborted;
		else if (Endpoint_IsOUTReceived())
		  break;

		if (Endpoint_IsINReady())
		{
			uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();

			while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize))
			{
				TEMPLATE_TRANSFER_BYTE(DataStream);
				TEMPLATE_BUFFER_MOVE(DataStream, 1);
				Length--;
				BytesInEndpoint++;
			}

			LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize);
			Endpoint_ClearIN();
		}
	}

	while (!(Endpoint_IsOUTReceived()))
	{
		uint8_t USB_DeviceState_LCL = USB_DeviceState;

		if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
		  return ENDPOINT_RWCSTREAM_DeviceDisconnected;
		else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
		  return ENDPOINT_RWCSTREAM_BusSuspended;
	}

	return ENDPOINT_RWCSTREAM_NoError;
}
开发者ID:Atarity,项目名称:Lightpack,代码行数:55,代码来源:Template_Endpoint_Control_W.c


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