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_DEST 0x09000000
|
||||||
#define ROCKBOX_EXEC 0x09000200
|
#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 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 */
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ void ShowFlashInfo(tFlashInfo* pInfo, tImageHeader* pImageHeader)
|
||||||
|
|
||||||
|
|
||||||
/* Kind of our main function, defines the application flow. */
|
/* Kind of our main function, defines the application flow. */
|
||||||
void DoUserDialog(void)
|
void DoUserDialog(char* filename)
|
||||||
{
|
{
|
||||||
tImageHeader ImageHeader;
|
tImageHeader ImageHeader;
|
||||||
tFlashInfo FlashInfo;
|
tFlashInfo FlashInfo;
|
||||||
|
@ -520,7 +520,7 @@ void DoUserDialog(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->lcd_puts(0, 3, "using file:");
|
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, 6, "[F1] 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();
|
||||||
|
@ -540,7 +540,7 @@ void DoUserDialog(void)
|
||||||
space = FlashInfo.size - (pos-FB + sizeof(ImageHeader));
|
space = FlashInfo.size - (pos-FB + sizeof(ImageHeader));
|
||||||
/* size minus start */
|
/* size minus start */
|
||||||
|
|
||||||
rc = CheckImageFile(FILENAME, space, &ImageHeader);
|
rc = CheckImageFile(filename, space, &ImageHeader);
|
||||||
rb->lcd_puts(0, 0, "checked:");
|
rb->lcd_puts(0, 0, "checked:");
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
case eOK:
|
case eOK:
|
||||||
|
@ -559,9 +559,8 @@ void DoUserDialog(void)
|
||||||
rb->lcd_puts(0, 4, " --10 rockbox.bin");
|
rb->lcd_puts(0, 4, " --10 rockbox.bin");
|
||||||
break;
|
break;
|
||||||
case eFileNotFound:
|
case eFileNotFound:
|
||||||
rb->lcd_puts(0, 1, "File not found.");
|
rb->lcd_puts(0, 1, "File not found:");
|
||||||
rb->lcd_puts(0, 2, "Put this in root:");
|
rb->lcd_puts_scroll(0, 2, filename);
|
||||||
rb->lcd_puts(0, 4, FILENAME);
|
|
||||||
break;
|
break;
|
||||||
case eTooBig:
|
case eTooBig:
|
||||||
rb->lcd_puts(0, 1, "File too big,");
|
rb->lcd_puts(0, 1, "File too big,");
|
||||||
|
@ -616,7 +615,7 @@ void DoUserDialog(void)
|
||||||
rb->lcd_puts(0, 0, "Programming...");
|
rb->lcd_puts(0, 0, "Programming...");
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
rc = ProgramImageFile(FILENAME, pos, &ImageHeader, UCL_HEADER, true_size);
|
rc = ProgramImageFile(filename, pos, &ImageHeader, UCL_HEADER, true_size);
|
||||||
if (rc)
|
if (rc)
|
||||||
{ /* errors */
|
{ /* errors */
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
|
@ -633,7 +632,7 @@ void DoUserDialog(void)
|
||||||
rb->lcd_puts(0, 0, "Verifying...");
|
rb->lcd_puts(0, 0, "Verifying...");
|
||||||
rb->lcd_update();
|
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();
|
rb->lcd_clear_display();
|
||||||
if (rc == 0)
|
if (rc == 0)
|
||||||
|
@ -671,19 +670,22 @@ void DoUserDialog(void)
|
||||||
|
|
||||||
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
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.
|
/* 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
|
it test that the api version and model the plugin was compiled for
|
||||||
matches the machine it is running on */
|
matches the machine it is running on */
|
||||||
TEST_PLUGIN_API(api);
|
TEST_PLUGIN_API(api);
|
||||||
|
|
||||||
/* if you don't use the parameter, you can do like
|
if (parameter == NULL)
|
||||||
this to avoid the compiler warning about it */
|
filename = DEFAULT_FILENAME;
|
||||||
(void)parameter;
|
else
|
||||||
|
filename = (char*) parameter;
|
||||||
|
|
||||||
rb = api; /* copy to global api pointer */
|
rb = api; /* copy to global api pointer */
|
||||||
|
|
||||||
/* now go ahead and have fun! */
|
/* now go ahead and have fun! */
|
||||||
DoUserDialog();
|
DoUserDialog(filename);
|
||||||
|
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue