summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Sparmann <theseven@rockbox.org>2010-10-10 20:52:46 +0000
committerMichael Sparmann <theseven@rockbox.org>2010-10-10 20:52:46 +0000
commitc599da333e0e69e75329f6b350611303ba644bf6 (patch)
tree5eaa23689a095d9780ee737d88e5aab07328590e
parente94eea95389567047dbbfd064f456ab8028b2852 (diff)
downloadrockbox-c599da333e0e69e75329f6b350611303ba644bf6.tar.gz
rockbox-c599da333e0e69e75329f6b350611303ba644bf6.tar.bz2
rockbox-c599da333e0e69e75329f6b350611303ba644bf6.zip
Commit FS#11663 by me - Patch: iPod Nano 2G Bootloader: Boot OF if MENU button is held
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28237 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--bootloader/ipodnano2g.c8
-rw-r--r--firmware/target/arm/ipod/button-clickwheel.c74
2 files changed, 61 insertions, 21 deletions
diff --git a/bootloader/ipodnano2g.c b/bootloader/ipodnano2g.c
index b2b2138f78..be714c6273 100644
--- a/bootloader/ipodnano2g.c
+++ b/bootloader/ipodnano2g.c
@@ -82,10 +82,6 @@ void fatal_error(void)
}
}
-/* aes_decrypt() and readfw() functions taken from iLoader.
- (C) Michael Sparmann and licenced under GPL v2 or later.
-*/
-
static void aes_decrypt(void* data, uint32_t size)
{
uint32_t ptr, i;
@@ -196,9 +192,9 @@ void main(void)
lcd_set_background(LCD_BLACK);
lcd_clear_display();
-// button_init();
+ button_init();
- btn=0; /* TODO */
+ btn = button_status();
/* Enable bootloader messages */
if (btn==BUTTON_RIGHT)
diff --git a/firmware/target/arm/ipod/button-clickwheel.c b/firmware/target/arm/ipod/button-clickwheel.c
index 512e133402..580f95a453 100644
--- a/firmware/target/arm/ipod/button-clickwheel.c
+++ b/firmware/target/arm/ipod/button-clickwheel.c
@@ -50,9 +50,16 @@
#ifdef CPU_PP
#define CLICKWHEEL_DATA (*(volatile unsigned long*)(0x7000c140))
#elif CONFIG_CPU==S5L8701
-#define CLICKWHEEL00 (*(volatile unsigned long*)(0x3c200000))
-#define CLICKWHEEL10 (*(volatile unsigned long*)(0x3c200010))
-#define CLICKWHEELINT (*(volatile unsigned long*)(0x3c200014))
+#define PCON15 (*((volatile uint32_t*)(0x3CF000F0)))
+#define PUNK15 (*((volatile uint32_t*)(0x3CF000FC)))
+#define WHEEL00 (*((volatile uint32_t*)(0x3C200000)))
+#define WHEEL04 (*((volatile uint32_t*)(0x3C200004)))
+#define WHEEL08 (*((volatile uint32_t*)(0x3C200008)))
+#define WHEEL0C (*((volatile uint32_t*)(0x3C20000C)))
+#define WHEEL10 (*((volatile uint32_t*)(0x3C200010)))
+#define WHEELINT (*((volatile uint32_t*)(0x3C200014)))
+#define WHEELRX (*((volatile uint32_t*)(0x3C200018)))
+#define WHEELTX (*((volatile uint32_t*)(0x3C20001C)))
#define CLICKWHEEL_DATA (*(volatile unsigned long*)(0x3c200018))
#else
#error CPU architecture not supported!
@@ -86,6 +93,10 @@ int int_btn = BUTTON_NONE;
static bool send_events = true;
#endif
+#if CONFIG_CPU==S5L8701
+static struct wakeup button_init_wakeup;
+#endif
+
#ifdef CPU_PP
static void opto_i2c_init(void)
{
@@ -254,6 +265,23 @@ static inline int ipod_4g_button_read(void)
}
}
+#if CONFIG_CPU==S5L8701
+ else if ((status & 0x8000FFFF) == 0x8000023A)
+ {
+ if (status & 0x00010000)
+ btn |= BUTTON_SELECT;
+ if (status & 0x00020000)
+ btn |= BUTTON_RIGHT;
+ if (status & 0x00040000)
+ btn |= BUTTON_LEFT;
+ if (status & 0x00080000)
+ btn |= BUTTON_PLAY;
+ if (status & 0x00100000)
+ btn |= BUTTON_MENU;
+ wakeup_signal(&button_init_wakeup);
+ }
+#endif
+
#ifdef CPU_PP
}
#endif
@@ -319,23 +347,37 @@ bool headphones_inserted(void)
#else
void INT_SPI(void)
{
- int clickwheel_events = CLICKWHEELINT;
+ int clickwheel_events = WHEELINT;
/* Clear interrupts */
- if (clickwheel_events & 4) CLICKWHEELINT = 4;
- if (clickwheel_events & 2) CLICKWHEELINT = 2;
- if (clickwheel_events & 1) CLICKWHEELINT = 1;
+ if (clickwheel_events & 4) WHEELINT = 4;
+ if (clickwheel_events & 2) WHEELINT = 2;
+ if (clickwheel_events & 1) WHEELINT = 1;
int_btn = ipod_4g_button_read();
}
+void s5l_clickwheel_init(void)
+{
+ PWRCONEXT &= ~1;
+ PCON15 = (PCON15 & ~0xFFFF0000) | 0x22220000;
+ PUNK15 = 0xF0;
+ WHEEL08 = 0x3A980;
+ WHEEL00 = 0x280000;
+ WHEEL10 = 3;
+ PCON10 = (PCON10 & ~0xFF0) | 0x10;
+ PDAT10 |= 2;
+ WHEELTX = 0x8000023A;
+ WHEEL04 |= 1;
+ PDAT10 &= ~2;
+}
+
void button_init_device(void)
{
- CLICKWHEEL00 = 0x280000;
- CLICKWHEEL10 = 3;
- INTMOD = 0;
+ wakeup_init(&button_init_wakeup);
INTMSK |= (1<<26);
- PCON10 &= ~0xF00;
+ s5l_clickwheel_init();
+ wakeup_wait(&button_init_wakeup, HZ / 10);
}
bool button_hold(void)
@@ -363,7 +405,9 @@ int button_read_device(void)
if (hold_button != hold_button_old)
{
+#ifndef BOOTLOADER
backlight_hold_changed(hold_button);
+#endif
if (hold_button)
{
@@ -372,8 +416,9 @@ int button_read_device(void)
DEV_EN &= ~DEV_OPTO;
#elif CONFIG_CPU==S5L8701
pmu_ldo_power_off(1); /* disable clickwheel power supply */
- CLICKWHEEL00 = 0;
- CLICKWHEEL10 = 0;
+ WHEEL00 = 0;
+ WHEEL10 = 0;
+ PWRCONEXT |= 1;
#endif
}
else
@@ -384,8 +429,7 @@ int button_read_device(void)
opto_i2c_init();
#elif CONFIG_CPU==S5L8701
pmu_ldo_power_on(1); /* enable clickwheel power supply */
- CLICKWHEEL00 = 0x280000;
- CLICKWHEEL10 = 3;
+ s5l_clickwheel_init();
#endif
}
}