diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-11-29 13:57:06 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-11-29 13:57:06 +0000 |
commit | 21c82221ac2b03ff34f3e9aa0e6f2412d0cd9fe2 (patch) | |
tree | a36caa4b006dc5e760a29d3f0b0ff5cd605dcc00 /ports/MSP430/chcore.h | |
parent | 49c92fbbb028a3fd0518473d39519572ff10141b (diff) | |
download | ChibiOS-21c82221ac2b03ff34f3e9aa0e6f2412d0cd9fe2.tar.gz ChibiOS-21c82221ac2b03ff34f3e9aa0e6f2412d0cd9fe2.tar.bz2 ChibiOS-21c82221ac2b03ff34f3e9aa0e6f2412d0cd9fe2.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@526 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports/MSP430/chcore.h')
-rw-r--r-- | ports/MSP430/chcore.h | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/ports/MSP430/chcore.h b/ports/MSP430/chcore.h index ea239c688..4333ca841 100644 --- a/ports/MSP430/chcore.h +++ b/ports/MSP430/chcore.h @@ -23,36 +23,47 @@ #include <iomacros.h>
#include <msp430/common.h>
+/*
+ * Macro defining the MSP430 architecture.
+ */
#define CH_ARCHITECTURE_MSP430
-typedef void *regmsp;
+/*
+ * 16 bit stack alignment.
+ */
+typedef uint16_t stkalign_t;
+
+/*
+ * Generic MSP430 register.
+ */
+typedef void *regmsp_t;
/*
* Interrupt saved context.
*/
struct extctx {
- regmsp r12;
- regmsp r13;
- regmsp r14;
- regmsp r15;
- regmsp sr;
- regmsp pc;
+ regmsp_t r12;
+ regmsp_t r13;
+ regmsp_t r14;
+ regmsp_t r15;
+ regmsp_t sr;
+ regmsp_t pc;
};
/*
* System saved context.
*/
struct intctx {
- regmsp r4;
- regmsp r5;
- regmsp r6;
- regmsp r7;
- regmsp r8;
- regmsp r9;
- regmsp r10;
- regmsp r11;
-// regmsp sr;
- regmsp pc;
+ regmsp_t r4;
+ regmsp_t r5;
+ regmsp_t r6;
+ regmsp_t r7;
+ regmsp_t r8;
+ regmsp_t r9;
+ regmsp_t r10;
+ regmsp_t r11;
+// regmsp_t sr;
+ regmsp_t pc;
};
typedef struct {
@@ -71,12 +82,19 @@ typedef struct { #define IDLE_THREAD_STACK_SIZE 0
#define INT_REQUIRED_STACK 32
-#define StackAlign(n) ((((n) - 1) | 1) + 1)
-#define UserStackSize(n) StackAlign(sizeof(Thread) + \
- sizeof(struct intctx) + \
- sizeof(struct extctx) + \
- (n) + (INT_REQUIRED_STACK))
-#define WorkingArea(s, n) uint16_t s[UserStackSize(n >> 1)];
+
+#define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1)
+//#define StackAlign(n) STACK_ALIGN(n)
+
+#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(Thread) + \
+ sizeof(struct intctx) + \
+ sizeof(struct extctx) + \
+ (n) + \
+ INT_REQUIRED_STACK)
+//#define UserStackSize(n) THD_WA_SIZE(n)
+
+#define WORKING_AREA(s, n) stkalign_t s[THD_WA_SIZE(n) / sizeof(stkalign_t)];
+//#define WorkingArea(s, n) WORKING_AREA(s, n)
#define chSysLock() asm volatile ("dint")
#define chSysUnlock() asm volatile ("eint")
@@ -91,7 +109,7 @@ typedef struct { #ifdef __cplusplus
extern "C" {
#endif
- void _IdleThread(void *p);
+ void _idle(void *p) __attribute__((weak, noreturn));
void chSysHalt(void);
void chSysSwitchI(Thread *otp, Thread *ntp);
void chSysPuts(char *msg);
|