diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2008-02-09 15:06:09 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2008-02-09 15:06:09 +0000 |
commit | 698113d9db061f00a4d0cd2196b46f5d3c64f4fb (patch) | |
tree | 2f0dbd4ba9c8067ac74fdefec259f6a4da156609 | |
parent | c6e9b8b7e15bb6eb0a4c0e6614a91c04427c9d3d (diff) | |
download | rockbox-698113d9db061f00a4d0cd2196b46f5d3c64f4fb.tar.gz rockbox-698113d9db061f00a4d0cd2196b46f5d3c64f4fb.zip |
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
-rw-r--r-- | apps/plugins/iriver_flash.c | 13 | ||||
-rw-r--r-- | bootloader/main.c | 98 | ||||
-rw-r--r-- | firmware/export/config-h100.h | 9 | ||||
-rwxr-xr-x | tools/configure | 1 |
4 files changed, 82 insertions, 39 deletions
diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c index f3fbbb45b8..6d776f4e29 100644 --- a/apps/plugins/iriver_flash.c +++ b/apps/plugins/iriver_flash.c @@ -27,7 +27,7 @@ unsigned char *audiobuf; ssize_t audiobuf_size; -#if defined(IRIVER_H120) +#ifdef IRIVER_H100_SERIES #define PLATFORM_ID ID_IRIVER_H100 #else #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 */ - sum = 0; + sum = MODEL_NUMBER; for (i = 0; i < len; i++) sum += audiobuf[i]; @@ -344,7 +344,12 @@ int load_firmware_file(const char *filename, uint32_t *checksum) unsigned long valid_bootloaders[][2] = { /* Size-8 CRC32 */ +#ifdef IRIVER_H120 /* Iriver H120/H140 checksums */ { 63788, 0x08ff01a9 }, /* 7-pre3, improved failsafe functions */ + { 48764, 0xc674323e }, /* 7-pre4. Fixed audio thump & remote bootup */ +#endif +#ifdef IRIVER_H100 +#endif { 0, 0 } }; @@ -483,7 +488,7 @@ int flash_rockbox(const char *filename, int section) p8 = (char *)get_section_address(section); p8 += sizeof(struct flash_header); - sum = 0; + sum = MODEL_NUMBER; for (i = 0; i < len; i++) sum += p8[i]; @@ -573,7 +578,7 @@ int flash_bootloader(const char *filename) /* Verify */ p8 = (char *)BOOTLOADER_ENTRYPOINT; - sum = 0; + sum = MODEL_NUMBER; for (i = 0; i < len; i++) sum += p8[i]; diff --git a/bootloader/main.c b/bootloader/main.c index b1a29f992a..6b3527be7a 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -240,9 +240,10 @@ static const char *options[] = { }; #define FAILSAFE_OPTIONS 4 +#define TIMEOUT (15*HZ) void failsafe_menu(void) { - int timeout = 15; + long start_tick = current_tick; int option = 3; int button; int defopt = -1; @@ -267,7 +268,7 @@ void failsafe_menu(void) defopt = option; } - while (timeout > 0) + while (current_tick - start_tick < TIMEOUT) { /* Draw the menu. */ line = 3; @@ -284,18 +285,17 @@ void failsafe_menu(void) 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_update(); button = button_get_w_tmo(HZ); - - if (button == BUTTON_NONE) - { - timeout--; + + if (button == BUTTON_NONE || button & SYS_EVENT) continue ; - } - timeout = 15; + start_tick = current_tick; + /* Ignore the ON/PLAY -button because it can cause trouble with the RTC alarm mod. */ switch (button & ~(BUTTON_ON)) @@ -314,8 +314,7 @@ void failsafe_menu(void) case BUTTON_SELECT: case BUTTON_RC_ON: - timeout = 0; - break ; + goto execute; case BUTTON_REC: case BUTTON_RC_REC: @@ -329,6 +328,8 @@ void failsafe_menu(void) } } + execute: + lcd_puts(0, 10, "Executing command..."); lcd_update(); sleep(HZ); @@ -354,6 +355,24 @@ void failsafe_menu(void) } #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) { int i; @@ -387,12 +406,14 @@ void main(void) power_init(); /* 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(); power_off(); } + __uda1380_reset_hi(); + /* Start with the main backlight OFF. */ _backlight_init(); _backlight_off(); @@ -405,6 +426,8 @@ void main(void) system_init(); kernel_init(); + __uda1380_reset_lo(); + #ifdef HAVE_ADJUSTABLE_CPU_FREQ /* Set up waitstates for the peripherals */ set_cpu_frequency(0); /* PLL off */ @@ -418,11 +441,28 @@ void main(void) initialize_eeprom(); #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(); button_init(); - if ((on_button && button_hold()) || - (rc_on_button && remote_button_hold())) + /* Only check remote hold status if remote power button was actually used. */ + 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; } @@ -437,35 +477,33 @@ void main(void) ide_power_enable(true); } -# ifdef EEPROM_SETTINGS +# ifdef HAVE_EEPROM_SETTINGS if (!hold_status && (usb_detect() != USB_INSERTED) && !recovery_mode) try_flashboot(); # endif 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(); -#ifdef HAVE_REMOTE_LCD - lcd_remote_init(); -#endif + + if (!rc_on_button) + lcd_remote_init(); + + /* Bootloader uses simplified backlight thread, so we need to enable + remote display here. */ + if (remote_detect()) + lcd_remote_on(); + font_init(); lcd_setfont(FONT_SYSFIXED); - + printf("Rockbox boot loader"); 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) || ((button_status() & BUTTON_RC_REC) == BUTTON_RC_REC); @@ -497,8 +535,6 @@ void main(void) start_iriver_fw(); } - usb_init(); - /* A hack to enter USB mode without using the USB thread */ if(usb_detect() == USB_INSERTED) { diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 9212152b08..0ecc3a8139 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -114,7 +114,7 @@ /* Define this if you can run rockbox from flash memory */ /* 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 HAVE_POWEROFF_WHILE_CHARGING @@ -149,9 +149,10 @@ #define FLASH_MAGIC 0xfbfbfbf2 /* Define this if there is an EEPROM chip */ -/* Someone with H100 and BDM, please verify if this works and remove these - ugly comments then. */ -// #define HAVE_EEPROM +#define HAVE_EEPROM + +/* Define this if the EEPROM chip is used */ +#define HAVE_EEPROM_SETTINGS #endif /* !SIMULATOR */ diff --git a/tools/configure b/tools/configure index 52d48e2c79..5c8165c3ef 100755 --- a/tools/configure +++ b/tools/configure @@ -877,6 +877,7 @@ EOF bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" output="rockbox.iriver" appextra="recorder:gui" + flash="$pwd/rombox.iriver" plugins="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for |