diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/power.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index 3522ad4232..8117f12902 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c | |||
@@ -16,9 +16,9 @@ | |||
16 | * KIND, either express or implied. | 16 | * KIND, either express or implied. |
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include "sh7034.h" | ||
20 | #include <stdbool.h> | ||
21 | #include "config.h" | 19 | #include "config.h" |
20 | #include "cpu.h" | ||
21 | #include <stdbool.h> | ||
22 | #include "adc.h" | 22 | #include "adc.h" |
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
@@ -36,6 +36,9 @@ static int fmstatus = 0; | |||
36 | 36 | ||
37 | void radio_set_status(int status) | 37 | void radio_set_status(int status) |
38 | { | 38 | { |
39 | #ifdef IRIVER_H100 | ||
40 | fmstatus = status; | ||
41 | #else | ||
39 | fmstatus = status; | 42 | fmstatus = status; |
40 | #ifdef HAVE_TUNER_PWR_CTRL | 43 | #ifdef HAVE_TUNER_PWR_CTRL |
41 | if (status) | 44 | if (status) |
@@ -46,6 +49,7 @@ void radio_set_status(int status) | |||
46 | else | 49 | else |
47 | or_b(0x04, &PADRL); /* drive PA2 high for tuner disable */ | 50 | or_b(0x04, &PADRL); /* drive PA2 high for tuner disable */ |
48 | #endif | 51 | #endif |
52 | #endif | ||
49 | } | 53 | } |
50 | 54 | ||
51 | int radio_get_status(void) | 55 | int radio_get_status(void) |
@@ -59,6 +63,15 @@ int radio_get_status(void) | |||
59 | 63 | ||
60 | void power_init(void) | 64 | void power_init(void) |
61 | { | 65 | { |
66 | #ifdef IRIVER_H100 | ||
67 | GPIO1_OUT |= 0x00080000; | ||
68 | GPIO1_ENABLE |= 0x00080000; | ||
69 | GPIO1_FUNCTION |= 0x00080000; | ||
70 | |||
71 | GPIO_OUT |= 0x80000000; | ||
72 | GPIO_ENABLE |= 0x80000000; | ||
73 | GPIO_FUNCTION |= 0x80000000; | ||
74 | #else | ||
62 | #ifdef HAVE_CHARGE_CTRL | 75 | #ifdef HAVE_CHARGE_CTRL |
63 | or_b(0x20, &PBIORL); /* Set charging control bit to output */ | 76 | or_b(0x20, &PBIORL); /* Set charging control bit to output */ |
64 | charger_enable(false); /* Default to charger OFF */ | 77 | charger_enable(false); /* Default to charger OFF */ |
@@ -68,10 +81,14 @@ void power_init(void) | |||
68 | or_b(0x04, &PADRL); /* drive PA2 high for tuner disable */ | 81 | or_b(0x04, &PADRL); /* drive PA2 high for tuner disable */ |
69 | or_b(0x04, &PAIORL); /* output for PA2 */ | 82 | or_b(0x04, &PAIORL); /* output for PA2 */ |
70 | #endif | 83 | #endif |
84 | #endif | ||
71 | } | 85 | } |
72 | 86 | ||
73 | bool charger_inserted(void) | 87 | bool charger_inserted(void) |
74 | { | 88 | { |
89 | #ifdef IRIVER_H100 | ||
90 | return (GPIO1_READ & 0x00400000)?true:false; | ||
91 | #else | ||
75 | #ifdef HAVE_CHARGING | 92 | #ifdef HAVE_CHARGING |
76 | #ifdef HAVE_CHARGE_CTRL | 93 | #ifdef HAVE_CHARGE_CTRL |
77 | /* Recorder */ | 94 | /* Recorder */ |
@@ -90,6 +107,7 @@ bool charger_inserted(void) | |||
90 | /* Ondio */ | 107 | /* Ondio */ |
91 | return false; | 108 | return false; |
92 | #endif /* HAVE_CHARGING */ | 109 | #endif /* HAVE_CHARGING */ |
110 | #endif | ||
93 | } | 111 | } |
94 | 112 | ||
95 | void charger_enable(bool on) | 113 | void charger_enable(bool on) |
@@ -113,8 +131,14 @@ void charger_enable(bool on) | |||
113 | void ide_power_enable(bool on) | 131 | void ide_power_enable(bool on) |
114 | { | 132 | { |
115 | (void)on; | 133 | (void)on; |
116 | bool touched = false; | ||
117 | 134 | ||
135 | #ifdef IRIVER_H100 | ||
136 | if(on) | ||
137 | GPIO_OUT &= ~0x80000000; | ||
138 | else | ||
139 | GPIO_OUT |= 0x80000000; | ||
140 | #else | ||
141 | bool touched = false; | ||
118 | #ifdef NEEDS_ATA_POWER_ON | 142 | #ifdef NEEDS_ATA_POWER_ON |
119 | if(on) | 143 | if(on) |
120 | { | 144 | { |
@@ -150,12 +174,16 @@ void ide_power_enable(bool on) | |||
150 | PACR2 &= 0xFBFF; /* GPIO for PA5 */ | 174 | PACR2 &= 0xFBFF; /* GPIO for PA5 */ |
151 | #endif | 175 | #endif |
152 | } | 176 | } |
177 | #endif | ||
153 | } | 178 | } |
154 | #endif /* !HAVE_MMC */ | 179 | #endif /* !HAVE_MMC */ |
155 | 180 | ||
156 | 181 | ||
157 | bool ide_powered(void) | 182 | bool ide_powered(void) |
158 | { | 183 | { |
184 | #ifdef IRIVER_H100 | ||
185 | return (GPIO_OUT & 0x80000000)?true:false; | ||
186 | #else | ||
159 | #if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) | 187 | #if defined(NEEDS_ATA_POWER_ON) || defined(HAVE_ATA_POWER_OFF) |
160 | #ifdef ATA_POWER_PLAYERSTYLE | 188 | #ifdef ATA_POWER_PLAYERSTYLE |
161 | /* This is not correct for very old players, since these are unable to | 189 | /* This is not correct for very old players, since these are unable to |
@@ -174,12 +202,16 @@ bool ide_powered(void) | |||
174 | #else | 202 | #else |
175 | return true; /* pretend always powered if not controlable */ | 203 | return true; /* pretend always powered if not controlable */ |
176 | #endif | 204 | #endif |
205 | #endif | ||
177 | } | 206 | } |
178 | 207 | ||
179 | 208 | ||
180 | void power_off(void) | 209 | void power_off(void) |
181 | { | 210 | { |
182 | set_irq_level(HIGHEST_IRQ_LEVEL); | 211 | set_irq_level(HIGHEST_IRQ_LEVEL); |
212 | #ifdef IRIVER_H100 | ||
213 | GPIO1_OUT &= ~0x00080000; | ||
214 | #else | ||
183 | #ifdef HAVE_POWEROFF_ON_PBDR | 215 | #ifdef HAVE_POWEROFF_ON_PBDR |
184 | and_b(~0x10, &PBDRL); | 216 | and_b(~0x10, &PBDRL); |
185 | or_b(0x10, &PBIORL); | 217 | or_b(0x10, &PBIORL); |
@@ -193,6 +225,7 @@ void power_off(void) | |||
193 | and_b(~0x08, &PADRH); | 225 | and_b(~0x08, &PADRH); |
194 | or_b(0x08, &PAIORH); | 226 | or_b(0x08, &PAIORH); |
195 | #endif | 227 | #endif |
228 | #endif | ||
196 | while(1); | 229 | while(1); |
197 | } | 230 | } |
198 | 231 | ||