From 2a2de8fea94d2a524e988725585b17746cd30dba Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Fri, 7 May 2010 06:48:27 +0000 Subject: [PATCH] Fix TeensyHID bootloader for the largest AVRs - only the ATMEGA128x needs the alternative addressing scheme. --- Bootloaders/TeensyHID/Descriptors.h | 11 ++++++----- Bootloaders/TeensyHID/TeensyHID.c | 6 +++--- LUFA/ManPages/AlternativeStacks.txt | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Bootloaders/TeensyHID/Descriptors.h b/Bootloaders/TeensyHID/Descriptors.h index f72dec2510..8ef964d2af 100644 --- a/Bootloaders/TeensyHID/Descriptors.h +++ b/Bootloaders/TeensyHID/Descriptors.h @@ -96,15 +96,16 @@ /** Vendor usage page for the Teensy++ 2.0 board */ #define TEENSY_USAGEPAGE_20PP 0x1C - #if defined(USB_SERIES_2_AVR) + #if (defined(__AVR_AT90USB162__) || defined(__AVR_ATmega16U2__)) #define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_10 - #elif defined(USB_SERIES_4_AVR) + #elif defined(__AVR_ATmega32U4__) #define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_20 - #define TEENSY_USAGE TEENSY_USAGE_20 - #elif defined(USB_SERIES_6_AVR) + #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)) #define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_10PP - #elif defined(USB_SERIES_7_AVR) + #elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)) #define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_20PP + #else + #error The selected AVR model is not currently supported by the TeensyHID bootloader. #endif /* Function Prototypes: */ diff --git a/Bootloaders/TeensyHID/TeensyHID.c b/Bootloaders/TeensyHID/TeensyHID.c index ff28927b4b..ffbaca8b32 100644 --- a/Bootloaders/TeensyHID/TeensyHID.c +++ b/Bootloaders/TeensyHID/TeensyHID.c @@ -115,10 +115,10 @@ void EVENT_USB_Device_UnhandledControlRequest(void) } else { - #if (SPM_PAGESIZE == 128) - uint16_t PageByteAddress = PageIndex; - #else + #if (FLASHEND > 0xFFFF) uint32_t PageByteAddress = ((uint32_t)PageIndex << 8); + #else + uint16_t PageByteAddress = PageIndex; #endif /* Erase the given FLASH page, ready to be programmed */ diff --git a/LUFA/ManPages/AlternativeStacks.txt b/LUFA/ManPages/AlternativeStacks.txt index 28176ce480..0ce9150f5a 100644 --- a/LUFA/ManPages/AlternativeStacks.txt +++ b/LUFA/ManPages/AlternativeStacks.txt @@ -43,8 +43,8 @@ * via a bit-banged (emulated) version of the USB protocol. They are limited in their capabilities due to the cycles required * to be dedicated to managing the USB bus, but offer a cheap way to implement USB functionality into a design. * - * - Name: AVR309: Software USB (Objective Development) \n - * Cost: Free for some uses, see website for licensing \n + * - Name: AVR309: Software USB (Atmel) \n + * Cost: Free \n * License: None Stated \n * Website: http://www.atmel.com/dyn/Products/app_notes.asp?family_id=607 \n * Description: Atmel's official software USB implementation, an Application Note containing work by Igor Cesko. This