aboutsummaryrefslogtreecommitdiffstats
path: root/src/templates/chcore.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates/chcore.h')
-rw-r--r--src/templates/chcore.h41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/templates/chcore.h b/src/templates/chcore.h
index 7f2c5fb0b..c88748f8b 100644
--- a/src/templates/chcore.h
+++ b/src/templates/chcore.h
@@ -25,21 +25,27 @@
#ifndef _CHCORE_H_
#define _CHCORE_H_
-/*
- * Stack saved context.
+/**
+ * Interrupt saved context.
+ */
+struct extctx {
+};
+
+/**
+ * System saved context.
*/
-struct stackregs {
+struct intctx {
};
typedef struct {
- struct stackregs *sp;
+ struct intctx *sp;
} Context;
/**
* Platform dependent part of the \p chThdCreate() API.
*/
-#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
-{ \
+#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
+{ \
}
/**
@@ -53,11 +59,24 @@ typedef struct {
#define INT_REQUIRED_STACK 0
/**
+ * Enforces a stack size alignment.
+ */
+#define StackAlign(n) (n)
+
+/**
* Macro to be used when allocating stack spaces, it adds the system-specific
* overhead.
*/
-#define UserStackSize(n) (sizeof(Thread) + \
- sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK))
+#define UserStackSize(n) StackAlign(sizeof(Thread) + \
+ sizeof(struct intctx) + \
+ sizeof(struct extctx) + \
+ (n) + (INT_REQUIRED_STACK))
+
+/**
+ * Macro used to allocate a thread working area aligned as both position and
+ * size.
+ */
+#define WorkingArea(s, n) BYTE8 s[UserStackSize(n)];
/**
* Enters the ChibiOS/RT system mutual exclusion zone, the implementation is
@@ -81,14 +100,10 @@ typedef struct {
*/
#define chSysUnlock()
-/**
- * Prints a message on the system console (if any).
- */
-#define chSysPuts(msg) {}
-
void _IdleThread(void *p);
void chSysHalt(void);
void chSysSwitchI(Context *oldp, Context *newp);
+void chSysPuts(char *msg);
#endif /* _CHCORE_H_ */