X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/c5038f1bf44aea75f1ae1ed035cb7d523ccfdacb..d26a9ed5fd6fc60a0dfa61d04f5ae2bd7163a85d:/Bootloaders/CDC/BootloaderCDC.c diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index 6769a0c2d..482859bda 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.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 @@ -36,7 +36,6 @@ #define INCLUDE_FROM_BOOTLOADERCDC_C #include "BootloaderCDC.h" -/* Globals: */ /** Line coding options for the virtual serial port. Although the virtual serial port data is never * sent through a physical serial port, the line encoding data must still be read and preserved from * the host, or the host will detect a problem and fail to open the port. This structure contains the @@ -116,15 +115,6 @@ void ResetHardware(void) boot_rww_enable(); } -/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user - * application started. - */ -void EVENT_USB_Device_Disconnect(void) -{ - /* Upon disconnection, run user application */ - RunBootloader = false; -} - /** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready * to relay data to and from the attached USB host. */ @@ -235,15 +225,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command) while (BlockSize--) { - if (MemoryType == 'E') - { - /* Read the next EEPROM byte into the endpoint */ - WriteNextResponseByte(eeprom_read_byte((uint8_t*)(uint16_t)(CurrAddress >> 1))); - - /* Increment the address counter after use */ - CurrAddress += 2; - } - else + if (MemoryType == 'F') { /* Read the next FLASH byte from the current FLASH page */ #if (FLASHEND > 0xFFFF) @@ -258,6 +240,14 @@ static void ReadWriteMemoryBlock(const uint8_t Command) HighByte = !HighByte; } + else + { + /* Read the next EEPROM byte into the endpoint */ + WriteNextResponseByte(eeprom_read_byte((uint8_t*)(uint16_t)(CurrAddress >> 1))); + + /* Increment the address counter after use */ + CurrAddress += 2; + } } } else @@ -353,7 +343,7 @@ static void WriteNextResponseByte(const uint8_t Response) /* Select the IN endpoint so that the next data byte can be written */ Endpoint_SelectEndpoint(CDC_TX_EPNUM); - /* If IN endpoint full, clear it and wait util ready for the next packet to the host */ + /* If IN endpoint full, clear it and wait until ready for the next packet to the host */ if (!(Endpoint_IsReadWriteAllowed())) { Endpoint_ClearIN(); @@ -533,7 +523,7 @@ void CDC_Task(void) else if (Command == 'D') { /* Read the byte from the endpoint and write it to the EEPROM */ - eeprom_write_byte((uint8_t*)(uint16_t)(CurrAddress >> 1), FetchNextCommandByte()); + eeprom_write_byte((uint8_t*)((uint16_t)(CurrAddress >> 1)), FetchNextCommandByte()); /* Increment the address after use */ CurrAddress += 2; @@ -544,7 +534,7 @@ void CDC_Task(void) else if (Command == 'd') { /* Read the EEPROM byte and write it to the endpoint */ - WriteNextResponseByte(eeprom_read_byte((uint8_t*)(uint16_t)(CurrAddress >> 1))); + WriteNextResponseByte(eeprom_read_byte((uint8_t*)((uint16_t)(CurrAddress >> 1)))); /* Increment the address after use */ CurrAddress += 2;