aboutsummaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-27 16:02:12 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2007-11-27 16:02:12 +0000
commit6f0569444dafdae8b367a54a07a4bfaf3675f545 (patch)
tree8d43ced8b892c95b243546fe2220e940be75affa /demos
parentb74cb5bc1a144b1890e229cd1fc165ece4f10325 (diff)
downloadChibiOS-6f0569444dafdae8b367a54a07a4bfaf3675f545.tar.gz
ChibiOS-6f0569444dafdae8b367a54a07a4bfaf3675f545.tar.bz2
ChibiOS-6f0569444dafdae8b367a54a07a4bfaf3675f545.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@117 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r--demos/ARM7-LPC214x-GCC-minimal/chcore.c7
-rw-r--r--demos/ARM7-LPC214x-GCC-minimal/chcore.h3
-rw-r--r--demos/ARM7-LPC214x-GCC/chcore.h3
-rw-r--r--demos/Win32-MSVS/chcore.c2
-rw-r--r--demos/Win32-MSVS/chcore.h39
-rw-r--r--demos/Win32-MinGW/chcore.h39
6 files changed, 53 insertions, 40 deletions
diff --git a/demos/ARM7-LPC214x-GCC-minimal/chcore.c b/demos/ARM7-LPC214x-GCC-minimal/chcore.c
index 068774d17..f844a6aa5 100644
--- a/demos/ARM7-LPC214x-GCC-minimal/chcore.c
+++ b/demos/ARM7-LPC214x-GCC-minimal/chcore.c
@@ -24,7 +24,6 @@
//#include "lpc214x_serial.h"
//#include "lpc214x_ssp.h"
//#include "mmcsd.h"
-
//#include "buzzer.h"
extern void IrqHandler(void);
@@ -166,6 +165,12 @@ void chSysHalt(void) {
}
/*
+ * System console message (not implemented).
+ */
+void chSysPuts(char *msg) {
+}
+
+/*
* Non-vectored IRQs handling here.
*/
void NonVectoredIrq(void) {
diff --git a/demos/ARM7-LPC214x-GCC-minimal/chcore.h b/demos/ARM7-LPC214x-GCC-minimal/chcore.h
index 5c595ae4f..941036830 100644
--- a/demos/ARM7-LPC214x-GCC-minimal/chcore.h
+++ b/demos/ARM7-LPC214x-GCC-minimal/chcore.h
@@ -97,7 +97,8 @@ extern void chSysUnlock(void);
#define UserStackSize(n) StackAlign(sizeof(Thread) + \
sizeof(struct intctx) + \
sizeof(struct extctx) + \
- (n) + (INT_REQUIRED_STACK))
+ (n) + \
+ INT_REQUIRED_STACK)
#define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2];
/* It requires zero bytes, but better be safe.*/
diff --git a/demos/ARM7-LPC214x-GCC/chcore.h b/demos/ARM7-LPC214x-GCC/chcore.h
index 5c595ae4f..941036830 100644
--- a/demos/ARM7-LPC214x-GCC/chcore.h
+++ b/demos/ARM7-LPC214x-GCC/chcore.h
@@ -97,7 +97,8 @@ extern void chSysUnlock(void);
#define UserStackSize(n) StackAlign(sizeof(Thread) + \
sizeof(struct intctx) + \
sizeof(struct extctx) + \
- (n) + (INT_REQUIRED_STACK))
+ (n) + \
+ INT_REQUIRED_STACK)
#define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2];
/* It requires zero bytes, but better be safe.*/
diff --git a/demos/Win32-MSVS/chcore.c b/demos/Win32-MSVS/chcore.c
index 0df82eec6..3915d6271 100644
--- a/demos/Win32-MSVS/chcore.c
+++ b/demos/Win32-MSVS/chcore.c
@@ -68,7 +68,7 @@ void ChkIntSources(void) {
}
}
-t_msg _IdleThread(void) {
+t_msg _IdleThread(void *p) {
chThdSetPriority(IDLEPRIO);
diff --git a/demos/Win32-MSVS/chcore.h b/demos/Win32-MSVS/chcore.h
index 15a21fb40..91fd7be9e 100644
--- a/demos/Win32-MSVS/chcore.h
+++ b/demos/Win32-MSVS/chcore.h
@@ -29,7 +29,7 @@ typedef void *regx86;
/*
* Stack saved context.
*/
-struct stackregs {
+struct intctx {
regx86 ebx;
regx86 edi;
regx86 esi;
@@ -38,33 +38,36 @@ struct stackregs {
};
typedef struct {
- struct stackregs *esp;
+ struct intctx *esp;
} Context;
#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a)
-#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
-{ \
- BYTE8 *esp = (BYTE8 *)workspace + wsize; \
- APUSH(esp, arg); \
- APUSH(esp, threadexit); \
- esp -= sizeof(struct stackregs); \
- ((struct stackregs *)esp)->eip = pf; \
- ((struct stackregs *)esp)->ebx = 0; \
- ((struct stackregs *)esp)->edi = 0; \
- ((struct stackregs *)esp)->esi = 0; \
- ((struct stackregs *)esp)->ebp = 0; \
- tp->p_ctx.esp = (struct stackregs *)esp; \
+#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
+{ \
+ BYTE8 *esp = (BYTE8 *)workspace + wsize; \
+ APUSH(esp, arg); \
+ APUSH(esp, threadexit); \
+ esp -= sizeof(struct intctx); \
+ ((struct intctx *)esp)->eip = pf; \
+ ((struct intctx *)esp)->ebx = 0; \
+ ((struct intctx *)esp)->edi = 0; \
+ ((struct intctx *)esp)->esi = 0; \
+ ((struct intctx *)esp)->ebp = 0; \
+ tp->p_ctx.esp = (struct intctx *)esp; \
}
#define chSysLock()
#define chSysUnlock()
#define chSysPuts(msg) {}
-#define INT_REQUIRED_STACK 0x0
-#define UserStackSize(n) (sizeof(Thread) + sizeof(void *)*2 + \
- sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK))
-
+#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) ULONG32 s[UserStackSize(n) >> 2];
#define IDLE_THREAD_STACK_SIZE 16384
diff --git a/demos/Win32-MinGW/chcore.h b/demos/Win32-MinGW/chcore.h
index c79b9bf81..2b90dd470 100644
--- a/demos/Win32-MinGW/chcore.h
+++ b/demos/Win32-MinGW/chcore.h
@@ -29,7 +29,7 @@ typedef void *regx86;
/*
* Stack saved context.
*/
-struct stackregs {
+struct intctx {
regx86 ebx;
regx86 edi;
regx86 esi;
@@ -38,33 +38,36 @@ struct stackregs {
};
typedef struct {
- struct stackregs *esp;
+ struct intctx *esp;
} Context;
#define APUSH(p, a) (p) -= sizeof(void *), *(void **)(p) = (void*)(a)
-#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
-{ \
- BYTE8 *esp = (BYTE8 *)workspace + wsize; \
- APUSH(esp, arg); \
- APUSH(esp, threadstart); \
- esp -= sizeof(struct stackregs); \
- ((struct stackregs *)esp)->eip = pf; \
- ((struct stackregs *)esp)->ebx = 0; \
- ((struct stackregs *)esp)->edi = 0; \
- ((struct stackregs *)esp)->esi = 0; \
- ((struct stackregs *)esp)->ebp = 0; \
- tp->p_ctx.esp = (struct stackregs *)esp; \
+#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
+{ \
+ BYTE8 *esp = (BYTE8 *)workspace + wsize; \
+ APUSH(esp, arg); \
+ APUSH(esp, threadstart); \
+ esp -= sizeof(struct intctx); \
+ ((struct intctx *)esp)->eip = pf; \
+ ((struct intctx *)esp)->ebx = 0; \
+ ((struct intctx *)esp)->edi = 0; \
+ ((struct intctx *)esp)->esi = 0; \
+ ((struct intctx *)esp)->ebp = 0; \
+ tp->p_ctx.esp = (struct intctx *)esp; \
}
#define chSysLock()
#define chSysUnlock()
#define chSysPuts(msg) {}
-#define INT_REQUIRED_STACK 0x0
-#define UserStackSize(n) (sizeof(Thread) + sizeof(void *) * 2 + \
- sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK))
-
+#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) ULONG32 s[UserStackSize(n) >> 2];
#define IDLE_THREAD_STACK_SIZE 16384