From 34dc7f241fe0627e21c3a218123d5d9fbc97374c Mon Sep 17 00:00:00 2001 From: Dean Camera <dean@fourwalledcubicle.com> Date: Sat, 7 Nov 2009 07:23:03 +0000 Subject: [PATCH] Make Low Level host demos use void pointers for the configuration descriptor, to prevent warnings when passed to the altered configuration descriptor parsing routines. Added preprocessor checks to give a human readable error when the class drivers are used when the incompatible NO_STREAM_CALLBACKS compile time option is used. --- Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c | 2 +- .../LowLevel/JoystickHostWithParser/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c | 2 +- .../LowLevel/KeyboardHostWithParser/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c | 2 +- Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c | 2 +- LUFA/Drivers/USB/Class/Audio.h | 4 ++++ LUFA/Drivers/USB/Class/CDC.h | 4 ++++ LUFA/Drivers/USB/Class/HID.h | 4 ++++ LUFA/Drivers/USB/Class/MIDI.h | 4 ++++ LUFA/Drivers/USB/Class/MassStorage.h | 4 ++++ LUFA/Drivers/USB/Class/Printer.h | 4 ++++ LUFA/Drivers/USB/Class/RNDIS.h | 4 ++++ LUFA/Drivers/USB/Class/StillImage.h | 4 ++++ LUFA/ManPages/WhyUseLUFA.txt | 7 +++++++ Projects/MissileLauncher/ConfigDescriptor.c | 2 +- 22 files changed, 52 insertions(+), 13 deletions(-) diff --git a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c index 487cac6e2..849b1f97c 100644 --- a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c +++ b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c @@ -33,7 +33,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; uint8_t FoundEndpoints = 0; diff --git a/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c b/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c index a3e6b778e..d0fc99457 100644 --- a/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/CDCHost/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; uint8_t FoundEndpoints = 0; diff --git a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c index b035862a1..f6a12494d 100644 --- a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; uint8_t FoundEndpoints = 0; diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c index 9d4b20121..758db8de2 100644 --- a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; /* Retrieve the entire configuration descriptor into the allocated buffer */ diff --git a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c index 03ee2cd16..0bca255a4 100644 --- a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; /* Retrieve the entire configuration descriptor into the allocated buffer */ diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c index e587a7532..01fb09e64 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; /* Retrieve the entire configuration descriptor into the allocated buffer */ diff --git a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c index 655e7795d..631b15fca 100644 --- a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; uint8_t FoundEndpoints = 0; diff --git a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c index a18d7ce69..bbe146415 100644 --- a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; uint8_t FoundEndpoints = 0; diff --git a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c index ee260ab1d..c9aaf8788 100644 --- a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; /* Retrieve the entire configuration descriptor into the allocated buffer */ diff --git a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c index 3c051185c..908aecd2b 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; /* Retrieve the entire configuration descriptor into the allocated buffer */ diff --git a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c index 9ee5ec684..8a40e35f6 100644 --- a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c @@ -47,7 +47,7 @@ uint8_t PrinterAltSetting; uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; uint8_t FoundEndpoints = 0; diff --git a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c index 5cee61bf0..9b7776281 100644 --- a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c +++ b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; uint8_t FoundEndpoints = 0; diff --git a/LUFA/Drivers/USB/Class/Audio.h b/LUFA/Drivers/USB/Class/Audio.h index c429b330f..e517f3be0 100644 --- a/LUFA/Drivers/USB/Class/Audio.h +++ b/LUFA/Drivers/USB/Class/Audio.h @@ -51,6 +51,10 @@ /* Includes: */ #include "../HighLevel/USBMode.h" + + #if defined(NO_STREAM_CALLBACKS) + #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers. + #endif #if defined(USB_CAN_BE_DEVICE) #include "Device/Audio.h" diff --git a/LUFA/Drivers/USB/Class/CDC.h b/LUFA/Drivers/USB/Class/CDC.h index 8ed0cf671..3d40dff3a 100644 --- a/LUFA/Drivers/USB/Class/CDC.h +++ b/LUFA/Drivers/USB/Class/CDC.h @@ -53,6 +53,10 @@ /* Includes: */ #include "../HighLevel/USBMode.h" + #if defined(NO_STREAM_CALLBACKS) + #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers. + #endif + #if defined(USB_CAN_BE_DEVICE) #include "Device/CDC.h" #endif diff --git a/LUFA/Drivers/USB/Class/HID.h b/LUFA/Drivers/USB/Class/HID.h index f1e23678d..f5f9575c7 100644 --- a/LUFA/Drivers/USB/Class/HID.h +++ b/LUFA/Drivers/USB/Class/HID.h @@ -54,6 +54,10 @@ /* Includes: */ #include "../HighLevel/USBMode.h" + #if defined(NO_STREAM_CALLBACKS) + #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers. + #endif + #if defined(USB_CAN_BE_DEVICE) #include "Device/HID.h" #endif diff --git a/LUFA/Drivers/USB/Class/MIDI.h b/LUFA/Drivers/USB/Class/MIDI.h index a38c3d878..96b23efcb 100644 --- a/LUFA/Drivers/USB/Class/MIDI.h +++ b/LUFA/Drivers/USB/Class/MIDI.h @@ -56,6 +56,10 @@ /* Includes: */ #include "../HighLevel/USBMode.h" + #if defined(NO_STREAM_CALLBACKS) + #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers. + #endif + #if defined(USB_CAN_BE_DEVICE) #include "Device/MIDI.h" #endif diff --git a/LUFA/Drivers/USB/Class/MassStorage.h b/LUFA/Drivers/USB/Class/MassStorage.h index d2ad7dc09..962b4d62b 100644 --- a/LUFA/Drivers/USB/Class/MassStorage.h +++ b/LUFA/Drivers/USB/Class/MassStorage.h @@ -53,6 +53,10 @@ /* Includes: */ #include "../HighLevel/USBMode.h" + #if defined(NO_STREAM_CALLBACKS) + #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers. + #endif + #if defined(USB_CAN_BE_DEVICE) #include "Device/MassStorage.h" #endif diff --git a/LUFA/Drivers/USB/Class/Printer.h b/LUFA/Drivers/USB/Class/Printer.h index b1d41fcc5..2f0285bae 100644 --- a/LUFA/Drivers/USB/Class/Printer.h +++ b/LUFA/Drivers/USB/Class/Printer.h @@ -54,6 +54,10 @@ /* Includes: */ #include "../HighLevel/USBMode.h" + #if defined(NO_STREAM_CALLBACKS) + #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers. + #endif + #if defined(USB_CAN_BE_HOST) #include "Host/Printer.h" #endif diff --git a/LUFA/Drivers/USB/Class/RNDIS.h b/LUFA/Drivers/USB/Class/RNDIS.h index 87616ae14..7b250a4dd 100644 --- a/LUFA/Drivers/USB/Class/RNDIS.h +++ b/LUFA/Drivers/USB/Class/RNDIS.h @@ -52,6 +52,10 @@ /* Includes: */ #include "../HighLevel/USBMode.h" + #if defined(NO_STREAM_CALLBACKS) + #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers. + #endif + #if defined(USB_CAN_BE_DEVICE) #include "Device/RNDIS.h" #endif diff --git a/LUFA/Drivers/USB/Class/StillImage.h b/LUFA/Drivers/USB/Class/StillImage.h index 273b97a77..794d612c1 100644 --- a/LUFA/Drivers/USB/Class/StillImage.h +++ b/LUFA/Drivers/USB/Class/StillImage.h @@ -52,6 +52,10 @@ /* Includes: */ #include "../HighLevel/USBMode.h" + #if defined(NO_STREAM_CALLBACKS) + #error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers. + #endif + #if defined(USB_CAN_BE_HOST) #include "Host/StillImage.h" #endif diff --git a/LUFA/ManPages/WhyUseLUFA.txt b/LUFA/ManPages/WhyUseLUFA.txt index 17483d6ba..b967e8791 100644 --- a/LUFA/ManPages/WhyUseLUFA.txt +++ b/LUFA/ManPages/WhyUseLUFA.txt @@ -31,9 +31,16 @@ * it directly. Updating the LUFA library is a simple folder-replacement and gives new features and bug fixes in * seconds each time a new release is made. * + * - <b>Size:</b> + * Not just requiring less code to make complex USB devices, LUFA (under most cases with the correct compile options) + * requires less FLASH space than Atmel's stack, meaning more space for the user application*. + * * - <b>Support:</b> * Since many people are now using LUFA in their own projects, you can take advantage of other's knowedge when you run * into difficulties or need some advice. In addition, you can also email the library author to recieve personalised * support when you need it (subject to author's schedule). + * + * <small>* Atmel Mouse Device Demo 4292 bytes, LUFA Mouse Low Level Device Demo 3336 bytes, under identical build + * environments</small> */ \ No newline at end of file diff --git a/Projects/MissileLauncher/ConfigDescriptor.c b/Projects/MissileLauncher/ConfigDescriptor.c index 0a50beb57..0ebf95a5f 100644 --- a/Projects/MissileLauncher/ConfigDescriptor.c +++ b/Projects/MissileLauncher/ConfigDescriptor.c @@ -48,7 +48,7 @@ uint8_t ProcessConfigurationDescriptor(void) { uint8_t ConfigDescriptorData[512]; - uint8_t* CurrConfigLocation = ConfigDescriptorData; + void* CurrConfigLocation = ConfigDescriptorData; uint16_t CurrConfigBytesRem; uint8_t FoundEndpoints = 0; -- GitLab