Altered all endpoint/pipe stream transfers so that the new BytesProcessed parameter now points to a location where the number of bytes in the transfer that have been completed can be stored (or NULL if entire transaction should be performed in one chunk).
Added new Endpoint_Null_Stream() and Pipe_Null_stream() functions. Removed the NO_STREAM_CALLBACKS compile time option due to the new partial stream transfer feature replacing it. Fixed errors in the incomplete Test and Measurement device demo preventing proper operation (thanks to Pavel Plotnikov).
This commit is contained in:
parent
477a2047f4
commit
f555ad7ced
107 changed files with 1257 additions and 943 deletions
|
@ -147,7 +147,7 @@ void ReadNextReport(void)
|
|||
uint8_t ReportINData[Pipe_BytesInPipe()];
|
||||
|
||||
/* Read in HID report data */
|
||||
Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData));
|
||||
Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData), NULL);
|
||||
|
||||
/* Print report data through the serial port */
|
||||
for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
|
||||
|
@ -198,7 +198,7 @@ void WriteNextReport(uint8_t* ReportOUTData,
|
|||
Pipe_Write_Byte(ReportIndex);
|
||||
|
||||
/* Write out HID report data */
|
||||
Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
|
||||
Pipe_Write_Stream_LE(ReportOUTData, ReportLength, NULL);
|
||||
|
||||
/* Clear the OUT endpoint, send last data packet */
|
||||
Pipe_ClearOUT();
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ void Joystick_HID_Task(void)
|
|||
uint8_t JoystickReport[Pipe_BytesInPipe()];
|
||||
|
||||
/* Load in the joystick report */
|
||||
Pipe_Read_Stream_LE(JoystickReport, Pipe_BytesInPipe());
|
||||
Pipe_Read_Stream_LE(JoystickReport, Pipe_BytesInPipe(), NULL);
|
||||
|
||||
/* Process the read in joystick report from the device */
|
||||
ProcessJoystickReport(JoystickReport);
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ void ReadNextReport(void)
|
|||
if (Pipe_IsReadWriteAllowed())
|
||||
{
|
||||
/* Read in keyboard report data */
|
||||
Pipe_Read_Stream_LE(&KeyboardReport, sizeof(KeyboardReport));
|
||||
Pipe_Read_Stream_LE(&KeyboardReport, sizeof(KeyboardReport), NULL);
|
||||
|
||||
/* 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);
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ void Keyboard_HID_Task(void)
|
|||
uint8_t KeyboardReport[Pipe_BytesInPipe()];
|
||||
|
||||
/* Load in the keyboard report */
|
||||
Pipe_Read_Stream_LE(KeyboardReport, Pipe_BytesInPipe());
|
||||
Pipe_Read_Stream_LE(KeyboardReport, Pipe_BytesInPipe(), NULL);
|
||||
|
||||
/* Process the read in keyboard report from the device */
|
||||
ProcessKeyboardReport(KeyboardReport);
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -181,7 +181,10 @@ void MIDI_Host_Task(void)
|
|||
{
|
||||
MIDI_EventPacket_t MIDIEvent;
|
||||
|
||||
Pipe_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
|
||||
Pipe_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL);
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
Pipe_ClearIN();
|
||||
|
||||
bool NoteOnEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_ON >> 4));
|
||||
bool NoteOffEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_OFF >> 4));
|
||||
|
@ -191,10 +194,7 @@ void MIDI_Host_Task(void)
|
|||
printf_P(PSTR("MIDI Note %s - Channel %d, Pitch %d, Velocity %d\r\n"), NoteOnEvent ? "On" : "Off",
|
||||
((MIDIEvent.Data1 & 0x0F) + 1),
|
||||
MIDIEvent.Data2, MIDIEvent.Data3);
|
||||
}
|
||||
|
||||
if (!(Pipe_BytesInPipe()))
|
||||
Pipe_ClearIN();
|
||||
}
|
||||
}
|
||||
|
||||
Pipe_SelectPipe(MIDI_DATA_OUT_PIPE);
|
||||
|
@ -255,7 +255,7 @@ void MIDI_Host_Task(void)
|
|||
};
|
||||
|
||||
/* Write the MIDI event packet to the pipe */
|
||||
Pipe_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
|
||||
Pipe_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent), NULL);
|
||||
|
||||
/* Send the data in the pipe to the device */
|
||||
Pipe_ClearOUT();
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -80,8 +80,11 @@ static uint8_t MassStore_SendCommand(MS_CommandBlockWrapper_t* const SCSICommand
|
|||
Pipe_Unfreeze();
|
||||
|
||||
/* Write the CBW command to the OUT pipe */
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t))) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(SCSICommandBlock, sizeof(MS_CommandBlockWrapper_t), NULL)) !=
|
||||
PIPE_RWSTREAM_NoError)
|
||||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
/* Send the data in the OUT pipe to the attached device */
|
||||
Pipe_ClearOUT();
|
||||
|
@ -200,7 +203,7 @@ static uint8_t MassStore_SendReceiveData(MS_CommandBlockWrapper_t* const SCSICom
|
|||
Pipe_Unfreeze();
|
||||
|
||||
/* Read in the block data from the pipe */
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_NoError)
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
/* Acknowledge the packet */
|
||||
|
@ -213,7 +216,7 @@ static uint8_t MassStore_SendReceiveData(MS_CommandBlockWrapper_t* const SCSICom
|
|||
Pipe_Unfreeze();
|
||||
|
||||
/* Write the block data to the pipe */
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_NoError)
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(BufferPtr, BytesRem, NULL)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
/* Acknowledge the packet */
|
||||
|
@ -251,9 +254,12 @@ static uint8_t MassStore_GetReturnedStatus(MS_CommandStatusWrapper_t* const SCSI
|
|||
Pipe_Unfreeze();
|
||||
|
||||
/* Load in the CSW from the attached device */
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t))) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t), NULL)) !=
|
||||
PIPE_RWSTREAM_NoError)
|
||||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
/* Clear the data ready for next reception */
|
||||
Pipe_ClearIN();
|
||||
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
LUFA_OPTS += -D USB_STREAM_TIMEOUT_MS=5000
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ void ReadNextReport(void)
|
|||
if (Pipe_IsReadWriteAllowed())
|
||||
{
|
||||
/* Read in mouse report data */
|
||||
Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
|
||||
Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport), NULL);
|
||||
|
||||
/* Alter status LEDs according to mouse X movement */
|
||||
if (MouseReport.X > 0)
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ void Mouse_HID_Task(void)
|
|||
uint8_t MouseReport[Pipe_BytesInPipe()];
|
||||
|
||||
/* Load in the mouse report */
|
||||
Pipe_Read_Stream_LE(MouseReport, Pipe_BytesInPipe());
|
||||
Pipe_Read_Stream_LE(MouseReport, Pipe_BytesInPipe(), NULL);
|
||||
|
||||
/* Process the read in mouse report from the device */
|
||||
ProcessMouseReport(MouseReport);
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ uint8_t Printer_SendData(const void* const PrinterCommands,
|
|||
Pipe_SelectPipe(PRINTER_DATA_OUT_PIPE);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, CommandSize)) != PIPE_RWSTREAM_NoError)
|
||||
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, CommandSize, NULL)) != PIPE_RWSTREAM_NoError)
|
||||
return ErrorCode;
|
||||
|
||||
Pipe_ClearOUT();
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -294,14 +294,15 @@ uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength)
|
|||
|
||||
RNDIS_Packet_Message_t DeviceMessage;
|
||||
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t))) != PIPE_RWSTREAM_NoError)
|
||||
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t), NULL)) != PIPE_RWSTREAM_NoError)
|
||||
{
|
||||
return ErrorCode;
|
||||
}
|
||||
|
||||
*PacketLength = (uint16_t)DeviceMessage.DataLength;
|
||||
|
||||
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)));
|
||||
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)),
|
||||
NULL);
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
|
|
|
@ -147,13 +147,13 @@ void PrintIncomingPackets(void)
|
|||
if (PacketLength > 1024)
|
||||
{
|
||||
puts_P(PSTR(ESC_FG_RED "Packet too large.\r\n" ESC_FG_WHITE));
|
||||
Pipe_Discard_Stream(PacketLength);
|
||||
Pipe_Discard_Stream(PacketLength, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint8_t PacketBuffer[PacketLength];
|
||||
|
||||
Pipe_Read_Stream_LE(&PacketBuffer, PacketLength);
|
||||
Pipe_Read_Stream_LE(&PacketBuffer, PacketLength, NULL);
|
||||
|
||||
for (uint16_t i = 0; i < PacketLength; i++)
|
||||
printf("0x%02x ", PacketBuffer[i]);
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void SImage_SendBlockHeader(void)
|
|||
Pipe_Unfreeze();
|
||||
|
||||
/* Write the PIMA block to the data OUT pipe */
|
||||
Pipe_Write_Stream_LE(&PIMA_SendBlock, PIMA_COMMAND_SIZE(0));
|
||||
Pipe_Write_Stream_LE(&PIMA_SendBlock, PIMA_COMMAND_SIZE(0), NULL);
|
||||
|
||||
/* If the block type is a command, send its parameters (if any) */
|
||||
if (PIMA_SendBlock.Type == PIMA_CONTAINER_CommandBlock)
|
||||
|
@ -67,7 +67,7 @@ void SImage_SendBlockHeader(void)
|
|||
if (ParamBytes)
|
||||
{
|
||||
/* Write the PIMA parameters to the data OUT pipe */
|
||||
Pipe_Write_Stream_LE(&PIMA_SendBlock.Params, ParamBytes);
|
||||
Pipe_Write_Stream_LE(&PIMA_SendBlock.Params, ParamBytes, NULL);
|
||||
}
|
||||
|
||||
/* Send the PIMA command block to the attached device */
|
||||
|
@ -91,7 +91,7 @@ uint8_t SImage_ReceiveEventHeader(void)
|
|||
Pipe_Unfreeze();
|
||||
|
||||
/* Read in the event data into the global structure */
|
||||
ErrorCode = Pipe_Read_Stream_LE(&PIMA_EventBlock, sizeof(PIMA_EventBlock));
|
||||
ErrorCode = Pipe_Read_Stream_LE(&PIMA_EventBlock, sizeof(PIMA_EventBlock), NULL);
|
||||
|
||||
/* Clear the pipe after read complete to prepare for next event */
|
||||
Pipe_ClearIN();
|
||||
|
@ -166,7 +166,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
|
|||
}
|
||||
|
||||
/* Load in the response from the attached device */
|
||||
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock, PIMA_COMMAND_SIZE(0));
|
||||
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock, PIMA_COMMAND_SIZE(0), NULL);
|
||||
|
||||
/* Check if the returned block type is a response block */
|
||||
if (PIMA_ReceivedBlock.Type == PIMA_CONTAINER_ResponseBlock)
|
||||
|
@ -178,7 +178,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
|
|||
if (ParamBytes)
|
||||
{
|
||||
/* Read the PIMA parameters from the data IN pipe */
|
||||
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock.Params, ParamBytes);
|
||||
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock.Params, ParamBytes, NULL);
|
||||
}
|
||||
|
||||
/* Clear pipe bank after use */
|
||||
|
@ -208,7 +208,7 @@ uint8_t SImage_SendData(void* const Buffer,
|
|||
Pipe_Unfreeze();
|
||||
|
||||
/* Write the data contents to the pipe */
|
||||
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes);
|
||||
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NULL);
|
||||
|
||||
/* Send the last packet to the attached device */
|
||||
Pipe_ClearOUT();
|
||||
|
@ -236,7 +236,7 @@ uint8_t SImage_ReadData(void* const Buffer,
|
|||
Pipe_Unfreeze();
|
||||
|
||||
/* Read in the data into the buffer */
|
||||
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes);
|
||||
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NULL);
|
||||
|
||||
/* Freeze the pipe again after use */
|
||||
Pipe_Freeze();
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ void CDC_Host_Task(void)
|
|||
uint8_t Buffer[BufferLength];
|
||||
|
||||
/* Read in the pipe data to the temporary buffer */
|
||||
Pipe_Read_Stream_LE(Buffer, BufferLength);
|
||||
Pipe_Read_Stream_LE(Buffer, BufferLength, NULL);
|
||||
|
||||
/* Print out the buffer contents to the USART */
|
||||
for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)
|
||||
|
|
|
@ -117,7 +117,6 @@ LUFA_PATH = ../../../..
|
|||
|
||||
# LUFA library compile-time options and predefined tokens
|
||||
LUFA_OPTS = -D USB_HOST_ONLY
|
||||
LUFA_OPTS += -D NO_STREAM_CALLBACKS
|
||||
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue