1
0
Fork 0
forked from len0rd/rockbox

Prepare for a new bootloader 7-pre4 release for iriver H100 series. Synced to work properly with SVN, and hopefully fixed remote detection problem and audio thump for some users. Also pure H100/H115 should be supported now. Actual bootloaders will be released separately.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16252 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Miika Pekkarinen 2008-02-09 15:06:09 +00:00
parent c6e9b8b7e1
commit 698113d9db
4 changed files with 82 additions and 39 deletions

View file

@ -27,7 +27,7 @@
unsigned char *audiobuf; unsigned char *audiobuf;
ssize_t audiobuf_size; ssize_t audiobuf_size;
#if defined(IRIVER_H120) #ifdef IRIVER_H100_SERIES
#define PLATFORM_ID ID_IRIVER_H100 #define PLATFORM_ID ID_IRIVER_H100
#else #else
#undef PLATFORM_ID /* this platform is not (yet) flashable */ #undef PLATFORM_ID /* this platform is not (yet) flashable */
@ -329,7 +329,7 @@ int load_firmware_file(const char *filename, uint32_t *checksum)
} }
/* Verify the checksum */ /* Verify the checksum */
sum = 0; sum = MODEL_NUMBER;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
sum += audiobuf[i]; sum += audiobuf[i];
@ -344,7 +344,12 @@ int load_firmware_file(const char *filename, uint32_t *checksum)
unsigned long valid_bootloaders[][2] = { unsigned long valid_bootloaders[][2] = {
/* Size-8 CRC32 */ /* Size-8 CRC32 */
#ifdef IRIVER_H120 /* Iriver H120/H140 checksums */
{ 63788, 0x08ff01a9 }, /* 7-pre3, improved failsafe functions */ { 63788, 0x08ff01a9 }, /* 7-pre3, improved failsafe functions */
{ 48764, 0xc674323e }, /* 7-pre4. Fixed audio thump & remote bootup */
#endif
#ifdef IRIVER_H100
#endif
{ 0, 0 } { 0, 0 }
}; };
@ -483,7 +488,7 @@ int flash_rockbox(const char *filename, int section)
p8 = (char *)get_section_address(section); p8 = (char *)get_section_address(section);
p8 += sizeof(struct flash_header); p8 += sizeof(struct flash_header);
sum = 0; sum = MODEL_NUMBER;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
sum += p8[i]; sum += p8[i];
@ -573,7 +578,7 @@ int flash_bootloader(const char *filename)
/* Verify */ /* Verify */
p8 = (char *)BOOTLOADER_ENTRYPOINT; p8 = (char *)BOOTLOADER_ENTRYPOINT;
sum = 0; sum = MODEL_NUMBER;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
sum += p8[i]; sum += p8[i];

View file

