diff options
Diffstat (limited to 'demos/AVR-AT90CANx-GCC/chcore.h')
-rw-r--r-- | demos/AVR-AT90CANx-GCC/chcore.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/demos/AVR-AT90CANx-GCC/chcore.h b/demos/AVR-AT90CANx-GCC/chcore.h index 799742f47..c3e0cfa34 100644 --- a/demos/AVR-AT90CANx-GCC/chcore.h +++ b/demos/AVR-AT90CANx-GCC/chcore.h @@ -79,8 +79,13 @@ typedef struct { /**
* Platform dependent part of the \p chThdCreate() API.
*/
-#define SETUP_CONTEXT(workspace, wsize, pf, arg) \
-{ \
+#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
+ tp->p_ctx.sp--; \
+ tp->p_ctx.sp->r2 = (int)pf; \
+ tp->p_ctx.sp->r3 = (int)pf >> 8; \
+ tp->p_ctx.sp->r4 = (int)arg; \
+ tp->p_ctx.sp->r5 = (int)arg >> 8; \
+ tp->p_ctx.sp->pc = (UWORD16)threadstart; \
}
/*
@@ -100,6 +105,7 @@ typedef struct { void chSysHalt(void) __attribute__((noreturn)) ;
void chSysPause(void) __attribute__((noreturn)) ;
void chSysSwitchI(Context *oldp, Context *newp);
+void threadstart(void);
#endif /* _CHCORE_H_ */
|