summaryrefslogtreecommitdiffstats
path: root/firmware/system.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-02-25 13:00:36 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-02-25 13:00:36 +0000
commitf9c780ccc146fd883374f8f89c14c9ce5968ee51 (patch)
tree7f09a228e34adeed9c626c9f6e91ded8003e678c /firmware/system.c
parent34455abfe6c93adbdc835be15cd01af8277229aa (diff)
downloadrockbox-f9c780ccc146fd883374f8f89c14c9ce5968ee51.tar.gz
rockbox-f9c780ccc146fd883374f8f89c14c9ce5968ee51.zip
The cli()/sti() functions are not safe. We should have removed them long ago.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4314 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/system.c')
-rw-r--r--firmware/system.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/firmware/system.c b/firmware/system.c
index 87d3b9dc7d..3ec56f7c15 100644
--- a/firmware/system.c
+++ b/firmware/system.c
@@ -302,7 +302,7 @@ void (*vbr[]) (void) __attribute__ ((section (".vectors"))) =
void system_reboot (void)
{
- cli ();
+ set_irq_level(15);
asm volatile ("ldc\t%0,vbr" : : "r"(0));
@@ -318,6 +318,18 @@ void system_reboot (void)
"r"(*(int*)0),"r"(4));
}
+/****************************************************************************
+ * Interrupt level setting
+ ****************************************************************************/
+int set_irq_level(int level)
+{
+ int i;
+ /* Read the old level and set the new one */
+ asm volatile ("stc sr, %0" : "=r" (i));
+ asm volatile ("ldc %0, sr" : : "r" (level << 4));
+ return (i >> 4) & 0x0f;
+}
+
void UIE (unsigned int pc) /* Unexpected Interrupt or Exception */
{
bool state = true;