aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-12-13 08:44:56 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-12-13 08:44:56 +0000
commit2b8c31c32f67d2e31ff19507ca3425f9bcecba76 (patch)
tree977dc101b34cfae78b787a0e45ea50d6881ac763 /demos
parente06b155baa31443e76650d4c6aaca960af9f0051 (diff)
downloadChibiOS-2b8c31c32f67d2e31ff19507ca3425f9bcecba76.tar.gz
ChibiOS-2b8c31c32f67d2e31ff19507ca3425f9bcecba76.tar.bz2
ChibiOS-2b8c31c32f67d2e31ff19507ca3425f9bcecba76.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@538 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r--demos/Win32-MinGW/chcore.c2
-rw-r--r--demos/Win32-MinGW/chcore.h35
2 files changed, 28 insertions, 9 deletions
diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c
index 047fe66da..48842f186 100644
--- a/demos/Win32-MinGW/chcore.c
+++ b/demos/Win32-MinGW/chcore.c
@@ -91,7 +91,7 @@ void ChkIntSources(void) {
}
}
-msg_t _IdleThread(void *p) {
+msg_t _idle(void *p) {
while (TRUE) {
diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h
index c3c3f3a0b..2c916f536 100644
--- a/demos/Win32-MinGW/chcore.h
+++ b/demos/Win32-MinGW/chcore.h
@@ -24,6 +24,16 @@
#ifndef _CHCORE_H_
#define _CHCORE_H_
+/*
+ * Unique macro for the implemented architecture.
+ */
+#define CH_ARCHITECTURE_WIN32SIM
+
+/*
+ * Base type for stack alignment.
+ */
+typedef uint32_t stkalign_t;
+
typedef void *regx86;
/*
@@ -65,17 +75,26 @@ typedef struct {
#define chSysIRQExitI()
#define INT_REQUIRED_STACK 0
-#define StackAlign(n) ((((n) - 1) | 3) + 1)
-#define UserStackSize(n) StackAlign(sizeof(Thread) + \
- sizeof(void *) * 2 + \
- sizeof(struct intctx) + \
- (n) + \
- INT_REQUIRED_STACK)
-#define WorkingArea(s, n) uint32_t s[UserStackSize(n) >> 2];
+#define STACK_ALIGN(n) ((((n) - 1) | sizeof(stkalign_t)) + 1)
+#define StackAlign(n) STACK_ALIGN(n)
+
+#define THD_WA_SIZE(n) StackAlign(sizeof(Thread) + \
+ sizeof(void *) * 2 + \
+ sizeof(struct intctx) + \
+ (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)
+
+/*
+ * Stack size for the system idle thread.
+ */
#define IDLE_THREAD_STACK_SIZE 16384
-msg_t _IdleThread(void *p);
+msg_t _idle(void *p);
__attribute__((fastcall)) void chSysHalt(void);
__attribute__((fastcall)) void chSysSwitchI(Thread *otp, Thread *ntp);
__attribute__((fastcall)) void threadstart(void);