diff options
Diffstat (limited to 'firmware')
| -rw-r--r-- | firmware/backlight.c | 2 | ||||
| -rw-r--r-- | firmware/drivers/adc.c | 2 | ||||
| -rw-r--r-- | firmware/drivers/button.c | 60 | ||||
| -rw-r--r-- | firmware/export/button.h | 3 | ||||
| -rw-r--r-- | firmware/export/config-ipod3g.h | 4 | ||||
| -rw-r--r-- | firmware/export/pp5002.h | 64 | ||||
| -rw-r--r-- | firmware/system.c | 10 | ||||
| -rw-r--r-- | firmware/usb.c | 11 |
8 files changed, 78 insertions, 78 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c index 0049f78..1a7ea8e 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -34,7 +34,7 @@ #include "pcf50606.h" /* iRiver brightness */ #endif -#if CONFIG_BACKLIGHT == BL_IRIVER_H300 +#if (CONFIG_BACKLIGHT == BL_IRIVER_H300) || (CONFIG_BACKLIGHT == BL_IPOD3G) #include "lcd.h" /* for lcd_enable() */ #endif #ifdef HAVE_REMOTE_LCD diff --git a/firmware/drivers/adc.c b/firmware/drivers/adc.c index e565372..6e1c577 100644 --- a/firmware/drivers/adc.c +++ b/firmware/drivers/adc.c @@ -282,7 +282,7 @@ void adc_init(void) sleep(2); /* Ensure valid readings when adc_init returns */ } -#elif CONFIG_CPU == PP5020 +#elif CONFIG_CPU == PP5020 || (CONFIG_CPU == PP5002) /* TODO: Implement adc.c */ diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 9f9ed12..d585550 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -241,9 +241,6 @@ void ipod_4g_button_int(void) } #endif #if CONFIG_KEYPAD == IPOD_3G_PAD -/* Variable to use for setting button status in interrupt handler */ -int int_btn = BUTTON_NONE; - /** * * @@ -282,13 +279,14 @@ void handle_scroll_wheel(int new_scroll, int was_hold, int reverse) else { /* 'r' keypress */ wheel_keycode = BUTTON_SCROLL_FWD; + } break; default: /* only happens if we get out of sync */ break; + } } - } if (wheel_keycode != BUTTON_NONE) queue_post(&button_queue, wheel_keycode, NULL); prev_scroll = new_scroll; @@ -306,65 +304,56 @@ int btn = BUTTON_NONE; udelay(250); /* get source of interupts */ - source = inb(0xcf000040); - if (source) { + source = GPIOA_INT_STAT; + /* get current keypad status */ - state = inb(0xcf000030); - outb(~state, 0xcf000060); + state = GPIOA_INPUT_VAL; + GPIOA_INT_LEV = ~state; if (was_hold && source == 0x40 && state == 0xbf) { /* ack any active interrupts */ - outb(source, 0xcf000070); + GPIOA_INT_CLR = source; return BUTTON_NONE; } was_hold = 0; - if ( source & 0x20 ) { + if ((state & 0x20) == 0) { /* 3g hold switch is active low */ btn |= BUTTON_HOLD; was_hold = 1; /* hold switch on 3g causes all outputs to go low */ /* we shouldn't interpret these as key presses */ - goto done; + GPIOA_INT_CLR = source; + return BUTTON_NONE; } - if (source & 0x1) { + if ((state & 0x1) == 0) { btn |= BUTTON_RIGHT; } - if (source & 0x2) { + if ((state & 0x2) == 0) { btn |= BUTTON_SELECT; } - if (source & 0x4) { + if ((state & 0x4) == 0) { btn |= BUTTON_PLAY; } - if (source & 0x8) { + if ((state & 0x8) == 0) { btn |= BUTTON_LEFT; } - if (source & 0x10) { + if ((state & 0x10) == 0) { btn |= BUTTON_MENU; } if (source & 0xc0) { handle_scroll_wheel((state & 0xc0) >> 6, was_hold, 0); } - done: /* ack any active interrupts */ - outb(source, 0xcf000070); - } + GPIOA_INT_CLR = source; + return btn; } -void ipod_3g_button_int(void) -{ - /** - * Theire is other things to do but for now ... - * TODO: implement this function in a better way - **/ - int_btn = ipod_3g_button_read(); - -} #endif static void button_tick(void) { @@ -566,10 +555,9 @@ void button_init(void) CPU_HI_INT_EN = I2C_MASK; #elif CONFIG_KEYPAD == IPOD_3G_PAD - outb(~inb(GPIOA_INPUT_VAL), GPIOA_INT_LEV); - outb(inb(GPIOA_INT_STAT), GPIOA_INT_CLR); - outb(0xff, GPIOA_INT_EN); - + GPIOA_INT_LEV = ~GPIOA_INPUT_VAL; + GPIOA_INT_CLR = GPIOA_INT_STAT; + GPIOA_INT_EN = 0xff; #endif /* CONFIG_KEYPAD */ queue_init(&button_queue); button_read(); @@ -1043,10 +1031,14 @@ static int button_read(void) if (data & 0x01) btn |= BUTTON_ON; -#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD) +#elif (CONFIG_KEYPAD == IPOD_4G_PAD) (void)data; /* The int_btn variable is set in the button interrupt handler */ btn = int_btn; +#elif (CONFIG_KEYPAD == IPOD_3G_PAD) + (void)data; + btn = ipod_3g_button_read(); + #elif (CONFIG_KEYPAD == IAUDIO_X5_PAD) static bool hold_button = false; static bool remote_hold_button = false; @@ -1098,7 +1090,7 @@ static int button_read(void) return retval; } -#if (CONFIG_KEYPAD == IPOD_4G_PAD) +#if (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) bool button_hold(void) { return (GPIOA_INPUT_VAL & 0x20)?false:true; diff --git a/firmware/export/button.h b/firmware/export/button.h index 3ae1d37..12eab9f 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -27,7 +27,8 @@ (CONFIG_KEYPAD == IAUDIO_X5_PAD) #define HAS_BUTTON_HOLD #define HAS_REMOTE_BUTTON_HOLD -#elif (CONFIG_KEYPAD == IPOD_4G_PAD) +#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \ + (CONFIG_KEYPAD == IPOD_3G_PAD) #define HAS_BUTTON_HOLD #endif extern struct event_queue button_queue; diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 9d55b6b..e809afa 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -82,10 +82,8 @@ /* Offset ( in the firmware file's header ) to the real data */ #define FIRMWARE_OFFSET_FILE_DATA 8 -#define USB_IPODSTYLE +#define USB_NONE -/* define this if the unit can be powered or charged via USB */ -#define HAVE_USB_POWER /* Virtual LED (icon) */ #define CONFIG_LED LED_VIRTUAL diff --git a/firmware/export/pp5002.h b/firmware/export/pp5002.h index 36bb3c9..3104fde 100644 --- a/firmware/export/pp5002.h +++ b/firmware/export/pp5002.h @@ -21,38 +21,38 @@ /* All info gleaned and/or copied from the iPodLinux project. */ -#define GPIOA_ENABLE (*(volatile unsigned long *)(0xcf000000)) -#define GPIOB_ENABLE (*(volatile unsigned long *)(0xcf000004)) -#define GPIOC_ENABLE (*(volatile unsigned long *)(0xcf000008)) -#define GPIOD_ENABLE (*(volatile unsigned long *)(0xcf00000c)) -#define GPIOA_OUTPUT_EN (*(volatile unsigned long *)(0xcf000010)) -#define GPIOB_OUTPUT_EN (*(volatile unsigned long *)(0xcf000014)) -#define GPIOC_OUTPUT_EN (*(volatile unsigned long *)(0xcf000018)) -#define GPIOD_OUTPUT_EN (*(volatile unsigned long *)(0xcf00001c)) -#define GPIOA_OUTPUT_VAL (*(volatile unsigned long *)(0xcf000020)) -#define GPIOB_OUTPUT_VAL (*(volatile unsigned long *)(0xcf000024)) -#define GPIOC_OUTPUT_VAL (*(volatile unsigned long *)(0xcf000028)) -#define GPIOD_OUTPUT_VAL (*(volatile unsigned long *)(0xcf00002c)) -#define GPIOA_INPUT_VAL (*(volatile unsigned long *)(0xcf000030)) -#define GPIOB_INPUT_VAL (*(volatile unsigned long *)(0xcf000034)) -#define GPIOC_INPUT_VAL (*(volatile unsigned long *)(0xcf000038)) -#define GPIOD_INPUT_VAL (*(volatile unsigned long *)(0xcf00003c)) -#define GPIOA_INT_STAT (*(volatile unsigned long *)(0xcf000040)) -#define GPIOB_INT_STAT (*(volatile unsigned long *)(0xcf000044)) -#define GPIOC_INT_STAT (*(volatile unsigned long *)(0xcf000048)) -#define GPIOD_INT_STAT (*(volatile unsigned long *)(0xcf00004c)) -#define GPIOA_INT_EN (*(volatile unsigned long *)(0xcf000050)) -#define GPIOB_INT_EN (*(volatile unsigned long *)(0xcf000054)) -#define GPIOC_INT_EN (*(volatile unsigned long *)(0xcf000058)) -#define GPIOD_INT_EN (*(volatile unsigned long *)(0xcf00005c)) -#define GPIOA_INT_LEV (*(volatile unsigned long *)(0xcf000060)) -#define GPIOB_INT_LEV (*(volatile unsigned long *)(0xcf000064)) -#define GPIOC_INT_LEV (*(volatile unsigned long *)(0xcf000068)) -#define GPIOD_INT_LEV (*(volatile unsigned long *)(0xcf00006c)) -#define GPIOA_INT_CLR (*(volatile unsigned long *)(0xcf000070)) -#define GPIOB_INT_CLR (*(volatile unsigned long *)(0xcf000074)) -#define GPIOC_INT_CLR (*(volatile unsigned long *)(0xcf000078)) -#define GPIOD_INT_CLR (*(volatile unsigned long *)(0xcf00007c)) +#define GPIOA_ENABLE (*(volatile unsigned char *)(0xcf000000)) +#define GPIOB_ENABLE (*(volatile unsigned char *)(0xcf000004)) +#define GPIOC_ENABLE (*(volatile unsigned char *)(0xcf000008)) +#define GPIOD_ENABLE (*(volatile unsigned char *)(0xcf00000c)) +#define GPIOA_OUTPUT_EN (*(volatile unsigned char *)(0xcf000010)) +#define GPIOB_OUTPUT_EN (*(volatile unsigned char *)(0xcf000014)) +#define GPIOC_OUTPUT_EN (*(volatile unsigned char *)(0xcf000018)) +#define GPIOD_OUTPUT_EN (*(volatile unsigned char *)(0xcf00001c)) +#define GPIOA_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000020)) +#define GPIOB_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000024)) +#define GPIOC_OUTPUT_VAL (*(volatile unsigned char *)(0xcf000028)) +#define GPIOD_OUTPUT_VAL (*(volatile unsigned char *)(0xcf00002c)) +#define GPIOA_INPUT_VAL (*(volatile unsigned char *)(0xcf000030)) +#define GPIOB_INPUT_VAL (*(volatile unsigned char *)(0xcf000034)) +#define GPIOC_INPUT_VAL (*(volatile unsigned char *)(0xcf000038)) +#define GPIOD_INPUT_VAL (*(volatile unsigned char *)(0xcf00003c)) +#define GPIOA_INT_STAT (*(volatile unsigned char *)(0xcf000040)) +#define GPIOB_INT_STAT (*(volatile unsigned char *)(0xcf000044)) +#define GPIOC_INT_STAT (*(volatile unsigned char *)(0xcf000048)) +#define GPIOD_INT_STAT (*(volatile unsigned char *)(0xcf00004c)) +#define GPIOA_INT_EN (*(volatile unsigned char *)(0xcf000050)) +#define GPIOB_INT_EN (*(volatile unsigned char *)(0xcf000054)) +#define GPIOC_INT_EN (*(volatile unsigned char *)(0xcf000058)) +#define GPIOD_INT_EN (*(volatile unsigned char *)(0xcf00005c)) +#define GPIOA_INT_LEV (*(volatile unsigned char *)(0xcf000060)) +#define GPIOB_INT_LEV (*(volatile unsigned char *)(0xcf000064)) +#define GPIOC_INT_LEV (*(volatile unsigned char *)(0xcf000068)) +#define GPIOD_INT_LEV (*(volatile unsigned char *)(0xcf00006c)) +#define GPIOA_INT_CLR (*(volatile unsigned char *)(0xcf000070)) +#define GPIOB_INT_CLR (*(volatile unsigned char *)(0xcf000074)) +#define GPIOC_INT_CLR (*(volatile unsigned char *)(0xcf000078)) +#define GPIOD_INT_CLR (*(volatile unsigned char *)(0xcf00007c)) #define DEV_RS (*(volatile unsigned long *)( 0xcf005030)) #define DEV_EN (*(volatile unsigned long *)( 0xcf005000)) diff --git a/firmware/system.c b/firmware/system.c index df75fbb..b47d983 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -1230,14 +1230,16 @@ int system_memory_guard(int newmode) unsigned int ipod_hw_rev; #ifndef BOOTLOADER extern void TIMER1(void); -extern void ipod_3g_button_int(void); void irq(void) { if (CPU_INT_STAT & TIMER1_MASK) TIMER1(); - else if (CPU_INT_STAT & GPIO_MASK) - ipod_3g_button_int(); +} + +void fiq(void) +{ + /** TODO: implement this function **/ } #endif @@ -1259,7 +1261,7 @@ static void ipod_init_cache(void) outl(0x2, 0xcf004024); /* PP5002 has 8KB cache */ - for (i = 0xf0004000; i < 0xf0006000; i += 16) { + for (i = 0xf0004000; i < (int)(0xf0006000); i += 16) { outl(0x0, i); } diff --git a/firmware/usb.c b/firmware/usb.c index f98bfa3..4fa032d 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -68,7 +68,7 @@ void screen_dump(void); /* Nasty again. Defined in apps/ too */ #elif CONFIG_KEYPAD == ONDIO_PAD #define USBPOWER_BUTTON BUTTON_MENU #define USBPOWER_BTN_IGNORE BUTTON_OFF -#elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD) +#elif (CONFIG_KEYPAD == IPOD_4G_PAD) #define USBPOWER_BUTTON BUTTON_MENU #define USBPOWER_BTN_IGNORE BUTTON_PLAY #elif CONFIG_KEYPAD == IRIVER_H300_PAD @@ -166,7 +166,7 @@ void usb_enable(bool on) #endif } -#elif defined(USB_IPODSTYLE) +#elif defined(USB_IPODSTYLE) /* For the ipod, we can only do one thing with USB mode - reboot into Apple's flash-based disk-mode. This does not return. */ if (on) @@ -181,6 +181,7 @@ void usb_enable(bool on) memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21); DEV_RS |= 4; /* Reboot */ } + #elif defined(USB_ISP1582) /* TODO: Implement USB_ISP1582 */ (void) on; @@ -554,6 +555,7 @@ void usb_init(void) tick_add_task(usb_tick); #endif + } void usb_wait_for_disconnect(struct event_queue *q) @@ -642,4 +644,9 @@ bool usb_detect(void) return false; } +void usb_wait_for_disconnect(struct event_queue *q) +{ + (void*)q; +} + #endif /* USB_NONE or SIMULATOR */ |