diff options
Diffstat (limited to 'apps/plugins/iriver_flash.c')
-rw-r--r-- | apps/plugins/iriver_flash.c | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c index b744eac70f..67ea090cf2 100644 --- a/apps/plugins/iriver_flash.c +++ b/apps/plugins/iriver_flash.c | |||
@@ -187,8 +187,6 @@ int wait_for_button(void) | |||
187 | /* helper for DoUserDialog() */ | 187 | /* helper for DoUserDialog() */ |
188 | void ShowFlashInfo(struct flash_info* pInfo) | 188 | void ShowFlashInfo(struct flash_info* pInfo) |
189 | { | 189 | { |
190 | char buf[32]; | ||
191 | |||
192 | if (!pInfo->manufacturer) | 190 | if (!pInfo->manufacturer) |
193 | { | 191 | { |
194 | rb->lcd_puts(0, 0, "Flash: M=?? D=??"); | 192 | rb->lcd_puts(0, 0, "Flash: M=?? D=??"); |
@@ -196,16 +194,14 @@ void ShowFlashInfo(struct flash_info* pInfo) | |||
196 | } | 194 | } |
197 | else | 195 | else |
198 | { | 196 | { |
199 | rb->snprintf(buf, sizeof(buf), "Flash: M=%02x D=%02x", | 197 | rb->lcd_putsf(0, 0, "Flash: M=%02x D=%02x", |
200 | pInfo->manufacturer, pInfo->id); | 198 | pInfo->manufacturer, pInfo->id); |
201 | rb->lcd_puts(0, 0, buf); | ||
202 | 199 | ||
203 | 200 | ||
204 | if (pInfo->size) | 201 | if (pInfo->size) |
205 | { | 202 | { |
206 | rb->lcd_puts(0, 1, pInfo->name); | 203 | rb->lcd_puts(0, 1, pInfo->name); |
207 | rb->snprintf(buf, sizeof(buf), "Size: %d KB", pInfo->size / 1024); | 204 | rb->lcd_putsf(0, 2, "Size: %d KB", pInfo->size / 1024); |
208 | rb->lcd_puts(0, 2, buf); | ||
209 | } | 205 | } |
210 | else | 206 | else |
211 | { | 207 | { |
@@ -235,11 +231,9 @@ bool show_info(void) | |||
235 | 231 | ||
236 | bool confirm(const char *msg) | 232 | bool confirm(const char *msg) |
237 | { | 233 | { |
238 | char buf[128]; | ||
239 | bool ret; | 234 | bool ret; |
240 | 235 | ||
241 | rb->snprintf(buf, sizeof buf, "%s ([PLAY] to CONFIRM)", msg); | 236 | rb->splashf(0, "%s ([PLAY] to CONFIRM)", msg); |
242 | rb->splash(0, buf); | ||
243 | 237 | ||
244 | ret = (wait_for_button() == BUTTON_ON); | 238 | ret = (wait_for_button() == BUTTON_ON); |
245 | show_info(); | 239 | show_info(); |
@@ -338,7 +332,6 @@ static int get_section_address(int section) | |||
338 | int flash_rockbox(const char *filename, int section) | 332 | int flash_rockbox(const char *filename, int section) |
339 | { | 333 | { |
340 | struct flash_header hdr; | 334 | struct flash_header hdr; |
341 | char buf[64]; | ||
342 | int pos, i, len, rc; | 335 | int pos, i, len, rc; |
343 | unsigned long checksum, sum; | 336 | unsigned long checksum, sum; |
344 | unsigned char *p8; | 337 | unsigned char *p8; |
@@ -378,9 +371,8 @@ int flash_rockbox(const char *filename, int section) | |||
378 | 371 | ||
379 | if (pos+sizeof(struct flash_header) != *p32) | 372 | if (pos+sizeof(struct flash_header) != *p32) |
380 | { | 373 | { |
381 | rb->snprintf(buf, sizeof(buf), "Incorrect relocation: 0x%08lx/0x%08lx", | 374 | rb->splashf(HZ*10, "Incorrect relocation: 0x%08lx/0x%08lx", |
382 | *p32, pos+sizeof(struct flash_header)); | 375 | *p32, pos+sizeof(struct flash_header)); |
383 | rb->splash(HZ*10, buf); | ||
384 | return -1; | 376 | return -1; |
385 | } | 377 | } |
386 | 378 | ||
@@ -393,9 +385,7 @@ int flash_rockbox(const char *filename, int section) | |||
393 | if (i + pos < SEC_SIZE) | 385 | if (i + pos < SEC_SIZE) |
394 | return -1; | 386 | return -1; |
395 | 387 | ||
396 | rb->snprintf(buf, sizeof(buf), "Erasing... %d%%", | 388 | rb->lcd_putsf(0, 3, "Erasing... %d%%", (i+SEC_SIZE)*100/len); |
397 | (i+SEC_SIZE)*100/len); | ||
398 | rb->lcd_puts(0, 3, buf); | ||
399 | rb->lcd_update(); | 389 | rb->lcd_update(); |
400 | 390 | ||
401 | rc = cfi_erase_sector(FB + (i + pos)/2); | 391 | rc = cfi_erase_sector(FB + (i + pos)/2); |
@@ -408,8 +398,7 @@ int flash_rockbox(const char *filename, int section) | |||
408 | // rb->strncpy(hdr.version, rb->rbversion , sizeof(hdr.version)-1); | 398 | // rb->strncpy(hdr.version, rb->rbversion , sizeof(hdr.version)-1); |
409 | p16 = (uint16_t *)&hdr; | 399 | p16 = (uint16_t *)&hdr; |
410 | 400 | ||
411 | rb->snprintf(buf, sizeof(buf), "Programming..."); | 401 | rb->lcd_puts(0, 4, "Programming..."); |
412 | rb->lcd_puts(0, 4, buf); | ||
413 | rb->lcd_update(); | 402 | rb->lcd_update(); |
414 | 403 | ||
415 | pos = get_section_address(section)/2; | 404 | pos = get_section_address(section)/2; |
@@ -424,9 +413,7 @@ int flash_rockbox(const char *filename, int section) | |||
424 | { | 413 | { |
425 | if (i % SEC_SIZE == 0) | 414 | if (i % SEC_SIZE == 0) |
426 | { | 415 | { |
427 | rb->snprintf(buf, sizeof(buf), "Programming... %d%%", | 416 | rb->lcd_putsf(0, 4, "Programming... %d%%", (i+1)*100/(len/2)); |
428 | (i+1)*100/(len/2)); | ||
429 | rb->lcd_puts(0, 4, buf); | ||
430 | rb->lcd_update(); | 417 | rb->lcd_update(); |
431 | } | 418 | } |
432 | 419 | ||
@@ -434,8 +421,7 @@ int flash_rockbox(const char *filename, int section) | |||
434 | } | 421 | } |
435 | 422 | ||
436 | /* Verify */ | 423 | /* Verify */ |
437 | rb->snprintf(buf, sizeof(buf), "Verifying"); | 424 | rb->lcd_puts(0, 5, "Verifying"); |
438 | rb->lcd_puts(0, 5, buf); | ||
439 | rb->lcd_update(); | 425 | rb->lcd_update(); |
440 | 426 | ||
441 | p8 = (char *)get_section_address(section); | 427 | p8 = (char *)get_section_address(section); |
@@ -560,13 +546,10 @@ int flash_bootloader(const char *filename) | |||
560 | int flash_original_fw(int len) | 546 | int flash_original_fw(int len) |
561 | { | 547 | { |
562 | unsigned char reset_vector[8]; | 548 | unsigned char reset_vector[8]; |
563 | char buf[32]; | ||
564 | int pos, i, rc; | 549 | int pos, i, rc; |
565 | unsigned char *p8; | 550 | unsigned char *p8; |
566 | uint16_t *p16; | 551 | uint16_t *p16; |
567 | 552 | ||
568 | (void)buf; | ||
569 | |||
570 | rb->lcd_puts(0, 3, "Critical section..."); | 553 | rb->lcd_puts(0, 3, "Critical section..."); |
571 | rb->lcd_update(); | 554 | rb->lcd_update(); |
572 | 555 | ||
@@ -586,13 +569,11 @@ int flash_original_fw(int len) | |||
586 | for (i = 1; i < BOOTLOADER_ERASEGUARD && (i-1)*4096 < len; i++) | 569 | for (i = 1; i < BOOTLOADER_ERASEGUARD && (i-1)*4096 < len; i++) |
587 | { | 570 | { |
588 | rc = cfi_erase_sector(FB + (SEC_SIZE/2) * i); | 571 | rc = cfi_erase_sector(FB + (SEC_SIZE/2) * i); |
589 | rb->snprintf(buf, sizeof(buf), "Erase: 0x%03x (%d)", i, rc); | 572 | rb->lcd_putsf(0, 5, "Erase: 0x%03x (%d)", i, rc); |
590 | rb->lcd_puts(0, 5, buf); | ||
591 | rb->lcd_update(); | 573 | rb->lcd_update(); |
592 | } | 574 | } |
593 | 575 | ||
594 | rb->snprintf(buf, sizeof(buf), "Programming"); | 576 | rb->lcd_puts(0, 6, "Programming"); |
595 | rb->lcd_puts(0, 6, buf); | ||
596 | rb->lcd_update(); | 577 | rb->lcd_update(); |
597 | 578 | ||
598 | pos = 0x00000008/2; | 579 | pos = 0x00000008/2; |
@@ -600,8 +581,7 @@ int flash_original_fw(int len) | |||
600 | for (i = 0; i < len/2 && pos + i < (BOOTLOADER_ENTRYPOINT/2); i++) | 581 | for (i = 0; i < len/2 && pos + i < (BOOTLOADER_ENTRYPOINT/2); i++) |
601 | cfi_program_word(FB + pos + i, p16[i]); | 582 | cfi_program_word(FB + pos + i, p16[i]); |
602 | 583 | ||
603 | rb->snprintf(buf, sizeof(buf), "Verifying"); | 584 | rb->lcd_puts(0, 7, "Verifying"); |
604 | rb->lcd_puts(0, 7, buf); | ||
605 | rb->lcd_update(); | 585 | rb->lcd_update(); |
606 | 586 | ||
607 | /* Verify reset vectors. */ | 587 | /* Verify reset vectors. */ |
@@ -623,8 +603,7 @@ int flash_original_fw(int len) | |||
623 | if (p8[i] != audiobuf[i]) | 603 | if (p8[i] != audiobuf[i]) |
624 | { | 604 | { |
625 | rb->splash(HZ*3, "Verify failed!"); | 605 | rb->splash(HZ*3, "Verify failed!"); |
626 | rb->snprintf(buf, sizeof buf, "at: 0x%08x", i); | 606 | rb->splashf(HZ*10, "at: 0x%08x", i); |
627 | rb->splash(HZ*10, buf); | ||
628 | return -5; | 607 | return -5; |
629 | } | 608 | } |
630 | } | 609 | } |