/* Check if the endpoint is a bulk IN or bulk OUT endpoint */\r
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)\r
{\r
- /* Kill the configured OUT pipe if the data endpoints are bidirectional */\r
- if (Pipe_IsEndpointBound(EndpointData->EndpointAddress))\r
- Pipe_DisablePipe();\r
-\r
/* Configure the data IN pipe */\r
Pipe_ConfigurePipe(RNDIS_DATAPIPE_IN, EP_TYPE_BULK, PIPE_TOKEN_IN,\r
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
}\r
else\r
{\r
- /* Only configure the OUT data pipe if the data endpoints have not shown to be bidirectional */\r
- if (!(Pipe_IsEndpointBound(EndpointData->EndpointAddress)))\r
- {\r
- /* Configure the data OUT pipe */\r
- Pipe_ConfigurePipe(RNDIS_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
- EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
- }\r
+ /* Configure the data OUT pipe */\r
+ Pipe_ConfigurePipe(RNDIS_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
+ EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
\r
/* Set the flag indicating that the data OUT pipe has been found */\r
FoundEndpoints |= (1 << RNDIS_DATAPIPE_OUT);\r
/* Check if the endpoint is a bulk IN or bulk OUT endpoint */\r
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)\r
{\r
- /* Kill the configured OUT pipe if the data endpoints are bidirectional */\r
- if (Pipe_IsEndpointBound(EndpointData->EndpointAddress))\r
- Pipe_DisablePipe();\r
-\r
/* Configure the data IN pipe */\r
Pipe_ConfigurePipe(CDC_DATAPIPE_IN, EP_TYPE_BULK, PIPE_TOKEN_IN,\r
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
}\r
else\r
{\r
- /* Only configure the OUT data pipe if the data endpoints have not shown to be bidirectional */\r
- if (!(Pipe_IsEndpointBound(EndpointData->EndpointAddress)))\r
- {\r
- /* Configure the data OUT pipe */\r
- Pipe_ConfigurePipe(CDC_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
- EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
- }\r
+ /* Configure the data OUT pipe */\r
+ Pipe_ConfigurePipe(CDC_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
+ EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);\r
\r
/* Set the flag indicating that the data OUT pipe has been found */\r
FoundEndpoints |= (1 << CDC_DATAPIPE_OUT);\r
case HOST_STATE_Configured:\r
/* Select the data IN pipe */\r
Pipe_SelectPipe(CDC_DATAPIPE_IN);\r
- Pipe_SetPipeToken(PIPE_TOKEN_IN);\r
Pipe_Unfreeze();\r
\r
/* Check to see if a packet has been received */\r
{\r
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)\r
{\r
- if (Pipe_IsEndpointBound(EndpointData->EndpointAddress))\r
- {\r
- CDCInterfaceInfo->State.BidirectionalDataEndpoints = true;\r
- Pipe_DisablePipe();\r
- }\r
-\r
Pipe_ConfigurePipe(CDCInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,\r
EndpointData->EndpointAddress, EndpointData->EndpointSize, \r
CDCInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
+\r
CDCInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;\r
\r
FoundEndpoints |= CDC_FOUND_DATAPIPE_IN;\r
}\r
else\r
{\r
- if (Pipe_IsEndpointBound(EndpointData->EndpointAddress))\r
- {\r
- CDCInterfaceInfo->State.BidirectionalDataEndpoints = true;\r
- }\r
- else\r
- {\r
- Pipe_ConfigurePipe(CDCInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
- EndpointData->EndpointAddress, EndpointData->EndpointSize, \r
- CDCInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
- }\r
- \r
+ Pipe_ConfigurePipe(CDCInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
+ EndpointData->EndpointAddress, EndpointData->EndpointSize, \r
+ CDCInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
+ \r
CDCInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;\r
\r
FoundEndpoints |= CDC_FOUND_DATAPIPE_OUT;\r
\r
uint8_t ErrorCode;\r
\r
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)\r
- {\r
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);\r
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);\r
- }\r
- else\r
- {\r
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); \r
- }\r
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); \r
\r
Pipe_Unfreeze();\r
ErrorCode = Pipe_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);\r
Pipe_Freeze();\r
-\r
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)\r
- Pipe_SetPipeToken(PIPE_TOKEN_IN);\r
\r
return ErrorCode;\r
}\r
\r
uint8_t ErrorCode;\r
\r
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)\r
- {\r
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);\r
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);\r
- }\r
- else\r
- {\r
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); \r
- }\r
- \r
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); \r
Pipe_Unfreeze();\r
\r
if (!(Pipe_IsReadWriteAllowed()))\r
\r
Pipe_Write_Byte(Data); \r
Pipe_Freeze();\r
-\r
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)\r
- Pipe_SetPipeToken(PIPE_TOKEN_IN);\r
\r
return PIPE_READYWAIT_NoError;\r
}\r
\r
uint8_t ErrorCode;\r
\r
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)\r
- {\r
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);\r
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);\r
- }\r
- else\r
- {\r
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); \r
- }\r
- \r
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber); \r
Pipe_Unfreeze();\r
\r
if (!(Pipe_BytesInPipe()))\r
}\r
\r
Pipe_Freeze();\r
-\r
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)\r
- Pipe_SetPipeToken(PIPE_TOKEN_IN);\r
\r
return PIPE_READYWAIT_NoError;\r
}\r
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe */\r
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification pipe, if used */\r
\r
- bool BidirectionalDataEndpoints; /**< Indicates if the attached CDC interface uses bidirectional data endpoints,\r
- * and this has only the IN pipe configured (with \ref Pipe_SetPipeToken()\r
- * used to switch the pipe's direction)\r
- */\r
-\r
struct\r
{\r
uint8_t HostToDevice; /**< Control line states from the host to device, as a set of CDC_CONTROL_LINE_OUT_*\r
{\r
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)\r
{\r
- if (Pipe_IsEndpointBound(EndpointData->EndpointAddress))\r
- {\r
- RNDISInterfaceInfo->State.BidirectionalDataEndpoints = true;\r
- Pipe_DisablePipe();\r
- }\r
-\r
Pipe_ConfigurePipe(RNDISInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,\r
EndpointData->EndpointAddress, EndpointData->EndpointSize, \r
RNDISInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
}\r
else\r
{\r
- if (Pipe_IsEndpointBound(EndpointData->EndpointAddress))\r
- {\r
- RNDISInterfaceInfo->State.BidirectionalDataEndpoints = true;\r
- }\r
- else\r
- {\r
- Pipe_ConfigurePipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
- EndpointData->EndpointAddress, EndpointData->EndpointSize, \r
- RNDISInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
- }\r
- \r
+ Pipe_ConfigurePipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,\r
+ EndpointData->EndpointAddress, EndpointData->EndpointSize, \r
+ RNDISInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);\r
+\r
RNDISInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;\r
\r
FoundEndpoints |= RNDIS_FOUND_DATAPIPE_OUT;\r
\r
RNDIS_Packet_Message_t DeviceMessage;\r
\r
- if (Pipe_BytesInPipe() < sizeof(RNDIS_Packet_Message_t))\r
- {\r
- printf("*SIZE YARG: %d*\r\n", Pipe_BytesInPipe());\r
- *PacketLength = 0;\r
- Pipe_ClearIN();\r
- return RNDIS_COMMAND_FAILED; \r
- }\r
- \r
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),\r
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)\r
{\r
return ErrorCode;\r
}\r
- \r
- if (DeviceMessage.MessageType != REMOTE_NDIS_PACKET_MSG)\r
- {\r
- printf("****YARG****\r\n");\r
- *PacketLength = 0;\r
- Pipe_ClearIN();\r
- return RNDIS_COMMAND_FAILED;\r
- }\r
\r
*PacketLength = (uint16_t)DeviceMessage.DataLength;\r
\r
if ((USB_HostState != HOST_STATE_Configured) || !(RNDISInterfaceInfo->State.IsActive))\r
return PIPE_READYWAIT_DeviceDisconnected;\r
\r
- if (RNDISInterfaceInfo->State.BidirectionalDataEndpoints)\r
- {\r
- Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);\r
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);\r
- }\r
- else\r
- {\r
- Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber); \r
- }\r
-\r
RNDIS_Packet_Message_t DeviceMessage;\r
\r
memset(&DeviceMessage, 0, sizeof(RNDIS_Packet_Message_t));\r
DeviceMessage.DataOffset = (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));\r
DeviceMessage.DataLength = PacketLength;\r
\r
+ Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber);\r
Pipe_Unfreeze();\r
\r
if ((ErrorCode = Pipe_Write_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),\r
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)\r
{\r
- if (RNDISInterfaceInfo->State.BidirectionalDataEndpoints)\r
- Pipe_SetPipeToken(PIPE_TOKEN_IN);\r
-\r
return ErrorCode;\r
}\r
\r
\r
Pipe_Freeze();\r
\r
- if (RNDISInterfaceInfo->State.BidirectionalDataEndpoints)\r
- Pipe_SetPipeToken(PIPE_TOKEN_IN);\r
- \r
return PIPE_RWSTREAM_NoError;\r
}\r
\r
\r
uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe */\r
uint16_t DataOUTPipeSize; /**< Size in bytes of the RNDIS interface's OUT data pipe */\r
- uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used */\r
- \r
- bool BidirectionalDataEndpoints; /**< Indicates if the attached RNDIS interface uses bidirectional data endpoints,\r
- * and this has only the IN pipe configured (with \ref Pipe_SetPipeToken()\r
- * used to switch the pipe's direction)\r
- */\r
+ uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used */ \r
+\r
uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device */\r
\r
uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair */\r
* - Fixed Benito project not resetting the target AVR automatically when programming has completed\r
* - Fixed DFU bootloader programming not discarding the correct number of filler bytes from the host when non-aligned programming\r
* ranges are specified (thanks to Thomas Bleeker)\r
+ * - Fixed CDC and RNDIS host demos and class drivers - bidirectional endpoints should use two seperate pipes, not one half-duplex pipe\r
*\r
* \section Sec_ChangeLog091223 Version 091223\r
*\r
" <body>"\r
" <h1>Hello from your USB AVR!</h1>"\r
" <p>"\r
- " Hello! Welcome to the LUFA RNDIS Demo Webserver test page, running on your USB AVR via the LUFA library. This demonstrates the HTTP webserver, TCP/IP stack and RNDIS demo all running atop the LUFA USB stack."\r
+ " Hello! Welcome to the LUFA RNDIS Demo Webserver test page, running on your USB AVR via the LUFA library and uIP TCP/IP network stack. This"\r
+ " demonstrates a simple HTTP webserver serving out pages to HTTP clients."\r
" <br /><br />"\r
" <small>Project Information: <a href=\"http://www.fourwalledcubicle.com/LUFA.php\">http://www.fourwalledcubicle.com/LUFA.php</a>.</small>"\r
" <hr />"\r
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);\r
\r
/* Read the incomming packet straight into the UIP packet buffer */\r
- printf("L=%d R=%d\r\n", uip_len, RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], &uip_len));\r
+ RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &uip_buf[0], &uip_len);\r
\r
if (uip_len > 0)\r
{\r