projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make sure CRC value is pre-zeroed before reading from the XMEGA target device, to...
[pub/USBasp.git]
/
Bootloaders
/
CDC
/
BootloaderCDC.c
diff --git
a/Bootloaders/CDC/BootloaderCDC.c
b/Bootloaders/CDC/BootloaderCDC.c
index
7695e33
..
a7fc883
100644
(file)
--- a/
Bootloaders/CDC/BootloaderCDC.c
+++ b/
Bootloaders/CDC/BootloaderCDC.c
@@
-1,13
+1,13
@@
/*
LUFA Library
/*
LUFA Library
- Copyright (C) Dean Camera, 201
1
.
+ Copyright (C) Dean Camera, 201
2
.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 201
1
Dean Camera (dean [at] fourwalledcubicle [dot] com)
+ Copyright 201
2
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
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
@@
-88,7
+88,7
@@
int main(void)
}
/** Configures all hardware required for the bootloader. */
}
/** Configures all hardware required for the bootloader. */
-void SetupHardware(void)
+
static
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
@@
-101,13
+101,13
@@
void SetupHardware(void)
MCUCR = (1 << IVCE);
MCUCR = (1 << IVSEL);
MCUCR = (1 << IVCE);
MCUCR = (1 << IVSEL);
- /* Initialize
USB Subsystem
*/
+ /* Initialize
the USB and other board hardware drivers
*/
USB_Init();
LEDs_Init();
USB_Init();
LEDs_Init();
-
+
/* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1);
/* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1);
- TCCR1B = ((1 << CS11) | (1 << CS10));
+ TCCR1B = ((1 << CS11) | (1 << CS10));
}
/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */
}
/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */
@@
-122,17
+122,12
@@
ISR(TIMER1_OVF_vect, ISR_BLOCK)
void EVENT_USB_Device_ConfigurationChanged(void)
{
/* Setup CDC Notification, Rx and Tx Endpoints */
void EVENT_USB_Device_ConfigurationChanged(void)
{
/* Setup CDC Notification, Rx and Tx Endpoints */
- Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPNUM, EP_TYPE_INTERRUPT,
- ENDPOINT_DIR_IN, CDC_NOTIFICATION_EPSIZE,
- ENDPOINT_BANK_SINGLE);
+ Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT,
+ CDC_NOTIFICATION_EPSIZE, 1);
- Endpoint_ConfigureEndpoint(CDC_TX_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_IN, CDC_TXRX_EPSIZE,
- ENDPOINT_BANK_SINGLE);
+ Endpoint_ConfigureEndpoint(CDC_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
- Endpoint_ConfigureEndpoint(CDC_RX_EPNUM, EP_TYPE_BULK,
- ENDPOINT_DIR_OUT, CDC_TXRX_EPSIZE,
- ENDPOINT_BANK_SINGLE);
+ Endpoint_ConfigureEndpoint(CDC_RX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1);
}
/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
}
/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
@@
-266,7
+261,7
@@
static void ReadWriteMemoryBlock(const uint8_t Command)
{
LowByte = FetchNextCommandByte();
}
{
LowByte = FetchNextCommandByte();
}
-
+
HighByte = !HighByte;
}
else
HighByte = !HighByte;
}
else
@@
-303,7
+298,7
@@
static void ReadWriteMemoryBlock(const uint8_t Command)
static uint8_t FetchNextCommandByte(void)
{
/* Select the OUT endpoint so that the next data byte can be read */
static uint8_t FetchNextCommandByte(void)
{
/* Select the OUT endpoint so that the next data byte can be read */
- Endpoint_SelectEndpoint(CDC_RX_EP
NUM
);
+ Endpoint_SelectEndpoint(CDC_RX_EP
ADDR
);
/* If OUT endpoint empty, clear it and wait for the next packet from the host */
while (!(Endpoint_IsReadWriteAllowed()))
/* If OUT endpoint empty, clear it and wait for the next packet from the host */
while (!(Endpoint_IsReadWriteAllowed()))
@@
-329,7
+324,7
@@
static uint8_t FetchNextCommandByte(void)
static void WriteNextResponseByte(const uint8_t Response)
{
/* Select the IN endpoint so that the next data byte can be written */
static void WriteNextResponseByte(const uint8_t Response)
{
/* Select the IN endpoint so that the next data byte can be written */
- Endpoint_SelectEndpoint(CDC_TX_EP
NUM
);
+ Endpoint_SelectEndpoint(CDC_TX_EP
ADDR
);
/* If IN endpoint full, clear it and wait until ready for the next packet to the host */
if (!(Endpoint_IsReadWriteAllowed()))
/* If IN endpoint full, clear it and wait until ready for the next packet to the host */
if (!(Endpoint_IsReadWriteAllowed()))
@@
-350,10
+345,10
@@
static void WriteNextResponseByte(const uint8_t Response)
/** Task to read in AVR910 commands from the CDC data OUT endpoint, process them, perform the required actions
* and send the appropriate response back to the host.
*/
/** Task to read in AVR910 commands from the CDC data OUT endpoint, process them, perform the required actions
* and send the appropriate response back to the host.
*/
-void CDC_Task(void)
+
static
void CDC_Task(void)
{
/* Select the OUT endpoint */
{
/* Select the OUT endpoint */
- Endpoint_SelectEndpoint(CDC_RX_EP
NUM
);
+ Endpoint_SelectEndpoint(CDC_RX_EP
ADDR
);
/* Check if endpoint has a command in it sent from the host */
if (!(Endpoint_IsOUTReceived()))
/* Check if endpoint has a command in it sent from the host */
if (!(Endpoint_IsOUTReceived()))
@@
-365,7
+360,7
@@
void CDC_Task(void)
if (Command == 'E')
{
RunBootloader = false;
if (Command == 'E')
{
RunBootloader = false;
-
+
/* Send confirmation byte back to the host */
WriteNextResponseByte('\r');
}
/* Send confirmation byte back to the host */
WriteNextResponseByte('\r');
}
@@
-549,7
+544,7
@@
void CDC_Task(void)
}
/* Select the IN endpoint */
}
/* Select the IN endpoint */
- Endpoint_SelectEndpoint(CDC_TX_EP
NUM
);
+ Endpoint_SelectEndpoint(CDC_TX_EP
ADDR
);
/* Remember if the endpoint is completely full before clearing it */
bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
/* Remember if the endpoint is completely full before clearing it */
bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
@@
-577,7
+572,7
@@
void CDC_Task(void)
}
/* Select the OUT endpoint */
}
/* Select the OUT endpoint */
- Endpoint_SelectEndpoint(CDC_RX_EP
NUM
);
+ Endpoint_SelectEndpoint(CDC_RX_EP
ADDR
);
/* Acknowledge the command from the host */
Endpoint_ClearOUT();
/* Acknowledge the command from the host */
Endpoint_ClearOUT();