diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-01-25 11:50:41 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-01-25 11:50:41 +0000 |
commit | 431db89b00408197976d653d89d15eeef8172e1b (patch) | |
tree | 8900ab7368cdd124b725a65da47407f96fd46053 /LUFA/Drivers/USB/Class/Host/CDC.c | |
parent | 74b6993d66d70c323beb4d7eccf5b8f45bf6d31f (diff) | |
download | lufa-431db89b00408197976d653d89d15eeef8172e1b.tar.gz lufa-431db89b00408197976d653d89d15eeef8172e1b.tar.bz2 lufa-431db89b00408197976d653d89d15eeef8172e1b.zip |
Fixed CDC and RNDIS host demos and class drivers - bidirectional endpoints should use two seperate pipes, not one half-duplex pipe.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Host/CDC.c')
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/CDC.c | 63 |
1 files changed, 8 insertions, 55 deletions
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index 7f5bcb940..8ad37de73 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -110,32 +110,20 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo {
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
{
- if (Pipe_IsEndpointBound(EndpointData->EndpointAddress))
- {
- CDCInterfaceInfo->State.BidirectionalDataEndpoints = true;
- Pipe_DisablePipe();
- }
-
Pipe_ConfigurePipe(CDCInterfaceInfo->Config.DataINPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_IN,
EndpointData->EndpointAddress, EndpointData->EndpointSize,
CDCInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+
CDCInterfaceInfo->State.DataINPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= CDC_FOUND_DATAPIPE_IN;
}
else
{
- if (Pipe_IsEndpointBound(EndpointData->EndpointAddress))
- {
- CDCInterfaceInfo->State.BidirectionalDataEndpoints = true;
- }
- else
- {
- Pipe_ConfigurePipe(CDCInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,
- EndpointData->EndpointAddress, EndpointData->EndpointSize,
- CDCInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
- }
-
+ Pipe_ConfigurePipe(CDCInterfaceInfo->Config.DataOUTPipeNumber, EP_TYPE_BULK, PIPE_TOKEN_OUT,
+ EndpointData->EndpointAddress, EndpointData->EndpointSize,
+ CDCInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
+
CDCInterfaceInfo->State.DataOUTPipeSize = EndpointData->EndpointSize;
FoundEndpoints |= CDC_FOUND_DATAPIPE_OUT;
@@ -277,22 +265,11 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, ch uint8_t ErrorCode;
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)
- {
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);
- }
- else
- {
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
- }
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
Pipe_Freeze();
-
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)
- Pipe_SetPipeToken(PIPE_TOKEN_IN);
return ErrorCode;
}
@@ -304,16 +281,7 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, cons uint8_t ErrorCode;
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)
- {
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);
- }
- else
- {
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
- }
-
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
if (!(Pipe_IsReadWriteAllowed()))
@@ -326,9 +294,6 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, cons Pipe_Write_Byte(Data);
Pipe_Freeze();
-
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)
- Pipe_SetPipeToken(PIPE_TOKEN_IN);
return PIPE_READYWAIT_NoError;
}
@@ -381,16 +346,7 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) uint8_t ErrorCode;
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)
- {
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
- Pipe_SetPipeToken(PIPE_TOKEN_OUT);
- }
- else
- {
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
- }
-
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
if (!(Pipe_BytesInPipe()))
@@ -409,9 +365,6 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) }
Pipe_Freeze();
-
- if (CDCInterfaceInfo->State.BidirectionalDataEndpoints)
- Pipe_SetPipeToken(PIPE_TOKEN_IN);
return PIPE_READYWAIT_NoError;
}
|