X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/e071f3897a0946c6be1e1b5e1f78eda8dcbf6fc7..d26a9ed5fd6fc60a0dfa61d04f5ae2bd7163a85d:/Bootloaders/DFU/BootloaderDFU.c diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index f9c8195f3..157b78ffb 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@ -1,21 +1,21 @@ /* LUFA Library - Copyright (C) Dean Camera, 2009. + Copyright (C) Dean Camera, 2010. dean [at] fourwalledcubicle [dot] com www.fourwalledcubicle.com */ /* - Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com) - - Permission to use, copy, modify, and distribute this software - and its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -92,6 +92,7 @@ uint16_t StartAddr = 0x0000; */ uint16_t EndAddr = 0x0000; + /** Main program entry point. This routine configures the hardware required by the bootloader, then continuously * runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start * the loaded application code. @@ -141,20 +142,11 @@ void ResetHardware(void) MCUCR = 0; } -/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user - * application started. - */ -void EVENT_USB_Disconnect(void) -{ - /* Upon disconnection, run user application */ - RunBootloader = false; -} - -/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific * control requests that are not handled internally by the USB library (including the DFU commands, which are * all issued via the control endpoint), so that they can be handled appropriately for the application. */ -void EVENT_USB_UnhandledControlPacket(void) +void EVENT_USB_Device_UnhandledControlRequest(void) { /* Get the size of the command and data from the wLength value */ SentCommand.DataSize = USB_ControlRequest.wLength; @@ -213,8 +205,8 @@ void EVENT_USB_UnhandledControlPacket(void) /* Throw away the filler bytes before the start of the firmware */ DiscardFillerBytes(DFU_FILLER_BYTES_SIZE); - /* Throw away the page alignment filler bytes before the start of the firmware */ - DiscardFillerBytes(StartAddr % SPM_PAGESIZE); + /* Throw away the packet alignment filler bytes before the start of the firmware */ + DiscardFillerBytes(StartAddr % FIXED_CONTROL_ENDPOINT_SIZE); /* Calculate the number of bytes remaining to be written */ uint16_t BytesRemaining = ((EndAddr - StartAddr) + 1); @@ -698,11 +690,7 @@ static void ProcessReadCommand(void) uint8_t DataIndexToRead = SentCommand.Data[1]; if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00)) // Read bootloader info - { - ResponseByte = BootloaderInfo[DataIndexToRead]; - } + ResponseByte = BootloaderInfo[DataIndexToRead]; else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Read signature byte - { - ResponseByte = SignatureInfo[DataIndexToRead - 0x30]; - } + ResponseByte = SignatureInfo[DataIndexToRead - 0x30]; }