diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2011-10-23 16:49:36 -0400 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2011-10-23 16:49:36 -0400 |
commit | 4f19d9bc8e4bd5c09eb21fd2e25748d5574e37c4 (patch) | |
tree | 7a45fb9da4d6bc0a2096a53ec12cb28004458849 /bootloaders/nuevo_diskloader/src | |
parent | 8d5361044e84cb3e80d83e35f1946fb4f37a3079 (diff) |
bootloader responds properly now. nearly there - still have an issue with it falling out of sync after completing most operations
Diffstat (limited to 'bootloaders/nuevo_diskloader/src')
-rw-r--r-- | bootloaders/nuevo_diskloader/src/CDC.cpp | 4 | ||||
-rw-r--r-- | bootloaders/nuevo_diskloader/src/DiskLoader.cpp | 41 | ||||
-rw-r--r-- | bootloaders/nuevo_diskloader/src/USBCore.cpp | 10 |
3 files changed, 39 insertions, 16 deletions
diff --git a/bootloaders/nuevo_diskloader/src/CDC.cpp b/bootloaders/nuevo_diskloader/src/CDC.cpp index 6c5e8dc..827899d 100644 --- a/bootloaders/nuevo_diskloader/src/CDC.cpp +++ b/bootloaders/nuevo_diskloader/src/CDC.cpp @@ -92,8 +92,8 @@ bool WEAK CDC_Setup(Setup& setup) if (CDC_SET_CONTROL_LINE_STATE == r) { - if (0 != _usbLineInfo.lineState && 1200 == _usbLineInfo.dwDTERate) // auto-reset is triggered when the port, already open at 1200 bps, is closed - Reboot(); +// if (0 != _usbLineInfo.lineState && 1200 == _usbLineInfo.dwDTERate) // auto-reset is triggered when the port, already open at 1200 bps, is closed +// Reboot(); _usbLineInfo.lineState = setup.wValueL; return true; } diff --git a/bootloaders/nuevo_diskloader/src/DiskLoader.cpp b/bootloaders/nuevo_diskloader/src/DiskLoader.cpp index 86d62e4..2f41f25 100644 --- a/bootloaders/nuevo_diskloader/src/DiskLoader.cpp +++ b/bootloaders/nuevo_diskloader/src/DiskLoader.cpp @@ -116,13 +116,14 @@ int main() _inSync = STK_INSYNC; _ok = STK_OK; + for (;;) { u8* packet = _flashbuf; u16 address = 0; for (;;) { - while (Serial.available() <= 0) + while (Serial.available() < 1) ; u8 cmd = Serial.read(); @@ -185,20 +186,42 @@ int main() USB_Send(CDC_TX, &_inSync, 1); if (send) { - u8 i; - for (i=0; i<send; i++) { -// Serial.write(0xFF); // this works -// Serial.write(*pgm + i); // this doesn't - Serial.write(pgm[i]); - } +// u8 i; +// for (i=0; i<send; i++) { +//// Serial.write(0xFF); // this works +//// Serial.write(*pgm + i); // this doesn't +// Serial.write(pgm[i]); +// } + USB_Send(CDC_TX|TRANSFER_PGM, pgm, send); } // Send ok // Serial.write(STK_OK); USB_Send(CDC_TX|TRANSFER_RELEASE, &_ok, 1); - if ('Q' == cmd) - break; +// if ('Q' == cmd) +// break; + } + } + + /* + for (;;) + { + for (;;) + { + while (Serial.available() < 1) + ; + u8 cmd = Serial.read(); + + if (cmd == '1') + { + L_LED_ON(); + } + +// USB_Send(CDC_TX, &_inSync, 1); +// +// USB_Send(CDC_TX|TRANSFER_RELEASE, &_ok, 1); } } + */ } diff --git a/bootloaders/nuevo_diskloader/src/USBCore.cpp b/bootloaders/nuevo_diskloader/src/USBCore.cpp index 8b7ef82..abb529a 100644 --- a/bootloaders/nuevo_diskloader/src/USBCore.cpp +++ b/bootloaders/nuevo_diskloader/src/USBCore.cpp @@ -268,14 +268,14 @@ int USB_Send(u8 ep, const void* d, int len) while (len) { u8 n = USB_SendSpace(ep); -// if (n == 0) -// { + if (n == 0) + { // if (!(--timeout)) // return -1; // delay(1); -// _delay_ms(1); -// continue; -// } + _delay_ms(3); + continue; + } if (n > len) n = len; |