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

This commit is contained in:
gdisirio 2011-01-08 10:04:39 +00:00
parent 5e01b77c03
commit 7dc2098ccd
2 changed files with 13 additions and 24 deletions

View File

@ -88,10 +88,10 @@ void _port_switch_from_irq(void) {
#define PUSH_CONTEXT(sp) { \ #define PUSH_CONTEXT(sp) { \
asm ("push {r4, r5, r6, r7, lr} \n\t" \ asm ("push {r4, r5, r6, r7, lr} \n\t" \
"mov r4, r8 \n\t" \ "mov r4, r8 \n\t" \
"mov r5, r9 \n\t" \ "mov r5, r9 \n\t" \
"mov r6, r10 \n\t" \ "mov r6, r10 \n\t" \
"mov r7, r11 \n\t" \ "mov r7, r11 \n\t" \
"push {r4, r5, r6, r7}"); \ "push {r4, r5, r6, r7}"); \
} }
#define POP_CONTEXT(sp) { \ #define POP_CONTEXT(sp) { \

View File

@ -80,9 +80,9 @@ struct intctx {
tp->p_ctx.r13 = (struct intctx *)((uint8_t *)workspace + \ tp->p_ctx.r13 = (struct intctx *)((uint8_t *)workspace + \
wsize - \ wsize - \
sizeof(struct intctx)); \ sizeof(struct intctx)); \
tp->p_ctx.r13->r4 = pf; \ tp->p_ctx.r13->r4 = (void *)pf; \
tp->p_ctx.r13->r5 = arg; \ tp->p_ctx.r13->r5 = arg; \
tp->p_ctx.r13->lr = _port_thread_start; \ tp->p_ctx.r13->lr = (void *)_port_thread_start; \
} }
/** /**
@ -129,18 +129,7 @@ struct intctx {
* @details This macro must be inserted at the end of all IRQ handlers * @details This macro must be inserted at the end of all IRQ handlers
* enabled to invoke system APIs. * enabled to invoke system APIs.
*/ */
#define PORT_IRQ_EPILOGUE() { \ #define PORT_IRQ_EPILOGUE() _port_irq_epilogue()
port_lock_from_isr(); \
if ((--_port_irq_nesting == 0) && chSchIsRescRequiredExI()) { \
register struct cmxctx *ctxp; \
\
asm volatile ("mrs %0, PSP" : "=r" (ctxp) : ); \
_port_saved_pc = ctxp->pc; \
ctxp->pc = _port_switch_from_irq; \
return; \
} \
port_unlock_from_isr(); \
}
/** /**
* @brief IRQ handler function declaration. * @brief IRQ handler function declaration.
@ -171,14 +160,14 @@ struct intctx {
* @details Usually this function just disables interrupts but may perform * @details Usually this function just disables interrupts but may perform
* more actions. * more actions.
*/ */
#define port_lock() asm volatile ("cpsid i" : : : "memory") #define port_lock() __disable_interrupt()
/** /**
* @brief Kernel-unlock action. * @brief Kernel-unlock action.
* @details Usually this function just disables interrupts but may perform * @details Usually this function just disables interrupts but may perform
* more actions. * more actions.
*/ */
#define port_unlock() asm volatile ("cpsie i" : : : "memory") #define port_unlock() __enable_interrupt()
/** /**
* @brief Kernel-lock action from an interrupt handler. * @brief Kernel-lock action from an interrupt handler.
@ -201,17 +190,17 @@ struct intctx {
/** /**
* @brief Disables all the interrupt sources. * @brief Disables all the interrupt sources.
*/ */
#define port_disable() asm volatile ("cpsid i" : : : "memory") #define port_disable() __enable_interrupt()
/** /**
* @brief Disables the interrupt sources below kernel-level priority. * @brief Disables the interrupt sources below kernel-level priority.
*/ */
#define port_suspend() asm volatile ("cpsid i" : : : "memory") #define port_suspend() __enable_interrupt()
/** /**
* @brief Enables all the interrupt sources. * @brief Enables all the interrupt sources.
*/ */
#define port_enable() asm volatile ("cpsie i" : : : "memory") #define port_enable() __enable_interrupt()
/** /**
* @brief Enters an architecture-dependent IRQ-waiting mode. * @brief Enters an architecture-dependent IRQ-waiting mode.
@ -222,7 +211,7 @@ struct intctx {
* @note Implemented as an inlined @p WFI instruction. * @note Implemented as an inlined @p WFI instruction.
*/ */
#if CORTEX_ENABLE_WFI_IDLE || defined(__DOXYGEN__) #if CORTEX_ENABLE_WFI_IDLE || defined(__DOXYGEN__)
#define port_wait_for_interrupt() asm volatile ("wfi" : : : "memory") #define port_wait_for_interrupt() asm ("wfi")
#else #else
#define port_wait_for_interrupt() #define port_wait_for_interrupt()
#endif #endif