summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-07-27 09:57:27 +0000
committerJens Arnold <amiconn@rockbox.org>2007-07-27 09:57:27 +0000
commitb701322fea42c809092f50e252f45ddfc38293c3 (patch)
treec988afdc26b6527c9e7a5db3c2c4e2c54bf674c9 /firmware/target/arm
parent90eacb26164598ae7e13074071836d6100a045a7 (diff)
downloadrockbox-b701322fea42c809092f50e252f45ddfc38293c3.tar.gz
rockbox-b701322fea42c809092f50e252f45ddfc38293c3.zip
Rockbox compiles and boots now on the 2nd gen, but doesn't work properly yet.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14021 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/ipod/3g/button-3g.c18
-rw-r--r--firmware/target/arm/ipod/adc-ipod.c5
-rw-r--r--firmware/target/arm/ipod/power-ipod.c7
3 files changed, 24 insertions, 6 deletions
diff --git a/firmware/target/arm/ipod/3g/button-3g.c b/firmware/target/arm/ipod/3g/button-3g.c
index c034d55936..aa26e30280 100644
--- a/firmware/target/arm/ipod/3g/button-3g.c
+++ b/firmware/target/arm/ipod/3g/button-3g.c
@@ -103,11 +103,12 @@ static int ipod_3g_button_read(void)
103 unsigned char source, state; 103 unsigned char source, state;
104 static int was_hold = 0; 104 static int was_hold = 0;
105 int btn = BUTTON_NONE; 105 int btn = BUTTON_NONE;
106 /* 106
107 * we need some delay for g3, cause hold generates several interrupts, 107#ifdef IPOD_3G
108 * some of them delayed 108 /* we need some delay for g3, cause hold generates several interrupts,
109 */ 109 * some of them delayed */
110 udelay(250); 110 udelay(250);
111#endif
111 112
112 /* get source of interupts */ 113 /* get source of interupts */
113 source = GPIOA_INT_STAT; 114 source = GPIOA_INT_STAT;
@@ -117,6 +118,7 @@ static int ipod_3g_button_read(void)
117 state = GPIOA_INPUT_VAL; 118 state = GPIOA_INPUT_VAL;
118 GPIOA_INT_LEV = ~state; 119 GPIOA_INT_LEV = ~state;
119 120
121#ifdef IPOD_3G
120 if (was_hold && source == 0x40 && state == 0xbf) { 122 if (was_hold && source == 0x40 && state == 0xbf) {
121 /* ack any active interrupts */ 123 /* ack any active interrupts */
122 GPIOA_INT_CLR = source; 124 GPIOA_INT_CLR = source;
@@ -124,7 +126,6 @@ static int ipod_3g_button_read(void)
124 } 126 }
125 was_hold = 0; 127 was_hold = 0;
126 128
127
128 if ((state & 0x20) == 0) { 129 if ((state & 0x20) == 0) {
129 /* 3g hold switch is active low */ 130 /* 3g hold switch is active low */
130 was_hold = 1; 131 was_hold = 1;
@@ -133,6 +134,12 @@ static int ipod_3g_button_read(void)
133 GPIOA_INT_CLR = source; 134 GPIOA_INT_CLR = source;
134 return BUTTON_NONE; 135 return BUTTON_NONE;
135 } 136 }
137#elif defined IPOD_1G2G
138 if (state & 0x20)
139 was_hold = 1;
140 else
141 was_hold = 0;
142#endif
136 if ((state & 0x1) == 0) { 143 if ((state & 0x1) == 0) {
137 btn |= BUTTON_RIGHT; 144 btn |= BUTTON_RIGHT;
138 } 145 }
@@ -163,6 +170,7 @@ void button_init_device(void)
163{ 170{
164 GPIOA_INT_LEV = ~GPIOA_INPUT_VAL; 171 GPIOA_INT_LEV = ~GPIOA_INPUT_VAL;
165 GPIOA_INT_CLR = GPIOA_INT_STAT; 172 GPIOA_INT_CLR = GPIOA_INT_STAT;
173 /* TODO: put additional G1 code here */
166 GPIOA_INT_EN = 0xff; 174 GPIOA_INT_EN = 0xff;
167} 175}
168 176
diff --git a/firmware/target/arm/ipod/adc-ipod.c b/firmware/target/arm/ipod/adc-ipod.c
index d351f0ee81..493b98ef74 100644
--- a/firmware/target/arm/ipod/adc-ipod.c
+++ b/firmware/target/arm/ipod/adc-ipod.c
@@ -36,6 +36,7 @@ static struct adc_struct adcdata[NUM_ADC_CHANNELS] IDATA_ATTR;
36 36
37static unsigned short _adc_read(struct adc_struct *adc) 37static unsigned short _adc_read(struct adc_struct *adc)
38{ 38{
39#ifndef IPOD_1G2G
39 if (adc->timeout < current_tick) { 40 if (adc->timeout < current_tick) {
40 unsigned char data[2]; 41 unsigned char data[2];
41 unsigned short value; 42 unsigned short value;
@@ -54,7 +55,9 @@ static unsigned short _adc_read(struct adc_struct *adc)
54 } 55 }
55 adc->data = value; 56 adc->data = value;
56 return value; 57 return value;
57 } else { 58 } else
59#endif
60 {
58 return adc->data; 61 return adc->data;
59 } 62 }
60} 63}
diff --git a/firmware/target/arm/ipod/power-ipod.c b/firmware/target/arm/ipod/power-ipod.c
index 4fde6faac1..1a84cbe022 100644
--- a/firmware/target/arm/ipod/power-ipod.c
+++ b/firmware/target/arm/ipod/power-ipod.c
@@ -30,7 +30,9 @@
30 30
31void power_init(void) 31void power_init(void)
32{ 32{
33#ifndef IPOD_1G2G
33 pcf50605_init(); 34 pcf50605_init();
35#endif
34} 36}
35 37
36bool charger_inserted(void) 38bool charger_inserted(void)
@@ -74,7 +76,12 @@ void power_off(void)
74#endif 76#endif
75 77
76#ifndef BOOTLOADER 78#ifndef BOOTLOADER
79#ifdef IPOD_1G2G
80 /* we cannot turn off the 1st gen/ 2nd gen yet. Need to figure out sleep mode. */
81 system_reboot();
82#else
77 /* We don't turn off the ipod, we put it in a deep sleep */ 83 /* We don't turn off the ipod, we put it in a deep sleep */
78 pcf50605_standby_mode(); 84 pcf50605_standby_mode();
79#endif 85#endif
86#endif
80} 87}