diff --git a/bootloader/mpio_hd200.c b/bootloader/mpio_hd200.c index 5b72dd3243..0eec84d6d5 100644 --- a/bootloader/mpio_hd200.c +++ b/bootloader/mpio_hd200.c @@ -186,6 +186,9 @@ static void rb_boot(void) { int rc; + /* boost to speedup rb image loading */ + cpu_boost(true); + rc = storage_init(); if(rc) { @@ -218,6 +221,7 @@ static void rb_boot(void) return; } + cpu_boost(false); start_rockbox(); } @@ -272,6 +276,7 @@ static void bootmenu(void) switch (button) { case BUTTON_PREV: + case BUTTON_RC_PREV: if (option > rockbox) option--; else @@ -279,6 +284,7 @@ static void bootmenu(void) break; case BUTTON_NEXT: + case BUTTON_RC_NEXT: if (option < shutdown) option++; else @@ -286,6 +292,7 @@ static void bootmenu(void) break; case BUTTON_PLAY: + case BUTTON_RC_PLAY: case (BUTTON_PLAY|BUTTON_REC): reset_screen(); @@ -322,6 +329,9 @@ void main(void) unsigned int event = EVENT_NONE; unsigned int last_event = EVENT_NONE; + /* this is default mode after power_init() */ + bool high_current_charging = true; + power_init(); system_init(); @@ -360,7 +370,7 @@ void main(void) event = EVENT_NONE; button = button_get_w_tmo(HZ); - if ( button & BUTTON_PLAY ) + if ( (button & BUTTON_PLAY) || (button & BUTTON_RC_PLAY) ) event |= EVENT_ON; if ( usb_detect() == USB_INSERTED ) @@ -388,8 +398,7 @@ void main(void) case EVENT_AC: if (!(last_event & EVENT_AC)) { - /* high current charge */ - or_l((1<<15),&GPIO_OUT); + /* reset charging circuit */ and_l(~(1<<23), &GPIO_ENABLE); } @@ -407,9 +416,25 @@ void main(void) blink_toggle = !blink_toggle; } - else + else /* end of charge condition */ { - lcd_putstring_centered(complete_msg); + /* put LTC1733 into shutdown mode */ + or_l((1<<23), &GPIO_ENABLE); + + if (high_current_charging) + { + /* switch to low current mode */ + and_l(~(1<<15), &GPIO_OUT); + + /* reset charging circuit */ + and_l(~(1<<23), &GPIO_ENABLE); + + high_current_charging = false; + } + else + { + lcd_putstring_centered(complete_msg); + } } check_battery(); break; @@ -418,8 +443,7 @@ void main(void) case (EVENT_USB | EVENT_AC): if (!(last_event & EVENT_AC)) { - /* high current charge */ - or_l((1<<15),&GPIO_OUT); + /* reset charger circuit */ and_l(~(1<<23), &GPIO_ENABLE); } @@ -442,6 +466,13 @@ void main(void) break; default: + if (last_event & EVENT_USB) + { + /* USB unplug */ + usb_enable(false); + ide_power_enable(false); + } + /* spurious wakeup */ __shutdown(); break;