projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make CDC class bootloader hard-reset the AVR when exited instead of a soft-reset...
[pub/USBasp.git]
/
Bootloaders
/
TeensyHID
/
TeensyHID.c
diff --git
a/Bootloaders/TeensyHID/TeensyHID.c
b/Bootloaders/TeensyHID/TeensyHID.c
index
b93be6d
..
ff28927
100644
(file)
--- a/
Bootloaders/TeensyHID/TeensyHID.c
+++ b/
Bootloaders/TeensyHID/TeensyHID.c
@@
-105,18
+105,24
@@
void EVENT_USB_Device_UnhandledControlRequest(void)
/* Wait until the command has been sent by the host */
\r
while (!(Endpoint_IsOUTReceived()));
\r
\r
/* Wait until the command has been sent by the host */
\r
while (!(Endpoint_IsOUTReceived()));
\r
\r
- /* Read in the write destination
address
*/
\r
- uint16_t Page
Address
= Endpoint_Read_Word_LE();
\r
+ /* Read in the write destination
index
*/
\r
+ uint16_t Page
Index
= Endpoint_Read_Word_LE();
\r
\r
/* Check if the command is a program page command, or a start application command */
\r
\r
/* Check if the command is a program page command, or a start application command */
\r
- if (Page
Address
== TEENSY_STARTAPPLICATION)
\r
+ if (Page
Index
== TEENSY_STARTAPPLICATION)
\r
{
\r
RunBootloader = false;
\r
}
\r
else
\r
{
\r
{
\r
RunBootloader = false;
\r
}
\r
else
\r
{
\r
+ #if (SPM_PAGESIZE == 128)
\r
+ uint16_t PageByteAddress = PageIndex;
\r
+ #else
\r
+ uint32_t PageByteAddress = ((uint32_t)PageIndex << 8);
\r
+ #endif
\r
+
\r
/* Erase the given FLASH page, ready to be programmed */
\r
/* Erase the given FLASH page, ready to be programmed */
\r
- boot_page_erase(PageAddress);
\r
+ boot_page_erase(Page
Byte
Address);
\r
boot_spm_busy_wait();
\r
\r
/* Write each of the FLASH page's bytes in sequence */
\r
boot_spm_busy_wait();
\r
\r
/* Write each of the FLASH page's bytes in sequence */
\r
@@
-134,15
+140,12
@@
void EVENT_USB_Device_UnhandledControlRequest(void)
}
\r
\r
/* Write the next data word to the FLASH page */
\r
}
\r
\r
/* Write the next data word to the FLASH page */
\r
- boot_page_fill(PageAddress + PageByte, Endpoint_Read_Word_LE());
\r
+ boot_page_fill(Page
Byte
Address + PageByte, Endpoint_Read_Word_LE());
\r
}
\r
\r
/* Write the filled FLASH page to memory */
\r
}
\r
\r
/* Write the filled FLASH page to memory */
\r
- boot_page_write(PageAddress);
\r
+ boot_page_write(Page
Byte
Address);
\r
boot_spm_busy_wait();
\r
boot_spm_busy_wait();
\r
-
\r
- /* Re-enable RWW section */
\r
- boot_rww_enable();
\r
}
\r
\r
Endpoint_ClearOUT();
\r
}
\r
\r
Endpoint_ClearOUT();
\r