blob: be36daf2effdca9290fcc3a76b1a74e0d1f5ba35 [file] [log] [blame]
Marcin Bukat28d54c62010-04-26 21:40:16 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
Marcin Bukat082c7d32010-10-22 12:28:43 +00008 * $Id$
Marcin Bukat28d54c62010-04-26 21:40:16 +00009 *
10 * Copyright (C) 2010 Marcin Bukat
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22
23#include <stdlib.h>
24#include <stdio.h>
25#include "inttypes.h"
26#include "string.h"
27#include "cpu.h"
28#include "system.h"
29#include "lcd.h"
30#include "kernel.h"
31#include "thread.h"
32#include "storage.h"
33#include "usb.h"
34#include "disk.h"
35#include "font.h"
36#include "adc.h"
37#include "backlight.h"
38#include "backlight-target.h"
39#include "button.h"
40#include "panic.h"
41#include "power.h"
42#include "powermgmt.h"
43#include "file.h"
44
45#include "common.h"
Rafaël Carré5d236b22010-05-27 09:41:46 +000046#include "version.h"
Marcin Bukat28d54c62010-04-26 21:40:16 +000047
48#include <stdarg.h>
49
50/* Maximum allowed firmware image size. 10MB is more than enough */
51#define MAX_LOADSIZE (10*1024*1024)
52
53#define DRAM_START 0x31000000
54
55#define BOOTMENU_TIMEOUT (10*HZ)
56#define BOOTMENU_OPTIONS 3
57
Marcin Bukat69fa42d2010-05-04 11:16:17 +000058#define EVENT_NONE 0x00
59#define EVENT_ON 0x01
60#define EVENT_AC 0x02
61#define EVENT_USB 0x04
Marcin Bukata73102f2010-12-06 10:24:29 +000062#define EVENT_RTC 0x08
Marcin Bukat69fa42d2010-05-04 11:16:17 +000063
Marcin Bukat28d54c62010-04-26 21:40:16 +000064/* From common.c */
65extern int line;
66static const char *bootmenu_options[] = {
67 "Boot rockbox",
68 "Boot MPIO firmware",
69 "Shutdown"
70};
71
72enum option_t {
73 rockbox,
74 mpio_firmware,
75 shutdown
76};
77
78int usb_screen(void)
79{
80 return 0;
81}
82
Marcin Bukata73102f2010-12-06 10:24:29 +000083/* return true if charger is present */
Marcin Bukat69fa42d2010-05-04 11:16:17 +000084static inline bool _charger_inserted(void)
Marcin Bukat28d54c62010-04-26 21:40:16 +000085{
86 return (GPIO1_READ & (1<<14)) ? false : true;
87}
88
Marcin Bukata73102f2010-12-06 10:24:29 +000089/* returns true if end of charge condition is reached */
Marcin Bukat69fa42d2010-05-04 11:16:17 +000090static inline bool _battery_full(void)
Marcin Bukat28d54c62010-04-26 21:40:16 +000091{
92 return (GPIO_READ & (1<<30)) ? true : false;
93}
94
Marcin Bukata73102f2010-12-06 10:24:29 +000095#ifdef MPIO_HD300
96/* returns true if startup is due to RTC alarm */
97static inline bool _rtc_alarm(void)
98{
99 if ( (GPIO1_READ & (1<<4)) && (GPIO1_READ & (1<<5)) )
100 return false;
101
102 return true;
103}
104#endif
105
Marcin Bukat28d54c62010-04-26 21:40:16 +0000106/* Reset the cookie for the crt0 crash check */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000107static inline void __reset_cookie(void)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000108{
109 asm(" move.l #0,%d0");
110 asm(" move.l %d0,0x10017ffc");
111}
112
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000113static void start_rockbox(void)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000114{
115 adc_close();
116 asm(" move.w #0x2700,%sr");
117 __reset_cookie();
118 asm(" move.l %0,%%d0" :: "i"(DRAM_START));
119 asm(" movec.l %d0,%vbr");
120 asm(" move.l %0,%%sp" :: "m"(*(int *)DRAM_START));
121 asm(" move.l %0,%%a0" :: "m"(*(int *)(DRAM_START+4)));
122 asm(" jmp (%a0)");
123}
124
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000125static void start_mpio_firmware(void)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000126{
127 asm(" move.w #0x2700,%sr");
128 __reset_cookie();
129 asm(" movec.l %d0,%vbr");
130 asm(" move.l 0,%sp");
131 asm(" jmp 8");
132}
133
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000134static void __shutdown(void)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000135{
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000136 if (_charger_inserted())
137 /* if AC power do nothing */
138 return;
139
Marcin Bukat28d54c62010-04-26 21:40:16 +0000140 /* We need to gracefully spin down the disk to prevent clicks. */
141 if (ide_powered())
142 {
143 /* Make sure ATA has been initialized. */
144 storage_init();
145
146 /* And put the disk into sleep immediately. */
147 storage_sleepnow();
148 }
149
150 /* Backlight OFF */
151 _backlight_off();
152 __reset_cookie();
153
Marcin Bukat28d54c62010-04-26 21:40:16 +0000154 power_off();
Marcin Bukat28d54c62010-04-26 21:40:16 +0000155}
156
157/* Print the battery voltage (and a warning message). */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000158static void check_battery(void)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000159{
160
161 int battery_voltage, batt_int, batt_frac;
162
163 battery_voltage = battery_adc_voltage();
164 batt_int = battery_voltage / 1000;
165 batt_frac = (battery_voltage % 1000) / 10;
166
167 printf("Battery: %d.%02dV", batt_int, batt_frac);
168
169 if (battery_voltage <= 3500)
170 {
171 printf("WARNING! BATTERY LOW!!");
172 sleep(HZ*2);
173 }
174
175}
176
177
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000178static void lcd_putstring_centered(const char *string)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000179{
180 int w,h;
181 font_getstringsize(string, &w, &h, FONT_SYSFIXED);
182 lcd_putsxy((LCD_WIDTH-w)/2, (LCD_HEIGHT-h)/2, string);
183}
184
Marcin Bukata73102f2010-12-06 10:24:29 +0000185/* This function initializes ATA driver, mounts partitions,
186 * loads rockbox image from disk to ram and finally
187 * jumps to entry point in ram
188 */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000189static void rb_boot(void)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000190{
191 int rc;
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000192
Marcin Bukat57484bd2010-07-06 17:30:10 +0000193 /* boost to speedup rb image loading */
194 cpu_boost(true);
195
Marcin Bukata73102f2010-12-06 10:24:29 +0000196 reset_screen();
Marcin Bukat15a0a3c2010-11-28 23:10:09 +0000197 printf("Rockbox boot loader");
198 printf("Version " RBVERSION);
199
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000200 rc = storage_init();
201 if(rc)
202 {
203 printf("ATA error: %d", rc);
204 sleep(HZ*5);
205 return;
206 }
207
208 disk_init();
209
210 rc = disk_mount_all();
211 if (rc<=0)
212 {
213 printf("No partition found");
214 sleep(HZ*5);
215 return;
216 }
217
218 printf("Loading firmware");
219
220 rc = load_firmware((unsigned char *)DRAM_START,
221 BOOTFILE, MAX_LOADSIZE);
222
223 if (rc < EOK)
224 {
225 printf("Error!");
226 printf("Can't load " BOOTFILE ": ");
227 printf("Result: %s", strerror(rc));
228 sleep(HZ*5);
229 return;
230 }
231
Marcin Bukat57484bd2010-07-06 17:30:10 +0000232 cpu_boost(false);
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000233 start_rockbox();
234}
235
Marcin Bukata73102f2010-12-06 10:24:29 +0000236/* This function prints small bootmenu where
237 * you can choose to boot OF, rockbox or just shutdown
238 */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000239static void bootmenu(void)
240{
Marcin Bukat28d54c62010-04-26 21:40:16 +0000241 enum option_t i;
242 enum option_t option = rockbox;
243 int button;
244 const char select[] = "->";
245 long start_tick = current_tick;
246
247 /* backbone of menu */
248 /* run the loader */
249 printf("Rockbox boot loader");
Rafaël Carré5d236b22010-05-27 09:41:46 +0000250 printf("Ver: " RBVERSION);
Marcin Bukat28d54c62010-04-26 21:40:16 +0000251
252 check_battery();
253
254 printf("");
255 printf("=========================");
256
257 line += BOOTMENU_OPTIONS+2; /* skip lines */
258
259 printf("=========================");
260 printf("");
Marcin Bukat650a2942010-11-02 10:51:04 +0000261 printf(" [FF] [REW] to move ");
Marcin Bukat28d54c62010-04-26 21:40:16 +0000262 printf(" [PLAY] to confirm ");
263
264 /* content of menu and keys handling */
265 while (TIME_BEFORE(current_tick,start_tick + BOOTMENU_TIMEOUT))
266 {
267 /* Draw the menu. */
268 line = 6; /* move below header */
269
270 for (i=0;i<BOOTMENU_OPTIONS;i++)
271 {
272 if (i != option)
273 printf(" %s",bootmenu_options[i]);
274 else
275 printf("%s %s",select,bootmenu_options[i]);
276 }
277
278 line = 15;
279
280 printf("Time left: %ds",(BOOTMENU_TIMEOUT -
281 (current_tick - start_tick))/HZ);
282
283 lcd_update();
284
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000285 button = BUTTON_NONE;
Marcin Bukat28d54c62010-04-26 21:40:16 +0000286 button = button_get_w_tmo(HZ);
287
288 switch (button)
289 {
Marcin Bukat650a2942010-11-02 10:51:04 +0000290 case BUTTON_REW:
Marcin Bukat9a248922010-11-26 23:28:08 +0000291#ifdef MPIO_HD200
Marcin Bukat650a2942010-11-02 10:51:04 +0000292 case BUTTON_RC_REW:
Marcin Bukat9a248922010-11-26 23:28:08 +0000293#endif
Marcin Bukat28d54c62010-04-26 21:40:16 +0000294 if (option > rockbox)
295 option--;
296 else
297 option = shutdown;
298 break;
299
Marcin Bukat650a2942010-11-02 10:51:04 +0000300 case BUTTON_FF:
Marcin Bukat9a248922010-11-26 23:28:08 +0000301#ifdef MPIO_HD200
Marcin Bukat650a2942010-11-02 10:51:04 +0000302 case BUTTON_RC_FF:
Marcin Bukat9a248922010-11-26 23:28:08 +0000303#endif
Marcin Bukat28d54c62010-04-26 21:40:16 +0000304 if (option < shutdown)
305 option++;
306 else
307 option = rockbox;
308 break;
309
310 case BUTTON_PLAY:
Marcin Bukat9a248922010-11-26 23:28:08 +0000311#ifdef MPIO_HD200
Marcin Bukat57484bd2010-07-06 17:30:10 +0000312 case BUTTON_RC_PLAY:
Marcin Bukat28d54c62010-04-26 21:40:16 +0000313 case (BUTTON_PLAY|BUTTON_REC):
Marcin Bukat9a248922010-11-26 23:28:08 +0000314#endif
Marcin Bukat28d54c62010-04-26 21:40:16 +0000315 reset_screen();
316
317 switch (option)
318 {
319 case rockbox:
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000320 rb_boot();
Marcin Bukat28d54c62010-04-26 21:40:16 +0000321 break;
322
323 case mpio_firmware:
324 start_mpio_firmware();
325 break;
326
327 default:
Marcin Bukata73102f2010-12-06 10:24:29 +0000328 __shutdown();
Marcin Bukat28d54c62010-04-26 21:40:16 +0000329 break;
330 }
331 }
332}
333/* timeout */
Marcin Bukat28d54c62010-04-26 21:40:16 +0000334}
335
336void main(void)
337{
338 /* messages */
339 const char usb_connect_msg[] = "Bootloader USB mode";
340 const char charging_msg[] = "Charging...";
341 const char complete_msg[] = "Charging complete";
Marcin Bukat28d54c62010-04-26 21:40:16 +0000342
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000343 /* helper variable for messages */
Marcin Bukat28d54c62010-04-26 21:40:16 +0000344 bool blink_toggle = false;
Marcin Bukat28d54c62010-04-26 21:40:16 +0000345
Marcin Bukat28d54c62010-04-26 21:40:16 +0000346 int button;
Marcin Bukat67feb812011-01-03 13:11:48 +0000347
348 /* hold status variables
349 * this two must have different
350 * values in the begining
351 */
352 bool hold = false;
353 bool last_hold = true;
354
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000355 unsigned int event = EVENT_NONE;
356 unsigned int last_event = EVENT_NONE;
Marcin Bukat28d54c62010-04-26 21:40:16 +0000357
Marcin Bukat57484bd2010-07-06 17:30:10 +0000358 /* this is default mode after power_init() */
359 bool high_current_charging = true;
360
Marcin Bukat38edf672010-10-22 12:11:58 +0000361 /* setup GPIOs related to power functions */
Marcin Bukat28d54c62010-04-26 21:40:16 +0000362 power_init();
363
364 system_init();
365 kernel_init();
366
Marcin Bukat38edf672010-10-22 12:11:58 +0000367 /* run at 45MHz */
Marcin Bukat28d54c62010-04-26 21:40:16 +0000368 set_cpu_frequency(CPUFREQ_NORMAL);
Marcin Bukat28d54c62010-04-26 21:40:16 +0000369
Marcin Bukat38edf672010-10-22 12:11:58 +0000370 /* IRQs are needed by button driver */
Marcin Bukat28d54c62010-04-26 21:40:16 +0000371 enable_irq();
Marcin Bukat38edf672010-10-22 12:11:58 +0000372
Marcin Bukat28d54c62010-04-26 21:40:16 +0000373 lcd_init();
374
Marcin Bukat67feb812011-01-03 13:11:48 +0000375 /* setup font system */
Marcin Bukat28d54c62010-04-26 21:40:16 +0000376 font_init();
377 lcd_setfont(FONT_SYSFIXED);
Marcin Bukat38edf672010-10-22 12:11:58 +0000378
Marcin Bukat67feb812011-01-03 13:11:48 +0000379 /* buttons reading init */
Marcin Bukat28d54c62010-04-26 21:40:16 +0000380 adc_init();
381 button_init();
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000382
Marcin Bukat28d54c62010-04-26 21:40:16 +0000383 usb_init();
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000384 cpu_idle_mode(true);
Marcin Bukat28d54c62010-04-26 21:40:16 +0000385
Marcin Bukat67feb812011-01-03 13:11:48 +0000386 /* lowlevel init only */
387 _backlight_init();
388
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000389 /* Handle wakeup event. Possibilities are:
Marcin Bukata73102f2010-12-06 10:24:29 +0000390 * RTC alarm (HD300)
391 * ON button (PLAY or RC_PLAY on HD200)
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000392 * USB insert
393 * AC charger plug
394 */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000395 while(1)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000396 {
Marcin Bukat67feb812011-01-03 13:11:48 +0000397 /* check hold status */
398 hold = button_hold();
399
400 /* backlight handling
401 * change only on hold toggle */
402 if ( hold != last_hold )
403 {
404 if ( hold )
405 _backlight_hw_off();
406 else
407 _backlight_hw_on();
408
409 last_hold = hold;
410 }
411
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000412 /* read buttons */
413 event = EVENT_NONE;
414 button = button_get_w_tmo(HZ);
Marcin Bukat28d54c62010-04-26 21:40:16 +0000415
Marcin Bukat9a248922010-11-26 23:28:08 +0000416 if ( (button & BUTTON_PLAY)
417#ifdef MPIO_HD200
418 || (button & BUTTON_RC_PLAY)
419#endif
420 )
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000421 event |= EVENT_ON;
422
423 if ( usb_detect() == USB_INSERTED )
424 event |= EVENT_USB;
Marcin Bukat28d54c62010-04-26 21:40:16 +0000425
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000426 if ( _charger_inserted() )
427 event |= EVENT_AC;
Marcin Bukata73102f2010-12-06 10:24:29 +0000428#ifdef MPIO_HD300
429 if ( _rtc_alarm() )
430 event |= EVENT_RTC;
431#endif
Marcin Bukat67feb812011-01-03 13:11:48 +0000432
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000433 reset_screen();
434 switch (event)
Marcin Bukat28d54c62010-04-26 21:40:16 +0000435 {
Marcin Bukata73102f2010-12-06 10:24:29 +0000436#ifdef MPIO_HD300
437 case EVENT_RTC:
438 case (EVENT_RTC | EVENT_ON):
439 /* start regardles of buttons state */
440 rb_boot();
441 break;
442#endif
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000443 case EVENT_ON:
444 case (EVENT_ON | EVENT_AC):
445 /* hold is handled in button driver */
Marcin Bukata73102f2010-12-06 10:24:29 +0000446 cpu_idle_mode(false);
447 ide_power_enable(true);
Marcin Bukat28d54c62010-04-26 21:40:16 +0000448
Marcin Bukata73102f2010-12-06 10:24:29 +0000449 if (button & BUTTON_REC)
450 bootmenu();
451 else
452 rb_boot();
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000453
Marcin Bukat28d54c62010-04-26 21:40:16 +0000454 break;
455
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000456 case EVENT_AC:
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000457 /* AC plug in */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000458 if (!(last_event & EVENT_AC))
Marcin Bukatcd879712010-06-14 10:42:45 +0000459 {
Marcin Bukat57484bd2010-07-06 17:30:10 +0000460 /* reset charging circuit */
Marcin Bukatcd879712010-06-14 10:42:45 +0000461 and_l(~(1<<23), &GPIO_ENABLE);
462 }
Marcin Bukat28d54c62010-04-26 21:40:16 +0000463
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000464 /* USB unplug */
465 if (last_event & EVENT_USB)
Marcin Bukatcd879712010-06-14 10:42:45 +0000466 {
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000467 usb_enable(false);
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000468 sleep(HZ);
Marcin Bukatcd879712010-06-14 10:42:45 +0000469 ide_power_enable(false);
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000470 sleep(HZ);
Marcin Bukatcd879712010-06-14 10:42:45 +0000471 }
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000472
Marcin Bukat28d54c62010-04-26 21:40:16 +0000473 if(!_battery_full())
474 {
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000475 if (blink_toggle)
476 lcd_putstring_centered(charging_msg);
477
Marcin Bukat28d54c62010-04-26 21:40:16 +0000478 blink_toggle = !blink_toggle;
Marcin Bukat28d54c62010-04-26 21:40:16 +0000479 }
Marcin Bukat57484bd2010-07-06 17:30:10 +0000480 else /* end of charge condition */
Marcin Bukat28d54c62010-04-26 21:40:16 +0000481 {
Marcin Bukat57484bd2010-07-06 17:30:10 +0000482 /* put LTC1733 into shutdown mode */
483 or_l((1<<23), &GPIO_ENABLE);
484
485 if (high_current_charging)
486 {
487 /* switch to low current mode */
488 and_l(~(1<<15), &GPIO_OUT);
489
490 /* reset charging circuit */
491 and_l(~(1<<23), &GPIO_ENABLE);
492
493 high_current_charging = false;
494 }
495 else
496 {
497 lcd_putstring_centered(complete_msg);
498 }
Marcin Bukat28d54c62010-04-26 21:40:16 +0000499 }
Marcin Bukat28d54c62010-04-26 21:40:16 +0000500 check_battery();
501 break;
Marcin Bukat28d54c62010-04-26 21:40:16 +0000502
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000503 case EVENT_USB:
504 case (EVENT_USB | EVENT_AC):
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000505 /* AC plug in while in USB mode */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000506 if (!(last_event & EVENT_AC))
Marcin Bukatcd879712010-06-14 10:42:45 +0000507 {
Marcin Bukat57484bd2010-07-06 17:30:10 +0000508 /* reset charger circuit */
Marcin Bukatcd879712010-06-14 10:42:45 +0000509 and_l(~(1<<23), &GPIO_ENABLE);
510 }
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000511
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000512 /* USB plug in */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000513 if (!(last_event & EVENT_USB))
514 {
515 /* init USB */
516 ide_power_enable(true);
517 sleep(HZ/20);
Marcin Bukat0358e7b2010-12-09 11:31:08 +0000518 ata_enable(false);
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000519 usb_enable(true);
520 }
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000521
522 /* display blinking USB indicator */
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000523 line = 0;
524
525 if (blink_toggle)
526 lcd_putstring_centered(usb_connect_msg);
527
528 check_battery();
529 blink_toggle = !blink_toggle;
530 storage_spin();
531 break;
532
533 default:
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000534 /* USB unplug */
Marcin Bukat57484bd2010-07-06 17:30:10 +0000535 if (last_event & EVENT_USB)
536 {
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000537 /* disable USB */
Marcin Bukat57484bd2010-07-06 17:30:10 +0000538 usb_enable(false);
Marcin Bukat0358e7b2010-12-09 11:31:08 +0000539 ata_enable(true);
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000540 sleep(HZ);
Marcin Bukat57484bd2010-07-06 17:30:10 +0000541 ide_power_enable(false);
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000542 sleep(HZ);
Marcin Bukat57484bd2010-07-06 17:30:10 +0000543 }
544
Marcin Bukat78d54fa2010-07-09 09:12:51 +0000545 /* spurious wakeup ?*/
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000546 __shutdown();
547 break;
Marcin Bukat28d54c62010-04-26 21:40:16 +0000548 }
Marcin Bukat28d54c62010-04-26 21:40:16 +0000549 lcd_update();
Marcin Bukat69fa42d2010-05-04 11:16:17 +0000550 last_event = event;
Marcin Bukat28d54c62010-04-26 21:40:16 +0000551 }
552
Marcin Bukat28d54c62010-04-26 21:40:16 +0000553}
554
555/* These functions are present in the firmware library, but we reimplement
556 them here because the originals do a lot more than we want */
557void screen_dump(void)
558{
559}