From 456702ee87b1adbbb559778aafe98c349700178a Mon Sep 17 00:00:00 2001 From: Andrew Wygle Date: Sun, 22 May 2016 12:41:42 -0700 Subject: Cleaned up MSP430X port to match recent changes to ChibiOS mainline. Also fixed a couple of bugs identified as part of the refresh. --- os/common/ports/MSP430X/chcore.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'os/common/ports/MSP430X/chcore.h') diff --git a/os/common/ports/MSP430X/chcore.h b/os/common/ports/MSP430X/chcore.h index 09f87c4..3683c1d 100644 --- a/os/common/ports/MSP430X/chcore.h +++ b/os/common/ports/MSP430X/chcore.h @@ -232,14 +232,19 @@ struct port_context { * @details This macro must be inserted at the end of all IRQ handlers * enabled to invoke system APIs. */ -#define PORT_IRQ_EPILOGUE() chSchRescheduleS() +#define PORT_IRQ_EPILOGUE() { \ + _dbg_check_lock(); \ + if (chSchIsPreemptionRequired()) \ + chSchDoReschedule(); \ + _dbg_check_unlock(); \ +} /** * @brief IRQ handler function declaration. * @note @p id can be a function name or a vector number depending on the * port implementation. */ -#define PORT_IRQ_HANDLER(id) __attribute__ ((interrupt(id))) \ +#define PORT_IRQ_HANDLER(id) __attribute__ ((interrupt(id))) \ void ISR_ ## id (void) /** -- cgit v1.2.3 From d9ee72504f248b7f9edae382ff941453301bf5ad Mon Sep 17 00:00:00 2001 From: Andrew Wygle Date: Sat, 4 Jun 2016 18:26:39 -0700 Subject: Adds ADC12 support to MSP430X port. Adds support for the MSP430X's 12-bit ADC peripheral, as well as reasonably complete testing of same. Also includes fixes for several bugs and cleanup of the DMA peripheral, which used ch calls rather than osal calls and was unclear about what contexts its methods could be called from. --- os/common/ports/MSP430X/chcore.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'os/common/ports/MSP430X/chcore.h') 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 #include +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; } /** -- cgit v1.2.3