aboutsummaryrefslogtreecommitdiffstats
path: root/os/ports/RC/STM8/chcore.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-03-09 13:43:16 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-03-09 13:43:16 +0000
commit1585e2851cd4d862b4e08efd2b200f0401110133 (patch)
tree72e636092684b0ad8ef5838a24d87fda02573a53 /os/ports/RC/STM8/chcore.h
parente4fed0ca868ce6365ef6cdf2774b49f83a430d6a (diff)
downloadChibiOS-1585e2851cd4d862b4e08efd2b200f0401110133.tar.gz
ChibiOS-1585e2851cd4d862b4e08efd2b200f0401110133.tar.bz2
ChibiOS-1585e2851cd4d862b4e08efd2b200f0401110133.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1733 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ports/RC/STM8/chcore.h')
-rw-r--r--os/ports/RC/STM8/chcore.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/os/ports/RC/STM8/chcore.h b/os/ports/RC/STM8/chcore.h
index f652a858b..6df8c5a61 100644
--- a/os/ports/RC/STM8/chcore.h
+++ b/os/ports/RC/STM8/chcore.h
@@ -47,6 +47,13 @@
typedef uint8_t stkalign_t;
/**
+ * @brief Generic STM8 function pointer.
+ * @note It is used to allocate the proper size for return addresses in
+ * context-related structures.
+ */
+typedef void (*stm8func_t)(void);
+
+/**
* @brief Interrupt saved context.
* @details This structure represents the stack frame saved during a
* preemption-capable interrupt handler.
@@ -75,7 +82,7 @@ struct extctx {
*/
struct intctx {
uint8_t _next;
- uint16_t pc;
+ stm8func_t pc; /* Function pointer sized return address. */
};
/**
@@ -85,10 +92,10 @@ struct intctx {
*/
struct startctx {
uint8_t _next;
- uint16_t ts; /* Trampoline address. */
- uint16_t arg; /* Thread argument. */
- uint16_t pc; /* Thread function address. */
- uint16_t ret; /* chThdExit() address. */
+ stm8func_t ts; /* Trampoline address. */
+ void *arg; /* Thread argument. */
+ stm8func_t pc; /* Thread function address. */
+ stm8func_t ret; /* chThdExit() address. */
};
/**
@@ -109,10 +116,10 @@ struct context {
struct startctx *scp; \
scp = (struct startctx *)((uint8_t *)workspace + wsize - \
sizeof(struct startctx)); \
- scp->ts = (uint16_t)_port_thread_start; \
- scp->arg = (uint16_t)arg; \
- scp->pc = (uint16_t)pf; \
- scp->ret = (uint16_t)chThdExit; \
+ scp->ts = _port_thread_start; \
+ scp->arg = arg; \
+ scp->pc = (stm8func_t)pf; \
+ scp->ret = (stm8func_t)chThdExit; \
tp->p_ctx.sp = (struct intctx *)scp; \
}