From 34dc7f241fe0627e21c3a218123d5d9fbc97374c Mon Sep 17 00:00:00 2001 From: Dean Camera 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 487cac6e26..849b1f97c0 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 a3e6b778e4..d0fc994579 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 b035862a1c..f6a12494d4 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 9d4b201211..758db8de26 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 03ee2cd164..0bca255a40 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 e587a75329..01fb09e649 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 655e7795d5..631b15fcac 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 a18d7ce693..bbe1464155 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 ee260ab1d7..c9aaf8788b 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 3c051185c6..908aecd2be 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 9ee5ec6843..8a40e35f6d 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 5cee61bf0d..9b7776281b 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 c429b330f3..e517f3be09 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 8ed0cf6718..3d40dff3a5 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 f1e23678d8..f5f9575c71 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 a38c3d878d..96b23efcbf 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 d2ad7dc09f..962b4d62b9 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 b1d41fcc53..2f0285bae0 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 87616ae144..7b250a4dd2 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 273b97a772..794d612c1f 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 17483d6ba0..b967e87911 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. * + * - Size: + * 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*. + * * - Support: * 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). + * + * * Atmel Mouse Device Demo 4292 bytes, LUFA Mouse Low Level Device Demo 3336 bytes, under identical build + * environments */ \ No newline at end of file diff --git a/Projects/MissileLauncher/ConfigDescriptor.c b/Projects/MissileLauncher/ConfigDescriptor.c index 0a50beb573..0ebf95a5f1 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;