aboutsummaryrefslogtreecommitdiffstats
path: root/os/common
diff options
context:
space:
mode:
authorAndrew Wygle <awygle@gmail.com>2016-06-04 18:26:39 -0700
committerAndrew Wygle <awygle@gmail.com>2016-06-05 13:51:11 -0700
commitd9ee72504f248b7f9edae382ff941453301bf5ad (patch)
tree0fff12a2fcc48a25a924a004be776df44662fc83 /os/common
parent456702ee87b1adbbb559778aafe98c349700178a (diff)
downloadChibiOS-Contrib-d9ee72504f248b7f9edae382ff941453301bf5ad.tar.gz
ChibiOS-Contrib-d9ee72504f248b7f9edae382ff941453301bf5ad.tar.bz2
ChibiOS-Contrib-d9ee72504f248b7f9edae382ff941453301bf5ad.zip
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.
Diffstat (limited to 'os/common')
-rw-r--r--os/common/ports/MSP430X/chcore.c7
-rw-r--r--os/common/ports/MSP430X/chcore.h11
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;
}
/**