diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2010-07-09 09:12:51 +0000 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2010-07-09 09:12:51 +0000 |
commit | 78d54fae752fea6846c0afb1fb9af5e8a93255e0 (patch) | |
tree | 0625e2e9671be24ca084ed5675a282fa9af2360f /bootloader/mpio_hd200.c | |
parent | b99066440f841e6d46816f7dda3cfdcf9a5b6ffb (diff) |
HD200 - Add delay when leaving bootloader USB mode. Add more comments in bootloader.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27355 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/mpio_hd200.c')
-rw-r--r-- | bootloader/mpio_hd200.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/bootloader/mpio_hd200.c b/bootloader/mpio_hd200.c index 0eec84d6d5..6ff4c57ad1 100644 --- a/bootloader/mpio_hd200.c +++ b/bootloader/mpio_hd200.c @@ -129,6 +129,10 @@ static void __reset(void) static void __shutdown(void) { + if (_charger_inserted()) + /* if AC power do nothing */ + return; + /* We need to gracefully spin down the disk to prevent clicks. */ if (ide_powered()) { @@ -143,15 +147,7 @@ static void __shutdown(void) _backlight_off(); __reset_cookie(); - if (_charger_inserted()) - { - /* reset instead of power_off() */ - __reset(); - } - else - { power_off(); - } } /* Print the battery voltage (and a warning message). */ @@ -271,6 +267,7 @@ static void bootmenu(void) lcd_update(); + button = BUTTON_NONE; button = button_get_w_tmo(HZ); switch (button) @@ -396,6 +393,7 @@ void main(void) break; case EVENT_AC: + /* AC plug in */ if (!(last_event & EVENT_AC)) { /* reset charging circuit */ @@ -406,7 +404,9 @@ void main(void) if (last_event & EVENT_USB) { usb_enable(false); + sleep(HZ); ide_power_enable(false); + sleep(HZ); } if(!_battery_full()) @@ -441,12 +441,14 @@ void main(void) case EVENT_USB: case (EVENT_USB | EVENT_AC): + /* AC plug in while in USB mode */ if (!(last_event & EVENT_AC)) { /* reset charger circuit */ and_l(~(1<<23), &GPIO_ENABLE); } + /* USB plug in */ if (!(last_event & EVENT_USB)) { /* init USB */ @@ -454,7 +456,8 @@ void main(void) sleep(HZ/20); usb_enable(true); } - + + /* display blinking USB indicator */ line = 0; if (blink_toggle) @@ -466,14 +469,17 @@ void main(void) break; default: + /* USB unplug */ if (last_event & EVENT_USB) { - /* USB unplug */ + /* disable USB */ usb_enable(false); + sleep(HZ); ide_power_enable(false); + sleep(HZ); } - /* spurious wakeup */ + /* spurious wakeup ?*/ __shutdown(); break; } |