aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-05-26 12:44:05 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-05-26 12:44:05 +0000
commit885170f5b456116d7c40570c36342193a30ed886 (patch)
treecb7906eb738f362c46528293d1ad868b7af0423d
parent54e69dbee146182a60c258076b8d26e8f5ac752a (diff)
downloadlufa-885170f5b456116d7c40570c36342193a30ed886.tar.gz
lufa-885170f5b456116d7c40570c36342193a30ed886.tar.bz2
lufa-885170f5b456116d7c40570c36342193a30ed886.zip
Removed unused line encoding data and control requests from the CDC Bootloader code, to save space.
-rw-r--r--Bootloaders/CDC/BootloaderCDC.c73
-rw-r--r--Bootloaders/CDC/BootloaderCDC.h48
-rw-r--r--LUFA/ManPages/ChangeLog.txt1
3 files changed, 4 insertions, 118 deletions
diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c
index 0b2eb810b..da2d0b665 100644
--- a/Bootloaders/CDC/BootloaderCDC.c
+++ b/Bootloaders/CDC/BootloaderCDC.c
@@ -36,17 +36,6 @@
#define INCLUDE_FROM_BOOTLOADERCDC_C
#include "BootloaderCDC.h"
-/** 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
- * current encoding options, including baud rate, character format, parity mode and total number of
- * bits in each data chunk.
- */
-CDC_Line_Coding_t LineCoding = { .BaudRateBPS = 9600,
- .CharFormat = OneStopBit,
- .ParityType = Parity_None,
- .DataBits = 8 };
-
/** Current address counter. This stores the current address of the FLASH or EEPROM as set by the host,
* and is used when reading or writing to the AVRs memory (either FLASH or EEPROM depending on the issued
* command.)
@@ -124,63 +113,6 @@ void EVENT_USB_Device_ConfigurationChanged(void)
ENDPOINT_BANK_SINGLE);
}
-/** 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, so that they can be handled appropriately
- * for the application.
- */
-void EVENT_USB_Device_UnhandledControlRequest(void)
-{
- uint8_t* LineCodingData = (uint8_t*)&LineCoding;
-
- /* Process CDC specific control requests */
- switch (USB_ControlRequest.bRequest)
- {
- case REQ_GetLineEncoding:
- if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
- {
- Endpoint_ClearSETUP();
-
- for (uint8_t i = 0; i < sizeof(LineCoding); i++)
- Endpoint_Write_Byte(*(LineCodingData++));
-
- Endpoint_ClearIN();
-
- Endpoint_ClearStatusStage();
- }
-
- break;
- case REQ_SetLineEncoding:
- if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
- {
- Endpoint_ClearSETUP();
-
- while (!(Endpoint_IsOUTReceived()))
- {
- if (USB_DeviceState == DEVICE_STATE_Unattached)
- return;
- }
-
- for (uint8_t i = 0; i < sizeof(LineCoding); i++)
- *(LineCodingData++) = Endpoint_Read_Byte();
-
- Endpoint_ClearOUT();
-
- Endpoint_ClearStatusStage();
- }
-
- break;
- case REQ_SetControlLineState:
- if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
- {
- Endpoint_ClearSETUP();
-
- Endpoint_ClearStatusStage();
- }
-
- break;
- }
-}
-
/** Reads or writes a block of EEPROM or FLASH memory to or from the appropriate CDC data endpoint, depending
* on the AVR910 protocol command issued.
*
@@ -339,7 +271,7 @@ static void WriteNextResponseByte(const uint8_t Response)
Endpoint_ClearIN();
while (!(Endpoint_IsINReady()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
@@ -367,7 +299,7 @@ void CDC_Task(void)
{
if (Command == 'E')
RunBootloader = false;
- if (Command == 'T')
+ else if (Command == 'T')
FetchNextCommandByte();
/* Send confirmation byte back to the host */
@@ -377,7 +309,6 @@ void CDC_Task(void)
{
/* Return ATMEGA128 part code - this is only to allow AVRProg to use the bootloader */
WriteNextResponseByte(0x44);
-
WriteNextResponseByte(0x00);
}
else if (Command == 'a')
diff --git a/Bootloaders/CDC/BootloaderCDC.h b/Bootloaders/CDC/BootloaderCDC.h
index 64811c85f..7aa07a294 100644
--- a/Bootloaders/CDC/BootloaderCDC.h
+++ b/Bootloaders/CDC/BootloaderCDC.h
@@ -49,22 +49,7 @@
#include <LUFA/Drivers/USB/USB.h>
- /* Macros: */
- /** CDC Class Specific request to get the line encoding on a CDC-ACM virtual serial port, including the
- * baud rate, parity, stop bits and data bits.
- */
- #define REQ_GetLineEncoding 0x21
-
- /** CDC Class Specific request to set the line encoding on a CDC-ACM virtual serial port, including the
- * baud rate, parity, stop bits and data bits.
- */
- #define REQ_SetLineEncoding 0x20
-
- /** CDC Class Specific request to set the state of the serial handshake lines (such as DCD and RTS) on
- * a CDC-ACM virtual serial port.
- */
- #define REQ_SetControlLineState 0x22
-
+ /* Macros: */
/** Version major of the CDC bootloader. */
#define BOOTLOADER_VERSION_MAJOR 0x01
@@ -83,43 +68,12 @@
/* Type Defines: */
/** Type define for a non-returning pointer to the start of the loaded application in flash memory. */
typedef void (*AppPtr_t)(void) ATTR_NO_RETURN;
-
- /** Type define for the CDC-ACM virtual serial port line encoding options, including baud rate, format, parity
- * and size of each data chunk in bits.
- */
- typedef struct
- {
- uint32_t BaudRateBPS; /**< Baud rate in BPS */
- uint8_t CharFormat; /**< Character format, an entry from the BootloaderCDC_CDC_LineCodingFormats_t enum */
- uint8_t ParityType; /**< Parity mode, an entry from the BootloaderCDC_CDC_LineCodeingParity_t enum */
- uint8_t DataBits; /**< Size of each data chunk, in bits */
- } CDC_Line_Coding_t;
-
- /* Enums: */
- /** Enum for the possible line encoding formats on a CDC-ACM virtual serial port */
- enum BootloaderCDC_CDC_LineCodingFormats_t
- {
- OneStopBit = 0, /**< Single stop bit */
- OneAndAHalfStopBits = 1, /**< 1.5 stop bits */
- TwoStopBits = 2, /**< Two stop bits */
- };
-
- /** Enum for the possible parity modes on a CDC-ACM virtual serial port */
- enum BootloaderCDC_CDC_LineCodingParity_t
- {
- Parity_None = 0, /**< No data parity checking */
- Parity_Odd = 1, /**< Odd data parity checking */
- Parity_Even = 2, /**< Even data parity checking */
- Parity_Mark = 3, /**< Mark data parity checking */
- Parity_Space = 4, /**< Space data parity checking */
- };
/* Function Prototypes: */
void CDC_Task(void);
void SetupHardware(void);
void EVENT_USB_Device_ConfigurationChanged(void);
- void EVENT_USB_Device_UnhandledControlRequest(void);
#if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)
static void ReadWriteMemoryBlock(const uint8_t Command);
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index 957a4e560..bf0fd6d83 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -17,6 +17,7 @@
* changed bytes are written to EEPROM to preserve its lifespan
* - Changed over the AVRISP-MKII and TemperatureDataLogger projects to use eeprom_update_byte() when writing non-volatile
* parameters to EEPROM to preserve its lifespan
+ * - Removed unused line encoding data and control requests from the CDC Bootloader code, to save space
*
* <b>Fixed:</b>
* - Fixed AVRISP project sending a LOAD EXTENDED ADDRESS command to 128KB AVRs after programming or reading from