summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/crt0.S8
-rw-r--r--firmware/drivers/power.c2
-rw-r--r--firmware/export/config-ipodcolor.h2
-rw-r--r--firmware/export/config-ipodnano.h2
-rw-r--r--firmware/export/config-ipodvideo.h2
-rw-r--r--firmware/export/kernel.h6
-rw-r--r--firmware/kernel.c11
-rw-r--r--firmware/system.c11
8 files changed, 35 insertions, 9 deletions
diff --git a/firmware/crt0.S b/firmware/crt0.S
index df2ff5884d..9dad41944a 100644
--- a/firmware/crt0.S
+++ b/firmware/crt0.S
@@ -197,12 +197,13 @@ start_loc:
197 /* execute the loader - this will load an image to 0x10000000 */ 197 /* execute the loader - this will load an image to 0x10000000 */
198 bl main 198 bl main
199 199
200 /* The loader only returns if it is loading the Apple firmware or Linux -
201 the following code isn't executed when starting Rockbox */
202
200 /* save the startup address for the COP */ 203 /* save the startup address for the COP */
201 ldr r1, =startup_loc 204 ldr r1, =startup_loc
202 str r0, [r1] 205 str r0, [r1]
203 206
204#if 0
205/* TODO: fix something for the COP to wake up to, until then let it sleep. */
206#if CONFIG_CPU==PP5002 207#if CONFIG_CPU==PP5002
207 /* make sure COP is sleeping */ 208 /* make sure COP is sleeping */
208 ldr r4, =0xcf004050 209 ldr r4, =0xcf004050
@@ -227,8 +228,7 @@ start_loc:
227 @ldr r4, =PP5020_COP_CTRL 228 @ldr r4, =PP5020_COP_CTRL
228 mov r3, #0x0 229 mov r3, #0x0
229 str r3, [r4] 230 str r3, [r4]
230#endif 231#endif
231#endif
232 /* jump to start location */ 232 /* jump to start location */
233 mov pc, r0 233 mov pc, r0
234 234
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index 04168f9895..141d985ee6 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -262,8 +262,10 @@ void power_off(void)
262#if CONFIG_CPU == MCF5249 262#if CONFIG_CPU == MCF5249
263 and_l(~0x00080000, &GPIO1_OUT); 263 and_l(~0x00080000, &GPIO1_OUT);
264#elif CONFIG_CPU == PP5020 264#elif CONFIG_CPU == PP5020
265#ifndef BOOTLOADER
265 /* We don't turn off the ipod, we put it in a deep sleep */ 266 /* We don't turn off the ipod, we put it in a deep sleep */
266 pcf50605_standby_mode(); 267 pcf50605_standby_mode();
268#endif
267#elif defined(GMINI_ARCH) 269#elif defined(GMINI_ARCH)
268 P1 &= ~1; 270 P1 &= ~1;
269 P1CON &= ~1; 271 P1CON &= ~1;
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 6de461f952..778055f3d7 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -27,7 +27,9 @@
27#define CONFIG_CODEC SWCODEC 27#define CONFIG_CODEC SWCODEC
28 28
29/* define this if you have a real-time clock */ 29/* define this if you have a real-time clock */
30#ifndef BOOTLOADER
30#define CONFIG_RTC RTC_PCF50605 31#define CONFIG_RTC RTC_PCF50605
32#endif
31 33
32/* Define this if you have a software controlled poweroff */ 34/* Define this if you have a software controlled poweroff */
33#define HAVE_SW_POWEROFF 35#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index bf7362a168..86cc279bb8 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -27,7 +27,9 @@
27#define CONFIG_CODEC SWCODEC 27#define CONFIG_CODEC SWCODEC
28 28
29/* define this if you have a real-time clock */ 29/* define this if you have a real-time clock */
30#ifndef BOOTLOADER
30#define CONFIG_RTC RTC_PCF50605 31#define CONFIG_RTC RTC_PCF50605
32#endif
31 33
32/* Define this if you have a software controlled poweroff */ 34/* Define this if you have a software controlled poweroff */
33#define HAVE_SW_POWEROFF 35#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index 3c3f403983..e06e999e1c 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -27,7 +27,9 @@
27#define CONFIG_CODEC SWCODEC 27#define CONFIG_CODEC SWCODEC
28 28
29/* define this if you have a real-time clock */ 29/* define this if you have a real-time clock */
30#ifndef BOOTLOADER
30#define CONFIG_RTC RTC_PCF50605 31#define CONFIG_RTC RTC_PCF50605
32#endif
31 33
32/* Define this if you have a software controlled poweroff */ 34/* Define this if you have a software controlled poweroff */
33#define HAVE_SW_POWEROFF 35#define HAVE_SW_POWEROFF
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
index 23c7bc7cb1..42d160bcea 100644
--- a/firmware/export/kernel.h
+++ b/firmware/export/kernel.h
@@ -66,7 +66,13 @@ struct mutex
66}; 66};
67 67
68/* global tick variable */ 68/* global tick variable */
69#if (CONFIG_CPU == PP5020) && defined(BOOTLOADER)
70/* We don't enable interrupts in the iPod bootloader, so we need to fake
71 the current_tick variable */
72#define current_tick ((*((volatile long*)0x60005010))/10000)
73#else
69extern long current_tick; 74extern long current_tick;
75#endif
70 76
71#ifdef SIMULATOR 77#ifdef SIMULATOR
72#define sleep(x) sim_sleep(x) 78#define sleep(x) sim_sleep(x)
diff --git a/firmware/kernel.c b/firmware/kernel.c
index 6166437282..a353c4bdc9 100644
--- a/firmware/kernel.c
+++ b/firmware/kernel.c
@@ -25,7 +25,9 @@
25#include "system.h" 25#include "system.h"
26#include "panic.h" 26#include "panic.h"
27 27
28#if (CONFIG_CPU != PP5020) || !defined(BOOTLOADER)
28long current_tick = 0; 29long current_tick = 0;
30#endif
29 31
30static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void); 32static void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
31 33
@@ -48,7 +50,7 @@ void kernel_init(void)
48 50
49 num_queues = 0; 51 num_queues = 0;
50 memset(all_queues, 0, sizeof(all_queues)); 52 memset(all_queues, 0, sizeof(all_queues));
51 53
52 tick_start(1000/HZ); 54 tick_start(1000/HZ);
53} 55}
54 56
@@ -319,6 +321,7 @@ void tick_start(unsigned int interval_in_ms)
319 321
320#define USECS_PER_INT 0x2710 322#define USECS_PER_INT 0x2710
321 323
324#ifndef BOOTLOADER
322void TIMER1(void) 325void TIMER1(void)
323{ 326{
324 int i; 327 int i;
@@ -336,9 +339,11 @@ void TIMER1(void)
336 current_tick++; 339 current_tick++;
337 wake_up_thread(); 340 wake_up_thread();
338} 341}
342#endif
339 343
340void tick_start(unsigned int interval_in_ms) 344void tick_start(unsigned int interval_in_ms)
341{ 345{
346#ifndef BOOTLOADER
342 /* TODO: use interval_in_ms to set timer periode */ 347 /* TODO: use interval_in_ms to set timer periode */
343 (void)interval_in_ms; 348 (void)interval_in_ms;
344 PP5020_TIMER1 = 0x0; 349 PP5020_TIMER1 = 0x0;
@@ -347,6 +352,10 @@ void tick_start(unsigned int interval_in_ms)
347 PP5020_TIMER1 = 0xc0000000 | USECS_PER_INT; 352 PP5020_TIMER1 = 0xc0000000 | USECS_PER_INT;
348 /* unmask interrupt source */ 353 /* unmask interrupt source */
349 PP5020_CPU_INT_EN = PP5020_TIMER1_MASK; 354 PP5020_CPU_INT_EN = PP5020_TIMER1_MASK;
355#else
356 /* We don't enable interrupts in the bootloader */
357 (void)interval_in_ms;
358#endif
350} 359}
351 360
352#endif 361#endif
diff --git a/firmware/system.c b/firmware/system.c
index 0015b3a55d..7afa3f720e 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -1106,6 +1106,7 @@ int system_memory_guard(int newmode)
1106} 1106}
1107#elif CONFIG_CPU==PP5020 1107#elif CONFIG_CPU==PP5020
1108 1108
1109#ifndef BOOTLOADER
1109extern void TIMER1(void); 1110extern void TIMER1(void);
1110extern void ipod_4g_button_int(void); 1111extern void ipod_4g_button_int(void);
1111 1112
@@ -1116,6 +1117,7 @@ void irq(void)
1116 else if (PP5020_CPU_HI_INT_STAT & PP5020_I2C_MASK) 1117 else if (PP5020_CPU_HI_INT_STAT & PP5020_I2C_MASK)
1117 ipod_4g_button_int(); 1118 ipod_4g_button_int();
1118} 1119}
1120#endif
1119 1121
1120/* TODO: The following two function have been lifted straight from IPL, and 1122/* TODO: The following two function have been lifted straight from IPL, and
1121 hence have a lot of numeric addresses used straight. I'd like to use 1123 hence have a lot of numeric addresses used straight. I'd like to use
@@ -1124,11 +1126,10 @@ void irq(void)
1124 to extend the funtions to do alternate cache configurations and/or 1126 to extend the funtions to do alternate cache configurations and/or
1125 some other CPU frequency scaling. */ 1127 some other CPU frequency scaling. */
1126 1128
1129#ifndef BOOTLOADER
1127static void ipod_init_cache(void) 1130static void ipod_init_cache(void)
1128{ 1131{
1129/* Initialising the cache in the iPod Video bootloader prevents 1132/* Initialising the cache in the iPod bootloader prevents Rockbox from starting */
1130 Rockbox from starting */
1131#if !defined(BOOTLOADER) || !defined(APPLE_IPODVIDEO)
1132 unsigned i; 1133 unsigned i;
1133 1134
1134 /* cache init mode? */ 1135 /* cache init mode? */
@@ -1147,7 +1148,6 @@ static void ipod_init_cache(void)
1147 1148
1148 for (i = 0x10000000; i < 0x10002000; i += 16) 1149 for (i = 0x10000000; i < 0x10002000; i += 16)
1149 inb(i); 1150 inb(i);
1150#endif
1151} 1151}
1152 1152
1153static void ipod_set_cpu_speed(void) 1153static void ipod_set_cpu_speed(void)
@@ -1163,9 +1163,11 @@ static void ipod_set_cpu_speed(void)
1163 1163
1164 outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020); 1164 outl((inl(0x60006020) & 0x0fffff0f) | 0x20000070, 0x60006020);
1165} 1165}
1166#endif
1166 1167
1167void system_init(void) 1168void system_init(void)
1168{ 1169{
1170#ifndef BOOTLOADER
1169 /* disable all irqs */ 1171 /* disable all irqs */
1170 outl(-1, 0x60001138); 1172 outl(-1, 0x60001138);
1171 outl(-1, 0x60001128); 1173 outl(-1, 0x60001128);
@@ -1176,6 +1178,7 @@ void system_init(void)
1176 outl(-1, 0x6000101c); 1178 outl(-1, 0x6000101c);
1177 ipod_set_cpu_speed(); 1179 ipod_set_cpu_speed();
1178 ipod_init_cache(); 1180 ipod_init_cache();
1181#endif
1179} 1182}
1180 1183
1181void system_reboot(void) 1184void system_reboot(void)