diff options
author | Fabio Utzig <utzig@utzig.org> | 2015-06-04 12:25:39 +0000 |
---|---|---|
committer | Fabio Utzig <utzig@utzig.org> | 2015-06-04 12:25:39 +0000 |
commit | 0e2b620290bcf45094f086e9d7a744a1c312b42b (patch) | |
tree | 7cfe81d0a3f60690a554297942d858e9970fb179 /os/rt/ports | |
parent | 6f6da8a73e877306e1fd96bfb5015de9849c575b (diff) | |
download | ChibiOS-0e2b620290bcf45094f086e9d7a744a1c312b42b.tar.gz ChibiOS-0e2b620290bcf45094f086e9d7a744a1c312b42b.tar.bz2 ChibiOS-0e2b620290bcf45094f086e9d7a744a1c312b42b.zip |
[AVR] Add support for models with 3-byte sized PC
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8009 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/ports')
-rw-r--r-- | os/rt/ports/AVR/chcore.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/os/rt/ports/AVR/chcore.h b/os/rt/ports/AVR/chcore.h index a8785161b..b119f0635 100644 --- a/os/rt/ports/AVR/chcore.h +++ b/os/rt/ports/AVR/chcore.h @@ -101,6 +101,9 @@ struct port_extctx { uint8_t sr;
uint8_t r1;
uint8_t r0;
+#ifdef __AVR_3_BYTE_PC__
+ uint8_t pcx;
+#endif
uint16_t pc;
};
@@ -131,6 +134,9 @@ struct port_intctx { uint8_t r4;
uint8_t r3;
uint8_t r2;
+#ifdef __AVR_3_BYTE_PC__
+ uint8_t pcx;
+#endif
uint8_t pcl;
uint8_t pch;
};
@@ -150,6 +156,19 @@ struct context { * @details This code usually setup the context switching frame represented
* by an @p port_intctx structure.
*/
+#ifdef __AVR_3_BYTE_PC__
+#define PORT_SETUP_CONTEXT(tp, workspace, wsize, pf, arg) { \
+ tp->p_ctx.sp = (struct port_intctx*)((uint8_t *)workspace + wsize - \
+ sizeof(struct port_intctx)); \
+ 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->pcx = 0; \
+ tp->p_ctx.sp->pcl = (int)_port_thread_start >> 8; \
+ tp->p_ctx.sp->pch = (int)_port_thread_start; \
+}
+#else /* __AVR_3_BYTE_PC__ */
#define PORT_SETUP_CONTEXT(tp, workspace, wsize, pf, arg) { \
tp->p_ctx.sp = (struct port_intctx*)((uint8_t *)workspace + wsize - \
sizeof(struct port_intctx)); \
@@ -160,6 +179,7 @@ struct context { tp->p_ctx.sp->pcl = (int)_port_thread_start >> 8; \
tp->p_ctx.sp->pch = (int)_port_thread_start; \
}
+#endif /* __AVR_3_BYTE_PC__ */
/**
* @brief Stack size for the system idle thread.
|