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


C++ Endpoint_Write_Stream_LE函数代码示例

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


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

示例1: SideShow_GetApplicationOrder

static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* PacketHeader)
{
	uint8_t  TotalApplications = 0;
		   
	Endpoint_ClearOUT();

	for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
	{
		if (InstalledApplications[App].InUse)
		  TotalApplications++;
	}

	PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
	                       sizeof(uint32_t) + (TotalApplications * sizeof(GUID_t));
	
	Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
	Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
	Endpoint_Write_DWord_LE(TotalApplications);
	
	for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
	{
		if (InstalledApplications[App].InUse)
		  Endpoint_Write_Stream_LE(&InstalledApplications[App].ApplicationID, sizeof(GUID_t));
	}

	Endpoint_ClearIN();
}
开发者ID:TomMD,项目名称:teensy,代码行数:27,代码来源:SideshowCommands.c

示例2: SCSI_Command_Inquiry

/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features
 *  and capabilities to the host.
 *
 *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface structure that the command is associated with
 *
 *  \return Boolean true if the command completed successfully, false otherwise.
 */
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
	uint16_t AllocationLength  = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[3]);
	uint16_t BytesTransferred  = (AllocationLength < sizeof(InquiryData))? AllocationLength :
	                                                                       sizeof(InquiryData);

	/* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
	if ((MSInterfaceInfo->State.CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
	     MSInterfaceInfo->State.CommandBlock.SCSICommandData[2])
	{
		/* Optional but unsupported bits set - update the SENSE key and fail the request */
		SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
		               SCSI_ASENSE_INVALID_FIELD_IN_CDB,
		               SCSI_ASENSEQ_NO_QUALIFIER);

		return false;
	}
	
	Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);

	uint8_t PadBytes[AllocationLength - BytesTransferred];
	
	/* Pad out remaining bytes with 0x00 */
	Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);

	/* Finalize the stream transfer to send the last packet */
	Endpoint_ClearIN();

	/* Succeed the command and update the bytes transferred counter */
	MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
	
	return true;
}
开发者ID:davr,项目名称:lufa-lib,代码行数:40,代码来源:SCSI.c

示例3: Endpoint_Streaming

void Endpoint_Streaming(uint8_t corenum, uint8_t *buffer, uint16_t packetsize,
						uint16_t totalpackets, uint16_t dummypackets)
{
	uint8_t PhyEP = endpointhandle(corenum)[endpointselected[corenum]];
	uint16_t i;

	if (PhyEP & 1) {
		for (i = 0; i < totalpackets; i++) {
			while (!Endpoint_IsReadWriteAllowed(corenum)) ;
			Endpoint_Write_Stream_LE(corenum,(void *) (buffer + i * packetsize), packetsize, NULL);
			Endpoint_ClearIN(corenum);
		}
		for (i = 0; i < dummypackets; i++) {
			while (!Endpoint_IsReadWriteAllowed(corenum)) ;
			Endpoint_Write_Stream_LE(corenum,(void *) buffer, packetsize, NULL);
			Endpoint_ClearIN(corenum);
		}
	}
	else {
		stream_total_packets = totalpackets + dummypackets;
		for (i = 0; i < totalpackets; i++) {
			DcdDataTransfer(PhyEP, (uint8_t *) (buffer + i * packetsize), packetsize);
			Endpoint_ClearOUT(corenum);
			while (!Endpoint_IsReadWriteAllowed(corenum)) ;
		}
		for (i = 0; i < dummypackets; i++) {
			DcdDataTransfer(PhyEP, buffer, packetsize);
			Endpoint_ClearOUT(corenum);
			while (!Endpoint_IsReadWriteAllowed(corenum)) ;
		}
		stream_total_packets = 0;
	}
}
开发者ID:JeremyHsiao,项目名称:TinyBlueRat_LPCv1_03,代码行数:33,代码来源:Endpoint_LPC11Uxx.c

示例4: CDC_Device_SendControlLineStateChange

void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
{
	if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
	  return;

	Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber);

	USB_Request_Header_t Notification = (USB_Request_Header_t)
		{
			.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
			.bRequest      = CDC_NOTIF_SerialState,
			.wValue        = CPU_TO_LE16(0),
			.wIndex        = CPU_TO_LE16(0),
			.wLength       = CPU_TO_LE16(sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost)),
		};

	Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL);
	Endpoint_Write_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,
	                         sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),
	                         NULL);
	Endpoint_ClearIN();
}

