diff options
Diffstat (limited to 'os/common')
-rw-r--r-- | os/common/ports/MSP430X/chcore.c | 7 | ||||
-rw-r--r-- | os/common/ports/MSP430X/chcore.h | 11 |
2 files changed, 13 insertions, 5 deletions
diff --git a/os/common/ports/MSP430X/chcore.c b/os/common/ports/MSP430X/chcore.c index 7a8d7f2..b9001b0 100644 --- a/os/common/ports/MSP430X/chcore.c +++ b/os/common/ports/MSP430X/chcore.c @@ -32,6 +32,8 @@ /* Module exported variables. */
/*===========================================================================*/
+bool __msp430x_in_isr;
+
/*===========================================================================*/
/* Module local types. */
/*===========================================================================*/
@@ -98,6 +100,11 @@ void _port_thread_start(void) { asm volatile ("mov R5, R12");
asm volatile ("call R4");
#endif
+#if defined(_CHIBIOS_RT_CONF_)
+ chThdExit(MSG_OK);
+#endif
+#if defined(_CHIBIOS_NIL_CONF_)
chSysHalt(0);
+#endif
}
/** @} */
diff --git a/os/common/ports/MSP430X/chcore.h b/os/common/ports/MSP430X/chcore.h index 3683c1d..9e1efa8 100644 --- a/os/common/ports/MSP430X/chcore.h +++ b/os/common/ports/MSP430X/chcore.h @@ -28,6 +28,8 @@ #include <msp430.h>
#include <in430.h>
+extern bool __msp430x_in_isr;
+
/*===========================================================================*/
/* Module constants. */
/*===========================================================================*/
@@ -225,7 +227,7 @@ struct port_context { * @details This macro must be inserted at the start of all IRQ handlers
* enabled to invoke system APIs.
*/
-#define PORT_IRQ_PROLOGUE()
+#define PORT_IRQ_PROLOGUE() __msp430x_in_isr = true;
/**
* @brief IRQ epilogue code.
@@ -233,6 +235,7 @@ struct port_context { * enabled to invoke system APIs.
*/
#define PORT_IRQ_EPILOGUE() { \
+ __msp430x_in_isr = false; \
_dbg_check_lock(); \
if (chSchIsPreemptionRequired()) \
chSchDoReschedule(); \
@@ -298,7 +301,7 @@ extern "C" { * @brief Port-related initialization code.
*/
static inline void port_init(void) {
-
+ __msp430x_in_isr = false;
}
/**
@@ -333,9 +336,7 @@ static inline bool port_irq_enabled(syssts_t sts) { * @retval true running in ISR mode.
*/
static inline bool port_is_isr_context(void) {
- /* Efficiency would be enhanced by not doing this,
- * because of implementation details */
- return __get_SR_register() & GIE;
+ return __msp430x_in_isr;
}
/**
|