git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@175 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2008-01-10 15:04:57 +00:00
parent a746b895fd
commit 98749abfdf
6 changed files with 14 additions and 12 deletions

View File

@ -69,7 +69,7 @@ void chSysUnlock(void) {
} }
#endif #endif
void chSysSwitchI(Context *oldp, Context *newp) { void chSysSwitchI(struct Thread *otp, struct Thread *ntp) {
#ifdef THUMB #ifdef THUMB
asm(".p2align 2,, \n\t" \ asm(".p2align 2,, \n\t" \
@ -80,8 +80,8 @@ void chSysSwitchI(Context *oldp, Context *newp) {
#ifdef CH_CURRP_REGISTER_CACHE #ifdef CH_CURRP_REGISTER_CACHE
asm("stmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr} \n\t" \ asm("stmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr} \n\t" \
"str sp, [r0, #0] \n\t" \ "str sp, [r0, #16] \n\t" \
"ldr sp, [r1, #0] \n\t"); "ldr sp, [r1, #16] \n\t");
#ifdef THUMB_PRESENT #ifdef THUMB_PRESENT
asm("ldmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr} \n\t" \ asm("ldmfd sp!, {r4, r5, r6, r8, r9, r10, r11, lr} \n\t" \
"bx lr \n\t"); "bx lr \n\t");
@ -90,8 +90,8 @@ void chSysSwitchI(Context *oldp, Context *newp) {
#endif /* !THUMB_PRESENT */ #endif /* !THUMB_PRESENT */
#else /* !CH_CURRP_REGISTER_CACHE */ #else /* !CH_CURRP_REGISTER_CACHE */
asm("stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t" \ asm("stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t" \
"str sp, [r0, #0] \n\t" \ "str sp, [r0, #16] \n\t" \
"ldr sp, [r1, #0] \n\t"); "ldr sp, [r1, #16] \n\t");
#ifdef THUMB_PRESENT #ifdef THUMB_PRESENT
asm("ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t" \ asm("ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} \n\t" \
"bx lr \n\t"); "bx lr \n\t");

View File

@ -122,7 +122,7 @@ extern void chSysUnlock(void);
void _IdleThread(void *p) __attribute__((noreturn)); void _IdleThread(void *p) __attribute__((noreturn));
void chSysHalt(void); void chSysHalt(void);
void chSysSwitchI(Context *oldp, Context *newp); void chSysSwitchI(struct Thread *otp, struct Thread *ntp);
void chSysPuts(char *msg); void chSysPuts(char *msg);
void threadstart(void); void threadstart(void);

View File

@ -87,7 +87,7 @@ void chSchGoSleepS(t_tstate newstate) {
#ifdef CH_USE_TRACE #ifdef CH_USE_TRACE
chDbgTrace(otp, currp); chDbgTrace(otp, currp);
#endif #endif
chSysSwitchI(&otp->p_ctx, &currp->p_ctx); chSysSwitchI(otp, currp);
} }
/** /**
@ -114,7 +114,7 @@ void chSchWakeupS(Thread *ntp, t_msg msg) {
#ifdef CH_USE_TRACE #ifdef CH_USE_TRACE
chDbgTrace(otp, ntp); chDbgTrace(otp, ntp);
#endif #endif
chSysSwitchI(&otp->p_ctx, &ntp->p_ctx); chSysSwitchI(otp, ntp);
} }
} }
@ -131,7 +131,7 @@ void chSchDoRescheduleI(void) {
#ifdef CH_USE_TRACE #ifdef CH_USE_TRACE
chDbgTrace(otp, currp); chDbgTrace(otp, currp);
#endif #endif
chSysSwitchI(&otp->p_ctx, &currp->p_ctx); chSysSwitchI(otp, currp);
} }
/** /**

View File

@ -27,6 +27,8 @@
#define _CHIBIOS_RT_ #define _CHIBIOS_RT_
struct Thread;
#ifndef __DOXIGEN__ #ifndef __DOXIGEN__
#ifndef _CHCONF_H_ #ifndef _CHCONF_H_
#include <chconf.h> #include <chconf.h>

View File

@ -61,8 +61,8 @@ extern "C" {
void chSchReadyI(Thread *tp, t_msg msg); void chSchReadyI(Thread *tp, t_msg msg);
void chSchGoSleepS(t_tstate newstate); void chSchGoSleepS(t_tstate newstate);
void chSchWakeupS(Thread *tp, t_msg msg); void chSchWakeupS(Thread *tp, t_msg msg);
void chSchRescheduleS(void);
void chSchDoRescheduleI(void); void chSchDoRescheduleI(void);
void chSchRescheduleS(void);
BOOL chSchRescRequiredI(void); BOOL chSchRescRequiredI(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -47,6 +47,8 @@ struct Thread {
t_tstate p_state; t_tstate p_state;
/** Mode flags.*/ /** Mode flags.*/
t_tmode p_flags; t_tmode p_flags;
/** Machine dependent processor context.*/
Context p_ctx;
/* /*
* The following fields are merged in unions because they are all * The following fields are merged in unions because they are all
* state-specific fields. This trick saves some extra space for each * state-specific fields. This trick saves some extra space for each
@ -79,8 +81,6 @@ struct Thread {
void *p_wtobjp; void *p_wtobjp;
#endif #endif
}; };
/** Machine dependent processor context.*/
Context p_ctx;
/* /*
* Start of the optional fields. * Start of the optional fields.
*/ */