1
0
Fork 0
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:
Jörg Hohensohn 2004-10-07 17:16:27 +00:00
parent 9411db3b4b
commit 6a9e4b4f94
3 changed files with 71 additions and 18 deletions

View file

@ -26,6 +26,8 @@
/* define DUMMY if you only want to "play" with the UI, does no harm */
/* #define DUMMY */
#define LATEST_BOOTLOADER_VERSION 1 /* update this with the bootloader */
#ifndef UINT8
#define UINT8 unsigned char
#endif
@ -45,9 +47,24 @@ static volatile UINT8* FB = (UINT8*)0x02000000; /* Flash base address */
#define ROCKBOX_DEST 0x09000000
#define ROCKBOX_EXEC 0x09000200
#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 */
#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
{
UINT32 destination; /* address to copy it to */
@ -301,6 +318,15 @@ unsigned CheckBootloader(void)
{
unsigned crc;
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 */
crc = crc_32((unsigned char*)pFlash[2], pFlash[3], -1);
@ -638,7 +664,7 @@ void DoUserDialog(char* filename, bool show_greet)
crc = CheckBootloader();
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, 1, "Hint: You're not ");
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, 5, "recommended, but ");
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();
if (WaitForButton() != BUTTON_F1)
if (WaitForButton() != KEY1)
{
return;
}
@ -660,11 +686,11 @@ void DoUserDialog(char* filename, bool show_greet)
{
rb->lcd_puts(0, 3, "using file:");
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_update();
if (WaitForButton() != BUTTON_F1)
if (WaitForButton() != KEY1)
{
return;
}
@ -728,7 +754,7 @@ void DoUserDialog(char* filename, bool show_greet)
if (rc == eOK)
{ /* 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");
}
else
@ -738,7 +764,7 @@ void DoUserDialog(char* filename, bool show_greet)
rb->lcd_update();
button = WaitForButton();
if (rc != eOK || button != BUTTON_F2)
if (rc != eOK || button != KEY2)
{
return;
}