aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-12-09 09:16:33 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-12-09 09:16:33 +0000
commitb797fc9591a6ea6ae11495142218e82fed5a69b2 (patch)
tree935df71c668ab80a5fe2d8e6f1b0e53c19e1b841 /demos
parent62458fc5d52e57dc7ce2493b9b78f2a03319fe7c (diff)
downloadChibiOS-b797fc9591a6ea6ae11495142218e82fed5a69b2.tar.gz
ChibiOS-b797fc9591a6ea6ae11495142218e82fed5a69b2.tar.bz2
ChibiOS-b797fc9591a6ea6ae11495142218e82fed5a69b2.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@135 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r--demos/ARM7-LPC214x-GCC/chcore.c42
-rw-r--r--demos/ARM7-LPC214x-GCC/chcore2.s71
2 files changed, 41 insertions, 72 deletions
diff --git a/demos/ARM7-LPC214x-GCC/chcore.c b/demos/ARM7-LPC214x-GCC/chcore.c
index 613841437..05305b24e 100644
--- a/demos/ARM7-LPC214x-GCC/chcore.c
+++ b/demos/ARM7-LPC214x-GCC/chcore.c
@@ -116,13 +116,11 @@ void hwinit(void) {
*/
InitVIC();
VICDefVectAddr = (IOREG32)IrqHandler;
- SetVICVector(T0IrqHandler, 0, SOURCE_Timer0);
- SetVICVector(UART0IrqHandler, 1, SOURCE_UART0);
- SetVICVector(UART1IrqHandler, 2, SOURCE_UART1);
/*
* System Timer initialization, 1ms intervals.
*/
+ SetVICVector(T0IrqHandler, 0, SOURCE_Timer0);
VICIntEnable = INTMASK(SOURCE_Timer0);
TC *timer = T0Base;
timer->TC_PR = VAL_TC0_PRESCALER;
@@ -134,7 +132,7 @@ void hwinit(void) {
/*
* Other subsystems.
*/
- InitSerial();
+ InitSerial(1, 2);
InitSSP();
InitMMC();
InitBuzzer();
@@ -174,17 +172,45 @@ void chSysPuts(char *msg) {
/*
* Non-vectored IRQs handling here.
*/
-void NonVectoredIrq(void) {
-
+__attribute__((naked, weak))
+void IrqHandler(void) {
+
+ asm(".code 32 \n\t" \
+ "stmfd sp!, {r0-r3, r12, lr} \n\t");
+#ifdef THUMB
+ asm("add r0, pc, #1 \n\t" \
+ "bx r0 \n\t" \
+ ".code 16 \n\t");
+ VICVectAddr = 0;
+ asm("ldr r0, =IrqCommon \n\t" \
+ "bx r0 \n\t");
+#else
VICVectAddr = 0;
+ asm("b IrqCommon \n\t");
+#endif
}
/*
* Timer 0 IRQ handling here.
*/
-void Timer0Irq(void) {
-
+__attribute__((naked, weak))
+void T0IrqHandler(void) {
+
+ asm(".code 32 \n\t" \
+ "stmfd sp!, {r0-r3, r12, lr} \n\t");
+#ifdef THUMB
+ asm("add r0, pc, #1 \n\t" \
+ "bx r0 \n\t" \
+ ".code 16 \n\t");
+ T0IR = 1; /* Clear interrupt on match MR0. */
+ chSysTimerHandlerI();
+ VICVectAddr = 0;
+ asm("ldr r0, =IrqCommon \n\t" \
+ "bx r0 \n\t");
+#else
T0IR = 1; /* Clear interrupt on match MR0. */
chSysTimerHandlerI();
VICVectAddr = 0;
+ asm("b IrqCommon \n\t");
+#endif
}
diff --git a/demos/ARM7-LPC214x-GCC/chcore2.s b/demos/ARM7-LPC214x-GCC/chcore2.s
index 92d9d6d24..2a7888387 100644
--- a/demos/ARM7-LPC214x-GCC/chcore2.s
+++ b/demos/ARM7-LPC214x-GCC/chcore2.s
@@ -53,18 +53,23 @@ jmpr4: bx r4
.code 32
#endif
+.weak UndHandler
.globl UndHandler
UndHandler:
+.weak SwiHandler
.globl SwiHandler
SwiHandler:
+.weak PrefetchHandler
.globl PrefetchHandler
PrefetchHandler:
+.weak AbortHandler
.globl AbortHandler
AbortHandler:
+.weak FiqHandler
.globl FiqHandler
FiqHandler:
#ifdef THUMB_NO_INTERWORKING
@@ -111,6 +116,8 @@ chSysSwitchI:
#endif /* CH_CURRP_REGISTER_CACHE */
/*
+ * Common exit point for all IRQ routines, it performs the rescheduling if
+ * required.
* System stack frame structure after a context switch in the
* interrupt handler:
*
@@ -135,70 +142,6 @@ chSysSwitchI:
* SP-> | R4 | -+
* Low +------------+
*/
-.globl IrqHandler
-IrqHandler:
- stmfd sp!, {r0-r3, r12, lr}
-#ifdef THUMB_NO_INTERWORKING
- add r0, pc, #1
- bx r0
-.code 16
- bl NonVectoredIrq
- b IrqCommon
-.code 32
-#else
- bl NonVectoredIrq
- b IrqCommon
-#endif
-
-.globl T0IrqHandler
-T0IrqHandler:
- stmfd sp!, {r0-r3, r12, lr}
-#ifdef THUMB_NO_INTERWORKING
- add r0, pc, #1
- bx r0
-.code 16
- bl Timer0Irq
- b IrqCommon
-.code 32
-#else
- bl Timer0Irq
- b IrqCommon
-#endif
-
-.globl UART0IrqHandler
-UART0IrqHandler:
- stmfd sp!, {r0-r3, r12, lr}
-#ifdef THUMB_NO_INTERWORKING
- add r0, pc, #1
- bx r0
-.code 16
- bl UART0Irq
- b IrqCommon
-.code 32
-#else
- bl UART0Irq
- b IrqCommon
-#endif
-
-.globl UART1IrqHandler
-UART1IrqHandler:
- stmfd sp!, {r0-r3, r12, lr}
-#ifdef THUMB_NO_INTERWORKING
- add r0, pc, #1
- bx r0
-.code 16
- bl UART1Irq
- b IrqCommon
-.code 32
-#else
- bl UART1Irq
- b IrqCommon
-#endif
-
-/*
- * Common exit point for all IRQ routines, it performs the rescheduling if
- * required.
- */
#ifdef THUMB_NO_INTERWORKING
.code 16
.globl IrqCommon