summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/as3525/system-as3525.c5
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/system-imx31.c10
-rw-r--r--firmware/target/arm/pnx0101/system-pnx0101.c5
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c6
-rw-r--r--firmware/target/arm/s5l8700/system-s5l8700.c5
-rw-r--r--firmware/target/arm/system-arm.c66
-rw-r--r--firmware/target/arm/system-pp5002.c12
-rw-r--r--firmware/target/arm/system-pp502x.c11
-rw-r--r--firmware/target/arm/tcc77x/system-tcc77x.c5
-rw-r--r--firmware/target/arm/tcc780x/system-tcc780x.c5
10 files changed, 130 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c
index b502b22425..c8366fe2bf 100644
--- a/firmware/target/arm/as3525/system-as3525.c
+++ b/firmware/target/arm/as3525/system-as3525.c
@@ -279,6 +279,11 @@ void system_reboot(void)
279 while(1); 279 while(1);
280} 280}
281 281
282void system_exception_wait(void)
283{
284 while (1);
285}
286
282int system_memory_guard(int newmode) 287int system_memory_guard(int newmode)
283{ 288{
284 (void)newmode; 289 (void)newmode;
diff --git a/firmware/target/arm/imx31/gigabeat-s/system-imx31.c b/firmware/target/arm/imx31/gigabeat-s/system-imx31.c
index 1e084485ac..c339f4fe7c 100644
--- a/firmware/target/arm/imx31/gigabeat-s/system-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/system-imx31.c
@@ -65,6 +65,16 @@ int system_memory_guard(int newmode)
65 65
66void system_reboot(void) 66void system_reboot(void)
67{ 67{
68 /* Multi-context so no SPI available (WDT?) */
69 while (1);
70}
71
72void system_exception_wait(void)
73{
74 /* Called in many contexts so button reading may be a chore */
75 avic_disable_int(ALL);
76 core_idle();
77 while (1);
68} 78}
69 79
70void system_init(void) 80void system_init(void)
diff --git a/firmware/target/arm/pnx0101/system-pnx0101.c b/firmware/target/arm/pnx0101/system-pnx0101.c
index f447f5f044..63720d11be 100644
--- a/firmware/target/arm/pnx0101/system-pnx0101.c
+++ b/firmware/target/arm/pnx0101/system-pnx0101.c
@@ -305,6 +305,11 @@ void system_reboot(void)
305 while (1); 305 while (1);
306} 306}
307 307
308void system_exception_wait(void)
309{
310 while (1);
311}
312
308int system_memory_guard(int newmode) 313int system_memory_guard(int newmode)
309{ 314{
310 (void)newmode; 315 (void)newmode;
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c
index 43e2c408a2..61b4653726 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/system-meg-fx.c
@@ -111,6 +111,12 @@ void system_reboot(void)
111 ; 111 ;
112} 112}
113 113
114void system_exception_wait(void)
115{
116 INTMSK = 0xFFFFFFFF;
117 while (GPGDAT & (1 << 0)) == 0); /* Wait for power button */
118}
119
114static void set_page_tables(void) 120static void set_page_tables(void)
115{ 121{
116 map_section(0, 0, 0x1000, CACHE_NONE); /* map every memory region to itself */ 122 map_section(0, 0, 0x1000, CACHE_NONE); /* map every memory region to itself */
diff --git a/firmware/target/arm/s5l8700/system-s5l8700.c b/firmware/target/arm/s5l8700/system-s5l8700.c
index 1370db40d7..c535a0d955 100644
--- a/firmware/target/arm/s5l8700/system-s5l8700.c
+++ b/firmware/target/arm/s5l8700/system-s5l8700.c
@@ -132,6 +132,11 @@ void system_reboot(void)
132{ 132{
133} 133}
134 134
135void system_exception_wait(void)
136{
137 while (1);
138}
139
135int system_memory_guard(int newmode) 140int system_memory_guard(int newmode)
136{ 141{
137 (void)newmode; 142 (void)newmode;
diff --git a/firmware/target/arm/system-arm.c b/firmware/target/arm/system-arm.c
new file mode 100644
index 0000000000..5c5a18c867
--- /dev/null
+++ b/firmware/target/arm/system-arm.c
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Thom Johansen
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "system.h"
23#include <stdio.h>
24#include "lcd.h"
25#include "font.h"
26
27static const char* const uiename[] = {
28 "Undefined instruction",
29 "Prefetch abort",
30 "Data abort",
31 "Divide by zero"
32};
33
34/* Unexpected Interrupt or Exception handler. Currently only deals with
35 exceptions, but will deal with interrupts later.
36 */
37void __attribute__((noreturn)) UIE(unsigned int pc, unsigned int num)
38{
39 char str[32];
40
41 lcd_clear_display();
42#ifdef HAVE_LCD_BITMAP
43 lcd_setfont(FONT_SYSFIXED);
44#endif
45 lcd_puts(0, 0, uiename[num]);
46 snprintf(str, sizeof(str), "at %08x" IF_COP(" (%d)"), pc
47 IF_COP(, CURRENT_CORE));
48 lcd_puts(0, 1, str);
49 lcd_update();
50
51 disable_interrupt(IRQ_FIQ_STATUS);
52
53 system_exception_wait(); /* If this returns, try to reboot */
54 system_reboot();
55 while (1); /* halt */
56}
57
58/* Needs to be here or gcc won't find it */
59void __attribute__((naked)) __div0(void)
60{
61 asm volatile (
62 "ldr r0, [sp] \r\n"
63 "mov r1, #3 \r\n"
64 "b UIE \r\n"
65 );
66}
diff --git a/firmware/target/arm/system-pp5002.c b/firmware/target/arm/system-pp5002.c
index b9a937c6e8..1b37d3303f 100644
--- a/firmware/target/arm/system-pp5002.c
+++ b/firmware/target/arm/system-pp5002.c
@@ -203,6 +203,18 @@ void system_init(void)
203void system_reboot(void) 203void system_reboot(void)
204{ 204{
205 DEV_RS |= 4; 205 DEV_RS |= 4;
206 while (1);
207}
208
209void system_exception_wait(void)
210{
211 /* FIXME: we just need the right buttons */
212 CPU_INT_DIS = -1;
213 COP_INT_DIS = -1;
214
215 /* Halt */
216 sleep_core(CURRENT_CORE);
217 while (1);
206} 218}
207 219
208int system_memory_guard(int newmode) 220int system_memory_guard(int newmode)
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index b1f178c8d5..277b1e9a0b 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -455,6 +455,17 @@ void system_reboot(void)
455 while (1); 455 while (1);
456} 456}
457 457
458void system_exception_wait(void)
459{
460 /* FIXME: we just need the right buttons */
461 CPU_INT_DIS = -1;
462 COP_INT_DIS = -1;
463
464 /* Halt */
465 PROC_CTL(CURRENT_CORE) = 0x40000000;
466 while (1);
467}
468
458int system_memory_guard(int newmode) 469int system_memory_guard(int newmode)
459{ 470{
460 (void)newmode; 471 (void)newmode;
diff --git a/firmware/target/arm/tcc77x/system-tcc77x.c b/firmware/target/arm/tcc77x/system-tcc77x.c
index 0896026b55..90e53afb14 100644
--- a/firmware/target/arm/tcc77x/system-tcc77x.c
+++ b/firmware/target/arm/tcc77x/system-tcc77x.c
@@ -58,6 +58,11 @@ void system_reboot(void)
58{ 58{
59} 59}
60 60
61void system_exception_wait(void)
62{
63 while (1);
64}
65
61/* TODO - these should live in the target-specific directories and 66/* TODO - these should live in the target-specific directories and
62 once we understand what all the GPIO pins do, move the init to the 67 once we understand what all the GPIO pins do, move the init to the
63 specific driver for that hardware. For now, we just perform the 68 specific driver for that hardware. For now, we just perform the
diff --git a/firmware/target/arm/tcc780x/system-tcc780x.c b/firmware/target/arm/tcc780x/system-tcc780x.c
index 5ecbbdac7c..bf3c64cd7a 100644
--- a/firmware/target/arm/tcc780x/system-tcc780x.c
+++ b/firmware/target/arm/tcc780x/system-tcc780x.c
@@ -287,6 +287,11 @@ void system_reboot(void)
287 while (1); 287 while (1);
288} 288}
289 289
290void system_exception_wait(void)
291{
292 while ((GPIOA & 0x10) == 0); /* check for power button */
293}
294
290int system_memory_guard(int newmode) 295int system_memory_guard(int newmode)
291{ 296{
292 (void)newmode; 297 (void)newmode;