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

This commit is contained in:
gdisirio 2010-03-29 20:58:35 +00:00
parent 97436c3443
commit e475309b5c
2 changed files with 15 additions and 5 deletions

View File

@ -33,6 +33,11 @@
*/ */
regarm_t _port_saved_pc; regarm_t _port_saved_pc;
/**
* @brief IRQ nesting counter.
*/
unsigned _port_irq_nesting;
/** /**
* @brief Halts the system. * @brief Halts the system.
* @note The function is declared as a weak symbol, it is possible * @note The function is declared as a weak symbol, it is possible

View File

@ -202,7 +202,11 @@ struct context {
* @details This macro must be inserted at the start of all IRQ handlers * @details This macro must be inserted at the start of all IRQ handlers
* enabled to invoke system APIs. * enabled to invoke system APIs.
*/ */
#define PORT_IRQ_PROLOGUE() #define PORT_IRQ_PROLOGUE() { \
chSysLockFromIsr(); \
_port_irq_nesting++; \
chSysUnlockFromIsr(); \
}
/** /**
* @brief IRQ epilogue code. * @brief IRQ epilogue code.
@ -211,8 +215,7 @@ struct context {
*/ */
#define PORT_IRQ_EPILOGUE() { \ #define PORT_IRQ_EPILOGUE() { \
chSysLockFromIsr(); \ chSysLockFromIsr(); \
if (((SCB_ICSR & ICSR_VECTPENDING_MASK) == 0) && \ if ((--_port_irq_nesting == 0) && chSchIsRescRequiredExI()) { \
chSchIsRescRequiredExI()) { \
register struct cmxctx *ctxp asm ("r3"); \ register struct cmxctx *ctxp asm ("r3"); \
\ \
asm volatile ("mrs %0, PSP" : "=r" (ctxp) : "r" (ctxp)); \ asm volatile ("mrs %0, PSP" : "=r" (ctxp) : "r" (ctxp)); \
@ -232,9 +235,10 @@ struct context {
/** /**
* @brief Port-related initialization code. * @brief Port-related initialization code.
* @note This function is empty in this port.
*/ */
#define port_init() #define port_init() { \
_port_irq_nesting = 0; \
}
/** /**
* @brief Kernel-lock action. * @brief Kernel-lock action.
@ -306,6 +310,7 @@ struct context {
#if !defined(__DOXYGEN__) #if !defined(__DOXYGEN__)
extern regarm_t _port_saved_pc; extern regarm_t _port_saved_pc;
extern unsigned _port_irq_nesting;
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus