From f3ec62b5c689d9c66b07a57df76ca83881ce3fe3 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 20 Feb 2011 14:43:13 +0000 Subject: [PATCH] More updates to remove architecture-specific comments from the documentation, alter USBMode.h preprocessor logic to support future architectures more easily. --- LUFA/CodeTemplates/DriverStubs/Dataflash.h | 2 +- LUFA/CodeTemplates/DriverStubs/Joystick.h | 3 +- LUFA/CodeTemplates/DriverStubs/LEDs.h | 2 +- LUFA/Common/Attributes.h | 4 +- LUFA/Common/Common.h | 15 +++---- LUFA/Drivers/Board/Dataflash.h | 2 +- LUFA/Drivers/Board/EVK527/Dataflash.h | 2 +- LUFA/Drivers/Board/STK525/Dataflash.h | 2 +- LUFA/Drivers/Board/STK526/Dataflash.h | 2 +- LUFA/Drivers/Board/USBKEY/Dataflash.h | 2 +- LUFA/Drivers/Board/XPLAIN/Dataflash.h | 2 +- LUFA/Drivers/USB/Class/Device/CDC.h | 2 +- LUFA/Drivers/USB/Class/Host/CDC.h | 2 +- LUFA/Drivers/USB/Core/Events.h | 2 +- LUFA/Drivers/USB/Core/StdDescriptors.h | 4 +- LUFA/Drivers/USB/Core/USBMode.h | 49 +++++++++++++--------- LUFA/Drivers/USB/Core/USBTask.h | 8 ++-- LUFA/Drivers/USB/USB.h | 5 --- LUFA/ManPages/DeviceSupport.txt | 5 ++- LUFA/ManPages/FutureChanges.txt | 1 - 20 files changed, 62 insertions(+), 54 deletions(-) diff --git a/LUFA/CodeTemplates/DriverStubs/Dataflash.h b/LUFA/CodeTemplates/DriverStubs/Dataflash.h index 814eb6d1a3..1e451b13a3 100644 --- a/LUFA/CodeTemplates/DriverStubs/Dataflash.h +++ b/LUFA/CodeTemplates/DriverStubs/Dataflash.h @@ -80,7 +80,7 @@ /* Inline Functions: */ /** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The AVR's SPI driver MUST be initialized before any of the dataflash commands are used. + * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. */ static inline void Dataflash_Init(void) { diff --git a/LUFA/CodeTemplates/DriverStubs/Joystick.h b/LUFA/CodeTemplates/DriverStubs/Joystick.h index c5c36268e2..bfde26bb6d 100644 --- a/LUFA/CodeTemplates/DriverStubs/Joystick.h +++ b/LUFA/CodeTemplates/DriverStubs/Joystick.h @@ -36,8 +36,7 @@ inside the application's folder. This stub is for the board-specific component of the LUFA Joystick - driver, a small surface mount four-way (plus button) digital joystick - on most USB AVR boards. + driver, for a digital four-way (plus button) joystick. */ #ifndef __JOYSTICK_USER_H__ diff --git a/LUFA/CodeTemplates/DriverStubs/LEDs.h b/LUFA/CodeTemplates/DriverStubs/LEDs.h index 2bd5e5ca1f..e698c9db6d 100644 --- a/LUFA/CodeTemplates/DriverStubs/LEDs.h +++ b/LUFA/CodeTemplates/DriverStubs/LEDs.h @@ -36,7 +36,7 @@ inside the application's folder. This stub is for the board-specific component of the LUFA LEDs driver, - for the LEDs (up to four) mounted on most USB AVR boards. + for the LEDs (up to four) mounted on most development boards. */ #ifndef __LEDS_USER_H__ diff --git a/LUFA/Common/Attributes.h b/LUFA/Common/Attributes.h index ad6882769d..8c40069901 100644 --- a/LUFA/Common/Attributes.h +++ b/LUFA/Common/Attributes.h @@ -29,7 +29,7 @@ */ /** \file - * \brief AVR-GCC special function/variable attribute macros. + * \brief GCC special function/variable attribute macros. * * \copydetails Group_GCCAttributes * @@ -39,7 +39,7 @@ /** \ingroup Group_Common * \defgroup Group_GCCAttributes Function/Variable Attributes - * \brief AVR-GCC special function/variable attribute macros. + * \brief GCC special function/variable attribute macros. * * This module contains macros for applying GCC specific attributes to functions and variables to control various * optimiser and code generation features of the compiler. Attributes may be placed in the function prototype diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index 57bebeda47..114f566b24 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -144,10 +144,11 @@ #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("BREAK" ::) #if !defined(pgm_read_ptr) || defined(__DOXYGEN__) - /** Reads a pointer out of PROGMEM space. This is currently a wrapper for the avr-libc \c pgm_read_ptr() - * macro with a \c void* cast, so that its value can be assigned directly to a pointer variable or used - * in pointer arithmetic without further casting in C. In a future avr-libc distribution this will be - * part of the standard API and will be implemented in a more formal manner. + /** Reads a pointer out of PROGMEM space on the AVR8 architecture. This is currently a wrapper for the + * avr-libc \c pgm_read_ptr() macro with a \c void* cast, so that its value can be assigned directly + * to a pointer variable or used in pointer arithmetic without further casting in C. In a future + * avr-libc distribution this will be part of the standard API and will be implemented in a more formal + * manner. * * \param[in] Addr Address of the pointer to read. * @@ -165,8 +166,8 @@ #define JTAG_DEBUG_ASSERT(Condition) MACROS{ if (!(Condition)) { JTAG_DEBUG_BREAK(); } }MACROE /** Macro for testing condition "x" and writing debug data to the stdout stream if \c false. The stdout stream - * must be pre-initialized before this macro is run and linked to an output device, such as the AVR's USART - * peripheral. + * must be pre-initialized before this macro is run and linked to an output device, such as the microcontroller's + * USART peripheral. * * The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {Condition} failed." * @@ -179,7 +180,7 @@ __FILE__, __func__, __LINE__, #Condition); } }MACROE #endif - /** Forces GCC to use pointer indirection (via the AVR's pointer register pairs) when accessing the given + /** Forces GCC to use pointer indirection (via the device's pointer register pairs) when accessing the given * struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through * a pointer, resulting in a larger binary. When this macro is used on a (non \c const) structure pointer before * use, it will force GCC to use pointer indirection on the elements rather than direct store and load diff --git a/LUFA/Drivers/Board/Dataflash.h b/LUFA/Drivers/Board/Dataflash.h index 0158e02003..4ed77a3746 100644 --- a/LUFA/Drivers/Board/Dataflash.h +++ b/LUFA/Drivers/Board/Dataflash.h @@ -151,7 +151,7 @@ /* Inline Functions: */ /** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC. * - * \note The AVR's SPI driver must be initialized before any of the dataflash commands are used. + * \note The microcontroller's SPI driver must be initialized before any of the dataflash commands are used. */ static inline void Dataflash_Init(void); diff --git a/LUFA/Drivers/Board/EVK527/Dataflash.h b/LUFA/Drivers/Board/EVK527/Dataflash.h index d9f20d52da..2f0ad5724c 100644 --- a/LUFA/Drivers/Board/EVK527/Dataflash.h +++ b/LUFA/Drivers/Board/EVK527/Dataflash.h @@ -83,7 +83,7 @@ /* Inline Functions: */ /** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The AVR's SPI driver MUST be initialized before any of the dataflash commands are used. + * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. */ static inline void Dataflash_Init(void) { diff --git a/LUFA/Drivers/Board/STK525/Dataflash.h b/LUFA/Drivers/Board/STK525/Dataflash.h index 687b194bd0..3d1cffaa53 100644 --- a/LUFA/Drivers/Board/STK525/Dataflash.h +++ b/LUFA/Drivers/Board/STK525/Dataflash.h @@ -83,7 +83,7 @@ /* Inline Functions: */ /** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The AVR's SPI driver MUST be initialized before any of the dataflash commands are used. + * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. */ static inline void Dataflash_Init(void) { diff --git a/LUFA/Drivers/Board/STK526/Dataflash.h b/LUFA/Drivers/Board/STK526/Dataflash.h index 626946a0e7..6688358bed 100644 --- a/LUFA/Drivers/Board/STK526/Dataflash.h +++ b/LUFA/Drivers/Board/STK526/Dataflash.h @@ -83,7 +83,7 @@ /* Inline Functions: */ /** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The AVR's SPI driver MUST be initialized before any of the dataflash commands are used. + * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. */ static inline void Dataflash_Init(void) { diff --git a/LUFA/Drivers/Board/USBKEY/Dataflash.h b/LUFA/Drivers/Board/USBKEY/Dataflash.h index 19040cf5c8..e54f0d8388 100644 --- a/LUFA/Drivers/Board/USBKEY/Dataflash.h +++ b/LUFA/Drivers/Board/USBKEY/Dataflash.h @@ -86,7 +86,7 @@ /* Inline Functions: */ /** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The AVR's SPI driver MUST be initialized before any of the dataflash commands are used. + * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. */ static inline void Dataflash_Init(void) { diff --git a/LUFA/Drivers/Board/XPLAIN/Dataflash.h b/LUFA/Drivers/Board/XPLAIN/Dataflash.h index 069512aeca..ed4ab6a182 100644 --- a/LUFA/Drivers/Board/XPLAIN/Dataflash.h +++ b/LUFA/Drivers/Board/XPLAIN/Dataflash.h @@ -89,7 +89,7 @@ /* Inline Functions: */ /** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC. - * The AVR's SPI driver MUST be initialized before any of the dataflash commands are used. + * The microcontroller's SPI driver MUST be initialized before any of the dataflash commands are used. */ static inline void Dataflash_Init(void) { diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h index 9eb7b48fc6..8b4e2da8e0 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.h +++ b/LUFA/Drivers/USB/Class/Device/CDC.h @@ -295,7 +295,7 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular - * functions in the avr-libc library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created + * functions in the standard library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created * stream is bidirectional and can be used for both input and output functions. * * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h index 8e799709e6..b679d10231 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.h +++ b/LUFA/Drivers/USB/Class/Host/CDC.h @@ -285,7 +285,7 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular - * functions in the avr-libc \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created + * functions in the standard \c library that accept a \c FILE stream as a destination (e.g. \c fprintf). The created * stream is bidirectional and can be used for both input and output functions. * * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single diff --git a/LUFA/Drivers/USB/Core/Events.h b/LUFA/Drivers/USB/Core/Events.h index c0a322b261..18814715e3 100644 --- a/LUFA/Drivers/USB/Core/Events.h +++ b/LUFA/Drivers/USB/Core/Events.h @@ -183,7 +183,7 @@ * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around * two seconds) will prevent the device from enumerating correctly. * - * \note For the smaller series 2 USB AVRs with limited USB controllers, VBUS is not available to the USB controller. + * \note For the microcontrollers with limited USB controller functionality, VBUS sensing is not available. * this means that the current connection state is derived from the bus suspension and wake up events by default, * which is not always accurate (host may suspend the bus while still connected). If the actual connection state * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h index d2a9bee0ed..8599f47aa1 100644 --- a/LUFA/Drivers/USB/Core/StdDescriptors.h +++ b/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -303,7 +303,7 @@ uint8_t SerialNumStrIndex; /**< String index for the product's globally unique hexadecimal * serial number, in uppercase Unicode ASCII. * - * \note On some AVR models, there is an embedded serial number + * \note On some microcontroller models, there is an embedded serial number * in the chip which can be used for the device serial number. * To use this serial number, set this to USE_INTERNAL_SERIAL. * On unsupported devices, this will evaluate to 0 and will cause @@ -351,7 +351,7 @@ uint8_t iSerialNumber; /**< String index for the product's globally unique hexadecimal * serial number, in uppercase Unicode ASCII. * - * \note On some AVR models, there is an embedded serial number + * \note On some microcontroller models, there is an embedded serial number * in the chip which can be used for the device serial number. * To use this serial number, set this to USE_INTERNAL_SERIAL. * On unsupported devices, this will evaluate to 0 and will cause diff --git a/LUFA/Drivers/USB/Core/USBMode.h b/LUFA/Drivers/USB/Core/USBMode.h index ff95ce3d51..1cb1328124 100644 --- a/LUFA/Drivers/USB/Core/USBMode.h +++ b/LUFA/Drivers/USB/Core/USBMode.h @@ -82,17 +82,17 @@ */ #define USB_SERIES_7_AVR - /** Indicates that the target AVR microcontroller and compilation settings allow for the + /** Indicates that the target microcontroller and compilation settings allow for the * target to be configured in USB Device mode when defined. */ #define USB_CAN_BE_DEVICE - /** Indicates that the target AVR microcontroller and compilation settings allow for the + /** Indicates that the target microcontroller and compilation settings allow for the * target to be configured in USB Host mode when defined. */ #define USB_CAN_BE_HOST - /** Indicates that the target AVR microcontroller and compilation settings allow for the + /** Indicates that the target microcontroller and compilation settings allow for the * target to be configured in either USB Device or Host mode when defined. */ #define USB_CAN_BE_BOTH @@ -101,37 +101,48 @@ #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \ defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)) #define USB_SERIES_2_AVR + #define USB_CAN_BE_DEVICE #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)) #define USB_SERIES_4_AVR + #define USB_CAN_BE_DEVICE #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)) #define USB_SERIES_6_AVR + #define USB_CAN_BE_DEVICE #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__)) #define USB_SERIES_7_AVR + #define USB_CAN_BE_DEVICE + #define USB_CAN_BE_HOST + #endif + + #if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST)) + #define USB_CAN_BE_BOTH #endif - #if !defined(USB_SERIES_7_AVR) - #if defined(USB_HOST_ONLY) - #error USB_HOST_ONLY is not available for the currently selected USB AVR model. - #endif - - #if !defined(USB_DEVICE_ONLY) - #define USB_DEVICE_ONLY + #if defined(USB_HOST_ONLY) + #if !defined(USB_CAN_BE_HOST) + #error USB_HOST_ONLY is not available for the currently selected microcontroller model. + #else + #undef USB_CAN_BE_DEVICE + #undef USB_CAN_BE_BOTH #endif #endif - #if (!defined(USB_DEVICE_ONLY) && !defined(USB_HOST_ONLY)) - #define USB_CAN_BE_BOTH - #define USB_CAN_BE_HOST - #define USB_CAN_BE_DEVICE - #elif defined(USB_HOST_ONLY) - #define USB_CAN_BE_HOST - #elif defined(USB_DEVICE_ONLY) - #define USB_CAN_BE_DEVICE + #if defined(USB_DEVICE_ONLY) + #if !defined(USB_CAN_BE_DEVICE) + #error USB_DEVICE_ONLY is not available for the currently selected microcontroller model. + #else + #undef USB_CAN_BE_HOST + #undef USB_CAN_BE_BOTH + #endif #endif - + #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY)) #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive. #endif + + #if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST)) + #error The currently selected architecture is not supported under the USB component of the library. + #endif #endif #endif diff --git a/LUFA/Drivers/USB/Core/USBTask.h b/LUFA/Drivers/USB/Core/USBTask.h index b5cf381aaf..f2ed7b7ba0 100644 --- a/LUFA/Drivers/USB/Core/USBTask.h +++ b/LUFA/Drivers/USB/Core/USBTask.h @@ -98,8 +98,8 @@ * the library internally. * * To reduce program size and speed up checks of this global on the AVR8 architecture, it can be - * placed into one of the AVR's GPIOR hardware registers instead of RAM by defining the - * HOST_STATE_AS_GPIOR token to a value between 0 and 2 in the project makefile and passing it to + * placed into one of the AVR's \c GPIOR hardware registers instead of RAM by defining the + * \c HOST_STATE_AS_GPIOR token to a value between 0 and 2 in the project makefile and passing it to * the compiler via the -D switch. When defined, the corresponding GPIOR register should not be used * in the user application except implicitly via the library APIs. * @@ -127,8 +127,8 @@ * (see \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events). * * To reduce program size and speed up checks of this global on the AVR8 architecture, it can be - * placed into one of the AVR's GPIOR hardware registers instead of RAM by defining the - * DEVICE_STATE_AS_GPIOR token to a value between 0 and 2 in the project makefile and passing it to + * placed into one of the AVR's \c GPIOR hardware registers instead of RAM by defining the + * \c DEVICE_STATE_AS_GPIOR token to a value between 0 and 2 in the project makefile and passing it to * the compiler via the -D switch. When defined, the corresponding GPIOR register should not be used * in the user application except implicitly via the library APIs. * diff --git a/LUFA/Drivers/USB/USB.h b/LUFA/Drivers/USB/USB.h index 6dba17f641..2c590968a4 100644 --- a/LUFA/Drivers/USB/USB.h +++ b/LUFA/Drivers/USB/USB.h @@ -364,11 +364,6 @@ #include "../../Common/Common.h" #include "Core/USBMode.h" - /* Preprocessor Checks: */ - #if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST)) - #error The currently selected architecture is not supported under the USB component of the library. - #endif - /* Includes: */ #include "Core/USBTask.h" #include "Core/Events.h" diff --git a/LUFA/ManPages/DeviceSupport.txt b/LUFA/ManPages/DeviceSupport.txt index 7e641016b1..c98797382c 100644 --- a/LUFA/ManPages/DeviceSupport.txt +++ b/LUFA/ManPages/DeviceSupport.txt @@ -7,7 +7,9 @@ /** * \page Page_DeviceSupport Device and Hardware Support * - * Currently supported AVR models: + * \section Sec_AVR8_Support Atmel 8-Bit AVR (AVR8) + * + * Currently supported AVR8 models: * - AT90USB82 (USB Device Only) * - ATMEGA8U2 (USB Device Only) * - AT90USB162 (USB Device Only) @@ -44,6 +46,7 @@ * - Minimus USB * - Olimex AVR-USB-162 * - PJRC Teensy (all revisions and versions) + * - Sparkfun U2 Breakout Board * - TCNISO Blackcat USB JTAG * - Tempusdictum Benito * - Tom's USBTINY-MKII (all revisions and versions) diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt index 8212e027f1..72c666f584 100644 --- a/LUFA/ManPages/FutureChanges.txt +++ b/LUFA/ManPages/FutureChanges.txt @@ -18,7 +18,6 @@ * -# Change makefiles to allow for absolute LUFA location to be used * -# Re-add interrupt Pipe/Endpoint support * -# Investigate dynamically created device descriptors - * -# Re-add in software PDI/TPI support into the AVRISP-MKII project * -# Add makefile includes to reduce boilerplate in user makefiles * - Documentation/Support * -# Add detailed overviews of how each demo works