aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/LowLevel/CDCHost
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-06-23 07:55:18 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-06-23 07:55:18 +0000
commit7f81803aaa312d589f79a77d1426150dcceb29f7 (patch)
treed23f2d3a2e56dfc805bedaf6b17172e4b48f8626 /Demos/Host/LowLevel/CDCHost
parent189d0c7e669b6a3d07ed35c1eaa0bfc8cbc7a729 (diff)
downloadlufa-7f81803aaa312d589f79a77d1426150dcceb29f7.tar.gz
lufa-7f81803aaa312d589f79a77d1426150dcceb29f7.tar.bz2
lufa-7f81803aaa312d589f79a77d1426150dcceb29f7.zip
Fixed CDCHost demo unfreezing IN pipes during configuration, rather than during use.
Changed Pipe stream functions to automatically set the pipe token, allowing them to be used on bidirectional pipes without having to explicitly call Pipe_SetPipeToken() beforehand.
Diffstat (limited to 'Demos/Host/LowLevel/CDCHost')
-rw-r--r--Demos/Host/LowLevel/CDCHost/CDCHost.c7
-rw-r--r--Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c3
2 files changed, 7 insertions, 3 deletions
diff --git a/Demos/Host/LowLevel/CDCHost/CDCHost.c b/Demos/Host/LowLevel/CDCHost/CDCHost.c
index e00332f9f..b3e067418 100644
--- a/Demos/Host/LowLevel/CDCHost/CDCHost.c
+++ b/Demos/Host/LowLevel/CDCHost/CDCHost.c
@@ -176,10 +176,14 @@ void CDC_Host_Task(void)
case HOST_STATE_Ready:
/* Select and the data IN pipe */
Pipe_SelectPipe(CDC_DATAPIPE_IN);
+ 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())
{
@@ -199,6 +203,9 @@ void CDC_Host_Task(void)
Pipe_ClearIN();
}
+ /* Re-freeze IN pipe after use */
+ Pipe_Freeze();
+
/* Select and unfreeze the notification pipe */
Pipe_SelectPipe(CDC_NOTIFICATIONPIPE);
Pipe_Unfreeze();
diff --git a/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c b/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c
index 57d7ec051..33234e4fd 100644
--- a/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c
@@ -155,7 +155,6 @@ uint8_t ProcessConfigurationDescriptor(void)
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
Pipe_SetInfiniteINRequests();
- Pipe_Unfreeze();
/* Set the flag indicating that the data IN pipe has been found */
FoundEndpoints |= (1 << CDC_DATAPIPE_IN);
@@ -166,8 +165,6 @@ uint8_t ProcessConfigurationDescriptor(void)
Pipe_ConfigurePipe(CDC_DATAPIPE_OUT, EP_TYPE_BULK, PIPE_TOKEN_OUT,
EndpointData->EndpointAddress, EndpointData->EndpointSize, PIPE_BANK_SINGLE);
- Pipe_Unfreeze();
-
/* Set the flag indicating that the data OUT pipe has been found */
FoundEndpoints |= (1 << CDC_DATAPIPE_OUT);
}