forked from len0rd/rockbox
Ondio flash support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5213 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9411db3b4b
commit
6a9e4b4f94
3 changed files with 71 additions and 18 deletions
|
@ -3,6 +3,7 @@ chessclock.c
|
||||||
favorites.c
|
favorites.c
|
||||||
firmware_flash.c
|
firmware_flash.c
|
||||||
helloworld.c
|
helloworld.c
|
||||||
|
rockbox_flash.c
|
||||||
search.c
|
search.c
|
||||||
sort.c
|
sort.c
|
||||||
vbrfix.c
|
vbrfix.c
|
||||||
|
@ -10,7 +11,6 @@ vbrfix.c
|
||||||
/* gradually bring in the ones not working yet */
|
/* gradually bring in the ones not working yet */
|
||||||
battery_test.c
|
battery_test.c
|
||||||
metronome.c
|
metronome.c
|
||||||
rockbox_flash.c
|
|
||||||
stopwatch.c
|
stopwatch.c
|
||||||
viewer.c
|
viewer.c
|
||||||
#endif /* #if CONFIG_KEYPAD != ONDIO_PAD */
|
#endif /* #if CONFIG_KEYPAD != ONDIO_PAD */
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
#define ID_FM 1
|
#define ID_FM 1
|
||||||
#define ID_PLAYER 2
|
#define ID_PLAYER 2
|
||||||
#define ID_REC_V2 3
|
#define ID_REC_V2 3
|
||||||
|
#define ID_ONDIO_FM 4
|
||||||
|
#define ID_ONDIO_SP 5
|
||||||
|
|
||||||
/* Here I have to check for ARCHOS_* defines in source code, which is
|
/* Here I have to check for ARCHOS_* defines in source code, which is
|
||||||
generally strongly discouraged. But here I'm not checking for a certain
|
generally strongly discouraged. But here I'm not checking for a certain
|
||||||
|
@ -63,12 +65,36 @@
|
||||||
#define FILE_TYPE "fm"
|
#define FILE_TYPE "fm"
|
||||||
#define KEEP MASK_ADR /* keep the mask value */
|
#define KEEP MASK_ADR /* keep the mask value */
|
||||||
#define PLATFORM_ID ID_FM
|
#define PLATFORM_ID ID_FM
|
||||||
|
#elif defined(ARCHOS_ONDIOFM)
|
||||||
|
#define FILE_TYPE "ondiofm"
|
||||||
|
#define KEEP MASK_ADR /* keep the mask value */
|
||||||
|
#define PLATFORM_ID ID_ONDIO_FM
|
||||||
|
#elif defined(ARCHOS_ONDIOSP)
|
||||||
|
#define FILE_TYPE "ondiosp"
|
||||||
|
#define KEEP MASK_ADR /* keep the mask value */
|
||||||
|
#define PLATFORM_ID ID_ONDIO_SP
|
||||||
#else
|
#else
|
||||||
#undef PLATFORM_ID /* this platform is not (yet) flashable */
|
#undef PLATFORM_ID /* this platform is not (yet) flashable */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_ID
|
#ifdef PLATFORM_ID
|
||||||
|
|
||||||
|
#if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */
|
||||||
|
#define KEY1 BUTTON_UP
|
||||||
|
#define KEY2 BUTTON_RIGHT
|
||||||
|
#define KEY3 BUTTON_DOWN
|
||||||
|
#define KEYNAME1 "[UP]"
|
||||||
|
#define KEYNAME2 "[RIGHT]"
|
||||||
|
#define KEYNAME3 "[DOWN]"
|
||||||
|
#else /* recorder keypad */
|
||||||
|
#define KEY1 BUTTON_F1
|
||||||
|
#define KEY2 BUTTON_F2
|
||||||
|
#define KEY3 BUTTON_F3
|
||||||
|
#define KEYNAME1 "[F1]"
|
||||||
|
#define KEYNAME2 "[F2]"
|
||||||
|
#define KEYNAME3 "[F3]"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* result of the CheckFirmwareFile() function */
|
/* result of the CheckFirmwareFile() function */
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -284,8 +310,9 @@ bool CheckPlatform(int platform_id, UINT16 version)
|
||||||
return (platform_id == ID_FM || platform_id == ID_REC_V2);
|
return (platform_id == ID_FM || platform_id == ID_REC_V2);
|
||||||
}
|
}
|
||||||
else if (version == 132)
|
else if (version == 132)
|
||||||
{ /* seen on a V2 recorder */
|
{ /* Ondio, and seen on a V2 recorder */
|
||||||
return (platform_id == ID_REC_V2);
|
return (platform_id == ID_ONDIO_SP || platform_id == ID_ONDIO_FM
|
||||||
|
|| platform_id == ID_REC_V2);
|
||||||
}
|
}
|
||||||
else if (version >= 115 && version <= 129)
|
else if (version >= 115 && version <= 129)
|
||||||
{ /* the range of Recorders seen so far */
|
{ /* the range of Recorders seen so far */
|
||||||
|
@ -385,7 +412,7 @@ tCheckResult CheckFirmwareFile(char* filename, int chipsize, bool is_romless)
|
||||||
return eBadContent;
|
return eBadContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0x30; i<MASK_ADR-1; i++) /* leave one byte for me */
|
for (i = 0x30; i<MASK_ADR-2; i++) /* leave two bytes for me */
|
||||||
{
|
{
|
||||||
if (sector[i] != FB[i])
|
if (sector[i] != FB[i])
|
||||||
{
|
{
|
||||||
|
@ -661,12 +688,12 @@ void DoUserDialog(char* filename)
|
||||||
|
|
||||||
rb->lcd_puts(0, 3, "using file:");
|
rb->lcd_puts(0, 3, "using file:");
|
||||||
rb->lcd_puts_scroll(0, 4, filename);
|
rb->lcd_puts_scroll(0, 4, filename);
|
||||||
rb->lcd_puts(0, 6, "[F1] to check file");
|
rb->lcd_puts(0, 6, KEYNAME1 " to check file");
|
||||||
rb->lcd_puts(0, 7, "other key to exit");
|
rb->lcd_puts(0, 7, "other key to exit");
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
button = WaitForButton();
|
button = WaitForButton();
|
||||||
if (button != BUTTON_F1)
|
if (button != KEY1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +745,7 @@ void DoUserDialog(char* filename)
|
||||||
|
|
||||||
if (rc == eOK)
|
if (rc == eOK)
|
||||||
{
|
{
|
||||||
rb->lcd_puts(0, 6, "[F2] to program");
|
rb->lcd_puts(0, 6, KEYNAME2 " to program");
|
||||||
rb->lcd_puts(0, 7, "other key to exit");
|
rb->lcd_puts(0, 7, "other key to exit");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -729,7 +756,7 @@ void DoUserDialog(char* filename)
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
button = WaitForButton();
|
button = WaitForButton();
|
||||||
if (button != BUTTON_F2 || rc != eOK)
|
if (button != KEY2 || rc != eOK)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -741,12 +768,12 @@ void DoUserDialog(char* filename)
|
||||||
rb->lcd_puts(0, 3, "it kills your box!");
|
rb->lcd_puts(0, 3, "it kills your box!");
|
||||||
rb->lcd_puts(0, 4, "See documentation.");
|
rb->lcd_puts(0, 4, "See documentation.");
|
||||||
|
|
||||||
rb->lcd_puts(0, 6, "[F3] to proceed");
|
rb->lcd_puts(0, 6, KEYNAME3 " to proceed");
|
||||||
rb->lcd_puts(0, 7, "other key to exit");
|
rb->lcd_puts(0, 7, "other key to exit");
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
button = WaitForButton();
|
button = WaitForButton();
|
||||||
if (button != BUTTON_F3)
|
if (button != KEY3)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
/* define DUMMY if you only want to "play" with the UI, does no harm */
|
/* define DUMMY if you only want to "play" with the UI, does no harm */
|
||||||
/* #define DUMMY */
|
/* #define DUMMY */
|
||||||
|
|
||||||
|
#define LATEST_BOOTLOADER_VERSION 1 /* update this with the bootloader */
|
||||||
|
|
||||||
#ifndef UINT8
|
#ifndef UINT8
|
||||||
#define UINT8 unsigned char
|
#define UINT8 unsigned char
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,9 +47,24 @@ static volatile UINT8* FB = (UINT8*)0x02000000; /* Flash base address */
|
||||||
#define ROCKBOX_DEST 0x09000000
|
#define ROCKBOX_DEST 0x09000000
|
||||||
#define ROCKBOX_EXEC 0x09000200
|
#define ROCKBOX_EXEC 0x09000200
|
||||||
#define DEFAULT_FILENAME "/rockbox.ucl"
|
#define DEFAULT_FILENAME "/rockbox.ucl"
|
||||||
#define VERS_ADR 0xFE /* position of firmware version value in Flash */
|
#define BOOT_VERS_ADR 0xFA /* position of bootloader version value in Flash */
|
||||||
|
#define FW_VERS_ADR 0xFE /* position of firmware version value in Flash */
|
||||||
#define UCL_HEADER 26 /* size of the header generated by uclpack */
|
#define UCL_HEADER 26 /* size of the header generated by uclpack */
|
||||||
|
|
||||||
|
#if CONFIG_KEYPAD == ONDIO_PAD /* limited keypad */
|
||||||
|
#define KEY1 BUTTON_UP
|
||||||
|
#define KEY2 BUTTON_RIGHT
|
||||||
|
#define KEY3 BUTTON_DOWN
|
||||||
|
#define KEYNAME1 "UP"
|
||||||
|
#define KEYNAME2 "RIGHT"
|
||||||
|
#else /* recorder keypad */
|
||||||
|
#define KEY1 BUTTON_F1
|
||||||
|
#define KEY2 BUTTON_F2
|
||||||
|
#define KEY3 BUTTON_F3
|
||||||
|
#define KEYNAME1 "F1"
|
||||||
|
#define KEYNAME2 "F2"
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT32 destination; /* address to copy it to */
|
UINT32 destination; /* address to copy it to */
|
||||||
|
@ -301,6 +318,15 @@ unsigned CheckBootloader(void)
|
||||||
{
|
{
|
||||||
unsigned crc;
|
unsigned crc;
|
||||||
UINT32* pFlash = (UINT32*)FB;
|
UINT32* pFlash = (UINT32*)FB;
|
||||||
|
int bootloader_version = FB[BOOT_VERS_ADR];
|
||||||
|
|
||||||
|
if (bootloader_version) /* this is a newer image, with a version number */
|
||||||
|
{
|
||||||
|
if (bootloader_version < LATEST_BOOTLOADER_VERSION)
|
||||||
|
return bootloader_version;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* checksum the bootloader, unfortunately I have no version info yet */
|
/* checksum the bootloader, unfortunately I have no version info yet */
|
||||||
crc = crc_32((unsigned char*)pFlash[2], pFlash[3], -1);
|
crc = crc_32((unsigned char*)pFlash[2], pFlash[3], -1);
|
||||||
|
@ -638,7 +664,7 @@ void DoUserDialog(char* filename, bool show_greet)
|
||||||
crc = CheckBootloader();
|
crc = CheckBootloader();
|
||||||
if (crc) /* outdated version found */
|
if (crc) /* outdated version found */
|
||||||
{
|
{
|
||||||
rb->snprintf(buf, sizeof(buf), " (CRC=0x%08x) ", crc);
|
rb->snprintf(buf, sizeof(buf), "(check=0x%08x)", crc);
|
||||||
rb->lcd_puts(0, 0, buf);
|
rb->lcd_puts(0, 0, buf);
|
||||||
rb->lcd_puts(0, 1, "Hint: You're not ");
|
rb->lcd_puts(0, 1, "Hint: You're not ");
|
||||||
rb->lcd_puts(0, 2, "using the latest ");
|
rb->lcd_puts(0, 2, "using the latest ");
|
||||||
|
@ -646,10 +672,10 @@ void DoUserDialog(char* filename, bool show_greet)
|
||||||
rb->lcd_puts(0, 4, "A full reflash is ");
|
rb->lcd_puts(0, 4, "A full reflash is ");
|
||||||
rb->lcd_puts(0, 5, "recommended, but ");
|
rb->lcd_puts(0, 5, "recommended, but ");
|
||||||
rb->lcd_puts(0, 6, "not required. ");
|
rb->lcd_puts(0, 6, "not required. ");
|
||||||
rb->lcd_puts(0, 7, "Press F1 to ignore");
|
rb->lcd_puts(0, 7, "Press " KEYNAME1 " to ignore");
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
if (WaitForButton() != BUTTON_F1)
|
if (WaitForButton() != KEY1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -660,11 +686,11 @@ void DoUserDialog(char* filename, bool show_greet)
|
||||||
{
|
{
|
||||||
rb->lcd_puts(0, 3, "using file:");
|
rb->lcd_puts(0, 3, "using file:");
|
||||||
rb->lcd_puts_scroll(0, 4, filename);
|
rb->lcd_puts_scroll(0, 4, filename);
|
||||||
rb->lcd_puts(0, 6, "[F1] to check file");
|
rb->lcd_puts(0, 6, "[" KEYNAME1 "] to check file");
|
||||||
rb->lcd_puts(0, 7, "other key to exit");
|
rb->lcd_puts(0, 7, "other key to exit");
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
if (WaitForButton() != BUTTON_F1)
|
if (WaitForButton() != KEY1)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -728,7 +754,7 @@ void DoUserDialog(char* filename, bool show_greet)
|
||||||
|
|
||||||
if (rc == eOK)
|
if (rc == eOK)
|
||||||
{ /* was OK */
|
{ /* was OK */
|
||||||
rb->lcd_puts(0, 6, "[F2] to program");
|
rb->lcd_puts(0, 6, "[" KEYNAME2 "] to program");
|
||||||
rb->lcd_puts(0, 7, "other key to exit");
|
rb->lcd_puts(0, 7, "other key to exit");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -738,7 +764,7 @@ void DoUserDialog(char* filename, bool show_greet)
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
button = WaitForButton();
|
button = WaitForButton();
|
||||||
if (rc != eOK || button != BUTTON_F2)
|
if (rc != eOK || button != KEY2)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue