diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2011-05-27 03:33:40 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2011-05-27 03:33:40 +0000 |
| commit | d62e9a7debc6ec46bc9391ab3ead969be257f7a9 (patch) | |
| tree | e659843a1038393b9e7023c08665af3d7ec5603c /Bootloaders | |
| parent | 01f728dc3d8f2f912583a893ed8f6f89c2bee36c (diff) | |
Merge over trunk changes to the 110528 BETA to form the 110528 release.
git-svn-id: http://lufa-lib.googlecode.com/svn/tags/LUFA-110528@1768 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Bootloaders')
| -rw-r--r-- | Bootloaders/CDC/BootloaderCDC.c | 17 | ||||
| -rw-r--r-- | Bootloaders/CDC/BootloaderCDC.h | 1 | ||||
| -rw-r--r-- | Bootloaders/DFU/BootloaderDFU.c | 25 | ||||
| -rw-r--r-- | Bootloaders/DFU/BootloaderDFU.h | 1 | ||||
| -rw-r--r-- | Bootloaders/HID/BootloaderHID.c | 8 |
5 files changed, 48 insertions, 4 deletions
diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index 8e6a58b0..7695e33d 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -66,6 +66,9 @@ int main(void) /* Setup hardware required for the bootloader */ SetupHardware(); + /* Turn on first LED on the board to indicate that the bootloader has started */ + LEDs_SetAllLEDs(LEDS_LED1); + /* Enable global interrupts so that the USB stack can function */ sei(); @@ -100,6 +103,17 @@ void SetupHardware(void) /* Initialize USB Subsystem */ USB_Init(); + LEDs_Init(); + + /* Bootloader active LED toggle timer initialization */ + TIMSK1 = (1 << TOIE1); + TCCR1B = ((1 << CS11) | (1 << CS10)); +} + +/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */ +ISR(TIMER1_OVF_vect, ISR_BLOCK) +{ + LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2); } /** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready @@ -134,6 +148,9 @@ void EVENT_USB_Device_ControlRequest(void) return; } + /* Activity - toggle indicator LEDs */ + LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2); + /* Process CDC specific control requests */ switch (USB_ControlRequest.bRequest) { diff --git a/Bootloaders/CDC/BootloaderCDC.h b/Bootloaders/CDC/BootloaderCDC.h index b6bea11e..72bc1e77 100644 --- a/Bootloaders/CDC/BootloaderCDC.h +++ b/Bootloaders/CDC/BootloaderCDC.h @@ -48,6 +48,7 @@ #include "Descriptors.h" #include <LUFA/Drivers/USB/USB.h> + #include <LUFA/Drivers/Board/LEDs.h> /* Macros: */ /** Version major of the CDC bootloader. */ diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index 113bea74..fdd4d2de 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@ -119,6 +119,9 @@ int main(void) MCUCR &= ~(1 << JTD); #endif + /* Turn on first LED on the board to indicate that the bootloader has started */ + LEDs_SetAllLEDs(LEDS_LED1); + /* Enable global interrupts so that the USB stack can function */ sei(); @@ -149,6 +152,11 @@ void SetupHardware(void) /* Initialize the USB subsystem */ USB_Init(); + LEDs_Init(); + + /* Bootloader active LED toggle timer initialization */ + TIMSK1 = (1 << TOIE1); + TCCR1B = ((1 << CS11) | (1 << CS10)); } /** Resets all configured hardware required for the bootloader back to their original states. */ @@ -162,15 +170,18 @@ void ResetHardware(void) MCUCR = 0; } +/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */ +ISR(TIMER1_OVF_vect, ISR_BLOCK) +{ + LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2); +} + /** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ void EVENT_USB_Device_ControlRequest(void) -{ - /* Get the size of the command and data from the wLength value */ - SentCommand.DataSize = USB_ControlRequest.wLength; - +{ /* Ignore any requests that aren't directed to the DFU interface */ if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) != (REQTYPE_CLASS | REQREC_INTERFACE)) @@ -178,6 +189,12 @@ void EVENT_USB_Device_ControlRequest(void) return; } + /* Activity - toggle indicator LEDs */ + LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2); + + /* Get the size of the command and data from the wLength value */ + SentCommand.DataSize = USB_ControlRequest.wLength; + switch (USB_ControlRequest.bRequest) { case DFU_REQ_DNLOAD: diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h index 1c1ebba6..8fbf64c7 100644 --- a/Bootloaders/DFU/BootloaderDFU.h +++ b/Bootloaders/DFU/BootloaderDFU.h @@ -50,6 +50,7 @@ #include "Descriptors.h" #include <LUFA/Drivers/USB/USB.h> + #include <LUFA/Drivers/Board/LEDs.h> /* Macros: */ /** Configuration define. Define this token to true to case the bootloader to reject all memory commands diff --git a/Bootloaders/HID/BootloaderHID.c b/Bootloaders/HID/BootloaderHID.c index f0480430..4a439544 100644 --- a/Bootloaders/HID/BootloaderHID.c +++ b/Bootloaders/HID/BootloaderHID.c @@ -113,10 +113,18 @@ void EVENT_USB_Device_ControlRequest(void) while (!(Endpoint_IsOUTReceived()));
/* Read in the write destination address */
+ #if (FLASHEND > 0xFFFF)
+ uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8);
+ #else
uint16_t PageAddress = Endpoint_Read_16_LE();
+ #endif
/* Check if the command is a program page command, or a start application command */
+ #if (FLASHEND > 0xFFFF)
+ if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION)
+ #else
if (PageAddress == COMMAND_STARTAPPLICATION)
+ #endif
{
RunBootloader = false;
}
|
