Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Mine
Thursday, July 26th, 2007 at 11:25:26am UTC 

  1. Index: bootloader/main-pp.c
  2. ===================================================================
  3. --- bootloader/main-pp.c        (revision 13992)
  4. +++ bootloader/main-pp.c        (working copy)
  5. @@ -44,6 +44,7 @@
  6.  
  7.  #elif CONFIG_KEYPAD == SANSA_E200_PAD
  8.  #define BOOTLOADER_BOOT_OF      BUTTON_LEFT
  9. +#define BOOTLOADER_BOOT_MENU    BUTTON_REC
  10.  
  11.  #endif
  12.  
  13. @@ -467,7 +468,7 @@
  14.          btn |= BOOTLOADER_BOOT_OF;
  15.  #endif
  16.      /* Enable bootloader messages if any button is pressed */
  17. -    if (btn)
  18. +    if ((btn) && ((btn&BOOTLOADER_BOOT_MENU) == 0))
  19.          verbose = true;
  20.  
  21.      lcd_setfont(FONT_SYSFIXED);
  22. @@ -509,9 +510,49 @@
  23.          printf("Partition %d: 0x%02x %ld MB",
  24.                  i, pinfo->type, pinfo->size / 2048);
  25.      }
  26. -
  27. -    if(btn & BOOTLOADER_BOOT_OF)
  28. +    if (btn&BOOTLOADER_BOOT_MENU)
  29.      {
  30. +        char *items[] = {"Rockbox", "MicroSD card", "Sansa Firmare", "Shutdown"};
  31. +        while (button_read_device()&BOOTLOADER_BOOT_MENU)
  32. +            ;
  33. +        switch (boot_menu(items, 4))
  34. +        {
  35. +            case 0: /* rockbox */
  36. +                rc=load_mi4(loadbuffer, BOOTFILE, MAX_LOADSIZE);
  37. +                break;
  38. +            case 1: /* microSD */
  39. +                rc=load_mi4(loadbuffer,
  40. +                            "/<microSD1>/.rockbox/rockbox.mi4", MAX_LOADSIZE);
  41. +                break;
  42. +            case 2: /* OF */
  43. +#ifdef SANSA_E200       
  44. +            /* First try a (hidden) firmware partition */
  45. +                printf("Trying firmware partition");
  46. +                pinfo = disk_partinfo(1);
  47. +                if(pinfo->type == PARTITION_TYPE_OS2_HIDDEN_C_DRIVE)
  48. +                {
  49. +                    rc = load_mi4_part(loadbuffer, pinfo, MAX_LOADSIZE, usb);
  50. +                    if (rc < EOK) {
  51. +                        printf("Can't load from partition");
  52. +                        printf(strerror(rc));
  53. +                    } else {
  54. +                        return (void*)loadbuffer;
  55. +                    }
  56. +                } else {
  57. +                    printf("No hidden partition found.");
  58. +                }
  59. +#endif
  60. +            break;
  61. +        case -1: /* timeout */
  62. +            case 3: /* shutdown */
  63. +                power_off();
  64. +                break;
  65. +        }
  66. +        if (rc < EOK)
  67. +            error(EBOOTFILE,rc);
  68. +    }
  69. +    else if(btn & BOOTLOADER_BOOT_OF)
  70. +    {
  71.          /* Load original mi4 firmware in to a memory buffer called loadbuffer.
  72.             The rest of the loading is done in crt0.S.
  73.             1) First try reading from the hidden partition (on Sansa only).
  74. Index: bootloader/SOURCES
  75. ===================================================================
  76. --- bootloader/SOURCES  (revision 13992)
  77. +++ bootloader/SOURCES  (working copy)
  78. @@ -1,5 +1,5 @@
  79.  common.c
  80. -
  81. +boot_menu.c
  82.  #if defined(IPOD_ARCH)
  83.  ipod.c
  84.  #elif defined(GIGABEAT_F)
  85. Index: bootloader/boot_menu.c
  86. ===================================================================
  87. --- bootloader/boot_menu.c      (revision 0)
  88. +++ bootloader/boot_menu.c      (revision 0)
  89. @@ -0,0 +1,66 @@
  90. +#include "config.h"
  91. +#include "lcd.h"
  92. +#include "stdbool.h"
  93. +#include "sysfont.h"
  94. +#include "button.h"
  95. +#include "kernel.h"
  96. +
  97. +#define TIMEOUT_VALUE 5*HZ
  98. +
  99. +/* Button definitions */
  100. +#if CONFIG_KEYPAD == IRIVER_H10_PAD
  101. +#define UP
  102. +
  103. +#elif CONFIG_KEYPAD == SANSA_E200_PAD
  104. +#define UP BUTTON_UP
  105. +#define DOWN BUTTON_DOWN
  106. +#define ACCEPT BUTTON_SELECT
  107. +
  108. +#endif
  109. +
  110. +int boot_menu(char **items, int count)
  111. +{
  112. +    int selection = 0, i;
  113. +    int nb_lines = LCD_HEIGHT/SYSFONT_HEIGHT;
  114. +    bool timeout_still_valid = true;
  115. +    int start_time = current_tick;
  116. +    int button;
  117. +   
  118. +    //lcd_backlight(true);
  119. +    while (1)
  120. +    {
  121. +        lcd_clear_display();
  122. +        for (i=0; i<nb_lines && i<count; i++)
  123. +        {
  124. +            if (i == selection)
  125. +            {
  126. +                lcd_puts_style(0, i+2, items[i], STYLE_INVERT);
  127. +            }
  128. +            else
  129. +                lcd_puts_style(0, i+2, items[i], STYLE_DEFAULT);
  130. +        }
  131. +        lcd_update();
  132. +        button = button_read_device();
  133. +        if (button != BUTTON_NONE)
  134. +            timeout_still_valid = false;
  135. +       
  136. +        if (timeout_still_valid)
  137. +        {
  138. +            if (current_tick > start_time+TIMEOUT_VALUE)
  139. +                return -1; /* timeout */
  140. +        }
  141. +       
  142. +        if ((button&UP) && (selection > 0))
  143. +        {
  144. +            selection--;
  145. +        }
  146. +        else if ((button&DOWN) && selection < (count-1))
  147. +        {
  148. +            selection++;
  149. +        }
  150. +        else if (button&ACCEPT)
  151. +            return selection;
  152. +        sleep(HZ/2);
  153. +    }
  154. +    return -1;
  155. +}
  156. Index: firmware/target/arm/sandisk/sansa-e200/button-e200.c
  157. ===================================================================
  158. --- firmware/target/arm/sandisk/sansa-e200/button-e200.c        (revision 13992)
  159. +++ firmware/target/arm/sandisk/sansa-e200/button-e200.c        (working copy)
  160. @@ -232,6 +232,7 @@
  161.  #endif /* BOOTLOADER */
  162.  
  163.  /* device buttons */
  164. +void button_int(void) IBSS_ATTR;
  165.  void button_int(void)
  166.  {
  167.      unsigned char state;

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

comments powered by Disqus
worth-right