From 350141e085d3dcc440962259314f569cc8fcef03 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 23 Mar 2009 05:43:49 +0000 Subject: [PATCH] Fixed CDC demo not sending an empty packet after each transfer to prevent the host from buffering incomming data. Altered Project and Bootloader makefiles so that the path to the LUFA library can be set in one place. --- Bootloaders/CDC/makefile | 27 ++++++++++++++++----------- Bootloaders/DFU/makefile | 27 ++++++++++++++++----------- Bootloaders/TeensyHID/makefile | 27 ++++++++++++++++----------- Demos/Device/CDC/CDC.c | 6 ++++++ LUFA.pnproj | 2 +- LUFA/ChangeLog.txt | 1 + Projects/Magstripe/makefile | 31 ++++++++++++++++++------------- 7 files changed, 74 insertions(+), 47 deletions(-) diff --git a/Bootloaders/CDC/makefile b/Bootloaders/CDC/makefile index f9924fe4ef..10f94984b1 100644 --- a/Bootloaders/CDC/makefile +++ b/Bootloaders/CDC/makefile @@ -106,17 +106,22 @@ TARGET = BootloaderCDC OBJDIR = . +# Path to the LUFA library +LUFA_PATH = ../.. + + # List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c \ - Descriptors.c \ - ../../LUFA/Drivers/USB/LowLevel/LowLevel.c \ - ../../LUFA/Drivers/USB/LowLevel/Endpoint.c \ - ../../LUFA/Drivers/USB/LowLevel/DevChapter9.c \ - ../../LUFA/Drivers/USB/HighLevel/USBTask.c \ - ../../LUFA/Drivers/USB/HighLevel/USBInterrupt.c \ - ../../LUFA/Drivers/USB/HighLevel/Events.c \ - ../../LUFA/Drivers/USB/HighLevel/StdDescriptors.c \ - +SRC = $(TARGET).c \ + Descriptors.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/StdDescriptors.c \ + + # List C++ source files here. (C dependencies are automatically generated.) CPPSRC = @@ -148,7 +153,7 @@ DEBUG = dwarf-2 # Each directory must be seperated by a space. # Use forward slashes for directory separators. # For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = ../../ +EXTRAINCDIRS = $(LUFA_PATH)/ # Compiler flag to set the C Standard level. diff --git a/Bootloaders/DFU/makefile b/Bootloaders/DFU/makefile index cb19cb6c7e..3bed40d590 100644 --- a/Bootloaders/DFU/makefile +++ b/Bootloaders/DFU/makefile @@ -106,17 +106,22 @@ TARGET = BootloaderDFU OBJDIR = . +# Path to the LUFA library +LUFA_PATH = ../.. + + # List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c \ - Descriptors.c \ - ../../LUFA/Drivers/USB/LowLevel/LowLevel.c \ - ../../LUFA/Drivers/USB/LowLevel/Endpoint.c \ - ../../LUFA/Drivers/USB/LowLevel/DevChapter9.c \ - ../../LUFA/Drivers/USB/HighLevel/USBTask.c \ - ../../LUFA/Drivers/USB/HighLevel/USBInterrupt.c \ - ../../LUFA/Drivers/USB/HighLevel/Events.c \ - ../../LUFA/Drivers/USB/HighLevel/StdDescriptors.c \ - +SRC = $(TARGET).c \ + Descriptors.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/StdDescriptors.c \ + + # List C++ source files here. (C dependencies are automatically generated.) CPPSRC = @@ -148,7 +153,7 @@ DEBUG = dwarf-2 # Each directory must be seperated by a space. # Use forward slashes for directory separators. # For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = ../../ +EXTRAINCDIRS = $(LUFA_PATH)/ # Compiler flag to set the C Standard level. diff --git a/Bootloaders/TeensyHID/makefile b/Bootloaders/TeensyHID/makefile index 062a3243b2..561ada56a1 100644 --- a/Bootloaders/TeensyHID/makefile +++ b/Bootloaders/TeensyHID/makefile @@ -106,17 +106,22 @@ TARGET = TeensyHID OBJDIR = . +# Path to the LUFA library +LUFA_PATH = ../.. + + # List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c \ - Descriptors.c \ - ../../LUFA/Drivers/USB/LowLevel/LowLevel.c \ - ../../LUFA/Drivers/USB/LowLevel/Endpoint.c \ - ../../LUFA/Drivers/USB/LowLevel/DevChapter9.c \ - ../../LUFA/Drivers/USB/HighLevel/USBTask.c \ - ../../LUFA/Drivers/USB/HighLevel/USBInterrupt.c \ - ../../LUFA/Drivers/USB/HighLevel/Events.c \ - ../../LUFA/Drivers/USB/HighLevel/StdDescriptors.c \ - +SRC = $(TARGET).c \ + Descriptors.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/StdDescriptors.c \ + + # List C++ source files here. (C dependencies are automatically generated.) CPPSRC = @@ -148,7 +153,7 @@ DEBUG = dwarf-2 # Each directory must be seperated by a space. # Use forward slashes for directory separators. # For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = ../../ +EXTRAINCDIRS = $(LUFA_PATH)/ # Compiler flag to set the C Standard level. diff --git a/Demos/Device/CDC/CDC.c b/Demos/Device/CDC/CDC.c index 6e933d5813..d4eecc8971 100644 --- a/Demos/Device/CDC/CDC.c +++ b/Demos/Device/CDC/CDC.c @@ -308,6 +308,12 @@ TASK(CDC_Task) /* Finalize the stream transfer to send the last packet */ Endpoint_ClearCurrentBank(); + + /* Wait until the endpoint is ready for another packet */ + while (!(Endpoint_ReadWriteAllowed())); + + /* Send an empty packet to ensure that the host does not buffer data sent to it */ + Endpoint_ClearCurrentBank(); } /* Select the Serial Rx Endpoint */ diff --git a/LUFA.pnproj b/LUFA.pnproj index c99953d7e3..4970ca3813 100644 --- a/LUFA.pnproj +++ b/LUFA.pnproj @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index 63fe3c1b10..f30867e893 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -41,6 +41,7 @@ * - Keyboard and Mouse device demos (normal, data interrupt and fully interrupt driven) combined into unified keyboard and mouse demos * - Keyboard and Mouse host demos (normal and data interrupt driven) combined into unified keyboard and mouse demos * - Removed AVRISP_Programmer project due to code quality concerns + * - Fixed CDC demo not sending an empty packet after each transfer to prevent the host from buffering incomming data * * \section Sec_ChangeLog090209 Version 090209 * diff --git a/Projects/Magstripe/makefile b/Projects/Magstripe/makefile index 25f3fa4290..908a626f2c 100644 --- a/Projects/Magstripe/makefile +++ b/Projects/Magstripe/makefile @@ -118,19 +118,24 @@ TARGET = Magstripe OBJDIR = . +# Path to the LUFA library +LUFA_PATH = ../.. + + # List C source files here. (C dependencies are automatically generated.) -SRC = $(TARGET).c \ - Descriptors.c \ - CircularBitBuffer.c \ - ../../LUFA/Scheduler/Scheduler.c \ - ../../LUFA/Drivers/USB/LowLevel/LowLevel.c \ - ../../LUFA/Drivers/USB/LowLevel/Endpoint.c \ - ../../LUFA/Drivers/USB/LowLevel/DevChapter9.c \ - ../../LUFA/Drivers/USB/HighLevel/USBTask.c \ - ../../LUFA/Drivers/USB/HighLevel/USBInterrupt.c \ - ../../LUFA/Drivers/USB/HighLevel/Events.c \ - ../../LUFA/Drivers/USB/HighLevel/StdDescriptors.c \ - +SRC = $(TARGET).c \ + Descriptors.c \ + CircularBitBuffer.c \ + $(LUFA_PATH)/LUFA/Scheduler/Scheduler.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/LowLevel.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/DevChapter9.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBInterrupt.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/StdDescriptors.c \ + + # List C++ source files here. (C dependencies are automatically generated.) CPPSRC = @@ -162,7 +167,7 @@ DEBUG = dwarf-2 # Each directory must be seperated by a space. # Use forward slashes for directory separators. # For a directory that has spaces, enclose it in quotes. -EXTRAINCDIRS = ../../ +EXTRAINCDIRS = $(LUFA_PATH)/ # Compiler flag to set the C Standard level.