diff options
author | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-07-25 17:34:42 +0000 |
---|---|---|
committer | Jörg Hohensohn <hohensoh@rockbox.org> | 2003-07-25 17:34:42 +0000 |
commit | 7d889c87df474e683ad69d063375c3c9286e36ec (patch) | |
tree | d701018246e81e9e31b67c2bec113172a9a6564f /apps/plugins | |
parent | df67fb2ea34a327fe79d1c0fc88cf0e2203aa949 (diff) | |
download | rockbox-7d889c87df474e683ad69d063375c3c9286e36ec.tar.gz rockbox-7d889c87df474e683ad69d063375c3c9286e36ec.zip |
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
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/rockbox_flash.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c index 1fb8ce5bcc..67e0753503 100644 --- a/apps/plugins/rockbox_flash.c +++ b/apps/plugins/rockbox_flash.c | |||
@@ -41,7 +41,7 @@ static volatile UINT8* FB = (UINT8*)0x02000000; /* Flash base address */ | |||
41 | 41 | ||
42 | #define ROCKBOX_DEST 0x09000000 | 42 | #define ROCKBOX_DEST 0x09000000 |
43 | #define ROCKBOX_EXEC 0x09000200 | 43 | #define ROCKBOX_EXEC 0x09000200 |
44 | #define FILENAME "/rockbox.ucl" | 44 | #define DEFAULT_FILENAME "/rockbox.ucl" |
45 | #define VERS_ADR 0xFE /* position of firmware version value in Flash */ | 45 | #define VERS_ADR 0xFE /* position of firmware version value in Flash */ |
46 | #define UCL_HEADER 26 /* size of the header generated by uclpack */ | 46 | #define UCL_HEADER 26 /* size of the header generated by uclpack */ |
47 | 47 | ||
@@ -492,7 +492,7 @@ void ShowFlashInfo(tFlashInfo* pInfo, tImageHeader* pImageHeader) | |||
492 | 492 | ||
493 | 493 | ||
494 | /* Kind of our main function, defines the application flow. */ | 494 | /* Kind of our main function, defines the application flow. */ |
495 | void DoUserDialog(void) | 495 | void DoUserDialog(char* filename) |
496 | { | 496 | { |
497 | tImageHeader ImageHeader; | 497 | tImageHeader ImageHeader; |
498 | tFlashInfo FlashInfo; | 498 | tFlashInfo FlashInfo; |
@@ -520,7 +520,7 @@ void DoUserDialog(void) | |||
520 | } | 520 | } |
521 | 521 | ||
522 | rb->lcd_puts(0, 3, "using file:"); | 522 | rb->lcd_puts(0, 3, "using file:"); |
523 | rb->lcd_puts(0, 4, FILENAME); | 523 | rb->lcd_puts_scroll(0, 4, filename); |
524 | rb->lcd_puts(0, 6, "[F1] to check file"); | 524 | rb->lcd_puts(0, 6, "[F1] to check file"); |
525 | rb->lcd_puts(0, 7, "other key to exit"); | 525 | rb->lcd_puts(0, 7, "other key to exit"); |
526 | rb->lcd_update(); | 526 | rb->lcd_update(); |
@@ -540,7 +540,7 @@ void DoUserDialog(void) | |||
540 | space = FlashInfo.size - (pos-FB + sizeof(ImageHeader)); | 540 | space = FlashInfo.size - (pos-FB + sizeof(ImageHeader)); |
541 | /* size minus start */ | 541 | /* size minus start */ |
542 | 542 | ||
543 | rc = CheckImageFile(FILENAME, space, &ImageHeader); | 543 | rc = CheckImageFile(filename, space, &ImageHeader); |
544 | rb->lcd_puts(0, 0, "checked:"); | 544 | rb->lcd_puts(0, 0, "checked:"); |
545 | switch (rc) { | 545 | switch (rc) { |
546 | case eOK: | 546 | case eOK: |
@@ -559,9 +559,8 @@ void DoUserDialog(void) | |||
559 | rb->lcd_puts(0, 4, " --10 rockbox.bin"); | 559 | rb->lcd_puts(0, 4, " --10 rockbox.bin"); |
560 | break; | 560 | break; |
561 | case eFileNotFound: | 561 | case eFileNotFound: |
562 | rb->lcd_puts(0, 1, "File not found."); | 562 | rb->lcd_puts(0, 1, "File not found:"); |
563 | rb->lcd_puts(0, 2, "Put this in root:"); | 563 | rb->lcd_puts_scroll(0, 2, filename); |
564 | rb->lcd_puts(0, 4, FILENAME); | ||
565 | break; | 564 | break; |
566 | case eTooBig: | 565 | case eTooBig: |
567 | rb->lcd_puts(0, 1, "File too big,"); | 566 | rb->lcd_puts(0, 1, "File too big,"); |
@@ -616,7 +615,7 @@ void DoUserDialog(void) | |||
616 | rb->lcd_puts(0, 0, "Programming..."); | 615 | rb->lcd_puts(0, 0, "Programming..."); |
617 | rb->lcd_update(); | 616 | rb->lcd_update(); |
618 | 617 | ||
619 | rc = ProgramImageFile(FILENAME, pos, &ImageHeader, UCL_HEADER, true_size); | 618 | rc = ProgramImageFile(filename, pos, &ImageHeader, UCL_HEADER, true_size); |
620 | if (rc) | 619 | if (rc) |
621 | { /* errors */ | 620 | { /* errors */ |
622 | rb->lcd_clear_display(); | 621 | rb->lcd_clear_display(); |
@@ -633,7 +632,7 @@ void DoUserDialog(void) | |||
633 | rb->lcd_puts(0, 0, "Verifying..."); | 632 | rb->lcd_puts(0, 0, "Verifying..."); |
634 | rb->lcd_update(); | 633 | rb->lcd_update(); |
635 | 634 | ||
636 | rc = VerifyImageFile(FILENAME, pos, &ImageHeader, UCL_HEADER, true_size); | 635 | rc = VerifyImageFile(filename, pos, &ImageHeader, UCL_HEADER, true_size); |
637 | 636 | ||
638 | rb->lcd_clear_display(); | 637 | rb->lcd_clear_display(); |
639 | if (rc == 0) | 638 | if (rc == 0) |
@@ -671,19 +670,22 @@ void DoUserDialog(void) | |||
671 | 670 | ||
672 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 671 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
673 | { | 672 | { |
673 | char* filename; | ||
674 | |||
674 | /* this macro should be called as the first thing you do in the plugin. | 675 | /* this macro should be called as the first thing you do in the plugin. |
675 | it test that the api version and model the plugin was compiled for | 676 | it test that the api version and model the plugin was compiled for |
676 | matches the machine it is running on */ | 677 | matches the machine it is running on */ |
677 | TEST_PLUGIN_API(api); | 678 | TEST_PLUGIN_API(api); |
678 | 679 | ||
679 | /* if you don't use the parameter, you can do like | 680 | if (parameter == NULL) |
680 | this to avoid the compiler warning about it */ | 681 | filename = DEFAULT_FILENAME; |
681 | (void)parameter; | 682 | else |
683 | filename = (char*) parameter; | ||
682 | 684 | ||
683 | rb = api; /* copy to global api pointer */ | 685 | rb = api; /* copy to global api pointer */ |
684 | 686 | ||
685 | /* now go ahead and have fun! */ | 687 | /* now go ahead and have fun! */ |
686 | DoUserDialog(); | 688 | DoUserDialog(filename); |
687 | 689 | ||
688 | return PLUGIN_OK; | 690 | return PLUGIN_OK; |
689 | } | 691 | } |