aboutsummaryrefslogtreecommitdiffstats
path: root/ports
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-12-18 10:46:23 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-12-18 10:46:23 +0000
commit2c91f58d0f0baf6b75a20b46d20bdeb524aa356f (patch)
treed73385719a8eb96f72446bf256dc7894b7b1e55b /ports
parentd34507ec44db7333c8a81ae23ffd89a05ef3293d (diff)
downloadChibiOS-2c91f58d0f0baf6b75a20b46d20bdeb524aa356f.tar.gz
ChibiOS-2c91f58d0f0baf6b75a20b46d20bdeb524aa356f.tar.bz2
ChibiOS-2c91f58d0f0baf6b75a20b46d20bdeb524aa356f.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@146 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports')
-rw-r--r--ports/ARM7-LPC214x/GCC/chcore.c61
-rw-r--r--ports/ARM7-LPC214x/GCC/chcore2.s72
2 files changed, 61 insertions, 72 deletions
diff --git a/ports/ARM7-LPC214x/GCC/chcore.c b/ports/ARM7-LPC214x/GCC/chcore.c
index 51ead6542..c8e2c61f7 100644
--- a/ports/ARM7-LPC214x/GCC/chcore.c
+++ b/ports/ARM7-LPC214x/GCC/chcore.c
@@ -33,6 +33,67 @@ void _IdleThread(void *p) {
}
}
+#ifdef THUMB
+void chSysLock(void) {
+
+ asm(".p2align 2,, \n\t" \
+ "mov r0, pc \n\t" \
+ "bx r0 \n\t" \
+ ".code 32 \n\t" \
+ "msr CPSR_c, #0x9F \n\t" \
+ "bx lr \n\t");
+}
+
+void chSysUnlock(void) {
+
+ asm(".p2align 2,, \n\t" \
+ "mov r0, pc \n\t" \
+ "bx r0 \n\t" \
+ ".code 32 \n\t" \
+ "msr CPSR_c, #0x1F \n\t" \
+ "bx lr \n\t");
+}
+#endif
+
+void chSysSwitchI(Context *oldp, Context *newp) {
+
+#ifdef CH_CURRP_REGISTER_CACHE
+#ifdef THUMB
+ asm(".p2align 2,, \n\t" \
+ "mov r2, pc \n\t" \
+ "bx r2 \n\t" \
+ ".code 32 \n\t" \
+ "stmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr} \n\t" \
+ "str sp, [r0, #0] \n\t" \
+ "ldr sp, [r1, #0] \n\t" \
+ "ldmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr} \n\t" \
+ "bx lr \n\t");
+#else /* !THUMB */
+ asm("stmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr} \n\t" \
+ "str sp, [r0, #0] \n\t" \
+ "ldr sp, [r1, #0] \n\t" \
+ "ldmfd sp!, {r4, r5, r6, r8, r9, r10, r11, pc} \n\t");
+#endif /* !THUMB */
+#else /* !CH_CURRP_REGISTER_CACHE */
+#ifdef THUMB
+ asm(".p2align 2,, \n\t" \
+ "mov r2, pc \n\t" \
+ "bx r2 \n\t" \
+ ".code 32 \n\t" \
+ "stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t" \
+ "str sp, [r0, #0] \n\t" \
+ "ldr sp, [r1, #0] \n\t" \
+ "ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t" \
+ "bx lr \n\t");
+#else /* !THUMB */
+ asm("stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t" \
+ "str sp, [r0, #0] \n\t" \
+ "ldr sp, [r1, #0] \n\t" \
+ "ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc} \n\t");
+#endif /* !THUMB */
+#endif /* !CH_CURRP_REGISTER_CACHE */
+}
+
/*
* System console message (not implemented).
*/
diff --git a/ports/ARM7-LPC214x/GCC/chcore2.s b/ports/ARM7-LPC214x/GCC/chcore2.s
deleted file mode 100644
index a31422cea..000000000
--- a/ports/ARM7-LPC214x/GCC/chcore2.s
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
-
- This file is part of ChibiOS/RT.
-
- ChibiOS/RT is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS/RT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <chconf.h>
-
-.set MODE_USR, 0x10
-.set MODE_FIQ, 0x11
-.set MODE_IRQ, 0x12
-.set MODE_SVC, 0x13
-.set MODE_ABT, 0x17
-.set MODE_UND, 0x1B
-.set MODE_SYS, 0x1F
-
-.equ I_BIT, 0x80
-.equ F_BIT, 0x40
-
-.text
-.code 32
-
-#ifdef THUMB
-.balign 16
-.globl chSysLock
-chSysLock:
- msr CPSR_c, #MODE_SYS | I_BIT
- bx lr
-
-.globl chSysUnlock
-chSysUnlock:
- msr CPSR_c, #MODE_SYS
- bx lr
-#endif
-
-.balign 16
-.globl chSysSwitchI
-chSysSwitchI:
-#ifdef CH_CURRP_REGISTER_CACHE
- stmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr}
- str sp, [r0, #0]
- ldr sp, [r1, #0]
-#ifdef THUMB
- ldmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr}
- bx lr
-#else
- ldmfd sp!, {r4, r5, r6, r8, r9, r10, r11, pc}
-#endif
-#else
- stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
- str sp, [r0, #0]
- ldr sp, [r1, #0]
-#ifdef THUMB
- ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
- bx lr
-#else
- ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc}
-#endif
-#endif /* CH_CURRP_REGISTER_CACHE */