git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@146 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2007-12-18 10:46:23 +00:00
parent d34507ec44
commit 2c91f58d0f
5 changed files with 65 additions and 76 deletions

View File

@ -79,7 +79,7 @@ ASRC = ../../ports/ARM7-LPC214x/GCC/chcore.c \
TSRC = TSRC =
# List ASM source files here # List ASM source files here
ASMSRC = ../../ports/ARM7-LPC214x/GCC/crt0.s ../../ports/ARM7-LPC214x/GCC/chcore2.s ASMSRC = ../../ports/ARM7-LPC214x/GCC/crt0.s
# List all user directories here # List all user directories here
UINCDIR = ../../src/include ../../src/lib ../../ports/ARM7-LPC214x/GCC UINCDIR = ../../src/include ../../src/lib ../../ports/ARM7-LPC214x/GCC

View File

@ -79,7 +79,7 @@ TSRC = ../../ports/ARM7-LPC214x/GCC/chcore.c \
board.c buzzer.c mmcsd.c main.c board.c buzzer.c mmcsd.c main.c
# List ASM source files here # List ASM source files here
ASMSRC = ../../ports/ARM7-LPC214x/GCC/crt0.s ../../ports/ARM7-LPC214x/GCC/chcore2.s ASMSRC = ../../ports/ARM7-LPC214x/GCC/crt0.s
# List all user directories here # List all user directories here
UINCDIR = ../../src/include ../../src/lib ../../ports/ARM7-LPC214x/GCC UINCDIR = ../../src/include ../../src/lib ../../ports/ARM7-LPC214x/GCC

View File

@ -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). * System console message (not implemented).
*/ */

View File

@ -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 */

View File

@ -55,8 +55,8 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
effects on the measurement. effects on the measurement.
- IRQ entry/exit code is now encapsulated into two new macros, see chcore.h - IRQ entry/exit code is now encapsulated into two new macros, see chcore.h
for details. for details.
- Most of the asm code previously in chcore2.s is now inline asm code in - All the asm code previously in chcore2.s is now inline asm code in chcore.c
chcore.c (ARM port). (ARM port).
- Moved all the board specific definitions/code into two new files: board.c - Moved all the board specific definitions/code into two new files: board.c
and board.h. Moved all the files no more board-dependent under ports/ and board.h. Moved all the files no more board-dependent under ports/
(ARM port). (ARM port).