forked from len0rd/rockbox
the plugin half of Lee Marlow's patch: second agument can be the filename of the .ucl to be flashed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3887 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
df67fb2ea3
commit
7d889c87df
1 changed files with 15 additions and 13 deletions
|
@ -41,7 +41,7 @@ static volatile UINT8* FB = (UINT8*)0x02000000; /* Flash base address */
|
|||
|
||||
#define ROCKBOX_DEST 0x09000000
|
||||
#define ROCKBOX_EXEC 0x09000200
|
||||
#define FILENAME "/rockbox.ucl"
|
||||
#define DEFAULT_FILENAME "/rockbox.ucl"
|
||||
#define VERS_ADR 0xFE /* position of firmware version value in Flash */
|
||||
#define UCL_HEADER 26 /* size of the header generated by uclpack */
|
||||
|
||||
|
@ -492,7 +492,7 @@ void ShowFlashInfo(tFlashInfo* pInfo, tImageHeader* pImageHeader)
|
|||
|
||||
|
||||
/* Kind of our main function, defines the application flow. */
|
||||
void DoUserDialog(void)
|
||||
void DoUserDialog(char* filename)
|
||||
{
|
||||
tImageHeader ImageHeader;
|
||||
tFlashInfo FlashInfo;
|
||||
|
@ -520,7 +520,7 @@ void DoUserDialog(void)
|
|||
}
|
||||
|
||||
rb->lcd_puts(0, 3, "using file:");
|
||||
rb->lcd_puts(0, 4, FILENAME);
|
||||
rb->lcd_puts_scroll(0, 4, filename);
|
||||
rb->lcd_puts(0, 6, "[F1] to check file");
|
||||
rb->lcd_puts(0, 7, "other key to exit");
|
||||
rb->lcd_update();
|
||||
|
@ -540,7 +540,7 @@ void DoUserDialog(void)
|
|||
space = FlashInfo.size - (pos-FB + sizeof(ImageHeader));
|
||||
/* size minus start */
|
||||
|
||||
rc = CheckImageFile(FILENAME, space, &ImageHeader);
|
||||
rc = CheckImageFile(filename, space, &ImageHeader);
|
||||
rb->lcd_puts(0, 0, "checked:");
|
||||
switch (rc) {
|
||||
case eOK:
|
||||
|
@ -559,9 +559,8 @@ void DoUserDialog(void)
|
|||
rb->lcd_puts(0, 4, " --10 rockbox.bin");
|
||||
break;
|
||||
case eFileNotFound:
|
||||
rb->lcd_puts(0, 1, "File not found.");
|
||||
rb->lcd_puts(0, 2, "Put this in root:");
|
||||
rb->lcd_puts(0, 4, FILENAME);
|
||||
rb->lcd_puts(0, 1, "File not found:");
|
||||
rb->lcd_puts_scroll(0, 2, filename);
|
||||
break;
|
||||
case eTooBig:
|
||||
rb->lcd_puts(0, 1, "File too big,");
|
||||
|
@ -616,7 +615,7 @@ void DoUserDialog(void)
|
|||
rb->lcd_puts(0, 0, "Programming...");
|
||||
rb->lcd_update();
|
||||
|
||||
rc = ProgramImageFile(FILENAME, pos, &ImageHeader, UCL_HEADER, true_size);
|
||||
rc = ProgramImageFile(filename, pos, &ImageHeader, UCL_HEADER, true_size);
|
||||
if (rc)
|
||||
{ /* errors */
|
||||
rb->lcd_clear_display();
|
||||
|
@ -633,7 +632,7 @@ void DoUserDialog(void)
|
|||
rb->lcd_puts(0, 0, "Verifying...");
|
||||
rb->lcd_update();
|
||||
|
||||
rc = VerifyImageFile(FILENAME, pos, &ImageHeader, UCL_HEADER, true_size);
|
||||
rc = VerifyImageFile(filename, pos, &ImageHeader, UCL_HEADER, true_size);
|
||||
|
||||
rb->lcd_clear_display();
|
||||
if (rc == 0)
|
||||
|
@ -671,19 +670,22 @@ void DoUserDialog(void)
|
|||
|
||||
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||
{
|
||||
char* filename;
|
||||
|
||||
/* this macro should be called as the first thing you do in the plugin.
|
||||
it test that the api version and model the plugin was compiled for
|
||||
matches the machine it is running on */
|
||||
TEST_PLUGIN_API(api);
|
||||
|
||||
/* if you don't use the parameter, you can do like
|
||||
this to avoid the compiler warning about it */
|
||||
(void)parameter;
|
||||
if (parameter == NULL)
|
||||
filename = DEFAULT_FILENAME;
|
||||
else
|
||||
filename = (char*) parameter;
|
||||
|
||||
rb = api; /* copy to global api pointer */
|
||||
|
||||
/* now go ahead and have fun! */
|
||||
DoUserDialog();
|
||||
DoUserDialog(filename);
|
||||
|
||||
return PLUGIN_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue