diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-10-26 12:53:57 -0400 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-10-26 12:53:57 -0400 |
commit | a52fb298607dfbd78b83e3d0787fdf5d508332d9 (patch) | |
tree | c95676e072bc9a37bf8a2bbf9f41ea6c867d21e5 /bootloaders/nuevo_diskloader/src | |
parent | bdfae9f7b7b7e34bc00acdf2889ba3dfaa1f3e87 (diff) |
working (?!?!?!) bootloader. doesn't yet restart chip after upload completes.
Diffstat (limited to 'bootloaders/nuevo_diskloader/src')
-rw-r--r-- | bootloaders/nuevo_diskloader/src/DiskLoader.cpp | 32 | ||||
-rw-r--r-- | bootloaders/nuevo_diskloader/src/USBCore.cpp | 6 |
2 files changed, 23 insertions, 15 deletions
diff --git a/bootloaders/nuevo_diskloader/src/DiskLoader.cpp b/bootloaders/nuevo_diskloader/src/DiskLoader.cpp index f611e17..a7ccde6 100644 --- a/bootloaders/nuevo_diskloader/src/DiskLoader.cpp +++ b/bootloaders/nuevo_diskloader/src/DiskLoader.cpp @@ -24,11 +24,12 @@ void entrypoint(void) u8 _flashbuf[128]; u8 _inSync; u8 _ok; +u16 do_reset = 0; volatile u16 _timeout; void Program(u8 ep, u16 page, u8 count) { - u8 write = page < 28*1024; // Don't write over firmware please + u8 write = page < 28*1024; // Don't write over bootloader please if (write) boot_page_erase(page); @@ -94,18 +95,18 @@ const u8 _consts[] = 0x00, // }; -int getch(void) -{ - u16 timeout; - u8 c; - for (timeout = 0; timeout; timeout--) - { - c = USB_Recv(CDC_RX); - if (c != -1) - return c; - } - return -1; -} +//int getch(void) +//{ +// u16 timeout; +// u8 c; +// for (timeout = 0; timeout; timeout--) +// { +// c = USB_Recv(CDC_RX); +// if (c != -1) +// return c; +// } +// return -1; +//} int main(void) __attribute__ ((naked)); @@ -245,8 +246,11 @@ int main() // Send ok USB_Send(CDC_TX|TRANSFER_RELEASE, &_ok, 1); - if ('Q' == cmd) + if ('Q' == cmd) + { + do_reset = 500; break; + } } } } diff --git a/bootloaders/nuevo_diskloader/src/USBCore.cpp b/bootloaders/nuevo_diskloader/src/USBCore.cpp index fffe6f7..453c2ff 100644 --- a/bootloaders/nuevo_diskloader/src/USBCore.cpp +++ b/bootloaders/nuevo_diskloader/src/USBCore.cpp @@ -219,7 +219,8 @@ u8 USB_Available(u8 ep) void USB_Recv_block(u8 ep, u8* dst, int len) { - SetEP(ep); +// SetEP(ep & 7); + LockEP lock(ep); while (len--) { while (!ReadWriteAllowed()) @@ -314,6 +315,9 @@ int USB_Send(u8 ep, const void* d, int len) ReleaseTX(); } } + if (ep & TRANSFER_RELEASE) + ReleaseTX(); + TX_LED_ON(); TxLEDPulse = TX_RX_LED_PULSE_MS; return r; |