#if defined(FDEV_SETUP_STREAM)
void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
                             FILE* const Stream)
{
	*Stream = (FILE)FDEV_SETUP_STREAM(CDC_Device_putchar, CDC_Device_getchar, _FDEV_SETUP_RW);
	fdev_set_udata(Stream, CDCInterfaceInfo);
}
开发者ID:cloud-hot,项目名称:Jennisense,代码行数:30,代码来源:CDC.c

示例5: RNDIS_Device_SendPacket

uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
                                void* Buffer,
                                const uint16_t PacketLength)
{
	uint8_t ErrorCode;

	if ((USB_DeviceState != DEVICE_STATE_Configured) ||
	    (RNDISInterfaceInfo->State.CurrRNDISState != RNDIS_Data_Initialized))
	{
		return ENDPOINT_RWSTREAM_DeviceDisconnected;
	}

	Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpoint.Address);

	if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
	  return ErrorCode;

	RNDIS_Packet_Message_t RNDISPacketHeader;

	memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t));

	RNDISPacketHeader.MessageType   = CPU_TO_LE32(REMOTE_NDIS_PACKET_MSG);
	RNDISPacketHeader.MessageLength = cpu_to_le32(sizeof(RNDIS_Packet_Message_t) + PacketLength);
	RNDISPacketHeader.DataOffset    = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
	RNDISPacketHeader.DataLength    = cpu_to_le32(PacketLength);

	Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL);
	Endpoint_Write_Stream_LE(Buffer, PacketLength, NULL);
	Endpoint_ClearIN();

	return ENDPOINT_RWSTREAM_NoError;
}
开发者ID:abcminiuser,项目名称:lufa,代码行数:32,代码来源:RNDISClassDevice.c

示例6: SCSI_Command_Inquiry

/** Command processing for an issued SCSI INQUIRY command. This command returns information about the device's features
 *  and capabilities to the host.
 */
static void SCSI_Command_Inquiry(void)
{
	uint16_t AllocationLength  = SwapEndian_16(*(uint16_t*)&CommandBlock.SCSICommandData[3]);
	uint16_t BytesTransferred  = (AllocationLength < sizeof(InquiryData))? AllocationLength :
	                                                                       sizeof(InquiryData);

	/* Only the standard INQUIRY data is supported, check if any optional INQUIRY bits set */
	if ((CommandBlock.SCSICommandData[1] & ((1 << 0) | (1 << 1))) ||
	     CommandBlock.SCSICommandData[2])
	{
		/* Optional but unsupported bits set - update the SENSE key and fail the request */
		SCSI_SET_SENSE(SCSI_SENSE_KEY_ILLEGAL_REQUEST,
		               SCSI_ASENSE_INVALID_FIELD_IN_CDB,
		               SCSI_ASENSEQ_NO_QUALIFIER);

		return;
	}

	/* Write the INQUIRY data to the endpoint */
	Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);

	uint8_t PadBytes[AllocationLength - BytesTransferred];
	
	/* Pad out remaining bytes with 0x00 */
	Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), StreamCallback_AbortOnMassStoreReset);

	/* Finalize the stream transfer to send the last packet */
	Endpoint_ClearIN();

	/* Succeed the command and update the bytes transferred counter */
	CommandBlock.DataTransferLength -= BytesTransferred;
}
开发者ID:G33KatWork,项目名称:XBox-360-AVR-flasher,代码行数:35,代码来源:SCSI.c

示例7: SCSI_Command_Request_Sense

/** Command processing for an issued SCSI REQUEST SENSE command. This command returns information about the last issued command,
 *  including the error code and additional error information so that the host can determine why a command failed to complete.
 *
 *  \param[in] MSInterfaceInfo  Pointer to the Mass Storage class interface structure that the command is associated with
 */
