Advertising
- Mine
- Thursday, July 26th, 2007 at 5:25:26am MDT
- Index: bootloader/main-pp.c
- ===================================================================
- --- bootloader/main-pp.c (revision 13992)
- +++ bootloader/main-pp.c (working copy)
- @@ -44,6 +44,7 @@
- #elif CONFIG_KEYPAD == SANSA_E200_PAD
- #define BOOTLOADER_BOOT_OF BUTTON_LEFT
- +#define BOOTLOADER_BOOT_MENU BUTTON_REC
- #endif
- @@ -467,7 +468,7 @@
- btn |= BOOTLOADER_BOOT_OF;
- #endif
- /* Enable bootloader messages if any button is pressed */
- - if (btn)
- + if ((btn) && ((btn&BOOTLOADER_BOOT_MENU) == 0))
- verbose = true;
- lcd_setfont(FONT_SYSFIXED);
- @@ -509,9 +510,49 @@
- printf("Partition %d: 0x%02x %ld MB",
- i, pinfo->type, pinfo->size / 2048);
- }
- -
- - if(btn & BOOTLOADER_BOOT_OF)
- + if (btn&BOOTLOADER_BOOT_MENU)
- {
- + char *items[] = {"Rockbox", "MicroSD card", "Sansa Firmare", "Shutdown"};
- + while (button_read_device()&BOOTLOADER_BOOT_MENU)
- + ;
- + switch (boot_menu(items, 4))
- + {
- + case 0: /* rockbox */
- + rc=load_mi4(loadbuffer, BOOTFILE, MAX_LOADSIZE);
- + break;
- + case 1: /* microSD */
- + rc=load_mi4(loadbuffer,
- + "/<microSD1>/.rockbox/rockbox.mi4", MAX_LOADSIZE);
- + break;
- + case 2: /* OF */
- +#ifdef SANSA_E200
- + /* First try a (hidden) firmware partition */
- + printf("Trying firmware partition");
- + pinfo = disk_partinfo(1);
- + if(pinfo->type == PARTITION_TYPE_OS2_HIDDEN_C_DRIVE)
- + {
- + rc = load_mi4_part(loadbuffer, pinfo, MAX_LOADSIZE, usb);
- + if (rc < EOK) {
- + printf("Can't load from partition");
- + printf(strerror(rc));
- + } else {
- + return (void*)loadbuffer;
- + }
- + } else {
- + printf("No hidden partition found.");
- + }
- +#endif
- + break;
- + case -1: /* timeout */
- + case 3: /* shutdown */
- + power_off();
- + break;
- + }
- + if (rc < EOK)
- + error(EBOOTFILE,rc);
- + }
- + else if(btn & BOOTLOADER_BOOT_OF)
- + {
- /* Load original mi4 firmware in to a memory buffer called loadbuffer.
- The rest of the loading is done in crt0.S.
- 1) First try reading from the hidden partition (on Sansa only).
- Index: bootloader/SOURCES
- ===================================================================
- --- bootloader/SOURCES (revision 13992)
- +++ bootloader/SOURCES (working copy)
- @@ -1,5 +1,5 @@
- common.c
- -
- +boot_menu.c
- #if defined(IPOD_ARCH)
- ipod.c
- #elif defined(GIGABEAT_F)
- Index: bootloader/boot_menu.c
- ===================================================================
- --- bootloader/boot_menu.c (revision 0)
- +++ bootloader/boot_menu.c (revision 0)
- @@ -0,0 +1,66 @@
- +#include "config.h"
- +#include "lcd.h"
- +#include "stdbool.h"
- +#include "sysfont.h"
- +#include "button.h"
- +#include "kernel.h"
- +
- +#define TIMEOUT_VALUE 5*HZ
- +
- +/* Button definitions */
- +#if CONFIG_KEYPAD == IRIVER_H10_PAD
- +#define UP
- +
- +#elif CONFIG_KEYPAD == SANSA_E200_PAD
- +#define UP BUTTON_UP
- +#define DOWN BUTTON_DOWN
- +#define ACCEPT BUTTON_SELECT
- +
- +#endif
- +
- +int boot_menu(char **items, int count)
- +{
- + int selection = 0, i;
- + int nb_lines = LCD_HEIGHT/SYSFONT_HEIGHT;
- + bool timeout_still_valid = true;
- + int start_time = current_tick;
- + int button;
- +
- + //lcd_backlight(true);
- + while (1)
- + {
- + lcd_clear_display();
- + for (i=0; i<nb_lines && i<count; i++)
- + {
- + if (i == selection)
- + {
- + lcd_puts_style(0, i+2, items[i], STYLE_INVERT);
- + }
- + else
- + lcd_puts_style(0, i+2, items[i], STYLE_DEFAULT);
- + }
- + lcd_update();
- + button = button_read_device();
- + if (button != BUTTON_NONE)
- + timeout_still_valid = false;
- +
- + if (timeout_still_valid)
- + {
- + if (current_tick > start_time+TIMEOUT_VALUE)
- + return -1; /* timeout */
- + }
- +
- + if ((button&UP) && (selection > 0))
- + {
- + selection--;
- + }
- + else if ((button&DOWN) && selection < (count-1))
- + {
- + selection++;
- + }
- + else if (button&ACCEPT)
- + return selection;
- + sleep(HZ/2);
- + }
- + return -1;
- +}
- Index: firmware/target/arm/sandisk/sansa-e200/button-e200.c
- ===================================================================
- --- firmware/target/arm/sandisk/sansa-e200/button-e200.c (revision 13992)
- +++ firmware/target/arm/sandisk/sansa-e200/button-e200.c (working copy)
- @@ -232,6 +232,7 @@
- #endif /* BOOTLOADER */
- /* device buttons */
- +void button_int(void) IBSS_ATTR;
- void button_int(void)
- {
- unsigned char state;
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.