From b701322fea42c809092f50e252f45ddfc38293c3 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 27 Jul 2007 09:57:27 +0000 Subject: 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 --- firmware/target/arm/ipod/3g/button-3g.c | 18 +++++++++++++----- firmware/target/arm/ipod/adc-ipod.c | 5 ++++- firmware/target/arm/ipod/power-ipod.c | 7 +++++++ 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'firmware') 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) unsigned char source, state; static int was_hold = 0; int btn = BUTTON_NONE; - /* - * we need some delay for g3, cause hold generates several interrupts, - * some of them delayed - */ + +#ifdef IPOD_3G + /* we need some delay for g3, cause hold generates several interrupts, + * some of them delayed */ udelay(250); +#endif /* get source of interupts */ source = GPIOA_INT_STAT; @@ -117,6 +118,7 @@ static int ipod_3g_button_read(void) state = GPIOA_INPUT_VAL; GPIOA_INT_LEV = ~state; +#ifdef IPOD_3G if (was_hold && source == 0x40 && state == 0xbf) { /* ack any active interrupts */ GPIOA_INT_CLR = source; @@ -124,7 +126,6 @@ static int ipod_3g_button_read(void) } was_hold = 0; - if ((state & 0x20) == 0) { /* 3g hold switch is active low */ was_hold = 1; @@ -133,6 +134,12 @@ static int ipod_3g_button_read(void) GPIOA_INT_CLR = source; return BUTTON_NONE; } +#elif defined IPOD_1G2G + if (state & 0x20) + was_hold = 1; + else + was_hold = 0; +#endif if ((state & 0x1) == 0) { btn |= BUTTON_RIGHT; } @@ -163,6 +170,7 @@ void button_init_device(void) { GPIOA_INT_LEV = ~GPIOA_INPUT_VAL; GPIOA_INT_CLR = GPIOA_INT_STAT; + /* TODO: put additional G1 code here */ GPIOA_INT_EN = 0xff; } 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; static unsigned short _adc_read(struct adc_struct *adc) { +#ifndef IPOD_1G2G if (adc->timeout < current_tick) { unsigned char data[2]; unsigned short value; @@ -54,7 +55,9 @@ static unsigned short _adc_read(struct adc_struct *adc) } adc->data = value; return value; - } else { + } else +#endif + { return adc->data; } } 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 @@ void power_init(void) { +#ifndef IPOD_1G2G pcf50605_init(); +#endif } bool charger_inserted(void) @@ -74,7 +76,12 @@ void power_off(void) #endif #ifndef BOOTLOADER +#ifdef IPOD_1G2G + /* we cannot turn off the 1st gen/ 2nd gen yet. Need to figure out sleep mode. */ + system_reboot(); +#else /* We don't turn off the ipod, we put it in a deep sleep */ pcf50605_standby_mode(); #endif +#endif } -- cgit v1.2.3