static void SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* MSInterfaceInfo)
{
	uint8_t  AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
	uint8_t  BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
	
	uint8_t PadBytes[AllocationLength - BytesTransferred];

	Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
	Endpoint_Write_Stream_LE(&PadBytes, (AllocationLength - BytesTransferred), NO_STREAM_CALLBACK);
	Endpoint_ClearIN();

	/* Succeed the command and update the bytes transferred counter */
	MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
}
开发者ID:TomMD,项目名称:teensy,代码行数:19,代码来源:SCSI.c

示例8: HID_Task

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

	/* Select the Joystick Report Endpoint */
	Endpoint_SelectEndpoint(JOYSTICK_EPADDR);

	/* Check to see if the host is ready for another packet */
	if (Endpoint_IsINReady())
	{
		USB_JoystickReport_Data_t JoystickReportData;

		/* Create the next HID report to send to the host */
		GetNextReport(&JoystickReportData);

		/* Write Joystick Report Data */
		Endpoint_Write_Stream_LE(&JoystickReportData, sizeof(JoystickReportData), NULL);

		/* Finalize the stream transfer to send the last packet */
		Endpoint_ClearIN();

		/* Clear the report data afterwards */
		memset(&JoystickReportData, 0, sizeof(JoystickReportData));
	}
}
开发者ID:BrazzoduroArduino,项目名称:Dougs-Arduino-Stuff,代码行数:28,代码来源:Joystick.c

示例9: MS_Device_ReturnCommandStatus

static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
	Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);

	while (Endpoint_IsStalled())
	{
		#if !defined(INTERRUPT_CONTROL_ENDPOINT)
		USB_USBTask();
		#endif

		if (MSInterfaceInfo->State.IsMassStoreReset)
		  return;
	}

	Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);

	while (Endpoint_IsStalled())
	{
		#if !defined(INTERRUPT_CONTROL_ENDPOINT)
		USB_USBTask();
		#endif
		
		if (MSInterfaceInfo->State.IsMassStoreReset)
		  return;
	}
	
	CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
	if (Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, sizeof(MS_CommandStatusWrapper_t),
	                             StreamCallback_MS_Device_AbortOnMassStoreReset))
	{
		return;
	}

	Endpoint_ClearIN();
}
开发者ID:Andrew0Hill,项目名称:keyboard,代码行数:35,代码来源:MassStorage.c

示例10: SendNextReport

/** Sends the next HID report to the host, via the IN endpoint. */
void SendNextReport(void)
{
	/* Select the IN Report Endpoint */
	Endpoint_SelectEndpoint(IN_EPNUM);

  if (ready && sendReport)
  {
    /* Wait until the host is ready to accept another packet */
    while (!Endpoint_IsINReady()) {}

		/* Write IN Report Data */
		Endpoint_Write_Stream_LE(report, sizeof(report), NULL);

		/* Finalize the stream transfer to send the last packet */
		Endpoint_ClearIN();

    sendReport = 0;

#ifdef REPORT_NB_INFO
		nbReports++;
		if(!nbReports) {
      Serial_SendData(info, sizeof(info));
		}
#endif
	}
}
开发者ID:RalphFox,项目名称:GIMX-firmwares,代码行数:27,代码来源:emu.c

示例11: RNDIS_Notification

/** Task to manage the sending and receiving of encapsulated RNDIS data and notifications. This removes the RNDIS
 *  wrapper from recieved Ethernet frames and places them in the FrameIN global buffer, or adds the RNDIS wrapper
 *  to a frame in the FrameOUT global before sending the buffer contents to the host.
 */
void RNDIS_Notification(void)
{
	/* Select the notification endpoint */
	Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);

	/* Check if a message response is ready for the host */
	if (Endpoint_ReadWriteAllowed() && ResponseReady)
	{
		USB_Notification_t Notification = (USB_Notification_t)
			{
				bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
				bNotification: NOTIF_RESPONSE_AVAILABLE,
				wValue:        0,
				wIndex:        0,
				wLength:       0,
			};

		/* Indicate that a message response is ready for the host */
		Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));

		/* Finalize the stream transfer to send the last packet */
		Endpoint_ClearCurrentBank();

		/* Indicate a response is no longer ready */
		ResponseReady = false;
	}
开发者ID:BackupTheBerlios,项目名称:culeth,代码行数:30,代码来源:If_RNDIS.c

示例12: HID_Task