@ -240,9 +240,10 @@ static const char *options[] = {
}; };
#define FAILSAFE_OPTIONS 4 #define FAILSAFE_OPTIONS 4
#define TIMEOUT (15*HZ)
void failsafe_menu(void) void failsafe_menu(void)
{ {
int timeout = 15; long start_tick = current_tick;
int option = 3; int option = 3;
int button; int button;
int defopt = -1; int defopt = -1;
@ -267,7 +268,7 @@ void failsafe_menu(void)
defopt = option; defopt = option;
} }
while (timeout > 0) while (current_tick - start_tick < TIMEOUT)
{ {
/* Draw the menu. */ /* Draw the menu. */
line = 3; line = 3;
@ -284,18 +285,17 @@ void failsafe_menu(void)
printf("%s %s %s", arrow, options[i], def); printf("%s %s %s", arrow, options[i], def);
} }
snprintf(buf, sizeof(buf), "Time left: %ds", timeout); snprintf(buf, sizeof(buf), "Time left: %ds",
(TIMEOUT - (current_tick - start_tick)) / HZ);
lcd_puts(0, 10, buf); lcd_puts(0, 10, buf);
lcd_update(); lcd_update();
button = button_get_w_tmo(HZ); button = button_get_w_tmo(HZ);
if (button == BUTTON_NONE) if (button == BUTTON_NONE || button & SYS_EVENT)
{
timeout--;
continue ; continue ;
}
timeout = 15; start_tick = current_tick;
/* Ignore the ON/PLAY -button because it can cause trouble /* Ignore the ON/PLAY -button because it can cause trouble
with the RTC alarm mod. */ with the RTC alarm mod. */
switch (button & ~(BUTTON_ON)) switch (button & ~(BUTTON_ON))
@ -314,8 +314,7 @@ void failsafe_menu(void)
case BUTTON_SELECT: case BUTTON_SELECT:
case BUTTON_RC_ON: case BUTTON_RC_ON:
timeout = 0; goto execute;
break ;
case BUTTON_REC: case BUTTON_REC:
case BUTTON_RC_REC: case BUTTON_RC_REC:
@ -329,6 +328,8 @@ void failsafe_menu(void)
} }
} }
execute:
lcd_puts(0, 10, "Executing command..."); lcd_puts(0, 10, "Executing command...");
lcd_update(); lcd_update();
sleep(HZ); sleep(HZ);
@ -354,6 +355,24 @@ void failsafe_menu(void)
} }
#endif #endif
/* get rid of a nasty humming sound during boot
-> RESET signal */
inline static void __uda1380_reset_hi(void)
{
#ifdef HAVE_UDA1380
or_l(1<<29, &GPIO_OUT);
or_l(1<<29, &GPIO_ENABLE);
or_l(1<<29, &GPIO_FUNCTION);
#endif
}
inline static void __uda1380_reset_lo(void)
{
#ifdef HAVE_UDA1380
and_l(~(1<<29), &GPIO_OUT);
#endif
}
void main(void) void main(void)
{ {
int i; int i;
@ -387,12 +406,14 @@ void main(void)
power_init(); power_init();
/* Turn off if neither ON button is pressed */ /* Turn off if neither ON button is pressed */
if(!(on_button || rc_on_button || (usb_detect() == USB_INSERTED))) if (!(on_button || rc_on_button))
{ {
__reset_cookie(); __reset_cookie();
power_off(); power_off();
} }
__uda1380_reset_hi();
/* Start with the main backlight OFF. */ /* Start with the main backlight OFF. */
_backlight_init(); _backlight_init();
_backlight_off(); _backlight_off();
@ -405,6 +426,8 @@ void main(void)
system_init(); system_init();
kernel_init(); kernel_init();
__uda1380_reset_lo();
#ifdef HAVE_ADJUSTABLE_CPU_FREQ #ifdef HAVE_ADJUSTABLE_CPU_FREQ
/* Set up waitstates for the peripherals */ /* Set up waitstates for the peripherals */
set_cpu_frequency(0); /* PLL off */ set_cpu_frequency(0); /* PLL off */
@ -418,11 +441,28 @@ void main(void)
initialize_eeprom(); initialize_eeprom();
#endif #endif
usb_init();
/* A small delay after usb_init is necessary to read the I/O port correctly
(if ports are read _immediately_ after the init). */
/* sleep(1); */
adc_init(); adc_init();
button_init(); button_init();
if ((on_button && button_hold()) || /* Only check remote hold status if remote power button was actually used. */
(rc_on_button && remote_button_hold())) if (rc_on_button)
{
lcd_remote_init();
/* Allow the button driver to check the buttons */
sleep(HZ/50);
if (remote_button_hold())
hold_status = true;
}
/* Check main hold switch status too. */
if (on_button && button_hold())
{ {
hold_status = true; hold_status = true;
} }
@ -437,27 +477,24 @@ void main(void)
ide_power_enable(true); ide_power_enable(true);
} }
# ifdef EEPROM_SETTINGS # ifdef HAVE_EEPROM_SETTINGS
if (!hold_status && (usb_detect() != USB_INSERTED) && !recovery_mode) if (!hold_status && (usb_detect() != USB_INSERTED) && !recovery_mode)
try_flashboot(); try_flashboot();
# endif # endif
backlight_init(); backlight_init();
#ifdef HAVE_UDA1380
/* get rid of a nasty humming sound during boot
-> RESET signal */
or_l(1<<29, &GPIO_OUT);
or_l(1<<29, &GPIO_ENABLE);
or_l(1<<29, &GPIO_FUNCTION);
sleep(HZ/100);
and_l(~(1<<29), &GPIO_OUT);
#endif
lcd_init(); lcd_init();
#ifdef HAVE_REMOTE_LCD
lcd_remote_init(); if (!rc_on_button)
#endif lcd_remote_init();
/* Bootloader uses simplified backlight thread, so we need to enable
remote display here. */
if (remote_detect())
lcd_remote_on();
font_init(); font_init();
lcd_setfont(FONT_SYSFIXED); lcd_setfont(FONT_SYSFIXED);
@ -465,7 +502,8 @@ void main(void)
printf("Rockbox boot loader"); printf("Rockbox boot loader");
printf("Version %s", version); printf("Version %s", version);
sleep(HZ/50); /* Allow the button driver to check the buttons */ /* No need to wait here more because lcd_init and others already do that. */
// sleep(HZ/50); /* Allow the button driver to check the buttons */
rec_button = ((button_status() & BUTTON_REC) == BUTTON_REC) rec_button = ((button_status() & BUTTON_REC) == BUTTON_REC)
|| ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC); || ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC);
@ -497,8 +535,6 @@ void main(void)
start_iriver_fw(); start_iriver_fw();
} }
usb_init();
/* A hack to enter USB mode without using the USB thread */ /* A hack to enter USB mode without using the USB thread */
if(usb_detect() == USB_INSERTED) if(usb_detect() == USB_INSERTED)
{ {

View file

@ -114,7 +114,7 @@
/* Define this if you can run rockbox from flash memory */ /* Define this if you can run rockbox from flash memory */
/* In theory we can, but somebody needs to verify there are no issues. */ /* In theory we can, but somebody needs to verify there are no issues. */
// #define HAVE_FLASHED_ROCKBOX #define HAVE_FLASHED_ROCKBOX
/* define this if the hardware can be powered off while charging */ /* define this if the hardware can be powered off while charging */
#define HAVE_POWEROFF_WHILE_CHARGING #define HAVE_POWEROFF_WHILE_CHARGING
@ -149,9 +149,10 @@
#define FLASH_MAGIC 0xfbfbfbf2 #define FLASH_MAGIC 0xfbfbfbf2
/* Define this if there is an EEPROM chip */ /* Define this if there is an EEPROM chip */
/* Someone with H100 and BDM, please verify if this works and remove these #define HAVE_EEPROM
ugly comments then. */
// #define HAVE_EEPROM /* Define this if the EEPROM chip is used */
#define HAVE_EEPROM_SETTINGS
#endif /* !SIMULATOR */ #endif /* !SIMULATOR */

1
tools/configure vendored
View file

@ -877,6 +877,7 @@ EOF
bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0"
output="rockbox.iriver" output="rockbox.iriver"
appextra="recorder:gui" appextra="recorder:gui"
flash="$pwd/rombox.iriver"
plugins="yes" plugins="yes"
swcodec="yes" swcodec="yes"
# toolset is the tools within the tools directory that we build for # toolset is the tools within the tools directory that we build for