diff options
Diffstat (limited to 'firmware/target/sh/archos/player/power-player.c')
-rw-r--r-- | firmware/target/sh/archos/player/power-player.c | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/firmware/target/sh/archos/player/power-player.c b/firmware/target/sh/archos/player/power-player.c deleted file mode 100644 index 33f5959021..0000000000 --- a/firmware/target/sh/archos/player/power-player.c +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
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 | #include "cpu.h" | ||
23 | #include <stdbool.h> | ||
24 | #include "kernel.h" | ||
25 | #include "system.h" | ||
26 | #include "power.h" | ||
27 | #include "usb.h" | ||
28 | |||
29 | void power_init(void) | ||
30 | { | ||
31 | } | ||
32 | |||
33 | unsigned int power_input_status(void) | ||
34 | { | ||
35 | /* Player */ | ||
36 | return ((PADR & 1) == 0) ? | ||
37 | POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE; | ||
38 | } | ||
39 | |||
40 | void ide_power_enable(bool on) | ||
41 | { | ||
42 | bool touched = false; | ||
43 | |||
44 | if(on) | ||
45 | { | ||
46 | or_b(0x10, &PBDRL); | ||
47 | touched = true; | ||
48 | } | ||
49 | #ifdef HAVE_ATA_POWER_OFF | ||
50 | if(!on) | ||
51 | { | ||
52 | and_b(~0x10, &PBDRL); | ||
53 | touched = true; | ||
54 | } | ||
55 | #endif /* HAVE_ATA_POWER_OFF */ | ||
56 | |||
57 | /* late port preparation, else problems with read/modify/write | ||
58 | of other bits on same port, while input and floating high */ | ||
59 | if (touched) | ||
60 | { | ||
61 | or_b(0x10, &PBIORL); /* PB4 is an output */ | ||
62 | PBCR2 &= ~0x0300; /* GPIO for PB4 */ | ||
63 | } | ||
64 | } | ||
65 | |||
66 | |||
67 | bool ide_powered(void) | ||
68 | { | ||
69 | /* This is not correct for very old players, since these are unable to | ||
70 | * control hd power. However, driving the pin doesn't hurt, because it | ||
71 | * is not connected anywhere */ | ||
72 | if ((PBCR2 & 0x0300) || !(PBIORL & 0x10)) /* not configured for output */ | ||
73 | return false; /* would be floating low, disk off */ | ||
74 | else | ||
75 | return (PBDRL & 0x10) != 0; | ||
76 | } | ||
77 | |||
78 | void power_off(void) | ||
79 | { | ||
80 | disable_irq(); | ||
81 | and_b(~0x08, &PADRH); | ||
82 | or_b(0x08, &PAIORH); | ||
83 | while(1); | ||
84 | } | ||