void HID_Task(void)
{
    if (USB_DeviceState != DEVICE_STATE_Configured)
      return;

    Endpoint_SelectEndpoint(GENERIC_OUT_EPNUM);

    if (Endpoint_IsOUTReceived())
    {
        if (Endpoint_IsReadWriteAllowed())
        {
            Endpoint_Read_Stream_LE(&HIDReportInData, sizeof(HIDReportInData), NULL);
        }
        Endpoint_ClearOUT();
    }

    Endpoint_SelectEndpoint(GENERIC_IN_EPNUM);

    if (Endpoint_IsINReady())
    {
        Endpoint_Write_Stream_LE(&HIDReportOutData, sizeof(HIDReportOutData), NULL);
        memset(&HIDReportOutData, 0, GENERIC_REPORT_SIZE + 1);
        Endpoint_ClearIN();
    }
}
开发者ID:HexTank,项目名称:KADE,代码行数:25,代码来源:KADE-USBHIDx4.c

示例13: Endpoint_Streaming

void Endpoint_Streaming(uint8_t * buffer,uint16_t packetsize,
						uint16_t totalpackets,uint16_t dummypackets)
{
	uint8_t PhyEP = endpointhandle[endpointselected];
	uint16_t i;

	dummypackets = dummypackets;
	if(PhyEP&1)
	{
		for(i=0;i<totalpackets;i++){
			while(!Endpoint_IsReadWriteAllowed());
			Endpoint_Write_Stream_LE((void*)(buffer + i*packetsize), packetsize,NULL);
			Endpoint_ClearIN();
		}
	}
	else
	{
		for(i=0;i<totalpackets;i++){
			DcdDataTransfer(PhyEP, usb_data_buffer_OUT, packetsize);
			Endpoint_ClearOUT();
			while(!Endpoint_IsReadWriteAllowed());
			Endpoint_Read_Stream_LE((void*)(buffer + i*packetsize),packetsize,NULL);
		}
	}
}
开发者ID:AlexandreN7,项目名称:Liqui_lense,代码行数:25,代码来源:Endpoint_LPC17xx.c

示例14: MIDI_To_Host

// From Arduino/Serial to USB/Host 
void MIDI_To_Host(void)
{
	// Device must be connected and configured for the task to run
	if (USB_DeviceState != DEVICE_STATE_Configured) return;

	// Select the MIDI IN stream
	Endpoint_SelectEndpoint(MIDI_STREAM_IN_EPADDR);

	if (Endpoint_IsINReady())
	{
		if (mPendingMessageValid == true)
		{
			mPendingMessageValid = false;

			// Write the MIDI event packet to the endpoint
			Endpoint_Write_Stream_LE(&mCompleteMessage, sizeof(mCompleteMessage), NULL);

			// Clear out complete message
			memset(&mCompleteMessage, 0, sizeof(mCompleteMessage)); 

			// Send the data in the endpoint to the host
			Endpoint_ClearIN();

			LEDs_TurnOffLEDs(LEDS_LED2);
			tx_ticks = TICK_COUNT; 
		}
	}

}
开发者ID:guidokritz,项目名称:KiloMux-Shield,代码行数:30,代码来源:arduino_midi.c

示例15: usb_debug

void usb_debug( char *msg )
{
	/* Device must be connected and configured for the task to run */
	if (USB_DeviceState != DEVICE_STATE_Configured)
	  return;
	
	Endpoint_SelectEndpoint(GENERIC_IN_EPADDR);

	/* Check to see if the host is ready to accept another packet */
	if (Endpoint_IsINReady())
	{
		/* Create a temporary buffer to hold the report to send to the host */
		uint8_t GenericData[BUFFER_EPSIZE];
		
		int len = strlen( msg );

		GenericData[0] = len;
		GenericData[1] = 0x01;	// debug msg
		
		for ( int c = 0; c < len; c++ )
			GenericData[c + 2] = *msg++;

		/* Write Generic Report Data */
		Endpoint_Write_Stream_LE(&GenericData, sizeof(GenericData), NULL);

		/* Finalize the stream transfer to send the last packet */
		Endpoint_ClearIN();
	}	

	_delay_ms(200);
}
开发者ID:12019,项目名称:mooltipass,代码行数:31,代码来源:usb.c


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