Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
885170f5
Commit
885170f5
authored
May 26, 2010
by
Dean Camera
Browse files
Removed unused line encoding data and control requests from the CDC Bootloader code, to save space.
parent
54e69dbe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Bootloaders/CDC/BootloaderCDC.c
View file @
885170f5
...
...
@@ -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'
)
...
...
Bootloaders/CDC/BootloaderCDC.h
View file @
885170f5
...
...
@@ -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
);
...
...
LUFA/ManPages/ChangeLog.txt
View file @
885170f5
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment