- fix typo recchar()
- fix flash read/write for mega128
This commit is contained in:
Olaf Rempel 2006-05-26 19:26:19 +02:00
parent 11b8928759
commit 2dca010c7d

12
main.c
View File

@ -151,7 +151,7 @@ static inline void recvBuffer(pagebuf_t size)
static inline uint16_t writeFlashPage(uint16_t waddr, pagebuf_t size) static inline uint16_t writeFlashPage(uint16_t waddr, pagebuf_t size)
{ {
uint32_t pagestart = waddr<<1; uint32_t pagestart = (uint32_t)waddr<<1;
uint32_t baddr = pagestart; uint32_t baddr = pagestart;
uint16_t data; uint16_t data;
pagebuf_t cnt = 0; pagebuf_t cnt = 0;
@ -194,7 +194,7 @@ static inline uint16_t writeEEpromPage(uint16_t address, pagebuf_t size)
static inline uint16_t readFlashPage(uint16_t waddr, pagebuf_t size) static inline uint16_t readFlashPage(uint16_t waddr, pagebuf_t size)
{ {
uint32_t baddr = waddr<<1; uint32_t baddr = (uint32_t)waddr<<1;
uint16_t data; uint16_t data;
do { do {
@ -297,13 +297,13 @@ int main(void)
jump_to_app(); // Jump to application sector jump_to_app(); // Jump to application sector
} else { } else {
val = recchar(); val = recvchar();
/* ESC */ /* ESC */
if (val == 0x1B) { if (val == 0x1B) {
// AVRPROG connection // AVRPROG connection
// Wait for signon // Wait for signon
while (val != 'S') while (val != 'S')
val = recchar(); val = recvchar();
send_boot(); // Report signon send_boot(); // Report signon
OK = 0; OK = 0;
@ -442,8 +442,8 @@ int main(void)
// write lockbits // write lockbits
} else if (val == 'l') { } else if (val == 'l') {
if (device == DEVTYPE) { if (device == DEVTYPE) {
// write_lock_bits(recchar()); // write_lock_bits(recvchar());
boot_lock_bits_set(recchar()); // boot.h takes care of mask boot_lock_bits_set(recvchar()); // boot.h takes care of mask
boot_spm_busy_wait(); boot_spm_busy_wait();
} }
sendchar('\r'); sendchar('\r');