diff options
-rw-r--r-- | demos/MSP430-MSP430x1611-GCC/board.c | 20 | ||||
-rw-r--r-- | demos/MSP430-MSP430x1611-GCC/board.h | 3 | ||||
-rw-r--r-- | ports/MSP430/chcore.h | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/demos/MSP430-MSP430x1611-GCC/board.c b/demos/MSP430-MSP430x1611-GCC/board.c index 68131b345..09f93075a 100644 --- a/demos/MSP430-MSP430x1611-GCC/board.c +++ b/demos/MSP430-MSP430x1611-GCC/board.c @@ -18,6 +18,7 @@ */
#include <ch.h>
+#include <signal.h>
#include "board.h"
@@ -26,4 +27,23 @@ * NOTE: Interrupts are still disabled.
*/
void hwinit(void) {
+
+ /*
+ * I/O ports initialization.
+ */
+
+ /*
+ * Timer 0 setup.
+ */
+ TACCR0 = ACLK / CH_FREQUENCY; /* Counter limit. */
+ TACTL = TACLR; /* Clean start. */
+ TACTL = TASSEL_1 | MC_1; /* Src=ACLK, cmp=TACCR0. */
+ TACCTL0 = CCIE; /* Interrupt on compare. */
+}
+
+interrupt(TIMERA0_VECTOR) tmr0irq(void) {
+
+ chSysIRQEnterI();
+ chSysTimerHandlerI();
+ chSysIRQExitI();
}
diff --git a/demos/MSP430-MSP430x1611-GCC/board.h b/demos/MSP430-MSP430x1611-GCC/board.h index 38ebf3f60..005b019a9 100644 --- a/demos/MSP430-MSP430x1611-GCC/board.h +++ b/demos/MSP430-MSP430x1611-GCC/board.h @@ -24,6 +24,9 @@ #include <msp430x16x.h>
#endif
+#define MCLK 8000000
+#define ACLK 8000000
+
void hwinit(void);
#endif /* _BOARD_H_ */
diff --git a/ports/MSP430/chcore.h b/ports/MSP430/chcore.h index b67e90d26..b6991baa2 100644 --- a/ports/MSP430/chcore.h +++ b/ports/MSP430/chcore.h @@ -79,7 +79,7 @@ typedef struct { #define chSysIRQEnterI()
#define chSysIRQExitI() { \
- if (chSchRescRequiredI1()) \
+ if (chSchRescRequiredI()) \
chSchDoRescheduleI(); \
}
|