本文整理汇总了C++中Pipe_Read_Stream_LE函数的典型用法代码示例。如果您正苦于以下问题:C++ Pipe_Read_Stream_LE函数的具体用法?C++ Pipe_Read_Stream_LE怎么用?C++ Pipe_Read_Stream_LE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Pipe_Read_Stream_LE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CDC_Host_USBTask
void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
{
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return;
Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipeNumber);
Pipe_SetPipeToken(PIPE_TOKEN_IN);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
{
USB_Request_Header_t Notification;
Pipe_Read_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
if ((Notification.bRequest == NOTIF_SerialState) &&
(Notification.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)))
{
Pipe_Read_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,
sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),
NO_STREAM_CALLBACK);
}
Pipe_ClearIN();
EVENT_CDC_Host_ControLineStateChanged(CDCInterfaceInfo);
}
Pipe_Freeze();
}
开发者ID:boris-arzur,项目名称:SafecastBGeigie,代码行数:30,代码来源:CDC.c
示例2: BluetoothAdapter_USBTask
/** Task to manage an enumerated USB Bluetooth adapter once connected, to display movement data as it is received. */
void BluetoothAdapter_USBTask(void)
{
if ((USB_HostState != HOST_STATE_Configured) || !(BluetoothAdapter_IsActive))
return;
Pipe_SelectPipe(BLUETOOTH_DATA_IN_PIPE);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
{
BT_HCIData_Header_t* PacketHeader = (BT_HCIData_Header_t*)BluetoothAdapter_Stack.Config.PacketBuffer;
/* Read in the HCI Data packet data from the Data IN pipe */
Pipe_Read_Stream_LE(PacketHeader, sizeof(BT_HCIData_Header_t), NULL);
Pipe_Read_Stream_LE(PacketHeader->Data, PacketHeader->DataLength, NULL);
Pipe_ClearIN();
Pipe_Freeze();
// RGB_SetColour(RGB_ALIAS_Busy);
Bluetooth_ProcessPacket(&BluetoothAdapter_Stack, BLUETOOTH_PACKET_HCIData);
// RGB_SetColour(RGB_ALIAS_Connected);
}
Pipe_Freeze();
Pipe_SelectPipe(BLUETOOTH_EVENTS_PIPE);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
{
BT_HCIEvent_Header_t* EventHeader = (BT_HCIEvent_Header_t*)BluetoothAdapter_Stack.Config.PacketBuffer;
/* Read in the HCI Event packet data from the Event IN pipe */
Pipe_Read_Stream_LE(EventHeader, sizeof(BT_HCIEvent_Header_t), NULL);
Pipe_Read_Stream_LE(EventHeader->Parameters, EventHeader->ParameterLength, NULL);
Pipe_ClearIN();
Pipe_Freeze();
//RGB_SetColour(RGB_ALIAS_Busy);
Bluetooth_ProcessPacket(&BluetoothAdapter_Stack, BLUETOOTH_PACKET_HCIEvent);
//RGB_SetColour(RGB_ALIAS_Connected);
}
Pipe_Freeze();
/* Keep on running the management routine until all pending packets have been sent */
while (Bluetooth_ManageConnections(&BluetoothAdapter_Stack)){};
//while (Bluetooth_ManageConnections(&BluetoothAdapter_Stack))
//RGB_SetColour(RGB_ALIAS_Busy);
}
开发者ID:Martin-P,项目名称:lpc1768-control-bluetooth-dongle,代码行数:52,代码来源:BluetoothAdapter.c
示例3: MassStore_GetReturnedStatus
/** Routine to receive the current CSW from the device.
*
* \param[out] SCSICommandStatus Pointer to a destination where the returned status data should be stored
*
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum, or MASS_STORE_SCSI_COMMAND_FAILED if the SCSI command fails
*/
static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICommandStatus)
{
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* If an error in the command occurred, abort */
if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Select the IN data pipe for data reception */
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
/* Load in the CSW from the attached device */
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(CommandStatusWrapper_t))) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Clear the data ready for next reception */
Pipe_ClearIN();
/* Freeze the IN pipe after use */
Pipe_Freeze();
/* Check to see if command failed */
if (SCSICommandStatus->Status != Command_Pass)
ErrorCode = MASS_STORE_SCSI_COMMAND_FAILED;
return ErrorCode;
}
开发者ID:Dzenik,项目名称:RF-Pirate,代码行数:34,代码来源:MassStoreCommands.c
示例4: Bluetooth_Signal_ConnectionResp
/** Internal Bluetooth stack Signal Command processing routine for a Connection Response command.
*
* \param[in] SignalCommandHeader Pointer to the start of the received packet's Signal Command header
*/
static inline void Bluetooth_Signal_ConnectionResp(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_ConnectionResp_t ConnectionResponse;
Pipe_Read_Stream_LE(&ConnectionResponse, sizeof(ConnectionResponse));
Pipe_ClearIN();
Pipe_Freeze();
BT_ACL_DEBUG(1, "<< L2CAP Connection Response");
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConnectionResponse.Result);
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionResponse.SourceChannel);
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionResponse.SourceChannel, CHANNEL_SEARCH_LOCALNUMBER);
/* Only progress if the referenced channel data was found */
if (ChannelData != NULL)
{
/* Set the channel structure's remote channel number to the channel allocated on the remote device */
ChannelData->RemoteNumber = ConnectionResponse.SourceChannel;
ChannelData->State = (ConnectionResponse.Result == BT_CONNECTION_SUCCESSFUL) ?
BT_Channel_Config_WaitConfig : BT_Channel_Closed;
}
}
开发者ID:Dzenik,项目名称:RF-Pirate,代码行数:30,代码来源:BluetoothACLPackets.c
示例5: MIDI_Host_ReceiveEventPacket
bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo,
MIDI_EventPacket_t* const Event)
{
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
bool DataReady = false;
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipe.Address);
Pipe_Unfreeze();
if (Pipe_IsINReceived())
{
if (Pipe_BytesInPipe())
{
Pipe_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL);
DataReady = true;
}
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
}
Pipe_Freeze();
return DataReady;
}
开发者ID:40000ft,项目名称:lufa,代码行数:27,代码来源:MIDIClassHost.c
示例6: MS_Host_GetReturnedStatus
static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
MS_CommandStatusWrapper_t* const SCSICommandStatus)
{
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
if ((ErrorCode = MS_Host_WaitForDataReceived(MSInterfaceInfo)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t),
NULL)) != PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
Pipe_ClearIN();
Pipe_Freeze();
if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass)
ErrorCode = MS_ERROR_LOGICAL_CMD_FAILED;
return ErrorCode;
}
开发者ID:Eih3,项目名称:v0.83,代码行数:25,代码来源:MassStorage.c
示例7: MouseHost_Task
/** Task to read and process the HID report descriptor and HID reports from the device and display the
* results onto the board LEDs.
*/
void MouseHost_Task(void)
{
if (USB_HostState != HOST_STATE_Configured)
return;
/* Select and unfreeze mouse data pipe */
Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
Pipe_Unfreeze();
/* Check to see if a packet has been received */
if (Pipe_IsINReceived())
{
/* Check if data has been received from the attached mouse */
if (Pipe_IsReadWriteAllowed())
{
/* Create buffer big enough for the report */
uint8_t MouseReport[Pipe_BytesInPipe()];
/* Load in the mouse report */
Pipe_Read_Stream_LE(MouseReport, Pipe_BytesInPipe(), NULL);
/* Process the read in mouse report from the device */
ProcessMouseReport(MouseReport);
}
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
}
/* Freeze mouse data pipe */
Pipe_Freeze();
}
开发者ID:hopfgarten,项目名称:jnode-atmega-dual-firmware,代码行数:35,代码来源:MouseHostWithParser.c
示例8: Bluetooth_SendHCICommand
static uint8_t Bluetooth_SendHCICommand(void* Parameters, uint8_t ParamLength)
{
uint8_t CommandBuffer[sizeof(HCICommandHeader) + HCICommandHeader.ParameterLength];
USB_HostRequest = (USB_Host_Request_Header_t)
{
bmRequestType: (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_DEVICE),
bRequest: 0,
wValue: 0,
wIndex: 0,
wLength: sizeof(CommandBuffer)
};
memset(CommandBuffer, 0x00, sizeof(CommandBuffer));
memcpy(CommandBuffer, &HCICommandHeader, sizeof(HCICommandHeader));
if (ParamLength)
memcpy(&CommandBuffer[sizeof(HCICommandHeader)], Parameters, ParamLength);
return USB_Host_SendControlRequest(CommandBuffer);
}
static bool Bluetooth_GetNextHCIEventHeader(void)
{
Pipe_SelectPipe(BLUETOOTH_EVENTS_PIPE);
Pipe_Unfreeze();
if (!(Pipe_ReadWriteAllowed()))
return false;
Pipe_Read_Stream_LE(&HCIEventHeader, sizeof(HCIEventHeader));
return true;
}
开发者ID:Limpinho0,项目名称:motmot-camtrig,代码行数:34,代码来源:BluetoothHCICommands.c
示例9: ReadNextReport
/** Reads in and processes the next report from the attached device, displaying the report
* contents on the board LEDs and via the serial port.
*/
void ReadNextReport(void)
{
USB_MouseReport_Data_t MouseReport;
uint8_t LEDMask = LEDS_NO_LEDS;
/* Select mouse data pipe */
Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
/* Unfreeze keyboard data pipe */
Pipe_Unfreeze();
/* Check to see if a packet has been received */
if (!(Pipe_IsINReceived()))
{
/* No packet received (no movement), turn off LEDs */
LEDs_SetAllLEDs(LEDS_NO_LEDS);
/* Refreeze HID data IN pipe */
Pipe_Freeze();
return;
}
/* Ensure pipe contains data before trying to read from it */
if (Pipe_IsReadWriteAllowed())
{
/* Read in mouse report data */
Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
/* Alter status LEDs according to mouse X movement */
if (MouseReport.X > 0)
LEDMask |= LEDS_LED1;
else if (MouseReport.X < 0)
LEDMask |= LEDS_LED2;
/* Alter status LEDs according to mouse Y movement */
if (MouseReport.Y > 0)
LEDMask |= LEDS_LED3;
else if (MouseReport.Y < 0)
LEDMask |= LEDS_LED4;
/* Alter status LEDs according to mouse button position */
if (MouseReport.Button)
LEDMask = LEDS_ALL_LEDS;
LEDs_SetAllLEDs(LEDMask);
/* Print mouse report data through the serial port */
printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X,
MouseReport.Y,
MouseReport.Button);
}
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
/* Refreeze mouse data pipe */
Pipe_Freeze();
}
开发者ID:AmesianX,项目名称:OpenPCR,代码行数:62,代码来源:MouseHost.c
示例10: ReadNextReport
/** Reads in and processes the next report from the attached device, displaying the report
* contents on the board LEDs and via the serial port.
*/
void ReadNextReport(void)
{
USB_KeyboardReport_Data_t KeyboardReport;
/* Select keyboard data pipe */
Pipe_SelectPipe(KEYBOARD_DATAPIPE);
/* Unfreeze keyboard data pipe */
Pipe_Unfreeze();
/* Check to see if a packet has been received */
if (!(Pipe_IsINReceived()))
{
/* Refreeze HID data IN pipe */
Pipe_Freeze();
return;
}
/* Ensure pipe contains data before trying to read from it */
if (Pipe_IsReadWriteAllowed())
{
/* Read in keyboard report data */
Pipe_Read_Stream_LE(&KeyboardReport, sizeof(KeyboardReport));
/* Indicate if the modifier byte is non-zero (special key such as shift is being pressed) */
LEDs_ChangeLEDs(LEDS_LED1, (KeyboardReport.Modifier) ? LEDS_LED1 : 0);
/* Check if a key has been pressed */
if (KeyboardReport.KeyCode)
{
/* Toggle status LED to indicate keypress */
LEDs_ToggleLEDs(LEDS_LED2);
char PressedKey = 0;
/* Retrieve pressed key character if alphanumeric */
if ((KeyboardReport.KeyCode[0] >= 0x04) && (KeyboardReport.KeyCode[0] <= 0x1D))
PressedKey = (KeyboardReport.KeyCode[0] - 0x04) + 'A';
else if ((KeyboardReport.KeyCode[0] >= 0x1E) && (KeyboardReport.KeyCode[0] <= 0x27))
PressedKey = (KeyboardReport.KeyCode[0] - 0x1E) + '0';
else if (KeyboardReport.KeyCode[0] == 0x2C)
PressedKey = ' ';
else if (KeyboardReport.KeyCode[0] == 0x28)
PressedKey = '\n';
/* Print the pressed key character out through the serial port if valid */
if (PressedKey)
putchar(PressedKey);
}
}
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
/* Refreeze keyboard data pipe */
Pipe_Freeze();
}
开发者ID:Andrew0Hill,项目名称:keyboard,代码行数:61,代码来源:KeyboardHost.c
示例11: Bluetooth_Signal_InformationReq
/** Internal Bluetooth stack Signal Command processing routine for an Information Request command.
*
* \param[in] SignalCommandHeader Pointer to the start of the received packet's Signal Command header
*/
static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_InformationReq_t InformationRequest;
Pipe_Read_Stream_LE(&InformationRequest, sizeof(InformationRequest));
BT_ACL_DEBUG(1, "<< L2CAP Information Request");
BT_ACL_DEBUG(2, "-- Info Type: 0x%04X", InformationRequest.InfoType);
Pipe_ClearIN();
Pipe_Freeze();
struct
{
BT_Signal_Header_t SignalCommandHeader;
BT_Signal_InformationResp_t InformationResponse;
uint8_t Data[4];
} ResponsePacket;
uint8_t DataLen = 0;
/* Retrieve the requested information and store it in the outgoing packet, if found */
switch (InformationRequest.InfoType)
{
case BT_INFOREQ_MTU:
ResponsePacket.InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
DataLen = 2;
*((uint16_t*)&ResponsePacket.Data) = MAXIMUM_CHANNEL_MTU;
break;
case BT_INFOREQ_EXTENDEDFEATURES:
ResponsePacket.InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
DataLen = 4;
*((uint32_t*)&ResponsePacket.Data) = 0;
break;
default:
ResponsePacket.InformationResponse.Result = BT_INFORMATION_NOTSUPPORTED;
DataLen = 0;
break;
}
/* Fill out the Signal Command header in the response packet */
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_INFORMATION_RESPONSE;
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
ResponsePacket.SignalCommandHeader.Length = sizeof(ResponsePacket.InformationResponse) + DataLen;
/* Fill out the Information Response in the response packet */
ResponsePacket.InformationResponse.InfoType = InformationRequest.InfoType;
Bluetooth_SendPacket(&ResponsePacket, (sizeof(ResponsePacket) - sizeof(ResponsePacket.Data) + DataLen), NULL);
BT_ACL_DEBUG(1, ">> L2CAP Information Response");
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.InformationResponse.Result);
}
开发者ID:Dzenik,项目名称:RF-Pirate,代码行数:60,代码来源:BluetoothACLPackets.c
示例12: CDC_Host_USBTask
void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
{
uint8_t portnum = CDCInterfaceInfo->Config.PortNumber;
if ((USB_HostState[portnum] != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return;
Pipe_SelectPipe(portnum,CDCInterfaceInfo->Config.NotificationPipeNumber);
Pipe_Unfreeze();
if (Pipe_IsINReceived(portnum))
{
USB_Request_Header_t Notification;
Pipe_Read_Stream_LE(portnum,&Notification, sizeof(USB_Request_Header_t), NULL);
if ((Notification.bRequest == CDC_NOTIF_SerialState) &&
(Notification.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)))
{
Pipe_Read_Stream_LE(portnum,
&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,
sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),
NULL);
Pipe_ClearIN(portnum);
EVENT_CDC_Host_ControLineStateChanged(CDCInterfaceInfo);
}
else
{
Pipe_ClearIN(portnum);
}
}
Pipe_Freeze();
#if !defined(NO_CLASS_DRIVER_AUTOFLUSH)
CDC_Host_Flush(CDCInterfaceInfo);
#endif
}
开发者ID:JeremyHsiao,项目名称:TinyBlueRat_LPCv1_03,代码行数:39,代码来源:CDCClassHost.c
示例13: SImage_Host_ReadData
uint8_t SImage_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, void* Buffer, const uint16_t Bytes)
{
uint8_t ErrorCode;
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NO_STREAM_CALLBACK);
Pipe_Freeze();
return ErrorCode;
}
开发者ID:andrew-taylor,项目名称:bowerbird-avr,代码行数:13,代码来源:StillImage.c
示例14: CDCHost_Task
/** Task to read in data received from the attached CDC device and print it to the serial port.
*/
void CDCHost_Task(void)
{
if (USB_HostState != HOST_STATE_Configured)
return;
/* Select the data IN pipe */
Pipe_SelectPipe(CDC_DATA_IN_PIPE);
Pipe_Unfreeze();
/* Check to see if a packet has been received */
if (Pipe_IsINReceived())
{
/* Re-freeze IN pipe after the packet has been received */
Pipe_Freeze();
/* Check if data is in the pipe */
if (Pipe_IsReadWriteAllowed())
{
/* Get the length of the pipe data, and create a new buffer to hold it */
uint16_t BufferLength = Pipe_BytesInPipe();
uint8_t Buffer[BufferLength];
/* Read in the pipe data to the temporary buffer */
Pipe_Read_Stream_LE(Buffer, BufferLength, NULL);
/* Print out the buffer contents to the USART */
for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)
putchar(Buffer[BufferByte]);
}
/* Clear the pipe after it is read, ready for the next packet */
Pipe_ClearIN();
}
/* Re-freeze IN pipe after use */
Pipe_Freeze();
/* Select and unfreeze the notification pipe */
Pipe_SelectPipe(CDC_NOTIFICATION_PIPE);
Pipe_Unfreeze();
/* Check if a packet has been received */
if (Pipe_IsINReceived())
{
/* Discard the unused event notification */
Pipe_ClearIN();
}
/* Freeze notification IN pipe after use */
Pipe_Freeze();
}
开发者ID:DynamicPerception,项目名称:ArduinoAT90USB,代码行数:53,代码来源:VirtualSerialHost.c
示例15: SImage_Host_ReceiveEventHeader
uint8_t SImage_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, SI_PIMA_Container_t* const PIMAHeader)
{
uint8_t ErrorCode;
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(SI_PIMA_Container_t), NO_STREAM_CALLBACK);
Pipe_ClearIN();
Pipe_Freeze();
return ErrorCode;
}
开发者ID:andrew-taylor,项目名称:bowerbird-avr,代码行数:14,代码来源:StillImage.c
示例16: MassStore_SendReceiveData
/** Sends or receives the transaction's data stage to or from the attached device, reading or
* writing to the nominated buffer.
*
* \param[in] SCSICommandBlock Pointer to a SCSI command block structure being sent to the attached device
* \param[in,out] BufferPtr Pointer to the data buffer to read from or write to
*
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
*/
static uint8_t MassStore_SendReceiveData(CommandBlockWrapper_t* const SCSICommandBlock,
void* BufferPtr)
{
uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
uint16_t BytesRem = SCSICommandBlock->DataTransferLength;
/* Check the direction of the SCSI command data stage */
if (SCSICommandBlock->Flags & COMMAND_DIRECTION_DATA_IN)
{
/* Wait until the device has replied with some data */
if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Select the IN data pipe for data reception */
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
/* Read in the block data from the pipe */
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Acknowledge the packet */
Pipe_ClearIN();
}
else
{
/* Select the OUT data pipe for data transmission */
Pipe_SelectPipe(MASS_STORE_DATA_OUT_PIPE);
Pipe_Unfreeze();
/* Write the block data to the pipe */
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
/* Acknowledge the packet */
Pipe_ClearOUT();
while (!(Pipe_IsOUTReady()))
{
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
}
}
/* Freeze used pipe after use */
Pipe_Freeze();
return PIPE_RWSTREAM_NoError;
}
开发者ID:Dzenik,项目名称:RF-Pirate,代码行数:57,代码来源:MassStoreCommands.c
示例17: MIDI_Host_ReceiveEventPacket
bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo, MIDI_EventPacket_t* const Event)
{
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipeNumber);
if (!(Pipe_IsReadWriteAllowed()))
return false;
Pipe_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK);
if (!(Pipe_IsReadWriteAllowed()))
Pipe_ClearIN();
return true;
}
开发者ID:dfletcher,项目名称:avr-pca9555,代码行数:17,代码来源:MIDI.c
示例18: RNDISHost_Task
/** Task to read in data received from the attached RNDIS device and print it to the serial port.
*/
void RNDISHost_Task(void)
{
if (USB_HostState != HOST_STATE_Configured)
return;
uint8_t ErrorCode;
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
uint16_t PacketLength;
if ((ErrorCode = RNDIS_GetPacketLength(&PacketLength)) != HOST_SENDCONTROL_Successful)
{
printf_P(PSTR(ESC_FG_RED "Packet Reception Error.\r\n"
" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
return;
}
if (!(PacketLength))
return;
Pipe_Unfreeze();
printf_P(PSTR("***PACKET (Size %d)***\r\n"), PacketLength);
if (PacketLength > 1024)
{
puts_P(PSTR(ESC_FG_RED "Packet too large.\r\n" ESC_FG_WHITE));
Pipe_Discard_Stream(PacketLength, NULL);
}
else
{
uint8_t PacketBuffer[PacketLength];
Pipe_Read_Stream_LE(&PacketBuffer, PacketLength, NULL);
for (uint16_t i = 0; i < PacketLength; i++)
printf("0x%02x ", PacketBuffer[i]);
}
Pipe_ClearIN();
Pipe_Freeze();
printf("\r\n\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
开发者ID:jledet,项目名称:lufa,代码行数:48,代码来源:RNDISEthernetHost.c
示例19: SImage_ReadData
/** Function to receive the given data from the device, after a response block has been received.
*
* \param[out] Buffer Destination data buffer to put read bytes from the device
* \param[in] Bytes Number of bytes to receive
*
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
*/
uint8_t SImage_ReadData(void* const Buffer,
const uint16_t Bytes)
{
uint8_t ErrorCode;
/* Unfreeze the data IN pipe */
Pipe_SelectPipe(SIMAGE_DATA_IN_PIPE);
Pipe_Unfreeze();
/* Read in the data into the buffer */
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NULL);
/* Freeze the pipe again after use */
Pipe_Freeze();
return ErrorCode;
}
开发者ID:ASHOK1991,项目名称:lb-Arduino-Code,代码行数:24,代码来源:StillImageCommands.c
示例20: SI_Host_ReceiveEventHeader
uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
PIMA_Container_t* const PIMAHeader)
{
uint8_t ErrorCode;
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(PIMA_Container_t), NO_STREAM_CALLBACK);
Pipe_ClearIN();
Pipe_Freeze();
return ErrorCode;
}
开发者ID:C3MA,项目名称:hexabus,代码行数:18,代码来源:StillImage.c
注:本文中的Pipe_Read_Stream_LE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论