diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-01-17 18:16:26 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-01-17 18:16:26 +0000 |
commit | f6ff614e9b23f889b29ac17c7ebfcc96ca3606b6 (patch) | |
tree | caafd1d3c517aa3b8210ac95758d54c681bffda0 /ports | |
parent | b66044d9698c9048623e328ea4d62fadd5293e11 (diff) | |
download | ChibiOS-f6ff614e9b23f889b29ac17c7ebfcc96ca3606b6.tar.gz ChibiOS-f6ff614e9b23f889b29ac17c7ebfcc96ca3606b6.tar.bz2 ChibiOS-f6ff614e9b23f889b29ac17c7ebfcc96ca3606b6.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@624 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports')
-rw-r--r-- | ports/ARM7-LPC214x/chcore.c | 8 | ||||
-rw-r--r-- | ports/ARM7/chcore.h | 125 | ||||
-rw-r--r-- | ports/ARM7/chsysasm.s | 53 | ||||
-rw-r--r-- | ports/ARM7/crt0.s | 4 |
4 files changed, 105 insertions, 85 deletions
diff --git a/ports/ARM7-LPC214x/chcore.c b/ports/ARM7-LPC214x/chcore.c index dd65e87eb..46f0bea04 100644 --- a/ports/ARM7-LPC214x/chcore.c +++ b/ports/ARM7-LPC214x/chcore.c @@ -38,7 +38,7 @@ * @param msg pointer to the message */
__attribute__((weak))
-void sys_puts(char *msg) {
+void port_puts(char *msg) {
}
/**
@@ -46,7 +46,7 @@ void sys_puts(char *msg) { * when an interrupt becomes pending.
*/
__attribute__((weak))
-void sys_wait_for_interrupt(void) {
+void port_wait_for_interrupt(void) {
#if ENABLE_WFI_IDLE != 0
PCON = 1;
@@ -57,9 +57,9 @@ void sys_wait_for_interrupt(void) { * Halts the system. */
__attribute__((weak))
-void sys_halt(void) {
+void port_halt(void) {
- sys_disable_all();
+ port_disable();
while (TRUE) {
}
}
diff --git a/ports/ARM7/chcore.h b/ports/ARM7/chcore.h index 0655f56ab..1a949ad79 100644 --- a/ports/ARM7/chcore.h +++ b/ports/ARM7/chcore.h @@ -99,7 +99,7 @@ typedef struct { sizeof(struct intctx)); \
tp->p_ctx.r13->r4 = pf; \
tp->p_ctx.r13->r5 = arg; \
- tp->p_ctx.r13->lr = _sys_thread_start; \
+ tp->p_ctx.r13->lr = _port_thread_start; \
}
/**
@@ -149,15 +149,15 @@ typedef struct { * it is transparent to the user code. */
#ifdef THUMB
-#define SYS_IRQ_PROLOGUE() { \
- asm volatile (".code 32 \n\t" \
- "stmfd sp!, {r0-r3, r12, lr} \n\t" \
- "add r0, pc, #1 \n\t" \
- "bx r0 \n\t" \
+#define PORT_IRQ_PROLOGUE() { \
+ asm volatile (".code 32 \n\t" \
+ "stmfd sp!, {r0-r3, r12, lr} \n\t" \
+ "add r0, pc, #1 \n\t" \
+ "bx r0 \n\t" \
".code 16"); \
}
#else /* THUMB */
-#define SYS_IRQ_PROLOGUE() { \
+#define PORT_IRQ_PROLOGUE() { \
asm volatile ("stmfd sp!, {r0-r3, r12, lr}"); \
}
#endif /* !THUMB */
@@ -169,100 +169,115 @@ typedef struct { * ARM or THUMB mode.
*/
#ifdef THUMB
-#define SYS_IRQ_EPILOGUE() { \
- asm volatile ("ldr r0, =_sys_irq_common \n\t" \
- "bx r0"); \
+#define PORT_IRQ_EPILOGUE() { \
+ asm volatile ("ldr r0, =_port_irq_common \n\t" \
+ "bx r0"); \
}
#else /* THUMB */
-#define SYS_IRQ_EPILOGUE() { \
- asm volatile ("b _sys_irq_common"); \
+#define PORT_IRQ_EPILOGUE() { \
+ asm volatile ("b _port_irq_common"); \
}
#endif /* !THUMB */
/**
* IRQ handler function modifier.
*/
-#define SYS_IRQ_HANDLER __attribute__((naked))
+#define PORT_IRQ_HANDLER __attribute__((naked))
/**
- * Performs a context switch between two threads.
- * @param otp the thread to be switched out
- * @param ntp the thread to be switched in
- * @note This macro has a different implementation depending if compiled in
- * ARM or THUMB mode.
- * @note This macro assumes to be invoked in ARM system mode.
+ * This function is empty in this port.
*/
-#ifdef THUMB
-#define sys_switch(otp, ntp) _sys_switch_thumb(otp, ntp)
-#else /* THUMB */
-#define sys_switch(otp, ntp) _sys_switch_arm(otp, ntp)
-#endif /* !THUMB */
+#define port_init()
/**
- * In this port this macro disables the IRQ sources.
- * @note This macro has a different implementation depending if compiled in
- * ARM or THUMB mode.
- * @note This macro assumes to be invoked in ARM system mode.
+ * Disables the IRQ sources and keeps the FIQ sources enabled.
*/
#ifdef THUMB
-#define sys_disable() _sys_disable_thumb()
+#define port_lock() _port_lock_thumb()
#else /* THUMB */
-#define sys_disable() asm volatile ("msr CPSR_c, #0x9F")
+#define port_lock() asm volatile ("msr CPSR_c, #0x9F")
#endif /* !THUMB */
/**
- * This port function is implemented as inlined code for performance reasons.
- * @note This macro has a different implementation depending if compiled in
- * ARM or THUMB mode.
- * @note This macro assumes to be invoked in ARM system mode.
+ * Enables both the IRQ and FIQ sources.
*/
#ifdef THUMB
-#define sys_enable() _sys_enable_thumb()
+#define port_unlock() _port_unlock_thumb()
#else /* THUMB */
-#define sys_enable() asm volatile ("msr CPSR_c, #0x1F")
+#define port_unlock() asm volatile ("msr CPSR_c, #0x1F")
#endif /* !THUMB */
/**
* This function is empty in this port.
*/
-#define sys_disable_from_isr()
+#define port_lock_from_isr()
/**
* This function is empty in this port.
*/
-#define sys_enable_from_isr()
+#define port_unlock_from_isr()
/**
- * Disables all the interrupt sources, even those having a priority higher
- * to the kernel.
- * In the ARM7 port this code disables both IRQ and FIQ sources. + * Disables both the IRQ and FIQ sources.
*/
#ifdef THUMB
-#define sys_disable_all() _sys_disable_all_thumb()
+#define port_disable() _port_disable_thumb()
#else /* THUMB */
-#define sys_disable_all() { \
- asm volatile ("mrs r3, CPSR \n\t" \
- "orr r3, #0x80 \n\t" \
- "msr CPSR_c, r3 \n\t" \
- "orr r3, #0x40 \n\t" \
+#define port_disable() { \
+ asm volatile ("mrs r3, CPSR \n\t" \
+ "orr r3, #0x80 \n\t" \
+ "msr CPSR_c, r3 \n\t" \
+ "orr r3, #0x40 \n\t" \
"msr CPSR_c, r3" : : : "r3"); \
}
#endif /* !THUMB */
+/**
+ * Disables the IRQ sources and enables the FIQ sources.
+ */
+#ifdef THUMB
+#define port_suspend() _port_suspend_thumb()
+#else /* THUMB */
+#define port_suspend() asm volatile ("msr CPSR_c, #0x9F")
+#endif /* !THUMB */
+
+/**
+ * Enables both the IRQ and FIQ sources.
+ */
+#ifdef THUMB
+#define port_enable() _port_enable_thumb()
+#else /* THUMB */
+#define port_enable() asm volatile ("msr CPSR_c, #0x1F")
+#endif /* !THUMB */
+
+/**
+ * Performs a context switch between two threads.
+ * @param otp the thread to be switched out
+ * @param ntp the thread to be switched in
+ */
+#ifdef THUMB
+#define port_switch(otp, ntp) _port_switch_thumb(otp, ntp)
+#else /* THUMB */
+#define port_switch(otp, ntp) _port_switch_arm(otp, ntp)
+#endif /* !THUMB */
+
#ifdef __cplusplus
extern "C" {
#endif
- void sys_puts(char *msg);
- void sys_wait_for_interrupt(void);
- void sys_halt(void);
- void _sys_enable_thumb(void);
- void _sys_disable_thumb(void);
+ void port_puts(char *msg);
+ void port_wait_for_interrupt(void);
+ void port_halt(void);
#ifdef THUMB
- void _sys_switch_thumb(Thread *otp, Thread *ntp);
+ void _port_lock_thumb(void);
+ void _port_unlock_thumb(void);
+ void _port_disable_thumb(void);
+ void _port_suspend_thumb(void);
+ void _port_enable_thumb(void);
+ void _port_switch_thumb(Thread *otp, Thread *ntp);
#else /* THUMB */
- void _sys_switch_arm(Thread *otp, Thread *ntp);
+ void _port_switch_arm(Thread *otp, Thread *ntp);
#endif /* !THUMB */
- void _sys_thread_start(void);
+ void _port_thread_start(void);
#ifdef __cplusplus
}
#endif
diff --git a/ports/ARM7/chsysasm.s b/ports/ARM7/chsysasm.s index cb64ed7b0..adbe1c622 100644 --- a/ports/ARM7/chsysasm.s +++ b/ports/ARM7/chsysasm.s @@ -44,54 +44,59 @@ .balign 16
.code 16
.thumb_func
-.global _sys_disable_thumb
-_sys_disable_thumb:
+.global _port_disable_all_thumb
+_port_disable_all_thumb:
mov r0, pc
bx r0
.code 32
- msr CPSR_c, #MODE_SYS | I_BIT
+ mrs r0, CPSR
+ orr r0, #I_BIT
+ msr CPSR_c, r0
+ orr r0, #F_BIT
+ msr CPSR_c, r0
bx lr
.balign 16
.code 16
.thumb_func
-.global _sys_enable_thumb
-_sys_enable_thumb:
+.global _port_suspend_thumb
+_port_disable_thumb:
+.global _port_lock_thumb
+_port_lock_thumb:
mov r0, pc
bx r0
.code 32
- msr CPSR_c, #MODE_SYS
+ msr CPSR_c, #MODE_SYS | I_BIT
bx lr
.balign 16
.code 16
.thumb_func
-.global _sys_disable_all_thumb
-_sys_disable_all_thumb:
+.global _port_enable_thumb
+_port_enable_thumb:
+.global _port_unlock_thumb
+_port_unlock_thumb:
mov r0, pc
bx r0
.code 32
- mrs r0, CPSR
- orr r0, #I_BIT
- msr CPSR_c, r0
- orr r0, #F_BIT
- msr CPSR_c, r0
+ msr CPSR_c, #MODE_SYS
bx lr
+
#endif
.balign 16
#ifdef THUMB_PRESENT
.code 16
.thumb_func
-.global _sys_switch_thumb
-_sys_switch_thumb:
+.global _port_switch_thumb
+_port_switch_thumb:
mov r2, pc
bx r2
- // Jumps into _sys_switch_arm in ARM mode
+ // Jumps into _port_switch_arm in ARM mode
#endif
.code 32
-.global _sys_switch_arm
-_sys_switch_arm:
+.global _port_switch_arm
+_port_switch_arm:
#ifdef CH_CURRP_REGISTER_CACHE
stmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr}
str sp, [r0, #16]
@@ -145,16 +150,16 @@ _sys_switch_arm: #ifdef THUMB_NO_INTERWORKING
.code 16
.thumb_func
-.globl _sys_irq_common
-_sys_irq_common:
+.globl _port_irq_common
+_port_irq_common:
bl chSchRescRequiredI
mov lr, pc
bx lr
.code 32
#else /* !THUMB_NO_INTERWORKING */
.code 32
-.globl _sys_irq_common
-_sys_irq_common:
+.globl _port_irq_common
+_port_irq_common:
bl chSchRescRequiredI
#endif /* !THUMB_NO_INTERWORKING */
cmp r0, #0 // Simply returns if a
@@ -200,8 +205,8 @@ _sys_irq_common: */
.balign 16
.code 32
-.globl _sys_thread_start
-_sys_thread_start:
+.globl _port_thread_start
+_port_thread_start:
msr CPSR_c, #MODE_SYS
#ifndef THUMB_NO_INTERWORKING
mov r0, r5
diff --git a/ports/ARM7/crt0.s b/ports/ARM7/crt0.s index f575de985..c5a341793 100644 --- a/ports/ARM7/crt0.s +++ b/ports/ARM7/crt0.s @@ -123,7 +123,7 @@ bssloop: mov r0, #0
mov r1, r0
bl main
- bl sys_halt
+ bl port_halt
#else
add r0, pc, #1
bx r0
@@ -132,7 +132,7 @@ bssloop: mov r0, #0
mov r1, r0
bl main
- bl sys_halt
+ bl port_halt
.code 32
#endif
|