From b2db83ef52aa6668193bdc71a88b81d3aefefea0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 2 Jun 2010 11:34:53 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1983 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/RC/STM8/chcore.c | 10 +++++----- os/ports/RC/STM8/chcore.h | 24 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) (limited to 'os/ports') diff --git a/os/ports/RC/STM8/chcore.c b/os/ports/RC/STM8/chcore.c index af890f6b9..6aaa182af 100644 --- a/os/ports/RC/STM8/chcore.c +++ b/os/ports/RC/STM8/chcore.c @@ -28,6 +28,8 @@ #include "ch.h" +page0 ReadyList rlist; + /** * @brief Performs a context switch between two threads. * @@ -38,12 +40,10 @@ void _port_switch(Thread *otp) { (void)otp; /* Asm because unoptimal code would generated by using _getSP_().*/ #pragma ASM - EXTRN PAGE0(rlist) - LDW Y,SP ; old context pointer - LDW (005H,X),Y ; SP saved in otp->p_ctx.sp - LDW X,rlist + 0DH ; r_current (currp) field - LDW X,(005H,X) ; currp->p_ctx.sp + LDW (5,X),Y ; SP saved in otp->p_ctx.sp + LDW X,rlist + 5 ; r_current (currp) field + LDW X,(5,X) ; currp->p_ctx.sp LDW SP,X ; new context pointer #pragma ENDASM } diff --git a/os/ports/RC/STM8/chcore.h b/os/ports/RC/STM8/chcore.h index 6fa112346..c4f490edc 100644 --- a/os/ports/RC/STM8/chcore.h +++ b/os/ports/RC/STM8/chcore.h @@ -273,6 +273,30 @@ extern "C" { } #endif +/*===========================================================================*/ +/* Scheduler captured code. */ +/*===========================================================================*/ + +#define PORT_OPTIMIZED_RLIST_VAR +#define PORT_OPTIMIZED_RLIST_EXT +#define PORT_OPTIMIZED_READYLIST_STRUCT + +typedef struct { + ThreadsQueue r_queue; + tprio_t r_prio; + Thread *r_current; +#if CH_USE_REGISTRY + Thread *r_newer; + Thread *r_older; +#endif + /* End of the fields shared with the Thread structure.*/ +#if CH_TIME_QUANTUM > 0 + cnt_t r_preempt; +#endif +} ReadyList; + +extern page0 ReadyList rlist; + #endif /* _CHCORE_H_ */ /** @} */ -- cgit v1.2.3