diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-10-07 17:16:27 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2004-10-07 17:16:27 +0000 |
commit | 6a9e4b4f94a7fcf59c7d04fcc2582ddaacc0f14a (patch) | |
tree | 7272181d3e38d1f4d57c64c1e9c2cb5b5667b3cf | |
parent | 9411db3b4bfe9ecfcbef3b736ceecd87040887ad (diff) | |
download | rockbox-6a9e4b4f94a7fcf59c7d04fcc2582ddaacc0f14a.tar.gz rockbox-6a9e4b4f94a7fcf59c7d04fcc2582ddaacc0f14a.zip |
Ondio flash support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5213 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/firmware_flash.c | 45 | ||||
-rw-r--r-- | apps/plugins/rockbox_flash.c | 42 |
3 files changed, 71 insertions, 18 deletions
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 6db328b5a4..2baaa6ba55 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES | |||
@@ -3,6 +3,7 @@ chessclock.c | |||
3 | favorites.c | 3 | favorites.c |
4 | firmware_flash.c | 4 | firmware_flash.c |
5 | helloworld.c | 5 | helloworld.c |
6 | rockbox_flash.c | ||
6 | search.c | 7 | search.c |
7 | sort.c | 8 | sort.c |
8 | vbrfix.c | 9 | vbrfix.c |
@@ -10,7 +11,6 @@ vbrfix.c | |||
10 | /* gradually bring in the ones not working yet */ | 11 | /* gradually bring in the ones not working yet */ |
11 | battery_test.c | 12 | battery_test.c |
12 | metronome.c | 13 | metronome.c |
13 | rockbox_flash.c | ||
14 | stopwatch.c | 14 | stopwatch.c |
15 | viewer.c | 15 | viewer.c |
16 | #endif /* #if CONFIG_KEYPAD != ONDIO_PAD */ | 16 | #endif /* #if CONFIG_KEYPAD != ONDIO_PAD */ |
diff --git a/apps/plugins/firmware_flash.c b/apps/plugins/firmware_flash.c index 751284aed1..2a90d33aa6 100644 --- a/apps/plugins/firmware_flash.c +++ b/apps/plugins/firmware_flash.c | |||
@@ -43,6 +43,8 @@ | |||
43 | #define ID_FM 1 | 43 | #define ID_FM 1 |
44 | #define ID_PLAYER 2 | 44 | #define ID_PLAYER 2 |
45 | #define ID_REC_V2 3 | 45 | #define ID_REC_V2 3 |
46 | #define ID_ONDIO_FM 4 | ||
47 | #define ID_ONDIO_SP 5 | ||
46 | 48 | ||
47 | /* Here I have to check for ARCHOS_* defines in source code, which is | 49 | /* Here I have to check for ARCHOS_* defines in source code, which is |
48 | generally strongly discouraged. But here I'm not checking for a certain | 50 | generally strongly discouraged. But here I'm not checking for a certain |
@@ -63,12 +65,36 @@ | |||
63 | #define FILE_TYPE "fm" | 65 | #define FILE_TYPE "fm" |
64 | #define KEEP MASK_ADR /* keep the mask value */ | 66 | #define KEEP MASK_ADR /* keep the mask value */ |
65 | #define PLATFORM_ID ID_FM | 67 | #define PLATFORM_ID ID_FM |
68 | #elif defined(ARCHOS_ONDIOFM) | ||
69 | #define FILE_TYPE "ondiofm" | ||
70 | #define KEEP MASK_ADR /* keep the mask value */ | ||
71 | #define PLATFORM_ID ID_ONDIO_FM | ||
72 | #elif defined(ARCHOS_ONDIOSP) | ||
73 | #define FILE_TYPE "ondiosp" | ||
74 | #define KEEP MASK_ADR /* keep the mask value */ | ||
75 | #define PLATFORM_ID ID_ONDIO_SP | ||
66 | #else | 76 | #else |
67 | #undef PLATFORM_ID /* this platform is not (yet) flashable */ | 77 | #undef PLATFORM_ID /* this platform is not (yet) flashable */ |
68 | #endif | 78 | #endif |
69 | 79 | ||
70 | #ifdef PLATFORM_ID | 80 | #ifdef PLATFORM_ID |
71 | 81 | ||
82 | #if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */ | ||
83 | #define KEY1 BUTTON_UP | ||
84 | #define KEY2 BUTTON_RIGHT | ||
85 | #define KEY3 BUTTON_DOWN | ||
86 | #define KEYNAME1 "[UP]" | ||
87 | #define KEYNAME2 "[RIGHT]" | ||
88 | #define KEYNAME3 "[DOWN]" | ||
89 | #else /* recorder keypad */ | ||
90 | #define KEY1 BUTTON_F1 | ||
91 | #define KEY2 BUTTON_F2 | ||
92 | #define KEY3 BUTTON_F3 | ||
93 | #define KEYNAME1 "[F1]" | ||
94 | #define KEYNAME2 "[F2]" | ||
95 | #define KEYNAME3 "[F3]" | ||
96 | #endif | ||
97 | |||
72 | /* result of the CheckFirmwareFile() function */ | 98 | /* result of the CheckFirmwareFile() function */ |
73 | typedef enum | 99 | typedef enum |
74 | { | 100 | { |
@@ -284,8 +310,9 @@ bool CheckPlatform(int platform_id, UINT16 version) | |||
284 | return (platform_id == ID_FM || platform_id == ID_REC_V2); | 310 | return (platform_id == ID_FM || platform_id == ID_REC_V2); |
285 | } | 311 | } |
286 | else if (version == 132) | 312 | else if (version == 132) |
287 | { /* seen on a V2 recorder */ | 313 | { /* Ondio, and seen on a V2 recorder */ |
288 | return (platform_id == ID_REC_V2); | 314 | return (platform_id == ID_ONDIO_SP || platform_id == ID_ONDIO_FM |
315 | || platform_id == ID_REC_V2); | ||
289 | } | 316 | } |
290 | else if (version >= 115 && version <= 129) | 317 | else if (version >= 115 && version <= 129) |
291 | { /* the range of Recorders seen so far */ | 318 | { /* the range of Recorders seen so far */ |
@@ -385,7 +412,7 @@ tCheckResult CheckFirmwareFile(char* filename, int chipsize, bool is_romless) | |||
385 | return eBadContent; | 412 | return eBadContent; |
386 | } | 413 | } |
387 | 414 | ||
388 | for (i = 0x30; i<MASK_ADR-1; i++) /* leave one byte for me */ | 415 | for (i = 0x30; i<MASK_ADR-2; i++) /* leave two bytes for me */ |
389 | { | 416 | { |
390 | if (sector[i] != FB[i]) | 417 | if (sector[i] != FB[i]) |
391 | { | 418 | { |
@@ -661,12 +688,12 @@ void DoUserDialog(char* filename) | |||
661 | 688 | ||
662 | rb->lcd_puts(0, 3, "using file:"); | 689 | rb->lcd_puts(0, 3, "using file:"); |
663 | rb->lcd_puts_scroll(0, 4, filename); | 690 | rb->lcd_puts_scroll(0, 4, filename); |
664 | rb->lcd_puts(0, 6, "[F1] to check file"); | 691 | rb->lcd_puts(0, 6, KEYNAME1 " to check file"); |
665 | rb->lcd_puts(0, 7, "other key to exit"); | 692 | rb->lcd_puts(0, 7, "other key to exit"); |
666 | rb->lcd_update(); | 693 | rb->lcd_update(); |
667 | 694 | ||
668 | button = WaitForButton(); | 695 | button = WaitForButton(); |
669 | if (button != BUTTON_F1) | 696 | if (button != KEY1) |
670 | { | 697 | { |
671 | return; | 698 | return; |
672 | } | 699 | } |
@@ -718,7 +745,7 @@ void DoUserDialog(char* filename) | |||
718 | 745 | ||
719 | if (rc == eOK) | 746 | if (rc == eOK) |
720 | { | 747 | { |
721 | rb->lcd_puts(0, 6, "[F2] to program"); | 748 | rb->lcd_puts(0, 6, KEYNAME2 " to program"); |
722 | rb->lcd_puts(0, 7, "other key to exit"); | 749 | rb->lcd_puts(0, 7, "other key to exit"); |
723 | } | 750 | } |
724 | else | 751 | else |
@@ -729,7 +756,7 @@ void DoUserDialog(char* filename) | |||
729 | rb->lcd_update(); | 756 | rb->lcd_update(); |
730 | 757 | ||
731 | button = WaitForButton(); | 758 | button = WaitForButton(); |
732 | if (button != BUTTON_F2 || rc != eOK) | 759 | if (button != KEY2 || rc != eOK) |
733 | { | 760 | { |
734 | return; | 761 | return; |
735 | } | 762 | } |
@@ -741,12 +768,12 @@ void DoUserDialog(char* filename) | |||
741 | rb->lcd_puts(0, 3, "it kills your box!"); | 768 | rb->lcd_puts(0, 3, "it kills your box!"); |
742 | rb->lcd_puts(0, 4, "See documentation."); | 769 | rb->lcd_puts(0, 4, "See documentation."); |
743 | 770 | ||
744 | rb->lcd_puts(0, 6, "[F3] to proceed"); | 771 | rb->lcd_puts(0, 6, KEYNAME3 " to proceed"); |
745 | rb->lcd_puts(0, 7, "other key to exit"); | 772 | rb->lcd_puts(0, 7, "other key to exit"); |
746 | rb->lcd_update(); | 773 | rb->lcd_update(); |
747 | 774 | ||
748 | button = WaitForButton(); | 775 | button = WaitForButton(); |
749 | if (button != BUTTON_F3) | 776 | if (button != KEY3) |
750 | { | 777 | { |
751 | return; | 778 | return; |
752 | } | 779 | } |
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c index e393f20058..37e4458b8b 100644 --- a/apps/plugins/rockbox_flash.c +++ b/apps/plugins/rockbox_flash.c | |||
@@ -26,6 +26,8 @@ | |||
26 | /* define DUMMY if you only want to "play" with the UI, does no harm */ | 26 | /* define DUMMY if you only want to "play" with the UI, does no harm */ |
27 | /* #define DUMMY */ | 27 | /* #define DUMMY */ |
28 | 28 | ||
29 | #define LATEST_BOOTLOADER_VERSION 1 /* update this with the bootloader */ | ||
30 | |||
29 | #ifndef UINT8 | 31 | #ifndef UINT8 |
30 | #define UINT8 unsigned char | 32 | #define UINT8 unsigned char |
31 | #endif | 33 | #endif |
@@ -45,9 +47,24 @@ static volatile UINT8* FB = (UINT8*)0x02000000; /* Flash base address */ | |||
45 | #define ROCKBOX_DEST 0x09000000 | 47 | #define ROCKBOX_DEST 0x09000000 |
46 | #define ROCKBOX_EXEC 0x09000200 | 48 | #define ROCKBOX_EXEC 0x09000200 |
47 | #define DEFAULT_FILENAME "/rockbox.ucl" | 49 | #define DEFAULT_FILENAME "/rockbox.ucl" |
48 | #define VERS_ADR 0xFE /* position of firmware version value in Flash */ | 50 | #define BOOT_VERS_ADR 0xFA /* position of bootloader version value in Flash */ |
51 | #define FW_VERS_ADR 0xFE /* position of firmware version value in Flash */ | ||
49 | #define UCL_HEADER 26 /* size of the header generated by uclpack */ | 52 | #define UCL_HEADER 26 /* size of the header generated by uclpack */ |
50 | 53 | ||
54 | #if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */ | ||
55 | #define KEY1 BUTTON_UP | ||
56 | #define KEY2 BUTTON_RIGHT | ||
57 | #define KEY3 BUTTON_DOWN | ||
58 | #define KEYNAME1 "UP" | ||
59 | #define KEYNAME2 "RIGHT" | ||
60 | #else /* recorder keypad */ | ||
61 | #define KEY1 BUTTON_F1 | ||
62 | #define KEY2 BUTTON_F2 | ||
63 | #define KEY3 BUTTON_F3 | ||
64 | #define KEYNAME1 "F1" | ||
65 | #define KEYNAME2 "F2" | ||
66 | #endif | ||
67 | |||
51 | typedef struct | 68 | typedef struct |
52 | { | 69 | { |
53 | UINT32 destination; /* address to copy it to */ | 70 | UINT32 destination; /* address to copy it to */ |
@@ -301,6 +318,15 @@ unsigned CheckBootloader(void) | |||
301 | { | 318 | { |
302 | unsigned crc; | 319 | unsigned crc; |
303 | UINT32* pFlash = (UINT32*)FB; | 320 | UINT32* pFlash = (UINT32*)FB; |
321 | int bootloader_version = FB[BOOT_VERS_ADR]; | ||
322 | |||
323 | if (bootloader_version) /* this is a newer image, with a version number */ | ||
324 | { | ||
325 | if (bootloader_version < LATEST_BOOTLOADER_VERSION) | ||
326 | return bootloader_version; | ||
327 | else | ||
328 | return 0; | ||
329 | } | ||
304 | 330 | ||
305 | /* checksum the bootloader, unfortunately I have no version info yet */ | 331 | /* checksum the bootloader, unfortunately I have no version info yet */ |
306 | crc = crc_32((unsigned char*)pFlash[2], pFlash[3], -1); | 332 | crc = crc_32((unsigned char*)pFlash[2], pFlash[3], -1); |
@@ -638,7 +664,7 @@ void DoUserDialog(char* filename, bool show_greet) | |||
638 | crc = CheckBootloader(); | 664 | crc = CheckBootloader(); |
639 | if (crc) /* outdated version found */ | 665 | if (crc) /* outdated version found */ |
640 | { | 666 | { |
641 | rb->snprintf(buf, sizeof(buf), " (CRC=0x%08x) ", crc); | 667 | rb->snprintf(buf, sizeof(buf), "(check=0x%08x)", crc); |
642 | rb->lcd_puts(0, 0, buf); | 668 | rb->lcd_puts(0, 0, buf); |
643 | rb->lcd_puts(0, 1, "Hint: You're not "); | 669 | rb->lcd_puts(0, 1, "Hint: You're not "); |
644 | rb->lcd_puts(0, 2, "using the latest "); | 670 | rb->lcd_puts(0, 2, "using the latest "); |
@@ -646,10 +672,10 @@ void DoUserDialog(char* filename, bool show_greet) | |||
646 | rb->lcd_puts(0, 4, "A full reflash is "); | 672 | rb->lcd_puts(0, 4, "A full reflash is "); |
647 | rb->lcd_puts(0, 5, "recommended, but "); | 673 | rb->lcd_puts(0, 5, "recommended, but "); |
648 | rb->lcd_puts(0, 6, "not required. "); | 674 | rb->lcd_puts(0, 6, "not required. "); |
649 | rb->lcd_puts(0, 7, "Press F1 to ignore"); | 675 | rb->lcd_puts(0, 7, "Press " KEYNAME1 " to ignore"); |
650 | rb->lcd_update(); | 676 | rb->lcd_update(); |
651 | 677 | ||
652 | if (WaitForButton() != BUTTON_F1) | 678 | if (WaitForButton() != KEY1) |
653 | { | 679 | { |
654 | return; | 680 | return; |
655 | } | 681 | } |
@@ -660,11 +686,11 @@ void DoUserDialog(char* filename, bool show_greet) | |||
660 | { | 686 | { |
661 | rb->lcd_puts(0, 3, "using file:"); | 687 | rb->lcd_puts(0, 3, "using file:"); |
662 | rb->lcd_puts_scroll(0, 4, filename); | 688 | rb->lcd_puts_scroll(0, 4, filename); |
663 | rb->lcd_puts(0, 6, "[F1] to check file"); | 689 | rb->lcd_puts(0, 6, "[" KEYNAME1 "] to check file"); |
664 | rb->lcd_puts(0, 7, "other key to exit"); | 690 | rb->lcd_puts(0, 7, "other key to exit"); |
665 | rb->lcd_update(); | 691 | rb->lcd_update(); |
666 | 692 | ||
667 | if (WaitForButton() != BUTTON_F1) | 693 | if (WaitForButton() != KEY1) |
668 | { | 694 | { |
669 | return; | 695 | return; |
670 | } | 696 | } |
@@ -728,7 +754,7 @@ void DoUserDialog(char* filename, bool show_greet) | |||
728 | 754 | ||
729 | if (rc == eOK) | 755 | if (rc == eOK) |
730 | { /* was OK */ | 756 | { /* was OK */ |
731 | rb->lcd_puts(0, 6, "[F2] to program"); | 757 | rb->lcd_puts(0, 6, "[" KEYNAME2 "] to program"); |
732 | rb->lcd_puts(0, 7, "other key to exit"); | 758 | rb->lcd_puts(0, 7, "other key to exit"); |
733 | } | 759 | } |
734 | else | 760 | else |
@@ -738,7 +764,7 @@ void DoUserDialog(char* filename, bool show_greet) | |||
738 | rb->lcd_update(); | 764 | rb->lcd_update(); |
739 | 765 | ||
740 | button = WaitForButton(); | 766 | button = WaitForButton(); |
741 | if (rc != eOK || button != BUTTON_F2) | 767 | if (rc != eOK || button != KEY2) |
742 | { | 768 | { |
743 | return; | 769 | return; |
744 | } | 770 | } |