diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2006-10-05 10:58:51 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2006-10-05 10:58:51 +0000 |
commit | d4945dc0d07b23eced900075e8748ccc7fb3e424 (patch) | |
tree | 4d67d49b4c036a841fb1ffe2e5f3a267bb9309d0 | |
parent | 1d69db7355dc7e3cbabc3c1c949e5d6ba3863405 (diff) | |
download | rockbox-d4945dc0d07b23eced900075e8748ccc7fb3e424.tar.gz rockbox-d4945dc0d07b23eced900075e8748ccc7fb3e424.zip |
Move all iPod targets into the target tree. FS#5890
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11129 a1c6a512-1295-4272-9138-f99709370657
33 files changed, 1395 insertions, 649 deletions
diff --git a/firmware/FILES b/firmware/FILES index a9d567cd0c..e153f05fed 100644 --- a/firmware/FILES +++ b/firmware/FILES | |||
@@ -21,3 +21,5 @@ target/arm/sandisk/sansa-e200/*.[chS] | |||
21 | target/arm/iriver/h10/*.[chS] | 21 | target/arm/iriver/h10/*.[chS] |
22 | target/arm/gigabeat/meg-fx/*.[chS] | 22 | target/arm/gigabeat/meg-fx/*.[chS] |
23 | target/arm/tatung/tpj1022/*.[chS] | 23 | target/arm/tatung/tpj1022/*.[chS] |
24 | target/arm/ipod/*.[chS] | ||
25 | target/arm/ipod/3g/*.[chS] | ||
diff --git a/firmware/SOURCES b/firmware/SOURCES index bfbad42be9..96af8d3d38 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -87,13 +87,6 @@ drivers/lcd-h100-remote.c | |||
87 | drivers/lcd-remote-2bit-vi.c | 87 | drivers/lcd-remote-2bit-vi.c |
88 | #endif | 88 | #endif |
89 | #endif | 89 | #endif |
90 | #if CONFIG_LCD==LCD_IPODNANO || CONFIG_LCD==LCD_IPODCOLOR \ | ||
91 | || CONFIG_LCD == LCD_IPOD2BPP || CONFIG_LCD == LCD_IPODMINI | ||
92 | drivers/lcd-ipod.c | ||
93 | #endif | ||
94 | #if CONFIG_LCD==LCD_IPODVIDEO | ||
95 | drivers/lcd-ipodvideo.c | ||
96 | #endif | ||
97 | #if CONFIG_LCD==LCD_H300 | 90 | #if CONFIG_LCD==LCD_H300 |
98 | drivers/lcd-h300.c | 91 | drivers/lcd-h300.c |
99 | #endif | 92 | #endif |
@@ -318,3 +311,95 @@ target/arm/tatung/tpj1022/lcd-tpj1022.c | |||
318 | target/arm/tatung/tpj1022/adc-tpj1022.c | 311 | target/arm/tatung/tpj1022/adc-tpj1022.c |
319 | #endif | 312 | #endif |
320 | #endif | 313 | #endif |
314 | |||
315 | #ifdef IPOD_4G | ||
316 | #ifndef SIMULATOR | ||
317 | drivers/lcd-ipod.c | ||
318 | drivers/pcf50605.c | ||
319 | target/arm/ata-pp5020.c | ||
320 | target/arm/ipod/adc-ipod.c | ||
321 | target/arm/ipod/backlight-4g_color.c | ||
322 | target/arm/ipod/button-clickwheel.c | ||
323 | target/arm/ipod/power-ipod.c | ||
324 | target/arm/ipod/usb-ipod.c | ||
325 | #endif | ||
326 | #endif | ||
327 | |||
328 | #ifdef IPOD_COLOR | ||
329 | #ifndef SIMULATOR | ||
330 | drivers/lcd-ipod.c | ||
331 | drivers/pcf50605.c | ||
332 | target/arm/ata-pp5020.c | ||
333 | target/arm/ipod/adc-ipod.c | ||
334 | target/arm/ipod/backlight-4g_color.c | ||
335 | target/arm/ipod/button-clickwheel.c | ||
336 | target/arm/ipod/power-ipod.c | ||
337 | target/arm/ipod/usb-ipod.c | ||
338 | #endif | ||
339 | #endif | ||
340 | |||
341 | #ifdef IPOD_NANO | ||
342 | #ifndef SIMULATOR | ||
343 | drivers/lcd-ipod.c | ||
344 | drivers/pcf50605.c | ||
345 | target/arm/ata-pp5020.c | ||
346 | target/arm/ipod/adc-ipod.c | ||
347 | target/arm/ipod/backlight-nano_video.c | ||
348 | target/arm/ipod/button-clickwheel.c | ||
349 | target/arm/ipod/power-ipod.c | ||
350 | target/arm/ipod/usb-ipod.c | ||
351 | #endif | ||
352 | #endif | ||
353 | |||
354 | #ifdef IPOD_VIDEO | ||
355 | #ifndef SIMULATOR | ||
356 | drivers/pcf50605.c | ||
357 | target/arm/ata-pp5020.c | ||
358 | target/arm/ipod/adc-ipod.c | ||
359 | target/arm/ipod/backlight-nano_video.c | ||
360 | target/arm/ipod/button-clickwheel.c | ||
361 | target/arm/ipod/power-ipod.c | ||
362 | target/arm/ipod/usb-ipod.c | ||
363 | drivers/lcd-ipodvideo.c | ||
364 | #endif | ||
365 | #endif | ||
366 | |||
367 | #ifdef IPOD_3G | ||
368 | #ifndef SIMULATOR | ||
369 | drivers/lcd-ipod.c | ||
370 | drivers/pcf50605.c | ||
371 | target/arm/ata-pp5020.c | ||
372 | target/arm/ipod/adc-ipod.c | ||
373 | target/arm/ipod/3g/backlight-3g.c | ||
374 | target/arm/ipod/3g/button-3g.c | ||
375 | target/arm/ipod/power-ipod.c | ||
376 | target/arm/ipod/usb-ipod.c | ||
377 | #endif | ||
378 | #endif | ||
379 | |||
380 | #ifdef IPOD_MINI | ||
381 | #ifndef SIMULATOR | ||
382 | drivers/lcd-ipod.c | ||
383 | drivers/pcf50605.c | ||
384 | target/arm/ata-pp5020.c | ||
385 | target/arm/ipod/adc-ipod.c | ||
386 | target/arm/ipod/backlight-mini1g_mini2g.c | ||
387 | target/arm/ipod/button-mini1g.c | ||
388 | target/arm/ipod/power-ipod.c | ||
389 | target/arm/ipod/usb-ipod.c | ||
390 | #endif | ||
391 | #endif | ||
392 | |||
393 | |||
394 | #ifdef IPOD_MINI2G | ||
395 | #ifndef SIMULATOR | ||
396 | drivers/lcd-ipod.c | ||
397 | drivers/pcf50605.c | ||
398 | target/arm/ata-pp5020.c | ||
399 | target/arm/ipod/adc-ipod.c | ||
400 | target/arm/ipod/backlight-mini1g_mini2g.c | ||
401 | target/arm/ipod/button-clickwheel.c | ||
402 | target/arm/ipod/power-ipod.c | ||
403 | target/arm/ipod/usb-ipod.c | ||
404 | #endif | ||
405 | #endif | ||
diff --git a/firmware/backlight.c b/firmware/backlight.c index 5e1f5922cd..997e26daa7 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c | |||
@@ -77,23 +77,6 @@ static inline void __backlight_on(void) | |||
77 | or_b(0x40, &PADRH); /* drive it high */ | 77 | or_b(0x40, &PADRH); /* drive it high */ |
78 | #elif CONFIG_BACKLIGHT == BL_GMINI | 78 | #elif CONFIG_BACKLIGHT == BL_GMINI |
79 | P1 |= 0x10; | 79 | P1 |= 0x10; |
80 | #elif CONFIG_BACKLIGHT == BL_IPOD4G | ||
81 | /* brightness full */ | ||
82 | outl(0x80000000 | (0xff << 16), 0x7000a010); | ||
83 | |||
84 | /* set port b bit 3 on */ | ||
85 | outl(((0x100 | 1) << 3), 0x6000d824); | ||
86 | #elif CONFIG_BACKLIGHT==BL_IPODMINI | ||
87 | /* set port B03 on */ | ||
88 | outl(((0x100 | 1) << 3), 0x6000d824); | ||
89 | #elif CONFIG_BACKLIGHT==BL_IPODNANO | ||
90 | /* set port B03 on */ | ||
91 | outl(((0x100 | 1) << 3), 0x6000d824); | ||
92 | |||
93 | /* set port L07 on */ | ||
94 | outl(((0x100 | 1) << 7), 0x6000d12c); | ||
95 | #elif CONFIG_BACKLIGHT==BL_IPOD3G | ||
96 | outl(inl(0xc0001000) | 0x02, 0xc0001000); | ||
97 | #elif CONFIG_BACKLIGHT==BL_IRIVER_IFP7XX | 80 | #elif CONFIG_BACKLIGHT==BL_IRIVER_IFP7XX |
98 | GPIO3_SET = 1; | 81 | GPIO3_SET = 1; |
99 | #endif | 82 | #endif |
@@ -115,23 +98,8 @@ static inline void __backlight_off(void) | |||
115 | and_b(~0x40, &PADRH); /* drive it low */ | 98 | and_b(~0x40, &PADRH); /* drive it low */ |
116 | #elif CONFIG_BACKLIGHT == BL_GMINI | 99 | #elif CONFIG_BACKLIGHT == BL_GMINI |
117 | P1 &= ~0x10; | 100 | P1 &= ~0x10; |
118 | #elif CONFIG_BACKLIGHT == BL_IPOD4G | ||
119 | /* fades backlight off on 4g */ | ||
120 | outl(inl(0x70000084) & ~0x2000000, 0x70000084); | ||
121 | outl(0x80000000, 0x7000a010); | ||
122 | #elif CONFIG_BACKLIGHT==BL_IPODNANO | ||
123 | /* set port B03 off */ | ||
124 | outl(((0x100 | 0) << 3), 0x6000d824); | ||
125 | |||
126 | /* set port L07 off */ | ||
127 | outl(((0x100 | 0) << 7), 0x6000d12c); | ||
128 | #elif CONFIG_BACKLIGHT==BL_IRIVER_IFP7XX | 101 | #elif CONFIG_BACKLIGHT==BL_IRIVER_IFP7XX |
129 | GPIO3_CLR = 1; | 102 | GPIO3_CLR = 1; |
130 | #elif CONFIG_BACKLIGHT==BL_IPOD3G | ||
131 | outl(inl(0xc0001000) & ~0x02, 0xc0001000); | ||
132 | #elif CONFIG_BACKLIGHT==BL_IPODMINI | ||
133 | /* set port B03 off */ | ||
134 | outl(((0x100 | 0) << 3), 0x6000d824); | ||
135 | #endif | 103 | #endif |
136 | } | 104 | } |
137 | #endif | 105 | #endif |
diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c index d00f89958a..9e6ed19e4b 100644 --- a/firmware/drivers/adc.c +++ b/firmware/drivers/adc.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include "thread.h" | 23 | #include "thread.h" |
24 | #include "string.h" | 24 | #include "string.h" |
25 | #include "adc.h" | 25 | #include "adc.h" |
26 | #include "pcf50605.h" | ||
27 | #include "pcf50606.h" | 26 | #include "pcf50606.h" |
28 | 27 | ||
29 | #if CONFIG_CPU == SH7034 | 28 | #if CONFIG_CPU == SH7034 |
@@ -285,62 +284,6 @@ void adc_init(void) | |||
285 | sleep(2); /* Ensure valid readings when adc_init returns */ | 284 | sleep(2); /* Ensure valid readings when adc_init returns */ |
286 | } | 285 | } |
287 | 286 | ||
288 | #elif defined(IPOD_ARCH) | ||
289 | |||
290 | struct adc_struct { | ||
291 | long timeout; | ||
292 | void (*conversion)(unsigned short *data); | ||
293 | short channelnum; | ||
294 | unsigned short data; | ||
295 | }; | ||
296 | |||
297 | static struct adc_struct adcdata[NUM_ADC_CHANNELS] IDATA_ATTR; | ||
298 | |||
299 | static unsigned short _adc_read(struct adc_struct *adc) | ||
300 | { | ||
301 | if (adc->timeout < current_tick) { | ||
302 | unsigned char data[2]; | ||
303 | unsigned short value; | ||
304 | /* 5x per 2 seconds */ | ||
305 | adc->timeout = current_tick + (HZ * 2 / 5); | ||
306 | |||
307 | /* ADCC1, 10 bit, start */ | ||
308 | pcf50605_write(0x2f, (adc->channelnum << 1) | 0x1); | ||
309 | pcf50605_read_multiple(0x30, data, 2); /* ADCS1, ADCS2 */ | ||
310 | value = data[0]; | ||
311 | value <<= 2; | ||
312 | value |= data[1] & 0x3; | ||
313 | |||
314 | if (adc->conversion) { | ||
315 | adc->conversion(&value); | ||
316 | } | ||
317 | adc->data = value; | ||
318 | return value; | ||
319 | } else { | ||
320 | return adc->data; | ||
321 | } | ||
322 | } | ||
323 | |||
324 | /* Force an ADC scan _now_ */ | ||
325 | unsigned short adc_scan(int channel) { | ||
326 | struct adc_struct *adc = &adcdata[channel]; | ||
327 | adc->timeout = 0; | ||
328 | return _adc_read(adc); | ||
329 | } | ||
330 | |||
331 | /* Retrieve the ADC value, only does a scan periodically */ | ||
332 | unsigned short adc_read(int channel) { | ||
333 | return _adc_read(&adcdata[channel]); | ||
334 | } | ||
335 | |||
336 | void adc_init(void) | ||
337 | { | ||
338 | struct adc_struct *adc_battery = &adcdata[ADC_BATTERY]; | ||
339 | adc_battery->channelnum = 0x2; /* ADCVIN1, resistive divider */ | ||
340 | adc_battery->timeout = 0; | ||
341 | _adc_read(adc_battery); | ||
342 | } | ||
343 | |||
344 | #elif CONFIG_CPU == PNX0101 | 287 | #elif CONFIG_CPU == PNX0101 |
345 | 288 | ||
346 | static unsigned short adcdata[NUM_ADC_CHANNELS]; | 289 | static unsigned short adcdata[NUM_ADC_CHANNELS]; |
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 599c22bc80..8acae01006 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -72,8 +72,7 @@ static bool remote_filter_first_keypress; | |||
72 | #define REPEAT_INTERVAL_FINISH 5 | 72 | #define REPEAT_INTERVAL_FINISH 5 |
73 | 73 | ||
74 | /* the power-off button and number of repeated keys before shutting off */ | 74 | /* the power-off button and number of repeated keys before shutting off */ |
75 | #if (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD) ||\ | 75 | #if (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) |
76 | (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) | ||
77 | #define POWEROFF_BUTTON BUTTON_PLAY | 76 | #define POWEROFF_BUTTON BUTTON_PLAY |
78 | #define POWEROFF_COUNT 40 | 77 | #define POWEROFF_COUNT 40 |
79 | #elif !defined(TARGET_TREE) | 78 | #elif !defined(TARGET_TREE) |
@@ -87,344 +86,10 @@ static int button_read(void); | |||
87 | static bool remote_button_hold_only(void); | 86 | static bool remote_button_hold_only(void); |
88 | #endif | 87 | #endif |
89 | 88 | ||
90 | #if CONFIG_KEYPAD == IPOD_4G_PAD | ||
91 | /* Variable to use for setting button status in interrupt handler */ | ||
92 | int int_btn = BUTTON_NONE; | ||
93 | #ifdef HAVE_WHEEL_POSITION | ||
94 | static int wheel_position = -1; | ||
95 | static bool send_events = true; | ||
96 | #endif | ||
97 | #endif | ||
98 | |||
99 | #ifdef HAVE_HEADPHONE_DETECTION | 89 | #ifdef HAVE_HEADPHONE_DETECTION |
100 | bool phones_present = false; | 90 | bool phones_present = false; |
101 | #endif | 91 | #endif |
102 | 92 | ||
103 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) && !defined(IPOD_MINI) | ||
104 | static void opto_i2c_init(void) | ||
105 | { | ||
106 | int i, curr_value; | ||
107 | |||
108 | /* wait for value to settle */ | ||
109 | i = 1000; | ||
110 | curr_value = (inl(0x7000c104) << 16) >> 24; | ||
111 | while (i > 0) | ||
112 | { | ||
113 | int new_value = (inl(0x7000c104) << 16) >> 24; | ||
114 | |||
115 | if (new_value != curr_value) { | ||
116 | i = 10000; | ||
117 | curr_value = new_value; | ||
118 | } | ||
119 | else { | ||
120 | i--; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | GPIOB_OUTPUT_VAL |= 0x10; | ||
125 | DEV_EN |= 0x10000; | ||
126 | DEV_RS |= 0x10000; | ||
127 | udelay(5); | ||
128 | DEV_RS &= ~0x10000; /* finish reset */ | ||
129 | |||
130 | outl(0xffffffff, 0x7000c120); | ||
131 | outl(0xffffffff, 0x7000c124); | ||
132 | outl(0xc00a1f00, 0x7000c100); | ||
133 | outl(0x1000000, 0x7000c104); | ||
134 | } | ||
135 | |||
136 | static inline int ipod_4g_button_read(void) | ||
137 | { | ||
138 | int whl = -1; | ||
139 | |||
140 | /* The ipodlinux source had a udelay(250) here, but testing has shown that | ||
141 | it is not needed - tested on Nano, Color/Photo and Video. */ | ||
142 | /* udelay(250);*/ | ||
143 | |||
144 | int btn = BUTTON_NONE; | ||
145 | unsigned reg = 0x7000c104; | ||
146 | if ((inl(0x7000c104) & 0x4000000) != 0) { | ||
147 | unsigned status = inl(0x7000c140); | ||
148 | |||
149 | reg = reg + 0x3C; /* 0x7000c140 */ | ||
150 | outl(0x0, 0x7000c140); /* clear interrupt status? */ | ||
151 | |||
152 | if ((status & 0x800000ff) == 0x8000001a) { | ||
153 | static int old_wheel_value IDATA_ATTR = -1; | ||
154 | static int wheel_repeat = 0; | ||
155 | |||
156 | if (status & 0x100) | ||
157 | btn |= BUTTON_SELECT; | ||
158 | if (status & 0x200) | ||
159 | btn |= BUTTON_RIGHT; | ||
160 | if (status & 0x400) | ||
161 | btn |= BUTTON_LEFT; | ||
162 | if (status & 0x800) | ||
163 | btn |= BUTTON_PLAY; | ||
164 | if (status & 0x1000) | ||
165 | btn |= BUTTON_MENU; | ||
166 | if (status & 0x40000000) { | ||
167 | /* NB: highest wheel = 0x5F, clockwise increases */ | ||
168 | int new_wheel_value = (status << 9) >> 25; | ||
169 | whl = new_wheel_value; | ||
170 | backlight_on(); | ||
171 | /* The queue should have no other events when scrolling */ | ||
172 | if (queue_empty(&button_queue) && old_wheel_value >= 0) { | ||
173 | |||
174 | /* This is for later = BUTTON_SCROLL_TOUCH;*/ | ||
175 | int wheel_delta = new_wheel_value - old_wheel_value; | ||
176 | unsigned long data; | ||
177 | int wheel_keycode; | ||
178 | |||
179 | if (wheel_delta < -48) | ||
180 | wheel_delta += 96; /* Forward wrapping case */ | ||
181 | else if (wheel_delta > 48) | ||
182 | wheel_delta -= 96; /* Backward wrapping case */ | ||
183 | |||
184 | if (wheel_delta > 4) { | ||
185 | wheel_keycode = BUTTON_SCROLL_FWD; | ||
186 | } else if (wheel_delta < -4) { | ||
187 | wheel_keycode = BUTTON_SCROLL_BACK; | ||
188 | } else goto wheel_end; | ||
189 | |||
190 | #ifdef HAVE_WHEEL_POSITION | ||
191 | if (send_events) | ||
192 | #endif | ||
193 | { | ||
194 | data = (wheel_delta << 16) | new_wheel_value; | ||
195 | queue_post(&button_queue, wheel_keycode | wheel_repeat, | ||
196 | (void *)data); | ||
197 | } | ||
198 | |||
199 | if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT; | ||
200 | } | ||
201 | |||
202 | old_wheel_value = new_wheel_value; | ||
203 | } else if (old_wheel_value >= 0) { | ||
204 | /* scroll wheel up */ | ||
205 | old_wheel_value = -1; | ||
206 | wheel_repeat = 0; | ||
207 | } | ||
208 | |||
209 | } else if (status == 0xffffffff) { | ||
210 | opto_i2c_init(); | ||
211 | } | ||
212 | } | ||
213 | |||
214 | wheel_end: | ||
215 | |||
216 | if ((inl(reg) & 0x8000000) != 0) { | ||
217 | outl(0xffffffff, 0x7000c120); | ||
218 | outl(0xffffffff, 0x7000c124); | ||
219 | } | ||
220 | /* Save the new absolute wheel position */ | ||
221 | wheel_position = whl; | ||
222 | return btn; | ||
223 | } | ||
224 | |||
225 | void ipod_4g_button_int(void) | ||
226 | { | ||
227 | CPU_HI_INT_CLR = I2C_MASK; | ||
228 | /* The following delay was 250 in the ipodlinux source, but 50 seems to | ||
229 | work fine - tested on Nano, Color/Photo and Video. */ | ||
230 | udelay(50); | ||
231 | outl(0x0, 0x7000c140); | ||
232 | int_btn = ipod_4g_button_read(); | ||
233 | outl(inl(0x7000c104) | 0xC000000, 0x7000c104); | ||
234 | outl(0x400a1f00, 0x7000c100); | ||
235 | |||
236 | GPIOB_OUTPUT_VAL |= 0x10; | ||
237 | CPU_INT_EN = 0x40000000; | ||
238 | CPU_HI_INT_EN = I2C_MASK; | ||
239 | } | ||
240 | #endif | ||
241 | #if (CONFIG_KEYPAD == IPOD_3G_PAD) || defined(IPOD_MINI) | ||
242 | /* iPod 3G and mini 1G, mini 2G uses iPod 4G code */ | ||
243 | void handle_scroll_wheel(int new_scroll, int was_hold, int reverse) | ||
244 | { | ||
245 | int wheel_keycode = BUTTON_NONE; | ||
246 | static int prev_scroll = -1; | ||
247 | static int direction = 0; | ||
248 | static int count = 0; | ||
249 | static int scroll_state[4][4] = { | ||
250 | {0, 1, -1, 0}, | ||
251 | {-1, 0, 0, 1}, | ||
252 | {1, 0, 0, -1}, | ||
253 | {0, -1, 1, 0} | ||
254 | }; | ||
255 | |||
256 | if ( prev_scroll == -1 ) { | ||
257 | prev_scroll = new_scroll; | ||
258 | } | ||
259 | else if (direction != scroll_state[prev_scroll][new_scroll]) { | ||
260 | direction = scroll_state[prev_scroll][new_scroll]; | ||
261 | count = 0; | ||
262 | } | ||
263 | else if (!was_hold) { | ||
264 | backlight_on(); | ||
265 | if (++count == 6) { /* reduce sensitivity */ | ||
266 | count = 0; | ||
267 | switch (direction) { | ||
268 | case 1: | ||
269 | if (reverse) { | ||
270 | /* 'r' keypress */ | ||
271 | wheel_keycode = BUTTON_SCROLL_FWD; | ||
272 | } | ||
273 | else { | ||
274 | /* 'l' keypress */ | ||
275 | wheel_keycode = BUTTON_SCROLL_BACK; | ||
276 | } | ||
277 | break; | ||
278 | case -1: | ||
279 | if (reverse) { | ||
280 | /* 'l' keypress */ | ||
281 | wheel_keycode = BUTTON_SCROLL_BACK; | ||
282 | } | ||
283 | else { | ||
284 | /* 'r' keypress */ | ||
285 | wheel_keycode = BUTTON_SCROLL_FWD; | ||
286 | } | ||
287 | break; | ||
288 | default: | ||
289 | /* only happens if we get out of sync */ | ||
290 | break; | ||
291 | } | ||
292 | } | ||
293 | } | ||
294 | if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue)) | ||
295 | queue_post(&button_queue, wheel_keycode, NULL); | ||
296 | prev_scroll = new_scroll; | ||
297 | } | ||
298 | #endif | ||
299 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) && defined(IPOD_MINI) | ||
300 | /* mini 1 only, mini 2G uses iPod 4G code */ | ||
301 | static int ipod_mini_button_read(void) | ||
302 | { | ||
303 | unsigned char source, wheel_source, state, wheel_state; | ||
304 | static bool was_hold = false; | ||
305 | int btn = BUTTON_NONE; | ||
306 | |||
307 | /* The ipodlinux source had a udelay(250) here, but testing has shown that | ||
308 | it is not needed - tested on mini 1g. */ | ||
309 | /* udelay(250);*/ | ||
310 | |||
311 | /* get source(s) of interupt */ | ||
312 | source = GPIOA_INT_STAT & 0x3f; | ||
313 | wheel_source = GPIOB_INT_STAT & 0x30; | ||
314 | |||
315 | if (source == 0 && wheel_source == 0) { | ||
316 | return BUTTON_NONE; /* not for us */ | ||
317 | } | ||
318 | |||
319 | /* get current keypad & wheel status */ | ||
320 | state = GPIOA_INPUT_VAL & 0x3f; | ||
321 | wheel_state = GPIOB_INPUT_VAL & 0x30; | ||
322 | |||
323 | /* toggle interrupt level */ | ||
324 | GPIOA_INT_LEV = ~state; | ||
325 | GPIOB_INT_LEV = ~wheel_state; | ||
326 | |||
327 | /* hold switch causes all outputs to go low */ | ||
328 | /* we shouldn't interpret these as key presses */ | ||
329 | if ((state & 0x20)) { | ||
330 | if (!(state & 0x1)) | ||
331 | btn |= BUTTON_SELECT; | ||
332 | if (!(state & 0x2)) | ||
333 | btn |= BUTTON_MENU; | ||
334 | if (!(state & 0x4)) | ||
335 | btn |= BUTTON_PLAY; | ||
336 | if (!(state & 0x8)) | ||
337 | btn |= BUTTON_RIGHT; | ||
338 | if (!(state & 0x10)) | ||
339 | btn |= BUTTON_LEFT; | ||
340 | |||
341 | if (wheel_source & 0x30) { | ||
342 | handle_scroll_wheel((wheel_state & 0x30) >> 4, was_hold, 1); | ||
343 | } | ||
344 | } | ||
345 | |||
346 | was_hold = button_hold(); | ||
347 | |||
348 | /* ack any active interrupts */ | ||
349 | if (source) | ||
350 | GPIOA_INT_CLR = source; | ||
351 | if (wheel_source) | ||
352 | GPIOB_INT_CLR = wheel_source; | ||
353 | |||
354 | return btn; | ||
355 | } | ||
356 | |||
357 | void ipod_mini_button_int(void) | ||
358 | { | ||
359 | CPU_HI_INT_CLR = GPIO_MASK; | ||
360 | int_btn = ipod_mini_button_read(); | ||
361 | //CPU_INT_EN = 0x40000000; | ||
362 | CPU_HI_INT_EN = GPIO_MASK; | ||
363 | } | ||
364 | #endif | ||
365 | #if CONFIG_KEYPAD == IPOD_3G_PAD | ||
366 | static int ipod_3g_button_read(void) | ||
367 | { | ||
368 | unsigned char source, state; | ||
369 | static int was_hold = 0; | ||
370 | int btn = BUTTON_NONE; | ||
371 | /* | ||
372 | * we need some delay for g3, cause hold generates several interrupts, | ||
373 | * some of them delayed | ||
374 | */ | ||
375 | udelay(250); | ||
376 | |||
377 | /* get source of interupts */ | ||
378 | source = GPIOA_INT_STAT; | ||
379 | |||
380 | |||
381 | /* get current keypad status */ | ||
382 | state = GPIOA_INPUT_VAL; | ||
383 | GPIOA_INT_LEV = ~state; | ||
384 | |||
385 | if (was_hold && source == 0x40 && state == 0xbf) { | ||
386 | /* ack any active interrupts */ | ||
387 | GPIOA_INT_CLR = source; | ||
388 | return BUTTON_NONE; | ||
389 | } | ||
390 | was_hold = 0; | ||
391 | |||
392 | |||
393 | if ((state & 0x20) == 0) { | ||
394 | /* 3g hold switch is active low */ | ||
395 | was_hold = 1; | ||
396 | /* hold switch on 3g causes all outputs to go low */ | ||
397 | /* we shouldn't interpret these as key presses */ | ||
398 | GPIOA_INT_CLR = source; | ||
399 | return BUTTON_NONE; | ||
400 | } | ||
401 | if ((state & 0x1) == 0) { | ||
402 | btn |= BUTTON_RIGHT; | ||
403 | } | ||
404 | if ((state & 0x2) == 0) { | ||
405 | btn |= BUTTON_SELECT; | ||
406 | } | ||
407 | if ((state & 0x4) == 0) { | ||
408 | btn |= BUTTON_PLAY; | ||
409 | } | ||
410 | if ((state & 0x8) == 0) { | ||
411 | btn |= BUTTON_LEFT; | ||
412 | } | ||
413 | if ((state & 0x10) == 0) { | ||
414 | btn |= BUTTON_MENU; | ||
415 | } | ||
416 | |||
417 | if (source & 0xc0) { | ||
418 | handle_scroll_wheel((state & 0xc0) >> 6, was_hold, 0); | ||
419 | } | ||
420 | |||
421 | /* ack any active interrupts */ | ||
422 | GPIOA_INT_CLR = source; | ||
423 | |||
424 | return btn; | ||
425 | } | ||
426 | #endif | ||
427 | |||
428 | static void button_tick(void) | 93 | static void button_tick(void) |
429 | { | 94 | { |
430 | static int count = 0; | 95 | static int count = 0; |
@@ -669,45 +334,6 @@ void button_init(void) | |||
669 | /* nothing to initialize here */ | 334 | /* nothing to initialize here */ |
670 | #elif CONFIG_KEYPAD == GMINI100_PAD | 335 | #elif CONFIG_KEYPAD == GMINI100_PAD |
671 | /* nothing to initialize here */ | 336 | /* nothing to initialize here */ |
672 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) && !defined(IPOD_MINI) | ||
673 | opto_i2c_init(); | ||
674 | /* hold button - enable as input */ | ||
675 | GPIOA_ENABLE |= 0x20; | ||
676 | GPIOA_OUTPUT_EN &= ~0x20; | ||
677 | /* hold button - set interrupt levels */ | ||
678 | GPIOA_INT_LEV = ~(GPIOA_INPUT_VAL & 0x20); | ||
679 | GPIOA_INT_CLR = GPIOA_INT_STAT & 0x20; | ||
680 | /* enable interrupts */ | ||
681 | GPIOA_INT_EN = 0x20; | ||
682 | /* unmask interrupt */ | ||
683 | CPU_INT_EN = 0x40000000; | ||
684 | CPU_HI_INT_EN = I2C_MASK; | ||
685 | |||
686 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) && defined(IPOD_MINI) | ||
687 | /* iPod Mini G1 */ | ||
688 | /* buttons - enable as input */ | ||
689 | GPIOA_ENABLE |= 0x3f; | ||
690 | GPIOA_OUTPUT_EN &= ~0x3f; | ||
691 | /* scroll wheel- enable as input */ | ||
692 | GPIOB_ENABLE |= 0x30; /* port b 4,5 */ | ||
693 | GPIOB_OUTPUT_EN &= ~0x30; /* port b 4,5 */ | ||
694 | /* buttons - set interrupt levels */ | ||
695 | GPIOA_INT_LEV = ~(GPIOA_INPUT_VAL & 0x3f); | ||
696 | GPIOA_INT_CLR = GPIOA_INT_STAT & 0x3f; | ||
697 | /* scroll wheel - set interrupt levels */ | ||
698 | GPIOB_INT_LEV = ~(GPIOB_INPUT_VAL & 0x30); | ||
699 | GPIOB_INT_CLR = GPIOB_INT_STAT & 0x30; | ||
700 | /* enable interrupts */ | ||
701 | GPIOA_INT_EN = 0x3f; | ||
702 | GPIOB_INT_EN = 0x30; | ||
703 | /* unmask interrupt */ | ||
704 | CPU_INT_EN = 0x40000000; | ||
705 | CPU_HI_INT_EN = GPIO_MASK; | ||
706 | |||
707 | #elif CONFIG_KEYPAD == IPOD_3G_PAD | ||
708 | GPIOA_INT_LEV = ~GPIOA_INPUT_VAL; | ||
709 | GPIOA_INT_CLR = GPIOA_INT_STAT; | ||
710 | GPIOA_INT_EN = 0xff; | ||
711 | #endif /* CONFIG_KEYPAD */ | 337 | #endif /* CONFIG_KEYPAD */ |
712 | queue_init(&button_queue, true); | 338 | queue_init(&button_queue, true); |
713 | button_read(); | 339 | button_read(); |
@@ -1266,35 +892,6 @@ static int button_read(void) | |||
1266 | if (data & 0x01) | 892 | if (data & 0x01) |
1267 | btn |= BUTTON_ON; | 893 | btn |= BUTTON_ON; |
1268 | 894 | ||
1269 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) | ||
1270 | static bool hold_button = false; | ||
1271 | bool hold_button_old; | ||
1272 | |||
1273 | /* normal buttons */ | ||
1274 | hold_button_old = hold_button; | ||
1275 | hold_button = button_hold(); | ||
1276 | |||
1277 | if (hold_button != hold_button_old) | ||
1278 | backlight_hold_changed(hold_button); | ||
1279 | |||
1280 | (void)data; | ||
1281 | /* The int_btn variable is set in the button interrupt handler */ | ||
1282 | btn = int_btn; | ||
1283 | |||
1284 | #elif (CONFIG_KEYPAD == IPOD_3G_PAD) | ||
1285 | static bool hold_button = false; | ||
1286 | bool hold_button_old; | ||
1287 | |||
1288 | /* normal buttons */ | ||
1289 | hold_button_old = hold_button; | ||
1290 | hold_button = button_hold(); | ||
1291 | |||
1292 | if (hold_button != hold_button_old) | ||
1293 | backlight_hold_changed(hold_button); | ||
1294 | |||
1295 | (void)data; | ||
1296 | btn = ipod_3g_button_read(); | ||
1297 | |||
1298 | #endif /* CONFIG_KEYPAD */ | 895 | #endif /* CONFIG_KEYPAD */ |
1299 | 896 | ||
1300 | #ifdef HAVE_LCD_BITMAP | 897 | #ifdef HAVE_LCD_BITMAP |
@@ -1313,13 +910,6 @@ static int button_read(void) | |||
1313 | return retval; | 910 | return retval; |
1314 | } | 911 | } |
1315 | 912 | ||
1316 | #if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) | ||
1317 | bool button_hold(void) | ||
1318 | { | ||
1319 | return (GPIOA_INPUT_VAL & 0x20)?false:true; | ||
1320 | } | ||
1321 | #endif | ||
1322 | |||
1323 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) | 913 | #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) |
1324 | bool button_hold(void) | 914 | bool button_hold(void) |
1325 | { | 915 | { |
@@ -1357,18 +947,6 @@ int button_status(void) | |||
1357 | return lastbtn; | 947 | return lastbtn; |
1358 | } | 948 | } |
1359 | 949 | ||
1360 | #ifdef HAVE_WHEEL_POSITION | ||
1361 | int wheel_status(void) | ||
1362 | { | ||
1363 | return wheel_position; | ||
1364 | } | ||
1365 | |||
1366 | void wheel_send_events(bool send) | ||
1367 | { | ||
1368 | send_events = send; | ||
1369 | } | ||
1370 | #endif | ||
1371 | |||
1372 | void button_clear_queue(void) | 950 | void button_clear_queue(void) |
1373 | { | 951 | { |
1374 | queue_clear(&button_queue); | 952 | queue_clear(&button_queue); |
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c index d5b75a130d..cfe64c965e 100644 --- a/firmware/drivers/power.c +++ b/firmware/drivers/power.c | |||
@@ -84,8 +84,6 @@ void power_init(void) | |||
84 | pcf50606_init(); | 84 | pcf50606_init(); |
85 | #endif | 85 | #endif |
86 | #endif | 86 | #endif |
87 | #elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002 | ||
88 | pcf50605_init(); | ||
89 | #else | 87 | #else |
90 | #ifdef HAVE_POWEROFF_ON_PB5 | 88 | #ifdef HAVE_POWEROFF_ON_PB5 |
91 | PBCR2 &= ~0x0c00; /* GPIO for PB5 */ | 89 | PBCR2 &= ~0x0c00; /* GPIO for PB5 */ |
@@ -123,12 +121,6 @@ bool charger_inserted(void) | |||
123 | return (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF); | 121 | return (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF); |
124 | #elif defined(TOSHIBA_GIGABEAT_F) | 122 | #elif defined(TOSHIBA_GIGABEAT_F) |
125 | return false; | 123 | return false; |
126 | #elif defined(IPOD_VIDEO) | ||
127 | return (GPIOL_INPUT_VAL & 0x08)?false:true; | ||
128 | #elif defined(IPOD_ARCH) | ||
129 | /* This needs filling in for other ipods. */ | ||
130 | return false; | ||
131 | #else | ||
132 | /* Player */ | 124 | /* Player */ |
133 | return (PADR & 1) == 0; | 125 | return (PADR & 1) == 0; |
134 | #endif | 126 | #endif |
@@ -166,8 +158,6 @@ bool charging_state(void) { | |||
166 | return charger_inserted(); | 158 | return charger_inserted(); |
167 | #elif defined IRIVER_H300_SERIES | 159 | #elif defined IRIVER_H300_SERIES |
168 | return (GPIO_READ & 0x00800000)?true:false; | 160 | return (GPIO_READ & 0x00800000)?true:false; |
169 | #elif defined IPOD_VIDEO | ||
170 | return (GPIOB_INPUT_VAL & 0x01)?false:true; | ||
171 | #endif | 161 | #endif |
172 | } | 162 | } |
173 | #endif | 163 | #endif |
@@ -201,8 +191,6 @@ void ide_power_enable(bool on) | |||
201 | or_l(0x80000000, &GPIO_OUT); | 191 | or_l(0x80000000, &GPIO_OUT); |
202 | #elif defined(IAUDIO_X5) | 192 | #elif defined(IAUDIO_X5) |
203 | /* X5 TODO */ | 193 | /* X5 TODO */ |
204 | #elif (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) | ||
205 | /* We do nothing on the iPod */ | ||
206 | #elif defined(GMINI_ARCH) | 194 | #elif defined(GMINI_ARCH) |
207 | if(on) | 195 | if(on) |
208 | P1 |= 0x08; | 196 | P1 |= 0x08; |
@@ -259,9 +247,6 @@ bool ide_powered(void) | |||
259 | return (GPIO_OUT & 0x80000000)?false:true; | 247 | return (GPIO_OUT & 0x80000000)?false:true; |
260 | #elif defined(IAUDIO_X5) | 248 | #elif defined(IAUDIO_X5) |
261 | return false; /* X5 TODO */ | 249 | return false; /* X5 TODO */ |
262 | #elif (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) | ||
263 | /* pretend we are always powered - we don't turn it off on the ipod */ | ||
264 | return true; | ||
265 | #elif defined(GMINI_ARCH) | 250 | #elif defined(GMINI_ARCH) |
266 | return (P1 & 0x08?true:false); | 251 | return (P1 & 0x08?true:false); |
267 | #elif defined(TOSHIBA_GIGABEAT_F) | 252 | #elif defined(TOSHIBA_GIGABEAT_F) |
@@ -296,11 +281,6 @@ void power_off(void) | |||
296 | #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) | 281 | #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) |
297 | and_l(~0x00080000, &GPIO1_OUT); | 282 | and_l(~0x00080000, &GPIO1_OUT); |
298 | asm("halt"); | 283 | asm("halt"); |
299 | #elif (CONFIG_CPU == PP5002) || (CONFIG_CPU == PP5020) | ||
300 | #ifndef BOOTLOADER | ||
301 | /* We don't turn off the ipod, we put it in a deep sleep */ | ||
302 | pcf50605_standby_mode(); | ||
303 | #endif | ||
304 | #elif CONFIG_CPU == PNX0101 | 284 | #elif CONFIG_CPU == PNX0101 |
305 | GPIO1_CLR = 1 << 16; | 285 | GPIO1_CLR = 1 << 16; |
306 | GPIO2_SET = 1; | 286 | GPIO2_SET = 1; |
diff --git a/firmware/export/adc.h b/firmware/export/adc.h index 3a438832d6..13d2617c00 100644 --- a/firmware/export/adc.h +++ b/firmware/export/adc.h | |||
@@ -24,12 +24,6 @@ | |||
24 | #ifdef TARGET_TREE | 24 | #ifdef TARGET_TREE |
25 | #include "adc-target.h" | 25 | #include "adc-target.h" |
26 | 26 | ||
27 | #elif defined(IPOD_ARCH) | ||
28 | #define NUM_ADC_CHANNELS 1 | ||
29 | |||
30 | #define ADC_BATTERY 0 | ||
31 | #define ADC_UNREG_POWER ADC_BATTERY | ||
32 | |||
33 | #elif defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) | 27 | #elif defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) |
34 | #define NUM_ADC_CHANNELS 4 | 28 | #define NUM_ADC_CHANNELS 4 |
35 | 29 | ||
@@ -106,8 +100,7 @@ | |||
106 | unsigned short adc_read(int channel); | 100 | unsigned short adc_read(int channel); |
107 | void adc_init(void); | 101 | void adc_init(void); |
108 | 102 | ||
109 | #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)\ | 103 | #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) |
110 | || defined(IPOD_ARCH) | ||
111 | /* Force a scan now */ | 104 | /* Force a scan now */ |
112 | unsigned short adc_scan(int channel); | 105 | unsigned short adc_scan(int channel); |
113 | #endif | 106 | #endif |
diff --git a/firmware/export/button.h b/firmware/export/button.h index 4ff04202d5..686fe79937 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h | |||
@@ -26,9 +26,7 @@ | |||
26 | (CONFIG_KEYPAD == IRIVER_H300_PAD) | 26 | (CONFIG_KEYPAD == IRIVER_H300_PAD) |
27 | #define HAS_BUTTON_HOLD | 27 | #define HAS_BUTTON_HOLD |
28 | #define HAS_REMOTE_BUTTON_HOLD | 28 | #define HAS_REMOTE_BUTTON_HOLD |
29 | #elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ | 29 | #elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) |
30 | (CONFIG_KEYPAD == IPOD_3G_PAD) || \ | ||
31 | (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) | ||
32 | #define HAS_BUTTON_HOLD | 30 | #define HAS_BUTTON_HOLD |
33 | #endif | 31 | #endif |
34 | extern struct event_queue button_queue; | 32 | extern struct event_queue button_queue; |
@@ -222,30 +220,6 @@ void wheel_send_events(bool send); | |||
222 | 220 | ||
223 | #define BUTTON_REMOTE 0 | 221 | #define BUTTON_REMOTE 0 |
224 | 222 | ||
225 | #elif ((CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD)) | ||
226 | |||
227 | /* iPod specific button codes */ | ||
228 | |||
229 | #define BUTTON_SELECT 0x00000001 | ||
230 | #define BUTTON_MENU 0x00000002 | ||
231 | |||
232 | #define BUTTON_LEFT 0x00000004 | ||
233 | #define BUTTON_RIGHT 0x00000008 | ||
234 | #define BUTTON_SCROLL_FWD 0x00000010 | ||
235 | #define BUTTON_SCROLL_BACK 0x00000020 | ||
236 | |||
237 | #define BUTTON_PLAY 0x00000040 | ||
238 | |||
239 | #define BUTTON_MAIN (BUTTON_SELECT|BUTTON_MENU\ | ||
240 | |BUTTON_LEFT|BUTTON_RIGHT|BUTTON_SCROLL_FWD\ | ||
241 | |BUTTON_SCROLL_BACK|BUTTON_PLAY) | ||
242 | |||
243 | #define BUTTON_REMOTE 0 | ||
244 | |||
245 | /* This is for later | ||
246 | #define BUTTON_SCROLL_TOUCH 0x00000200 | ||
247 | */ | ||
248 | |||
249 | #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD | 223 | #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD |
250 | 224 | ||
251 | /* iriver IFP7XX specific button codes */ | 225 | /* iriver IFP7XX specific button codes */ |
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 94035069a5..e94c3c087c 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This config file is for the Apple iPod 3g | 2 | * This config file is for the Apple iPod 3g |
3 | */ | 3 | */ |
4 | #define IPOD_ARCH 1 | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* For Rolo and boot loader */ | 6 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 7 | 7 | #define MODEL_NUMBER 7 |
@@ -101,6 +101,10 @@ | |||
101 | 101 | ||
102 | #define USB_NONE | 102 | #define USB_NONE |
103 | 103 | ||
104 | /* LCD contrast */ | ||
105 | #define MIN_CONTRAST_SETTING 5 | ||
106 | #define MAX_CONTRAST_SETTING 63 | ||
107 | #define DEFAULT_CONTRAST_SETTING 40 /* Match boot contrast */ | ||
104 | 108 | ||
105 | /* Virtual LED (icon) */ | 109 | /* Virtual LED (icon) */ |
106 | #define CONFIG_LED LED_VIRTUAL | 110 | #define CONFIG_LED LED_VIRTUAL |
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 2b603987f4..c61ab05b77 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This config file is for the Apple iPod Color/Photo | 2 | * This config file is for the Apple iPod Color/Photo |
3 | */ | 3 | */ |
4 | #define IPOD_ARCH 1 | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* For Rolo and boot loader */ | 6 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 8 | 7 | #define MODEL_NUMBER 8 |
@@ -100,6 +100,11 @@ | |||
100 | 100 | ||
101 | #define USB_IPODSTYLE | 101 | #define USB_IPODSTYLE |
102 | 102 | ||
103 | /* LCD contrast */ | ||
104 | #define MIN_CONTRAST_SETTING 5 | ||
105 | #define MAX_CONTRAST_SETTING 63 | ||
106 | #define DEFAULT_CONTRAST_SETTING 40 /* Match boot contrast */ | ||
107 | |||
103 | /* define this if the unit can be powered or charged via USB */ | 108 | /* define this if the unit can be powered or charged via USB */ |
104 | #define HAVE_USB_POWER | 109 | #define HAVE_USB_POWER |
105 | 110 | ||
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 0bcb25b56c..0f8a56fe8b 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This config file is for the Apple iPod Color/Photo | 2 | * This config file is for the Apple iPod Color/Photo |
3 | */ | 3 | */ |
4 | #define IPOD_ARCH 1 | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* For Rolo and boot loader */ | 6 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 3 | 7 | #define MODEL_NUMBER 3 |
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index f2f96946c9..a089ebdd78 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This config file is for the Apple iPod Mini (1st Gen) | 2 | * This config file is for the Apple iPod Mini (1st Gen) |
3 | */ | 3 | */ |
4 | #define IPOD_ARCH 1 | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* For Rolo and boot loader */ | 6 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 9 /* TODO: change to 9 */ | 7 | #define MODEL_NUMBER 9 /* TODO: change to 9 */ |
@@ -100,6 +100,11 @@ | |||
100 | 100 | ||
101 | #define USB_IPODSTYLE | 101 | #define USB_IPODSTYLE |
102 | 102 | ||
103 | /* LCD contrast */ | ||
104 | #define MIN_CONTRAST_SETTING 5 | ||
105 | #define MAX_CONTRAST_SETTING 63 | ||
106 | #define DEFAULT_CONTRAST_SETTING 40 /* Match boot contrast */ | ||
107 | |||
103 | /* define this if the unit can be powered or charged via USB */ | 108 | /* define this if the unit can be powered or charged via USB */ |
104 | #define HAVE_USB_POWER | 109 | #define HAVE_USB_POWER |
105 | 110 | ||
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index bac60e3e72..c37be05400 100755 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This config file is for the Apple iPod Mini 2nd Gen | 2 | * This config file is for the Apple iPod Mini 2nd Gen |
3 | */ | 3 | */ |
4 | #define IPOD_ARCH 1 | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* For Rolo and boot loader */ | 6 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 11 | 7 | #define MODEL_NUMBER 11 |
@@ -103,6 +103,11 @@ | |||
103 | 103 | ||
104 | #define USB_IPODSTYLE | 104 | #define USB_IPODSTYLE |
105 | 105 | ||
106 | /* LCD contrast */ | ||
107 | #define MIN_CONTRAST_SETTING 5 | ||
108 | #define MAX_CONTRAST_SETTING 63 | ||
109 | #define DEFAULT_CONTRAST_SETTING 40 /* Match boot contrast */ | ||
110 | |||
106 | /* define this if the unit can be powered or charged via USB */ | 111 | /* define this if the unit can be powered or charged via USB */ |
107 | #define HAVE_USB_POWER | 112 | #define HAVE_USB_POWER |
108 | 113 | ||
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index c24aa43e55..258d93bad5 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This config file is for the Apple iPod Nano | 2 | * This config file is for the Apple iPod Nano |
3 | */ | 3 | */ |
4 | #define IPOD_ARCH 1 | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* For Rolo and boot loader */ | 6 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 4 | 7 | #define MODEL_NUMBER 4 |
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index cd8f1eea11..530417d612 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * This config file is for the Apple iPod Video | 2 | * This config file is for the Apple iPod Video |
3 | */ | 3 | */ |
4 | #define IPOD_ARCH 1 | 4 | #define TARGET_TREE /* this target is using the target tree system */ |
5 | 5 | ||
6 | /* For Rolo and boot loader */ | 6 | /* For Rolo and boot loader */ |
7 | #define MODEL_NUMBER 5 | 7 | #define MODEL_NUMBER 5 |
diff --git a/firmware/export/pcf50605.h b/firmware/export/pcf50605.h index eeb09b4612..eb899afc86 100644 --- a/firmware/export/pcf50605.h +++ b/firmware/export/pcf50605.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #ifndef PCF50605_H | 20 | #ifndef PCF50605_H |
21 | #define PCF50605_H | 21 | #define PCF50605_H |
22 | 22 | ||
23 | #ifdef IPOD_ARCH | ||
24 | int pcf50605_read(int address); | 23 | int pcf50605_read(int address); |
25 | int pcf50605_read_multiple(int address, unsigned char* buf, int count); | 24 | int pcf50605_read_multiple(int address, unsigned char* buf, int count); |
26 | int pcf50605_write(int address, unsigned char val); | 25 | int pcf50605_write(int address, unsigned char val); |
@@ -29,6 +28,5 @@ int pcf50605_a2d_read(int channel); | |||
29 | bool pcf50605_charger_inserted(void); | 28 | bool pcf50605_charger_inserted(void); |
30 | void pcf50605_standby_mode(void); | 29 | void pcf50605_standby_mode(void); |
31 | void pcf50605_init(void); | 30 | void pcf50605_init(void); |
32 | #endif | ||
33 | 31 | ||
34 | #endif | 32 | #endif |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index be63aae106..b9d67ce02a 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -1077,15 +1077,6 @@ void shutdown_hw(void) | |||
1077 | #endif | 1077 | #endif |
1078 | backlight_off(); | 1078 | backlight_off(); |
1079 | #endif /* IAUDIO_X5 */ | 1079 | #endif /* IAUDIO_X5 */ |
1080 | #if defined(IPOD_ARCH) && defined(HAVE_LCD_COLOR) | ||
1081 | /* Clear the screen and backdrop to | ||
1082 | remove ghosting effect on shutdown */ | ||
1083 | lcd_set_backdrop(NULL); | ||
1084 | lcd_set_background(LCD_WHITE); | ||
1085 | lcd_clear_display(); | ||
1086 | lcd_update(); | ||
1087 | sleep(HZ/16); | ||
1088 | #endif | ||
1089 | #ifndef IAUDIO_X5 | 1080 | #ifndef IAUDIO_X5 |
1090 | lcd_set_contrast(0); | 1081 | lcd_set_contrast(0); |
1091 | #endif | 1082 | #endif |
diff --git a/firmware/target/arm/ipod/3g/backlight-3g.c b/firmware/target/arm/ipod/3g/backlight-3g.c new file mode 100644 index 0000000000..b676e2473b --- /dev/null +++ b/firmware/target/arm/ipod/3g/backlight-3g.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include <stdlib.h> | ||
21 | #include "cpu.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "i2c.h" | ||
25 | #include "debug.h" | ||
26 | #include "rtc.h" | ||
27 | #include "usb.h" | ||
28 | #include "power.h" | ||
29 | #include "system.h" | ||
30 | #include "button.h" | ||
31 | #include "timer.h" | ||
32 | #include "backlight.h" | ||
33 | |||
34 | inline void __backlight_on(void) | ||
35 | { | ||
36 | outl(inl(0xc0001000) | 0x02, 0xc0001000); | ||
37 | } | ||
38 | |||
39 | inline void __backlight_off(void) | ||
40 | { | ||
41 | outl(inl(0xc0001000) & ~0x02, 0xc0001000); | ||
42 | } | ||
diff --git a/firmware/target/arm/ipod/3g/button-3g.c b/firmware/target/arm/ipod/3g/button-3g.c new file mode 100644 index 0000000000..7244dd597b --- /dev/null +++ b/firmware/target/arm/ipod/3g/button-3g.c | |||
@@ -0,0 +1,189 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Daniel Stenberg | ||
11 | * | ||
12 | * iPod driver based on code from the ipodlinux project - http://ipodlinux.org | ||
13 | * Adapted for Rockbox in December 2005 | ||
14 | * Original file: linux/arch/armnommu/mach-ipod/keyboard.c | ||
15 | * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org) | ||
16 | * | ||
17 | * | ||
18 | * All files in this archive are subject to the GNU General Public License. | ||
19 | * See the file COPYING in the source tree root for full license agreement. | ||
20 | * | ||
21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
22 | * KIND, either express or implied. | ||
23 | * | ||
24 | ****************************************************************************/ | ||
25 | |||
26 | /* | ||
27 | * Rockbox button functions | ||
28 | */ | ||
29 | |||
30 | #include <stdlib.h> | ||
31 | #include "config.h" | ||
32 | #include "cpu.h" | ||
33 | #include "system.h" | ||
34 | #include "button.h" | ||
35 | #include "kernel.h" | ||
36 | #include "backlight.h" | ||
37 | #include "adc.h" | ||
38 | #include "serial.h" | ||
39 | #include "power.h" | ||
40 | #include "system.h" | ||
41 | #include "powermgmt.h" | ||
42 | |||
43 | /* iPod 3G and mini 1G, mini 2G uses iPod 4G code */ | ||
44 | void handle_scroll_wheel(int new_scroll, int was_hold, int reverse) | ||
45 | { | ||
46 | int wheel_keycode = BUTTON_NONE; | ||
47 | static int prev_scroll = -1; | ||
48 | static int direction = 0; | ||
49 | static int count = 0; | ||
50 | static int scroll_state[4][4] = { | ||
51 | {0, 1, -1, 0}, | ||
52 | {-1, 0, 0, 1}, | ||
53 | {1, 0, 0, -1}, | ||
54 | {0, -1, 1, 0} | ||
55 | }; | ||
56 | |||
57 | if ( prev_scroll == -1 ) { | ||
58 | prev_scroll = new_scroll; | ||
59 | } | ||
60 | else if (direction != scroll_state[prev_scroll][new_scroll]) { | ||
61 | direction = scroll_state[prev_scroll][new_scroll]; | ||
62 | count = 0; | ||
63 | } | ||
64 | else if (!was_hold) { | ||
65 | backlight_on(); | ||
66 | if (++count == 6) { /* reduce sensitivity */ | ||
67 | count = 0; | ||
68 | switch (direction) { | ||
69 | case 1: | ||
70 | if (reverse) { | ||
71 | /* 'r' keypress */ | ||
72 | wheel_keycode = BUTTON_SCROLL_FWD; | ||
73 | } | ||
74 | else { | ||
75 | /* 'l' keypress */ | ||
76 | wheel_keycode = BUTTON_SCROLL_BACK; | ||
77 | } | ||
78 | break; | ||
79 | case -1: | ||
80 | if (reverse) { | ||
81 | /* 'l' keypress */ | ||
82 | wheel_keycode = BUTTON_SCROLL_BACK; | ||
83 | } | ||
84 | else { | ||
85 | /* 'r' keypress */ | ||
86 | wheel_keycode = BUTTON_SCROLL_FWD; | ||
87 | } | ||
88 | break; | ||
89 | default: | ||
90 | /* only happens if we get out of sync */ | ||
91 | break; | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue)) | ||
96 | queue_post(&button_queue, wheel_keycode, NULL); | ||
97 | prev_scroll = new_scroll; | ||
98 | } | ||
99 | |||
100 | static int ipod_3g_button_read(void) | ||
101 | { | ||
102 | unsigned char source, state; | ||
103 | static int was_hold = 0; | ||
104 | int btn = BUTTON_NONE; | ||
105 | /* | ||
106 | * we need some delay for g3, cause hold generates several interrupts, | ||
107 | * some of them delayed | ||
108 | */ | ||
109 | udelay(250); | ||
110 | |||
111 | /* get source of interupts */ | ||
112 | source = GPIOA_INT_STAT; | ||
113 | |||
114 | |||
115 | /* get current keypad status */ | ||
116 | state = GPIOA_INPUT_VAL; | ||
117 | GPIOA_INT_LEV = ~state; | ||
118 | |||
119 | if (was_hold && source == 0x40 && state == 0xbf) { | ||
120 | /* ack any active interrupts */ | ||
121 | GPIOA_INT_CLR = source; | ||
122 | return BUTTON_NONE; | ||
123 | } | ||
124 | was_hold = 0; | ||
125 | |||
126 | |||
127 | if ((state & 0x20) == 0) { | ||
128 | /* 3g hold switch is active low */ | ||
129 | was_hold = 1; | ||
130 | /* hold switch on 3g causes all outputs to go low */ | ||
131 | /* we shouldn't interpret these as key presses */ | ||
132 | GPIOA_INT_CLR = source; | ||
133 | return BUTTON_NONE; | ||
134 | } | ||
135 | if ((state & 0x1) == 0) { | ||
136 | btn |= BUTTON_RIGHT; | ||
137 | } | ||
138 | if ((state & 0x2) == 0) { | ||
139 | btn |= BUTTON_SELECT; | ||
140 | } | ||
141 | if ((state & 0x4) == 0) { | ||
142 | btn |= BUTTON_PLAY; | ||
143 | } | ||
144 | if ((state & 0x8) == 0) { | ||
145 | btn |= BUTTON_LEFT; | ||
146 | } | ||
147 | if ((state & 0x10) == 0) { | ||
148 | btn |= BUTTON_MENU; | ||
149 | } | ||
150 | |||
151 | if (source & 0xc0) { | ||
152 | handle_scroll_wheel((state & 0xc0) >> 6, was_hold, 0); | ||
153 | } | ||
154 | |||
155 | /* ack any active interrupts */ | ||
156 | GPIOA_INT_CLR = source; | ||
157 | |||
158 | return btn; | ||
159 | } | ||
160 | |||
161 | void button_init_device(void) | ||
162 | { | ||
163 | GPIOA_INT_LEV = ~GPIOA_INPUT_VAL; | ||
164 | GPIOA_INT_CLR = GPIOA_INT_STAT; | ||
165 | GPIOA_INT_EN = 0xff; | ||
166 | } | ||
167 | |||
168 | /* | ||
169 | * Get button pressed from hardware | ||
170 | */ | ||
171 | int button_read_device(void) | ||
172 | { | ||
173 | static bool hold_button = false; | ||
174 | bool hold_button_old; | ||
175 | |||
176 | /* normal buttons */ | ||
177 | hold_button_old = hold_button; | ||
178 | hold_button = button_hold(); | ||
179 | |||
180 | if (hold_button != hold_button_old) | ||
181 | backlight_hold_changed(hold_button); | ||
182 | |||
183 | return ipod_3g_button_read(); | ||
184 | } | ||
185 | |||
186 | bool button_hold(void) | ||
187 | { | ||
188 | return (GPIOA_INPUT_VAL & 0x20)?false:true; | ||
189 | } | ||
diff --git a/firmware/target/arm/ipod/adc-ipod.c b/firmware/target/arm/ipod/adc-ipod.c new file mode 100644 index 0000000000..d351f0ee81 --- /dev/null +++ b/firmware/target/arm/ipod/adc-ipod.c | |||
@@ -0,0 +1,80 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "system.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "string.h" | ||
25 | #include "adc.h" | ||
26 | #include "pcf50605.h" | ||
27 | |||
28 | struct adc_struct { | ||
29 | long timeout; | ||
30 | void (*conversion)(unsigned short *data); | ||
31 | short channelnum; | ||
32 | unsigned short data; | ||
33 | }; | ||
34 | |||
35 | static struct adc_struct adcdata[NUM_ADC_CHANNELS] IDATA_ATTR; | ||
36 | |||
37 | static unsigned short _adc_read(struct adc_struct *adc) | ||
38 | { | ||
39 | if (adc->timeout < current_tick) { | ||
40 | unsigned char data[2]; | ||
41 | unsigned short value; | ||
42 | /* 5x per 2 seconds */ | ||
43 | adc->timeout = current_tick + (HZ * 2 / 5); | ||
44 | |||
45 | /* ADCC1, 10 bit, start */ | ||
46 | pcf50605_write(0x2f, (adc->channelnum << 1) | 0x1); | ||
47 | pcf50605_read_multiple(0x30, data, 2); /* ADCS1, ADCS2 */ | ||
48 | value = data[0]; | ||
49 | value <<= 2; | ||
50 | value |= data[1] & 0x3; | ||
51 | |||
52 | if (adc->conversion) { | ||
53 | adc->conversion(&value); | ||
54 | } | ||
55 | adc->data = value; | ||
56 | return value; | ||
57 | } else { | ||
58 | return adc->data; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | /* Force an ADC scan _now_ */ | ||
63 | unsigned short adc_scan(int channel) { | ||
64 | struct adc_struct *adc = &adcdata[channel]; | ||
65 | adc->timeout = 0; | ||
66 | return _adc_read(adc); | ||
67 | } | ||
68 | |||
69 | /* Retrieve the ADC value, only does a scan periodically */ | ||
70 | unsigned short adc_read(int channel) { | ||
71 | return _adc_read(&adcdata[channel]); | ||
72 | } | ||
73 | |||
74 | void adc_init(void) | ||
75 | { | ||
76 | struct adc_struct *adc_battery = &adcdata[ADC_BATTERY]; | ||
77 | adc_battery->channelnum = 0x2; /* ADCVIN1, resistive divider */ | ||
78 | adc_battery->timeout = 0; | ||
79 | _adc_read(adc_battery); | ||
80 | } | ||
diff --git a/firmware/target/arm/ipod/adc-target.h b/firmware/target/arm/ipod/adc-target.h new file mode 100644 index 0000000000..8458779b59 --- /dev/null +++ b/firmware/target/arm/ipod/adc-target.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _ADC_TARGET_H_ | ||
20 | #define _ADC_TARGET_H_ | ||
21 | |||
22 | #define NUM_ADC_CHANNELS 1 | ||
23 | |||
24 | #define ADC_BATTERY 0 | ||
25 | #define ADC_UNREG_POWER ADC_BATTERY | ||
26 | |||
27 | /* Force a scan now */ | ||
28 | unsigned short adc_scan(int channel); | ||
29 | #endif | ||
diff --git a/firmware/target/arm/ipod/backlight-4g_color.c b/firmware/target/arm/ipod/backlight-4g_color.c new file mode 100644 index 0000000000..be1dff7c0b --- /dev/null +++ b/firmware/target/arm/ipod/backlight-4g_color.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include <stdlib.h> | ||
21 | #include "cpu.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "i2c.h" | ||
25 | #include "debug.h" | ||
26 | #include "rtc.h" | ||
27 | #include "usb.h" | ||
28 | #include "power.h" | ||
29 | #include "system.h" | ||
30 | #include "button.h" | ||
31 | #include "timer.h" | ||
32 | #include "backlight.h" | ||
33 | |||
34 | inline void __backlight_on(void) | ||
35 | { | ||
36 | /* brightness full */ | ||
37 | outl(0x80000000 | (0xff << 16), 0x7000a010); | ||
38 | |||
39 | /* set port b bit 3 on */ | ||
40 | outl(((0x100 | 1) << 3), 0x6000d824); | ||
41 | } | ||
42 | |||
43 | inline void __backlight_off(void) | ||
44 | { | ||
45 | /* fades backlight off on 4g */ | ||
46 | outl(inl(0x70000084) & ~0x2000000, 0x70000084); | ||
47 | outl(0x80000000, 0x7000a010); | ||
48 | } | ||
diff --git a/firmware/target/arm/ipod/backlight-mini1g_mini2g.c b/firmware/target/arm/ipod/backlight-mini1g_mini2g.c new file mode 100644 index 0000000000..6cfa8f889c --- /dev/null +++ b/firmware/target/arm/ipod/backlight-mini1g_mini2g.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include <stdlib.h> | ||
21 | #include "cpu.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "i2c.h" | ||
25 | #include "debug.h" | ||
26 | #include "rtc.h" | ||
27 | #include "usb.h" | ||
28 | #include "power.h" | ||
29 | #include "system.h" | ||
30 | #include "button.h" | ||
31 | #include "timer.h" | ||
32 | #include "backlight.h" | ||
33 | |||
34 | inline void __backlight_on(void) | ||
35 | { | ||
36 | /* set port B03 on */ | ||
37 | outl(((0x100 | 1) << 3), 0x6000d824); | ||
38 | } | ||
39 | |||
40 | inline void __backlight_off(void) | ||
41 | { | ||
42 | /* set port B03 off */ | ||
43 | outl(((0x100 | 0) << 3), 0x6000d824); | ||
44 | } | ||
diff --git a/firmware/target/arm/ipod/backlight-nano_video.c b/firmware/target/arm/ipod/backlight-nano_video.c new file mode 100644 index 0000000000..5559709333 --- /dev/null +++ b/firmware/target/arm/ipod/backlight-nano_video.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include <stdlib.h> | ||
21 | #include "cpu.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "i2c.h" | ||
25 | #include "debug.h" | ||
26 | #include "rtc.h" | ||
27 | #include "usb.h" | ||
28 | #include "power.h" | ||
29 | #include "system.h" | ||
30 | #include "button.h" | ||
31 | #include "timer.h" | ||
32 | #include "backlight.h" | ||
33 | |||
34 | inline void __backlight_on(void) | ||
35 | { | ||
36 | /* set port B03 on */ | ||
37 | outl(((0x100 | 1) << 3), 0x6000d824); | ||
38 | |||
39 | /* set port L07 on */ | ||
40 | outl(((0x100 | 1) << 7), 0x6000d12c); | ||
41 | } | ||
42 | |||
43 | inline void __backlight_off(void) | ||
44 | { | ||
45 | /* set port B03 off */ | ||
46 | outl(((0x100 | 0) << 3), 0x6000d824); | ||
47 | |||
48 | /* set port L07 off */ | ||
49 | outl(((0x100 | 0) << 7), 0x6000d12c); | ||
50 | } | ||
diff --git a/firmware/target/arm/ipod/backlight-target.h b/firmware/target/arm/ipod/backlight-target.h new file mode 100644 index 0000000000..d35dccdc4a --- /dev/null +++ b/firmware/target/arm/ipod/backlight-target.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef BACKLIGHT_TARGET_H | ||
20 | #define BACKLIGHT_TARGET_H | ||
21 | |||
22 | void __backlight_on(void); | ||
23 | void __backlight_off(void); | ||
24 | |||
25 | #endif | ||
diff --git a/firmware/target/arm/ipod/button-clickwheel.c b/firmware/target/arm/ipod/button-clickwheel.c new file mode 100644 index 0000000000..4c536343c4 --- /dev/null +++ b/firmware/target/arm/ipod/button-clickwheel.c | |||
@@ -0,0 +1,237 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Daniel Stenberg | ||
11 | * | ||
12 | * iPod driver based on code from the ipodlinux project - http://ipodlinux.org | ||
13 | * Adapted for Rockbox in December 2005 | ||
14 | * Original file: linux/arch/armnommu/mach-ipod/keyboard.c | ||
15 | * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org) | ||
16 | * | ||
17 | * | ||
18 | * All files in this archive are subject to the GNU General Public License. | ||
19 | * See the file COPYING in the source tree root for full license agreement. | ||
20 | * | ||
21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
22 | * KIND, either express or implied. | ||
23 | * | ||
24 | ****************************************************************************/ | ||
25 | |||
26 | /* | ||
27 | * Rockbox button functions | ||
28 | */ | ||
29 | |||
30 | #include <stdlib.h> | ||
31 | #include "config.h" | ||
32 | #include "cpu.h" | ||
33 | #include "system.h" | ||
34 | #include "button.h" | ||
35 | #include "kernel.h" | ||
36 | #include "backlight.h" | ||
37 | #include "adc.h" | ||
38 | #include "serial.h" | ||
39 | #include "power.h" | ||
40 | #include "system.h" | ||
41 | #include "powermgmt.h" | ||
42 | |||
43 | /* Variable to use for setting button status in interrupt handler */ | ||
44 | int int_btn = BUTTON_NONE; | ||
45 | #ifdef HAVE_WHEEL_POSITION | ||
46 | static int wheel_position = -1; | ||
47 | static bool send_events = true; | ||
48 | #endif | ||
49 | |||
50 | static void opto_i2c_init(void) | ||
51 | { | ||
52 | int i, curr_value; | ||
53 | |||
54 | /* wait for value to settle */ | ||
55 | i = 1000; | ||
56 | curr_value = (inl(0x7000c104) << 16) >> 24; | ||
57 | while (i > 0) | ||
58 | { | ||
59 | int new_value = (inl(0x7000c104) << 16) >> 24; | ||
60 | |||
61 | if (new_value != curr_value) { | ||
62 | i = 10000; | ||
63 | curr_value = new_value; | ||
64 | } | ||
65 | else { | ||
66 | i--; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | GPIOB_OUTPUT_VAL |= 0x10; | ||
71 | DEV_EN |= 0x10000; | ||
72 | DEV_RS |= 0x10000; | ||
73 | udelay(5); | ||
74 | DEV_RS &= ~0x10000; /* finish reset */ | ||
75 | |||
76 | outl(0xffffffff, 0x7000c120); | ||
77 | outl(0xffffffff, 0x7000c124); | ||
78 | outl(0xc00a1f00, 0x7000c100); | ||
79 | outl(0x1000000, 0x7000c104); | ||
80 | } | ||
81 | |||
82 | static inline int ipod_4g_button_read(void) | ||
83 | { | ||
84 | int whl = -1; | ||
85 | |||
86 | /* The ipodlinux source had a udelay(250) here, but testing has shown that | ||
87 | it is not needed - tested on Nano, Color/Photo and Video. */ | ||
88 | /* udelay(250);*/ | ||
89 | |||
90 | int btn = BUTTON_NONE; | ||
91 | unsigned reg = 0x7000c104; | ||
92 | if ((inl(0x7000c104) & 0x4000000) != 0) { | ||
93 | unsigned status = inl(0x7000c140); | ||
94 | |||
95 | reg = reg + 0x3C; /* 0x7000c140 */ | ||
96 | outl(0x0, 0x7000c140); /* clear interrupt status? */ | ||
97 | |||
98 | if ((status & 0x800000ff) == 0x8000001a) { | ||
99 | static int old_wheel_value IDATA_ATTR = -1; | ||
100 | static int wheel_repeat = 0; | ||
101 | |||
102 | if (status & 0x100) | ||
103 | btn |= BUTTON_SELECT; | ||
104 | if (status & 0x200) | ||
105 | btn |= BUTTON_RIGHT; | ||
106 | if (status & 0x400) | ||
107 | btn |= BUTTON_LEFT; | ||
108 | if (status & 0x800) | ||
109 | btn |= BUTTON_PLAY; | ||
110 | if (status & 0x1000) | ||
111 | btn |= BUTTON_MENU; | ||
112 | if (status & 0x40000000) { | ||
113 | /* NB: highest wheel = 0x5F, clockwise increases */ | ||
114 | int new_wheel_value = (status << 9) >> 25; | ||
115 | whl = new_wheel_value; | ||
116 | backlight_on(); | ||
117 | /* The queue should have no other events when scrolling */ | ||
118 | if (queue_empty(&button_queue) && old_wheel_value >= 0) { | ||
119 | |||
120 | /* This is for later = BUTTON_SCROLL_TOUCH;*/ | ||
121 | int wheel_delta = new_wheel_value - old_wheel_value; | ||
122 | unsigned long data; | ||
123 | int wheel_keycode; | ||
124 | |||
125 | if (wheel_delta < -48) | ||
126 | wheel_delta += 96; /* Forward wrapping case */ | ||
127 | else if (wheel_delta > 48) | ||
128 | wheel_delta -= 96; /* Backward wrapping case */ | ||
129 | |||
130 | if (wheel_delta > 4) { | ||
131 | wheel_keycode = BUTTON_SCROLL_FWD; | ||
132 | } else if (wheel_delta < -4) { | ||
133 | wheel_keycode = BUTTON_SCROLL_BACK; | ||
134 | } else goto wheel_end; | ||
135 | |||
136 | #ifdef HAVE_WHEEL_POSITION | ||
137 | if (send_events) | ||
138 | #endif | ||
139 | { | ||
140 | data = (wheel_delta << 16) | new_wheel_value; | ||
141 | queue_post(&button_queue, wheel_keycode | wheel_repeat, | ||
142 | (void *)data); | ||
143 | } | ||
144 | |||
145 | if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT; | ||
146 | } | ||
147 | |||
148 | old_wheel_value = new_wheel_value; | ||
149 | } else if (old_wheel_value >= 0) { | ||
150 | /* scroll wheel up */ | ||
151 | old_wheel_value = -1; | ||
152 | wheel_repeat = 0; | ||
153 | } | ||
154 | |||
155 | } else if (status == 0xffffffff) { | ||
156 | opto_i2c_init(); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | wheel_end: | ||
161 | |||
162 | if ((inl(reg) & 0x8000000) != 0) { | ||
163 | outl(0xffffffff, 0x7000c120); | ||
164 | outl(0xffffffff, 0x7000c124); | ||
165 | } | ||
166 | /* Save the new absolute wheel position */ | ||
167 | wheel_position = whl; | ||
168 | return btn; | ||
169 | } | ||
170 | |||
171 | #ifdef HAVE_WHEEL_POSITION | ||
172 | int wheel_status(void) | ||
173 | { | ||
174 | return wheel_position; | ||
175 | } | ||
176 | |||
177 | void wheel_send_events(bool send) | ||
178 | { | ||
179 | send_events = send; | ||
180 | } | ||
181 | #endif | ||
182 | |||
183 | void ipod_4g_button_int(void) | ||
184 | { | ||
185 | CPU_HI_INT_CLR = I2C_MASK; | ||
186 | /* The following delay was 250 in the ipodlinux source, but 50 seems to | ||
187 | work fine - tested on Nano, Color/Photo and Video. */ | ||
188 | udelay(50); | ||
189 | outl(0x0, 0x7000c140); | ||
190 | int_btn = ipod_4g_button_read(); | ||
191 | outl(inl(0x7000c104) | 0xC000000, 0x7000c104); | ||
192 | outl(0x400a1f00, 0x7000c100); | ||
193 | |||
194 | GPIOB_OUTPUT_VAL |= 0x10; | ||
195 | CPU_INT_EN = 0x40000000; | ||
196 | CPU_HI_INT_EN = I2C_MASK; | ||
197 | } | ||
198 | |||
199 | void button_init_device(void) | ||
200 | { | ||
201 | opto_i2c_init(); | ||
202 | /* hold button - enable as input */ | ||
203 | GPIOA_ENABLE |= 0x20; | ||
204 | GPIOA_OUTPUT_EN &= ~0x20; | ||
205 | /* hold button - set interrupt levels */ | ||
206 | GPIOA_INT_LEV = ~(GPIOA_INPUT_VAL & 0x20); | ||
207 | GPIOA_INT_CLR = GPIOA_INT_STAT & 0x20; | ||
208 | /* enable interrupts */ | ||
209 | GPIOA_INT_EN = 0x20; | ||
210 | /* unmask interrupt */ | ||
211 | CPU_INT_EN = 0x40000000; | ||
212 | CPU_HI_INT_EN = I2C_MASK; | ||
213 | } | ||
214 | |||
215 | /* | ||
216 | * Get button pressed from hardware | ||
217 | */ | ||
218 | int button_read_device(void) | ||
219 | { | ||
220 | static bool hold_button = false; | ||
221 | bool hold_button_old; | ||
222 | |||
223 | /* normal buttons */ | ||
224 | hold_button_old = hold_button; | ||
225 | hold_button = button_hold(); | ||
226 | |||
227 | if (hold_button != hold_button_old) | ||
228 | backlight_hold_changed(hold_button); | ||
229 | |||
230 | /* The int_btn variable is set in the button interrupt handler */ | ||
231 | return int_btn; | ||
232 | } | ||
233 | |||
234 | bool button_hold(void) | ||
235 | { | ||
236 | return (GPIOA_INPUT_VAL & 0x20)?false:true; | ||
237 | } | ||
diff --git a/firmware/target/arm/ipod/button-mini1g.c b/firmware/target/arm/ipod/button-mini1g.c new file mode 100644 index 0000000000..07885bc159 --- /dev/null +++ b/firmware/target/arm/ipod/button-mini1g.c | |||
@@ -0,0 +1,217 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Daniel Stenberg | ||
11 | * | ||
12 | * iPod driver based on code from the ipodlinux project - http://ipodlinux.org | ||
13 | * Adapted for Rockbox in December 2005 | ||
14 | * Original file: linux/arch/armnommu/mach-ipod/keyboard.c | ||
15 | * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org) | ||
16 | * | ||
17 | * | ||
18 | * All files in this archive are subject to the GNU General Public License. | ||
19 | * See the file COPYING in the source tree root for full license agreement. | ||
20 | * | ||
21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
22 | * KIND, either express or implied. | ||
23 | * | ||
24 | ****************************************************************************/ | ||
25 | |||
26 | /* | ||
27 | * Rockbox button functions | ||
28 | */ | ||
29 | |||
30 | #include <stdlib.h> | ||
31 | #include "config.h" | ||
32 | #include "cpu.h" | ||
33 | #include "system.h" | ||
34 | #include "button.h" | ||
35 | #include "kernel.h" | ||
36 | #include "backlight.h" | ||
37 | #include "adc.h" | ||
38 | #include "serial.h" | ||
39 | #include "power.h" | ||
40 | #include "system.h" | ||
41 | #include "powermgmt.h" | ||
42 | |||
43 | /* Variable to use for setting button status in interrupt handler */ | ||
44 | int int_btn = BUTTON_NONE; | ||
45 | #ifdef HAVE_WHEEL_POSITION | ||
46 | static int wheel_position = -1; | ||
47 | static bool send_events = true; | ||
48 | #endif | ||
49 | |||
50 | /* iPod 3G and mini 1G, mini 2G uses iPod 4G code */ | ||
51 | void handle_scroll_wheel(int new_scroll, int was_hold, int reverse) | ||
52 | { | ||
53 | int wheel_keycode = BUTTON_NONE; | ||
54 | static int prev_scroll = -1; | ||
55 | static int direction = 0; | ||
56 | static int count = 0; | ||
57 | static int scroll_state[4][4] = { | ||
58 | {0, 1, -1, 0}, | ||
59 | {-1, 0, 0, 1}, | ||
60 | {1, 0, 0, -1}, | ||
61 | {0, -1, 1, 0} | ||
62 | }; | ||
63 | |||
64 | if ( prev_scroll == -1 ) { | ||
65 | prev_scroll = new_scroll; | ||
66 | } | ||
67 | else if (direction != scroll_state[prev_scroll][new_scroll]) { | ||
68 | direction = scroll_state[prev_scroll][new_scroll]; | ||
69 | count = 0; | ||
70 | } | ||
71 | else if (!was_hold) { | ||
72 | backlight_on(); | ||
73 | if (++count == 6) { /* reduce sensitivity */ | ||
74 | count = 0; | ||
75 | switch (direction) { | ||
76 | case 1: | ||
77 | if (reverse) { | ||
78 | /* 'r' keypress */ | ||
79 | wheel_keycode = BUTTON_SCROLL_FWD; | ||
80 | } | ||
81 | else { | ||
82 | /* 'l' keypress */ | ||
83 | wheel_keycode = BUTTON_SCROLL_BACK; | ||
84 | } | ||
85 | break; | ||
86 | case -1: | ||
87 | if (reverse) { | ||
88 | /* 'l' keypress */ | ||
89 | wheel_keycode = BUTTON_SCROLL_BACK; | ||
90 | } | ||
91 | else { | ||
92 | /* 'r' keypress */ | ||
93 | wheel_keycode = BUTTON_SCROLL_FWD; | ||
94 | } | ||
95 | break; | ||
96 | default: | ||
97 | /* only happens if we get out of sync */ | ||
98 | break; | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | if (wheel_keycode != BUTTON_NONE && queue_empty(&button_queue)) | ||
103 | queue_post(&button_queue, wheel_keycode, NULL); | ||
104 | prev_scroll = new_scroll; | ||
105 | } | ||
106 | |||
107 | /* mini 1 only, mini 2G uses iPod 4G code */ | ||
108 | static int ipod_mini_button_read(void) | ||
109 | { | ||
110 | unsigned char source, wheel_source, state, wheel_state; | ||
111 | static bool was_hold = false; | ||
112 | int btn = BUTTON_NONE; | ||
113 | |||
114 | /* The ipodlinux source had a udelay(250) here, but testing has shown that | ||
115 | it is not needed - tested on mini 1g. */ | ||
116 | /* udelay(250);*/ | ||
117 | |||
118 | /* get source(s) of interupt */ | ||
119 | source = GPIOA_INT_STAT & 0x3f; | ||
120 | wheel_source = GPIOB_INT_STAT & 0x30; | ||
121 | |||
122 | if (source == 0 && wheel_source == 0) { | ||
123 | return BUTTON_NONE; /* not for us */ | ||
124 | } | ||
125 | |||
126 | /* get current keypad & wheel status */ | ||
127 | state = GPIOA_INPUT_VAL & 0x3f; | ||
128 | wheel_state = GPIOB_INPUT_VAL & 0x30; | ||
129 | |||
130 | /* toggle interrupt level */ | ||
131 | GPIOA_INT_LEV = ~state; | ||
132 | GPIOB_INT_LEV = ~wheel_state; | ||
133 | |||
134 | /* hold switch causes all outputs to go low */ | ||
135 | /* we shouldn't interpret these as key presses */ | ||
136 | if ((state & 0x20)) { | ||
137 | if (!(state & 0x1)) | ||
138 | btn |= BUTTON_SELECT; | ||
139 | if (!(state & 0x2)) | ||
140 | btn |= BUTTON_MENU; | ||
141 | if (!(state & 0x4)) | ||
142 | btn |= BUTTON_PLAY; | ||
143 | if (!(state & 0x8)) | ||
144 | btn |= BUTTON_RIGHT; | ||
145 | if (!(state & 0x10)) | ||
146 | btn |= BUTTON_LEFT; | ||
147 | |||
148 | if (wheel_source & 0x30) { | ||
149 | handle_scroll_wheel((wheel_state & 0x30) >> 4, was_hold, 1); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | was_hold = button_hold(); | ||
154 | |||
155 | /* ack any active interrupts */ | ||
156 | if (source) | ||
157 | GPIOA_INT_CLR = source; | ||
158 | if (wheel_source) | ||
159 | GPIOB_INT_CLR = wheel_source; | ||
160 | |||
161 | return btn; | ||
162 | } | ||
163 | |||
164 | void ipod_mini_button_int(void) | ||
165 | { | ||
166 | CPU_HI_INT_CLR = GPIO_MASK; | ||
167 | int_btn = ipod_mini_button_read(); | ||
168 | //CPU_INT_EN = 0x40000000; | ||
169 | CPU_HI_INT_EN = GPIO_MASK; | ||
170 | } | ||
171 | |||
172 | void button_init_device(void) | ||
173 | { | ||
174 | /* iPod Mini G1 */ | ||
175 | /* buttons - enable as input */ | ||
176 | GPIOA_ENABLE |= 0x3f; | ||
177 | GPIOA_OUTPUT_EN &= ~0x3f; | ||
178 | /* scroll wheel- enable as input */ | ||
179 | GPIOB_ENABLE |= 0x30; /* port b 4,5 */ | ||
180 | GPIOB_OUTPUT_EN &= ~0x30; /* port b 4,5 */ | ||
181 | /* buttons - set interrupt levels */ | ||
182 | GPIOA_INT_LEV = ~(GPIOA_INPUT_VAL & 0x3f); | ||
183 | GPIOA_INT_CLR = GPIOA_INT_STAT & 0x3f; | ||
184 | /* scroll wheel - set interrupt levels */ | ||
185 | GPIOB_INT_LEV = ~(GPIOB_INPUT_VAL & 0x30); | ||
186 | GPIOB_INT_CLR = GPIOB_INT_STAT & 0x30; | ||
187 | /* enable interrupts */ | ||
188 | GPIOA_INT_EN = 0x3f; | ||
189 | GPIOB_INT_EN = 0x30; | ||
190 | /* unmask interrupt */ | ||
191 | CPU_INT_EN = 0x40000000; | ||
192 | CPU_HI_INT_EN = GPIO_MASK; | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | * Get button pressed from hardware | ||
197 | */ | ||
198 | int button_read_device(void) | ||
199 | { | ||
200 | static bool hold_button = false; | ||
201 | bool hold_button_old; | ||
202 | |||
203 | /* normal buttons */ | ||
204 | hold_button_old = hold_button; | ||
205 | hold_button = button_hold(); | ||
206 | |||
207 | if (hold_button != hold_button_old) | ||
208 | backlight_hold_changed(hold_button); | ||
209 | |||
210 | /* The int_btn variable is set in the button interrupt handler */ | ||
211 | return int_btn; | ||
212 | } | ||
213 | |||
214 | bool button_hold(void) | ||
215 | { | ||
216 | return (GPIOA_INPUT_VAL & 0x20)?false:true; | ||
217 | } | ||
diff --git a/firmware/target/arm/ipod/button-target.h b/firmware/target/arm/ipod/button-target.h new file mode 100644 index 0000000000..d736effb72 --- /dev/null +++ b/firmware/target/arm/ipod/button-target.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _BUTTON_TARGET_H_ | ||
20 | #define _BUTTON_TARGET_H_ | ||
21 | |||
22 | #include <stdbool.h> | ||
23 | #include "config.h" | ||
24 | |||
25 | #define HAS_BUTTON_HOLD | ||
26 | |||
27 | bool button_hold(void); | ||
28 | void button_init_device(void); | ||
29 | int button_read_device(void); | ||
30 | |||
31 | void handle_scroll_wheel(int new_scroll, int was_hold, int reverse); | ||
32 | void ipod_mini_button_int(void); | ||
33 | void ipod_4g_button_int(void); | ||
34 | |||
35 | /* iPod specific button codes */ | ||
36 | |||
37 | #define BUTTON_SELECT 0x00000001 | ||
38 | #define BUTTON_MENU 0x00000002 | ||
39 | |||
40 | #define BUTTON_LEFT 0x00000004 | ||
41 | #define BUTTON_RIGHT 0x00000008 | ||
42 | #define BUTTON_SCROLL_FWD 0x00000010 | ||
43 | #define BUTTON_SCROLL_BACK 0x00000020 | ||
44 | |||
45 | #define BUTTON_PLAY 0x00000040 | ||
46 | |||
47 | #define BUTTON_MAIN (BUTTON_SELECT|BUTTON_MENU\ | ||
48 | |BUTTON_LEFT|BUTTON_RIGHT|BUTTON_SCROLL_FWD\ | ||
49 | |BUTTON_SCROLL_BACK|BUTTON_PLAY) | ||
50 | |||
51 | #define BUTTON_REMOTE 0 | ||
52 | |||
53 | /* This is for later | ||
54 | #define BUTTON_SCROLL_TOUCH 0x00000200 | ||
55 | */ | ||
56 | |||
57 | |||
58 | #define POWEROFF_BUTTON BUTTON_PLAY | ||
59 | #define POWEROFF_COUNT 40 | ||
60 | |||
61 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/ipod/power-ipod.c b/firmware/target/arm/ipod/power-ipod.c new file mode 100644 index 0000000000..8932b95cdd --- /dev/null +++ b/firmware/target/arm/ipod/power-ipod.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include <stdbool.h> | ||
22 | #include "adc.h" | ||
23 | #include "kernel.h" | ||
24 | #include "system.h" | ||
25 | #include "power.h" | ||
26 | #include "hwcompat.h" | ||
27 | #include "logf.h" | ||
28 | #include "pcf50605.h" | ||
29 | #include "usb.h" | ||
30 | #include "lcd.h" | ||
31 | |||
32 | void power_init(void) | ||
33 | { | ||
34 | pcf50605_init(); | ||
35 | } | ||
36 | |||
37 | bool charger_inserted(void) | ||
38 | { | ||
39 | #ifdef IPOD_VIDEO | ||
40 | return (GPIOL_INPUT_VAL & 0x08)?false:true; | ||
41 | #else | ||
42 | /* This needs filling in for other ipods. */ | ||
43 | return false; | ||
44 | #endif | ||
45 | } | ||
46 | |||
47 | /* Returns true if the unit is charging the batteries. */ | ||
48 | bool charging_state(void) { | ||
49 | return (GPIOB_INPUT_VAL & 0x01)?false:true; | ||
50 | } | ||
51 | |||
52 | |||
53 | void ide_power_enable(bool on) | ||
54 | { | ||
55 | /* We do nothing on the iPod */ | ||
56 | (void)on; | ||
57 | } | ||
58 | |||
59 | bool ide_powered(void) | ||
60 | { | ||
61 | /* pretend we are always powered - we don't turn it off on the ipod */ | ||
62 | return true; | ||
63 | } | ||
64 | |||
65 | void power_off(void) | ||
66 | { | ||
67 | #if defined(HAVE_LCD_COLOR) | ||
68 | /* Clear the screen and backdrop to | ||
69 | remove ghosting effect on shutdown */ | ||
70 | lcd_set_backdrop(NULL); | ||
71 | lcd_set_background(LCD_WHITE); | ||
72 | lcd_clear_display(); | ||
73 | lcd_update(); | ||
74 | sleep(HZ/16); | ||
75 | #endif | ||
76 | |||
77 | #ifndef BOOTLOADER | ||
78 | /* We don't turn off the ipod, we put it in a deep sleep */ | ||
79 | pcf50605_standby_mode(); | ||
80 | #endif | ||
81 | } | ||
diff --git a/firmware/target/arm/ipod/usb-ipod.c b/firmware/target/arm/ipod/usb-ipod.c new file mode 100644 index 0000000000..c481355768 --- /dev/null +++ b/firmware/target/arm/ipod/usb-ipod.c | |||
@@ -0,0 +1,114 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * iPod driver based on code from the ipodlinux project - http://ipodlinux.org | ||
13 | * Adapted for Rockbox in January 2006 | ||
14 | * Original file: podzilla/usb.c | ||
15 | * Copyright (C) 2005 Adam Johnston | ||
16 | * | ||
17 | * All files in this archive are subject to the GNU General Public License. | ||
18 | * See the file COPYING in the source tree root for full license agreement. | ||
19 | * | ||
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
21 | * KIND, either express or implied. | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | #include "config.h" | ||
25 | #include "cpu.h" | ||
26 | #include "kernel.h" | ||
27 | #include "thread.h" | ||
28 | #include "system.h" | ||
29 | #include "debug.h" | ||
30 | #include "ata.h" | ||
31 | #include "fat.h" | ||
32 | #include "disk.h" | ||
33 | #include "panic.h" | ||
34 | #include "lcd.h" | ||
35 | #include "adc.h" | ||
36 | #include "usb.h" | ||
37 | #include "button.h" | ||
38 | #include "sprintf.h" | ||
39 | #include "string.h" | ||
40 | #include "hwcompat.h" | ||
41 | |||
42 | void usb_init_device(void) | ||
43 | { | ||
44 | int r0; | ||
45 | outl(inl(0x70000084) | 0x200, 0x70000084); | ||
46 | |||
47 | outl(inl(0x7000002C) | 0x3000000, 0x7000002C); | ||
48 | outl(inl(0x6000600C) | 0x400000, 0x6000600C); | ||
49 | |||
50 | outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */ | ||
51 | outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */ | ||
52 | |||
53 | outl(inl(0x70000020) | 0x80000000, 0x70000020); | ||
54 | while ((inl(0x70000028) & 0x80) == 0); | ||
55 | |||
56 | outl(inl(0xc5000184) | 0x100, 0xc5000184); | ||
57 | while ((inl(0xc5000184) & 0x100) != 0); | ||
58 | |||
59 | outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4); | ||
60 | if ((inl(0xc50001A4) & 0x100) == 0) { | ||
61 | outl(inl(0xc50001A8) & ~0x3, 0xc50001A8); | ||
62 | outl(inl(0xc50001A8) | 0x2, 0xc50001A8); | ||
63 | outl(inl(0x70000028) | 0x4000, 0x70000028); | ||
64 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
65 | } else { | ||
66 | outl(inl(0xc50001A8) | 0x3, 0xc50001A8); | ||
67 | outl(inl(0x70000028) &~0x4000, 0x70000028); | ||
68 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
69 | } | ||
70 | outl(inl(0xc5000140) | 0x2, 0xc5000140); | ||
71 | while((inl(0xc5000140) & 0x2) != 0); | ||
72 | r0 = inl(0xc5000184); | ||
73 | |||
74 | /* Note from IPL source (referring to next 5 lines of code: | ||
75 | THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */ | ||
76 | outl(inl(0x70000020) | 0x80000000, 0x70000020); | ||
77 | outl(inl(0x6000600C) | 0x400000, 0x6000600C); | ||
78 | while ((inl(0x70000028) & 0x80) == 0); | ||
79 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
80 | |||
81 | udelay(0x186A0); | ||
82 | } | ||
83 | |||
84 | void usb_enable(bool on) | ||
85 | { | ||
86 | /* For the ipod, we can only do one thing with USB mode - reboot | ||
87 | into Apple's flash-based disk-mode. This does not return. */ | ||
88 | if (on) | ||
89 | { | ||
90 | /* The following code is copied from ipodlinux */ | ||
91 | #if defined(IPOD_COLOR) || defined(IPOD_3G) || \ | ||
92 | defined(IPOD_4G) || defined(IPOD_MINI) | ||
93 | unsigned char* storage_ptr = (unsigned char *)0x40017F00; | ||
94 | #elif defined(IPOD_NANO) || defined(IPOD_VIDEO) || defined(IPOD_MINI2G) | ||
95 | unsigned char* storage_ptr = (unsigned char *)0x4001FF00; | ||
96 | #endif | ||
97 | memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21); | ||
98 | DEV_RS |= 4; /* Reboot */ | ||
99 | } | ||
100 | } | ||
101 | |||
102 | bool usb_detect(void) | ||
103 | { | ||
104 | bool current_status; | ||
105 | |||
106 | /* The following check is in the ipodlinux source, with the | ||
107 | comment "USB2D_IDENT is bad" if USB2D_IDENT != 0x22FA05 */ | ||
108 | if (USB2D_IDENT != 0x22FA05) { | ||
109 | return false; | ||
110 | } | ||
111 | current_status = (USB_STATUS & 0x800)?true:false; | ||
112 | |||
113 | return current_status; | ||
114 | } | ||
diff --git a/firmware/target/arm/ipod/usb-target.h b/firmware/target/arm/ipod/usb-target.h new file mode 100644 index 0000000000..69a81472f8 --- /dev/null +++ b/firmware/target/arm/ipod/usb-target.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardelll | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef USB_TARGET_H | ||
20 | #define USB_TARGET_H | ||
21 | |||
22 | bool usb_init_device(void); | ||
23 | |||
24 | #endif | ||
diff --git a/firmware/usb.c b/firmware/usb.c index ce9d1ce69f..f83cb44e17 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -175,23 +175,6 @@ void usb_enable(bool on) | |||
175 | or_l(0x00000008,&GPIO1_OUT); | 175 | or_l(0x00000008,&GPIO1_OUT); |
176 | #endif | 176 | #endif |
177 | } | 177 | } |
178 | |||
179 | #elif defined(USB_IPODSTYLE) | ||
180 | /* For the ipod, we can only do one thing with USB mode - reboot | ||
181 | into Apple's flash-based disk-mode. This does not return. */ | ||
182 | if (on) | ||
183 | { | ||
184 | /* The following code is copied from ipodlinux */ | ||
185 | #if defined(IPOD_COLOR) || defined(IPOD_3G) || \ | ||
186 | defined(IPOD_4G) || defined(IPOD_MINI) | ||
187 | unsigned char* storage_ptr = (unsigned char *)0x40017F00; | ||
188 | #elif defined(IPOD_NANO) || defined(IPOD_VIDEO) || defined(IPOD_MINI2G) | ||
189 | unsigned char* storage_ptr = (unsigned char *)0x4001FF00; | ||
190 | #endif | ||
191 | memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21); | ||
192 | DEV_RS |= 4; /* Reboot */ | ||
193 | } | ||
194 | |||
195 | #elif defined(USB_ISP1582) | 178 | #elif defined(USB_ISP1582) |
196 | /* TODO: Implement USB_ISP1582 */ | 179 | /* TODO: Implement USB_ISP1582 */ |
197 | (void) on; | 180 | (void) on; |
@@ -496,7 +479,9 @@ void usb_init(void) | |||
496 | usb_monitor_enabled = false; | 479 | usb_monitor_enabled = false; |
497 | countdown = -1; | 480 | countdown = -1; |
498 | 481 | ||
499 | #ifdef USB_IRIVERSTYLE | 482 | #ifdef TARGET_TREE |
483 | usb_init_device(); | ||
484 | #elif defined USB_IRIVERSTYLE | ||
500 | or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */ | 485 | or_l(0x00000080, &GPIO1_FUNCTION); /* GPIO39 is the USB detect input */ |
501 | 486 | ||
502 | #ifdef IRIVER_H300_SERIES | 487 | #ifdef IRIVER_H300_SERIES |
@@ -514,45 +499,6 @@ void usb_init(void) | |||
514 | or_l(0x01000040, &GPIO_FUNCTION); | 499 | or_l(0x01000040, &GPIO_FUNCTION); |
515 | #endif | 500 | #endif |
516 | 501 | ||
517 | #elif defined(USB_IPODSTYLE) | ||
518 | int r0; | ||
519 | outl(inl(0x70000084) | 0x200, 0x70000084); | ||
520 | |||
521 | outl(inl(0x7000002C) | 0x3000000, 0x7000002C); | ||
522 | outl(inl(0x6000600C) | 0x400000, 0x6000600C); | ||
523 | |||
524 | outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */ | ||
525 | outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */ | ||
526 | |||
527 | outl(inl(0x70000020) | 0x80000000, 0x70000020); | ||
528 | while ((inl(0x70000028) & 0x80) == 0); | ||
529 | |||
530 | outl(inl(0xc5000184) | 0x100, 0xc5000184); | ||
531 | while ((inl(0xc5000184) & 0x100) != 0); | ||
532 | |||
533 | outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4); | ||
534 | if ((inl(0xc50001A4) & 0x100) == 0) { | ||
535 | outl(inl(0xc50001A8) & ~0x3, 0xc50001A8); | ||
536 | outl(inl(0xc50001A8) | 0x2, 0xc50001A8); | ||
537 | outl(inl(0x70000028) | 0x4000, 0x70000028); | ||
538 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
539 | } else { | ||
540 | outl(inl(0xc50001A8) | 0x3, 0xc50001A8); | ||
541 | outl(inl(0x70000028) &~0x4000, 0x70000028); | ||
542 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
543 | } | ||
544 | outl(inl(0xc5000140) | 0x2, 0xc5000140); | ||
545 | while((inl(0xc5000140) & 0x2) != 0); | ||
546 | r0 = inl(0xc5000184); | ||
547 | |||
548 | /* Note from IPL source (referring to next 5 lines of code: | ||
549 | THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */ | ||
550 | outl(inl(0x70000020) | 0x80000000, 0x70000020); | ||
551 | outl(inl(0x6000600C) | 0x400000, 0x6000600C); | ||
552 | while ((inl(0x70000028) & 0x80) == 0); | ||
553 | outl(inl(0x70000028) | 0x2, 0x70000028); | ||
554 | |||
555 | udelay(0x186A0); | ||
556 | #endif | 502 | #endif |
557 | 503 | ||
558 | usb_enable(false); | 504 | usb_enable(false); |
diff --git a/tools/configure b/tools/configure index bbbdc50150..b0f54e96c4 100755 --- a/tools/configure +++ b/tools/configure | |||
@@ -777,6 +777,10 @@ EOF | |||
777 | # toolset is the tools within the tools directory that we build for | 777 | # toolset is the tools within the tools directory that we build for |
778 | # this particular target. | 778 | # this particular target. |
779 | toolset=$ipodbitmaptools | 779 | toolset=$ipodbitmaptools |
780 | # architecture, manufacturer and model for the target-tree build | ||
781 | t_cpu="arm" | ||
782 | t_manufacturer="ipod" | ||
783 | t_model="color" | ||
780 | ;; | 784 | ;; |
781 | 785 | ||
782 | 21|ipodnano) | 786 | 21|ipodnano) |
@@ -799,6 +803,10 @@ EOF | |||
799 | # toolset is the tools within the tools directory that we build for | 803 | # toolset is the tools within the tools directory that we build for |
800 | # this particular target. | 804 | # this particular target. |
801 | toolset=$ipodbitmaptools | 805 | toolset=$ipodbitmaptools |
806 | # architecture, manufacturer and model for the target-tree build | ||
807 | t_cpu="arm" | ||
808 | t_manufacturer="ipod" | ||
809 | t_model="nano" | ||
802 | ;; | 810 | ;; |
803 | 811 | ||
804 | 22|ipodvideo) | 812 | 22|ipodvideo) |
@@ -821,6 +829,10 @@ EOF | |||
821 | # toolset is the tools within the tools directory that we build for | 829 | # toolset is the tools within the tools directory that we build for |
822 | # this particular target. | 830 | # this particular target. |
823 | toolset=$ipodbitmaptools | 831 | toolset=$ipodbitmaptools |
832 | # architecture, manufacturer and model for the target-tree build | ||
833 | t_cpu="arm" | ||
834 | t_manufacturer="ipod" | ||
835 | t_model="video" | ||
824 | ;; | 836 | ;; |
825 | 837 | ||
826 | 23|ipod3g) | 838 | 23|ipod3g) |
@@ -843,6 +855,10 @@ EOF | |||
843 | # toolset is the tools within the tools directory that we build for | 855 | # toolset is the tools within the tools directory that we build for |
844 | # this particular target. | 856 | # this particular target. |
845 | toolset=$ipodbitmaptools | 857 | toolset=$ipodbitmaptools |
858 | # architecture, manufacturer and model for the target-tree build | ||
859 | t_cpu="arm" | ||
860 | t_manufacturer="ipod" | ||
861 | t_model="3g" | ||
846 | ;; | 862 | ;; |
847 | 863 | ||
848 | 24|ipod4g) | 864 | 24|ipod4g) |
@@ -865,6 +881,10 @@ EOF | |||
865 | # toolset is the tools within the tools directory that we build for | 881 | # toolset is the tools within the tools directory that we build for |
866 | # this particular target. | 882 | # this particular target. |
867 | toolset=$ipodbitmaptools | 883 | toolset=$ipodbitmaptools |
884 | # architecture, manufacturer and model for the target-tree build | ||
885 | t_cpu="arm" | ||
886 | t_manufacturer="ipod" | ||
887 | t_model="4g" | ||
868 | ;; | 888 | ;; |
869 | 889 | ||
870 | 25|ipodmini) | 890 | 25|ipodmini) |
@@ -887,6 +907,10 @@ EOF | |||
887 | # toolset is the tools within the tools directory that we build for | 907 | # toolset is the tools within the tools directory that we build for |
888 | # this particular target. | 908 | # this particular target. |
889 | toolset=$ipodbitmaptools | 909 | toolset=$ipodbitmaptools |
910 | # architecture, manufacturer and model for the target-tree build | ||
911 | t_cpu="arm" | ||
912 | t_manufacturer="ipod" | ||
913 | t_model="mini" | ||
890 | ;; | 914 | ;; |
891 | 915 | ||
892 | 13|ifp7xx) | 916 | 13|ifp7xx) |
@@ -953,6 +977,10 @@ EOF | |||
953 | # toolset is the tools within the tools directory that we build for | 977 | # toolset is the tools within the tools directory that we build for |
954 | # this particular target. | 978 | # this particular target. |
955 | toolset=$ipodbitmaptools | 979 | toolset=$ipodbitmaptools |
980 | # architecture, manufacturer and model for the target-tree build | ||
981 | t_cpu="arm" | ||
982 | t_manufacturer="ipod" | ||
983 | t_model="mini2g" | ||
956 | ;; | 984 | ;; |
957 | 985 | ||
958 | 14|h10) | 986 | 14|h10) |