From a134cd919ea3e6fee591bc29d360f3da74f46a8b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 27 Nov 2007 11:43:28 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@115 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-LPC214x-GCC-minimal/chconf.h | 4 ++++ demos/ARM7-LPC214x-GCC/chconf.h | 6 +++++- demos/ARM7-LPC214x-GCC/chcore.c | 6 ++++++ demos/ARM7-LPC214x-GCC/chcore.h | 28 +++++++++++++--------------- demos/AVR-AT90CANx-GCC/chconf.h | 4 ++++ demos/AVR-AT90CANx-GCC/chcore.h | 31 +++++++++++++------------------ demos/Win32-MSVS/chconf.h | 4 ++++ demos/Win32-MinGW/chconf.h | 4 ++++ 8 files changed, 53 insertions(+), 34 deletions(-) (limited to 'demos') diff --git a/demos/ARM7-LPC214x-GCC-minimal/chconf.h b/demos/ARM7-LPC214x-GCC-minimal/chconf.h index 70908e292..fc81d571f 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/chconf.h +++ b/demos/ARM7-LPC214x-GCC-minimal/chconf.h @@ -162,6 +162,10 @@ */ //#define CH_USE_DEBUG +/** Debug option: Includes the threads context switch tracing feature. + */ +//#define CH_USE_TRACE + #endif /* _CHCONF_H_ */ /** @} */ diff --git a/demos/ARM7-LPC214x-GCC/chconf.h b/demos/ARM7-LPC214x-GCC/chconf.h index 51aac3a64..311d6efbc 100644 --- a/demos/ARM7-LPC214x-GCC/chconf.h +++ b/demos/ARM7-LPC214x-GCC/chconf.h @@ -160,7 +160,11 @@ * @note the debug support is port-dependent, it may be not present on some * targets. In that case stub functions will be included. */ -//#define CH_USE_DEBUG +#define CH_USE_DEBUG + +/** Debug option: Includes the threads context switch tracing feature. + */ +#define CH_USE_TRACE #endif /* _CHCONF_H_ */ diff --git a/demos/ARM7-LPC214x-GCC/chcore.c b/demos/ARM7-LPC214x-GCC/chcore.c index 49d1d314f..ad6f3a82c 100644 --- a/demos/ARM7-LPC214x-GCC/chcore.c +++ b/demos/ARM7-LPC214x-GCC/chcore.c @@ -165,6 +165,12 @@ void chSysHalt(void) { ; } +/* + * System console message (implemented via JTAG). + */ +void chSysPuts(char *msg) { +} + /* * Non-vectored IRQs handling here. */ diff --git a/demos/ARM7-LPC214x-GCC/chcore.h b/demos/ARM7-LPC214x-GCC/chcore.h index d5ad07040..5c595ae4f 100644 --- a/demos/ARM7-LPC214x-GCC/chcore.h +++ b/demos/ARM7-LPC214x-GCC/chcore.h @@ -71,13 +71,13 @@ typedef struct { /* * Platform dependent part of the \p chThdCreate() API. */ -#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ - tp->p_ctx.r13 = (struct intctx *)((BYTE8 *)workspace + \ - wsize - \ - sizeof(struct intctx)); \ - tp->p_ctx.r13->r4 = pf; \ - tp->p_ctx.r13->r5 = arg; \ - tp->p_ctx.r13->lr = threadstart; \ +#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \ + tp->p_ctx.r13 = (struct intctx *)((BYTE8 *)workspace + \ + wsize - \ + sizeof(struct intctx)); \ + tp->p_ctx.r13->r4 = pf; \ + tp->p_ctx.r13->r5 = arg; \ + tp->p_ctx.r13->lr = threadstart; \ } #ifdef THUMB @@ -88,19 +88,16 @@ extern void chSysUnlock(void); #define chSysUnlock() asm("msr CPSR_c, #0x1F") #endif /* THUMB */ -#define chSysPuts(msg) {} - #ifdef THUMB #define INT_REQUIRED_STACK 0x10 #else /* !THUMB */ #define INT_REQUIRED_STACK 0 #endif /* THUMB */ -#define UserStackSize(n) (((sizeof(Thread) + \ - sizeof(struct intctx) + \ - sizeof(struct extctx) + \ - (INT_REQUIRED_STACK) + \ - (n) - 1) | 3) + 1) - +#define StackAlign(n) ((((n) - 1) | 3) + 1) +#define UserStackSize(n) StackAlign(sizeof(Thread) + \ + sizeof(struct intctx) + \ + sizeof(struct extctx) + \ + (n) + (INT_REQUIRED_STACK)) #define WorkingArea(s, n) ULONG32 s[UserStackSize(n) >> 2]; /* It requires zero bytes, but better be safe.*/ @@ -109,6 +106,7 @@ void _IdleThread(void *p) __attribute__((noreturn)); void chSysHalt(void) __attribute__((noreturn)); void chSysSwitchI(Context *oldp, Context *newp); +void chSysPuts(char *msg); void threadstart(void); void DefFiqHandler(void); void DefIrqHandler(void); diff --git a/demos/AVR-AT90CANx-GCC/chconf.h b/demos/AVR-AT90CANx-GCC/chconf.h index c6146f5e7..2bc89dc2f 100644 --- a/demos/AVR-AT90CANx-GCC/chconf.h +++ b/demos/AVR-AT90CANx-GCC/chconf.h @@ -163,6 +163,10 @@ */ //#define CH_USE_DEBUG +/** Debug option: Includes the threads context switch tracing feature. + */ +//#define CH_USE_TRACE + #endif /* _CHCONF_H_ */ /** @} */ diff --git a/demos/AVR-AT90CANx-GCC/chcore.h b/demos/AVR-AT90CANx-GCC/chcore.h index 07cb45f64..9e1b95db8 100644 --- a/demos/AVR-AT90CANx-GCC/chcore.h +++ b/demos/AVR-AT90CANx-GCC/chcore.h @@ -83,26 +83,21 @@ typedef struct { /** * Platform dependent part of the \p chThdCreate() API. */ -#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; \ +#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; \ } -/* - * Interrupt stack usage except for saved registers. - */ -#define EXTRA_INT_STACK 0x10 - -#define UserStackSize(n) (sizeof(Thread) + \ - sizeof(struct intctx) + \ - sizeof(struct extctx) + \ - EXTRA_INT_STACK + \ - (n)) - +#define INT_REQUIRED_STACK 0x10 +#define StackAlign(n) (n) +#define UserStackSize(n) StackAlign(sizeof(Thread) + \ + sizeof(struct intctx) + \ + sizeof(struct extctx) + \ + (n) + (INT_REQUIRED_STACK)) #define WorkingArea(s, n) BYTE8 s[UserStackSize(n)]; #define chSysLock() asm("cli") diff --git a/demos/Win32-MSVS/chconf.h b/demos/Win32-MSVS/chconf.h index be1896046..5941cc856 100644 --- a/demos/Win32-MSVS/chconf.h +++ b/demos/Win32-MSVS/chconf.h @@ -167,6 +167,10 @@ */ //#define CH_USE_DEBUG +/** Debug option: Includes the threads context switch tracing feature. + */ +//#define CH_USE_TRACE + #endif /* _CHCONF_H_ */ /** @} */ diff --git a/demos/Win32-MinGW/chconf.h b/demos/Win32-MinGW/chconf.h index 8ce32defa..af19dd995 100644 --- a/demos/Win32-MinGW/chconf.h +++ b/demos/Win32-MinGW/chconf.h @@ -167,6 +167,10 @@ */ //#define CH_USE_DEBUG +/** Debug option: Includes the threads context switch tracing feature. + */ +//#define CH_USE_TRACE + #endif /* _CHCONF_H_ */ /** @} */ -- cgit v1.2.3