From 0214e096a0274fd506b09812f47dc1183084851d Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Wed, 11 Mar 2009 13:11:58 +0000 Subject: [PATCH] Renamed NO_CLEARSET_FEATURE_REQUEST compile time token to NO_FEATURELESS_CONTROL_ONLY_DEVICE and expanded its function to also remove parts of the Get Status chapter 9 request, to further reduce code usage. --- Bootloaders/DFU/makefile | 2 +- Bootloaders/TeensyHID/makefile | 2 +- LUFA/ChangeLog.txt | 2 ++ LUFA/CompileTimeTokens.txt | 9 ++++----- LUFA/Drivers/USB/LowLevel/DevChapter9.c | 8 ++++++-- LUFA/Drivers/USB/LowLevel/DevChapter9.h | 2 +- LUFA/MigrationInformation.txt | 6 ++++++ 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Bootloaders/DFU/makefile b/Bootloaders/DFU/makefile index 88c539ca53..9e812e5de2 100644 --- a/Bootloaders/DFU/makefile +++ b/Bootloaders/DFU/makefile @@ -165,7 +165,7 @@ BOOT_START = 0x1E000 # Place -D or -U options here for C sources CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) -CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_CLEARSET_FEATURE_REQUEST +CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DFEATURELESS_CONTROL_ONLY_DEVICE CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=32 CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION diff --git a/Bootloaders/TeensyHID/makefile b/Bootloaders/TeensyHID/makefile index 8d8636f360..1a544dd780 100644 --- a/Bootloaders/TeensyHID/makefile +++ b/Bootloaders/TeensyHID/makefile @@ -165,7 +165,7 @@ BOOT_START = 0xC000 # Place -D or -U options here for C sources CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD) -CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_CLEARSET_FEATURE_REQUES +CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DFEATURELESS_CONTROL_ONLY_DEVICE CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=8 CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION diff --git a/LUFA/ChangeLog.txt b/LUFA/ChangeLog.txt index d283d7f95d..05e6fe5437 100644 --- a/LUFA/ChangeLog.txt +++ b/LUFA/ChangeLog.txt @@ -30,6 +30,8 @@ * - Added ATTR_ALWAYS_INLINE attribute to several key inlined library components, to ensure they are inlined in all circumstances * - Removed SetSystemClockPrescaler() macro, the clock_prescale_set() avr-libc macro has been corrected in recent avr-libc versions * - Fixed incorrect/missing control status stage transfers on demos, bootloaders and applications (thanks to Nate Lawson) + * - The NO_CLEARSET_FEATURE_REQUEST compile time token has been renamed to NO_FEATURELESS_CONTROL_ONLY_DEVICE, and its function expanded + * to also remove parts of the Get Status chapter 9 request to further reduce code usage * * \section Sec_ChangeLog090209 Version 090209 * diff --git a/LUFA/CompileTimeTokens.txt b/LUFA/CompileTimeTokens.txt index 196132b956..e93e1ad328 100644 --- a/LUFA/CompileTimeTokens.txt +++ b/LUFA/CompileTimeTokens.txt @@ -111,11 +111,10 @@ * EEPROM or RAM rather than flash memory) and reduces code maintenance. However, many USB device projects use only a single configuration. * Defining this token enables single-configuration mode, reducing the compiled size of the binary at the expense of flexibility. * - * NO_CLEARSET_FEATURE_REQUEST - DevChapter9.h \n - * In some limited USB device applications, the Get Feature and Set Feature requests are not used - this is when the device does not have - * device level features (such as remote wakeup) nor any data endpoints beyond the mandatory control endpoint. In such limited situations, - * this token may be defined to remove the handling of the Get Feature and Set Feature Chapter 9 requests to save space. Generally, this - * is usually only useful in (some) bootloaders. + * FEATURELESS_CONTROL_ONLY_DEVICE - DevChapter9.h \n + * In some limited USB device applications, device features (other than self-power) and endpoints other than the control endpoint aren't + * used. In such limited situations, this token may be defined to remove the handling of the Set Feature Chapter 9 request entirely and + * parts of the Get Feature chapter 9 request to save space. Generally, this is usually only useful in (some) bootloaders. * * NO_STREAM_CALLBACKS - Endpoint.h, Pipe.h \n * Both the endpoint and the pipe driver code contains stream functions, allowing for arrays of data to be sent to or from the diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.c b/LUFA/Drivers/USB/LowLevel/DevChapter9.c index 9ea3f417cc..44493e6989 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.c +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.c @@ -55,7 +55,7 @@ void USB_Device_ProcessControlPacket(void) } break; -#if !defined(NO_CLEARSET_FEATURE_REQUEST) +#if !defined(FEATURELESS_CONTROL_ONLY_DEVICE) case REQ_ClearFeature: case REQ_SetFeature: if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT)) @@ -238,7 +238,9 @@ static void USB_Device_GetStatus(const uint8_t bmRequestType) Endpoint_Discard_Word(); +#if !defined(FEATURELESS_CONTROL_ONLY_DEVICE) uint8_t wIndex_LSB = Endpoint_Read_Byte(); +#endif switch (bmRequestType) { @@ -250,12 +252,14 @@ static void USB_Device_GetStatus(const uint8_t bmRequestType) CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED; break; +#if !defined(FEATURELESS_CONTROL_ONLY_DEVICE) case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT): Endpoint_SelectEndpoint(wIndex_LSB); CurrentStatus = Endpoint_IsStalled(); break; +#endif } Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); @@ -268,7 +272,7 @@ static void USB_Device_GetStatus(const uint8_t bmRequestType) Endpoint_ClearSetupOUT(); } -#if !defined(NO_CLEARSET_FEATURE_REQUEST) +#if !defined(FEATURELESS_CONTROL_ONLY_DEVICE) static void USB_Device_ClearSetFeature(const uint8_t bRequest, const uint8_t bmRequestType) { uint16_t wValue = Endpoint_Read_Word_LE(); diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.h b/LUFA/Drivers/USB/LowLevel/DevChapter9.h index 5e1772a536..543c1a9406 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.h +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.h @@ -121,7 +121,7 @@ static void USB_Device_GetConfiguration(void); static void USB_Device_GetDescriptor(void); static void USB_Device_GetStatus(const uint8_t bmRequestType); - #if !defined(NO_CLEARSET_FEATURE_REQUEST) + #if !defined(FEATURELESS_CONTROL_ONLY_DEVICE) static void USB_Device_ClearSetFeature(const uint8_t bRequest, const uint8_t bmRequestType); #endif #endif diff --git a/LUFA/MigrationInformation.txt b/LUFA/MigrationInformation.txt index 75b5d1912e..25bf782685 100644 --- a/LUFA/MigrationInformation.txt +++ b/LUFA/MigrationInformation.txt @@ -29,6 +29,12 @@ * Non-USB Library Components * - The ATTR_ALWAYSINLINE function attribute macro has been renamed to ATTR_ALWAYS_INLINE. * + * Device Mode + * - The NO_CLEARSET_FEATURE_REQUEST compile time token has been renamed to NO_FEATURELESS_CONTROL_ONLY_DEVICE, and its function expanded + * to also remove parts of the Get Status chapter 9 request to further reduce code usage. On all applications currently using the + * NO_CLEARSET_FEATURE_REQUEST compile time token, it can be replaced with the NO_FEATURELESS_CONTROL_ONLY_DEVICE token with no further + * modifications required. + * * \section Sec_Migration090209 Migrating from 081217 to 090209 * * Device Mode