summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2010-07-06 17:30:10 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2010-07-06 17:30:10 +0000
commit57484bdf0458ec0f0f0c447b929b128e4b54a294 (patch)
tree4df0ad30ce755018004aaed52d3077497e014c8d
parentf99e4fb3bf5e93db4b3a9f3e1df94883570ab72e (diff)
downloadrockbox-57484bdf0458ec0f0f0c447b929b128e4b54a294.tar.gz
rockbox-57484bdf0458ec0f0f0c447b929b128e4b54a294.zip
HD200 - add support for remote in bootloader
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27316 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/mpio_hd200.c45
1 files changed, 38 insertions, 7 deletions
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)
186{ 186{
187 int rc; 187 int rc;
188 188
189 /* boost to speedup rb image loading */
190 cpu_boost(true);
191
189 rc = storage_init(); 192 rc = storage_init();
190 if(rc) 193 if(rc)
191 { 194 {
@@ -218,6 +221,7 @@ static void rb_boot(void)
218 return; 221 return;
219 } 222 }
220 223
224 cpu_boost(false);
221 start_rockbox(); 225 start_rockbox();
222} 226}
223 227
@@ -272,6 +276,7 @@ static void bootmenu(void)
272 switch (button) 276 switch (button)
273 { 277 {
274 case BUTTON_PREV: 278 case BUTTON_PREV:
279 case BUTTON_RC_PREV:
275 if (option > rockbox) 280 if (option > rockbox)
276 option--; 281 option--;
277 else 282 else
@@ -279,6 +284,7 @@ static void bootmenu(void)
279 break; 284 break;
280 285
281 case BUTTON_NEXT: 286 case BUTTON_NEXT:
287 case BUTTON_RC_NEXT:
282 if (option < shutdown) 288 if (option < shutdown)
283 option++; 289 option++;
284 else 290 else
@@ -286,6 +292,7 @@ static void bootmenu(void)
286 break; 292 break;
287 293
288 case BUTTON_PLAY: 294 case BUTTON_PLAY:
295 case BUTTON_RC_PLAY:
289 case (BUTTON_PLAY|BUTTON_REC): 296 case (BUTTON_PLAY|BUTTON_REC):
290 reset_screen(); 297 reset_screen();
291 298
@@ -322,6 +329,9 @@ void main(void)
322 unsigned int event = EVENT_NONE; 329 unsigned int event = EVENT_NONE;
323 unsigned int last_event = EVENT_NONE; 330 unsigned int last_event = EVENT_NONE;
324 331
332 /* this is default mode after power_init() */
333 bool high_current_charging = true;
334
325 power_init(); 335 power_init();
326 336
327 system_init(); 337 system_init();
@@ -360,7 +370,7 @@ void main(void)
360 event = EVENT_NONE; 370 event = EVENT_NONE;
361 button = button_get_w_tmo(HZ); 371 button = button_get_w_tmo(HZ);
362 372
363 if ( button & BUTTON_PLAY ) 373 if ( (button & BUTTON_PLAY) || (button & BUTTON_RC_PLAY) )
364 event |= EVENT_ON; 374 event |= EVENT_ON;
365 375
366 if ( usb_detect() == USB_INSERTED ) 376 if ( usb_detect() == USB_INSERTED )
@@ -388,8 +398,7 @@ void main(void)
388 case EVENT_AC: 398 case EVENT_AC:
389 if (!(last_event & EVENT_AC)) 399 if (!(last_event & EVENT_AC))
390 { 400 {
391 /* high current charge */ 401 /* reset charging circuit */
392 or_l((1<<15),&GPIO_OUT);
393 and_l(~(1<<23), &GPIO_ENABLE); 402 and_l(~(1<<23), &GPIO_ENABLE);
394 } 403 }
395 404
@@ -407,9 +416,25 @@ void main(void)
407 416
408 blink_toggle = !blink_toggle; 417 blink_toggle = !blink_toggle;
409 } 418 }
410 else 419 else /* end of charge condition */
411 { 420 {
412 lcd_putstring_centered(complete_msg); 421 /* put LTC1733 into shutdown mode */
422 or_l((1<<23), &GPIO_ENABLE);
423
424 if (high_current_charging)
425 {
426 /* switch to low current mode */
427 and_l(~(1<<15), &GPIO_OUT);
428
429 /* reset charging circuit */
430 and_l(~(1<<23), &GPIO_ENABLE);
431
432 high_current_charging = false;
433 }
434 else
435 {
436 lcd_putstring_centered(complete_msg);
437 }
413 } 438 }
414 check_battery(); 439 check_battery();
415 break; 440 break;
@@ -418,8 +443,7 @@ void main(void)
418 case (EVENT_USB | EVENT_AC): 443 case (EVENT_USB | EVENT_AC):
419 if (!(last_event & EVENT_AC)) 444 if (!(last_event & EVENT_AC))
420 { 445 {
421 /* high current charge */ 446 /* reset charger circuit */
422 or_l((1<<15),&GPIO_OUT);
423 and_l(~(1<<23), &GPIO_ENABLE); 447 and_l(~(1<<23), &GPIO_ENABLE);
424 } 448 }
425 449
@@ -442,6 +466,13 @@ void main(void)
442 break; 466 break;
443 467
444 default: 468 default:
469 if (last_event & EVENT_USB)
470 {
471 /* USB unplug */
472 usb_enable(false);
473 ide_power_enable(false);
474 }
475
445 /* spurious wakeup */ 476 /* spurious wakeup */
446 __shutdown(); 477 __shutdown();
447 break; 478 break;