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

master
gdisirio 2010-04-13 17:29:54 +00:00
parent 676bb610cb
commit c406099319
4 changed files with 62 additions and 64 deletions

View File

@ -64,13 +64,13 @@ __attribute__((naked))
#endif
void _port_switch_from_irq(void) {
/* Note, saves r4 to make space for the PC.*/
asm volatile ("push {r0, r1, r2, r3, r4} \n\t" \
"mrs r0, APSR \n\t" \
"mov r1, r12 \n\t" \
"push {r0, r1, lr} \n\t" \
"ldr r0, =_port_saved_pc \n\t" \
"ldr r0, [r0] \n\t" \
"add r0, r0, #1 \n\t" \
asm volatile ("push {r0, r1, r2, r3, r4} \n\t"
"mrs r0, APSR \n\t"
"mov r1, r12 \n\t"
"push {r0, r1, lr} \n\t"
"ldr r0, =_port_saved_pc \n\t"
"ldr r0, [r0] \n\t"
"add r0, r0, #1 \n\t"
"str r0, [sp, #28]");
chSchDoRescheduleI();
@ -80,11 +80,11 @@ void _port_switch_from_irq(void) {
possibility that the stack is filled by continuous and saturating
interrupts that would not allow that last words to be pulled out of
the stack.*/
asm volatile ("pop {r0, r1, r2} \n\t" \
"mov r12, r1 \n\t" \
"msr APSR, r0 \n\t" \
"mov lr, r2 \n\t" \
"cpsie i \n\t" \
asm volatile ("pop {r0, r1, r2} \n\t"
"mov r12, r1 \n\t"
"msr APSR, r0 \n\t"
"mov lr, r2 \n\t"
"cpsie i \n\t"
"pop {r0, r1, r2, r3, pc}");
}
@ -145,8 +145,8 @@ void port_switch(Thread *ntp, Thread *otp) {
void _port_thread_start(void) {
port_unlock();
asm volatile ("mov r0, r5 \n\t" \
"blx r4 \n\t" \
asm volatile ("mov r0, r5 \n\t"
"blx r4 \n\t"
"bl chThdExit");
}

View File

@ -129,9 +129,9 @@ struct intctx {
* enabled to invoke system APIs.
*/
#define PORT_IRQ_PROLOGUE() { \
chSysLockFromIsr(); \
port_lock_from_isr(); \
_port_irq_nesting++; \
chSysUnlockFromIsr(); \
port_unlock_from_isr(); \
}
/**
@ -140,7 +140,7 @@ struct intctx {
* enabled to invoke system APIs.
*/
#define PORT_IRQ_EPILOGUE() { \
chSysLockFromIsr(); \
port_lock_from_isr(); \
if ((--_port_irq_nesting == 0) && chSchIsRescRequiredExI()) { \
register struct cmxctx *ctxp; \
\
@ -149,7 +149,7 @@ struct intctx {
ctxp->pc = _port_switch_from_irq; \
return; \
} \
chSysUnlockFromIsr(); \
port_unlock_from_isr(); \
}
/**

View File

@ -63,7 +63,7 @@ CH_IRQ_HANDLER(SysTickVector) {
void SVCallVector(void) {
register struct extctx *ctxp;
/* Discardig the current exception context and positioning the stack to
/* Discarding the current exception context and positioning the stack to
point to the real one.*/
asm volatile ("mrs %0, PSP" : "=r" (ctxp) : );
ctxp++;
@ -94,9 +94,7 @@ void _port_irq_epilogue(void) {
/**
* @brief Post-IRQ switch code.
* @details On entry the stack and the registers are restored by the exception
* return, the PC value is stored in @p _port_saved_pc, the interrupts
* are disabled.
* @details Exception handlers return here for context switching.
*/
#if !defined(__DOXYGEN__)
__attribute__((naked))
@ -155,8 +153,8 @@ void port_switch(Thread *ntp, Thread *otp) {
void _port_thread_start(void) {
port_unlock();
asm volatile ("mov r0, r5 \n\t" \
"blx r4 \n\t" \
asm volatile ("mov r0, r5 \n\t"
"blx r4 \n\t"
"bl chThdExit");
}

View File

@ -164,7 +164,7 @@ struct intctx {
* @brief Kernel-unlock action.
* @details Usually this function just disables interrupts but may perform
* more actions.
* @note In this port this it lowers the base priority to kernel level.
* @note In this port this it lowers the base priority to user level.
*/
#if CH_OPTIMIZE_SPEED
#define port_unlock() { \