git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@115 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
a62cb84475
commit
a134cd919e
|
@ -162,6 +162,10 @@
|
|||
*/
|
||||
//#define CH_USE_DEBUG
|
||||
|
||||
/** Debug option: Includes the threads context switch tracing feature.
|
||||
*/
|
||||
//#define CH_USE_TRACE
|
||||
|
||||
#endif /* _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_ */
|
||||
|
||||
|
|
|
@ -165,6 +165,12 @@ void chSysHalt(void) {
|
|||
;
|
||||
}
|
||||
|
||||
/*
|
||||
* System console message (implemented via JTAG).
|
||||
*/
|
||||
void chSysPuts(char *msg) {
|
||||
}
|
||||
|
||||
/*
|
||||
* Non-vectored IRQs handling here.
|
||||
*/
|
||||
|
|
|
@ -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) + \
|
||||
#define StackAlign(n) ((((n) - 1) | 3) + 1)
|
||||
#define UserStackSize(n) StackAlign(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(INT_REQUIRED_STACK) + \
|
||||
(n) - 1) | 3) + 1)
|
||||
|
||||
(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);
|
||||
|
|
|
@ -163,6 +163,10 @@
|
|||
*/
|
||||
//#define CH_USE_DEBUG
|
||||
|
||||
/** Debug option: Includes the threads context switch tracing feature.
|
||||
*/
|
||||
//#define CH_USE_TRACE
|
||||
|
||||
#endif /* _CHCONF_H_ */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -92,17 +92,12 @@ typedef struct {
|
|||
tp->p_ctx.sp->pc = (UWORD16)threadstart; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Interrupt stack usage except for saved registers.
|
||||
*/
|
||||
#define EXTRA_INT_STACK 0x10
|
||||
|
||||
#define UserStackSize(n) (sizeof(Thread) + \
|
||||
#define INT_REQUIRED_STACK 0x10
|
||||
#define StackAlign(n) (n)
|
||||
#define UserStackSize(n) StackAlign(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
EXTRA_INT_STACK + \
|
||||
(n))
|
||||
|
||||
(n) + (INT_REQUIRED_STACK))
|
||||
#define WorkingArea(s, n) BYTE8 s[UserStackSize(n)];
|
||||
|
||||
#define chSysLock() asm("cli")
|
||||
|
|
|
@ -167,6 +167,10 @@
|
|||
*/
|
||||
//#define CH_USE_DEBUG
|
||||
|
||||
/** Debug option: Includes the threads context switch tracing feature.
|
||||
*/
|
||||
//#define CH_USE_TRACE
|
||||
|
||||
#endif /* _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_ */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = ChibiOS/RT
|
||||
PROJECT_NUMBER = "0.4.2 beta"
|
||||
PROJECT_NUMBER = "0.4.3 beta"
|
||||
OUTPUT_DIRECTORY = .
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#ifdef CH_USE_DEBUG
|
||||
|
||||
TraceBuffer dbgtb;
|
||||
char *dbglastmsg;
|
||||
|
||||
/**
|
||||
|
@ -29,27 +28,10 @@ char *dbglastmsg;
|
|||
*/
|
||||
void chDbgInit(void) {
|
||||
|
||||
#ifdef CH_USE_TRACE
|
||||
dbgtb.tb_size = TRACE_BUFFER_SIZE;
|
||||
dbgtb.tb_ptr = &dbgtb.tb_buffer[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts in the circular debug trace buffer a context switch record.
|
||||
* @param otp the thread being switched out
|
||||
* @param ntp the thread to be resumed
|
||||
*/
|
||||
void chDbgTrace(Thread *otp, Thread *ntp) {
|
||||
|
||||
dbgtb.tb_ptr->cse_slpdata = otp->p_common;
|
||||
#ifdef CH_USE_SYSTEMTIME
|
||||
dbgtb.tb_ptr->cse_time = chSysGetTime();
|
||||
#else
|
||||
dbgtb.tb_ptr->cse_time = 0;
|
||||
#endif
|
||||
dbgtb.tb_ptr->cse_state = otp->p_state;
|
||||
dbgtb.tb_ptr->cse_tid = ntp->p_tid;
|
||||
if (++dbgtb.tb_ptr >= &dbgtb.tb_buffer[TRACE_BUFFER_SIZE])
|
||||
dbgtb.tb_ptr = &dbgtb.tb_buffer[0];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,4 +54,30 @@ void chDbgPanic(char *msg) {
|
|||
chSysHalt();
|
||||
}
|
||||
|
||||
#ifdef CH_USE_TRACE
|
||||
/**
|
||||
* Public trace buffer.
|
||||
*/
|
||||
TraceBuffer dbgtb;
|
||||
|
||||
/**
|
||||
* Inserts in the circular debug trace buffer a context switch record.
|
||||
* @param otp the thread being switched out
|
||||
* @param ntp the thread to be resumed
|
||||
*/
|
||||
void chDbgTrace(Thread *otp, Thread *ntp) {
|
||||
|
||||
dbgtb.tb_ptr->cse_slpdata = otp->p_common;
|
||||
#ifdef CH_USE_SYSTEMTIME
|
||||
dbgtb.tb_ptr->cse_time = chSysGetTime();
|
||||
#else
|
||||
dbgtb.tb_ptr->cse_time = 0;
|
||||
#endif
|
||||
dbgtb.tb_ptr->cse_state = otp->p_state;
|
||||
dbgtb.tb_ptr->cse_tid = ntp->p_tid;
|
||||
if (++dbgtb.tb_ptr >= &dbgtb.tb_buffer[TRACE_BUFFER_SIZE])
|
||||
dbgtb.tb_ptr = &dbgtb.tb_buffer[0];
|
||||
}
|
||||
#endif /* CH_USE_TRACE */
|
||||
|
||||
#endif /* CH_USE_DEBUG */
|
||||
|
|
|
@ -88,7 +88,7 @@ void chSchGoSleepS(t_tstate newstate) {
|
|||
(otp = currp)->p_state = newstate;
|
||||
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||
#ifdef CH_USE_DEBUG
|
||||
#ifdef CH_USE_TRACE
|
||||
chDbgTrace(otp, currp);
|
||||
#endif
|
||||
chSysSwitchI(&otp->p_ctx, &currp->p_ctx);
|
||||
|
@ -115,7 +115,7 @@ void chSchWakeupS(Thread *ntp, t_msg msg) {
|
|||
(currp = ntp)->p_state = PRCURR;
|
||||
ntp->p_rdymsg = msg;
|
||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||
#ifdef CH_USE_DEBUG
|
||||
#ifdef CH_USE_TRACE
|
||||
chDbgTrace(otp, ntp);
|
||||
#endif
|
||||
chSysSwitchI(&otp->p_ctx, &ntp->p_ctx);
|
||||
|
|
|
@ -52,7 +52,6 @@ extern char *dbglastmsg;
|
|||
extern "C" {
|
||||
#endif
|
||||
void chDbgInit(void);
|
||||
void chDbgTrace(Thread *otp, Thread *ntp);
|
||||
void chDbgPuts(char *msg);
|
||||
void chDbgPanic(char *msg);
|
||||
#ifdef __cplusplus
|
||||
|
@ -67,6 +66,16 @@ extern "C" {
|
|||
|
||||
#endif /* CH_USE_DEBUG */
|
||||
|
||||
#ifdef CH_USE_TRACE
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void chDbgTrace(Thread *otp, Thread *ntp);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* CH_USE_TRACE */
|
||||
|
||||
#endif /* _DEBUG_H_ */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -157,12 +157,16 @@
|
|||
*/
|
||||
//#define CH_CURRP_REGISTER_CACHE "reg"
|
||||
|
||||
/** Configuration option: Includes basic debug support to the kernel.
|
||||
/** Debug option: Includes basic debug support to the kernel.
|
||||
* @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
|
||||
|
||||
/** Debug option: Includes the threads context switch tracing feature.
|
||||
*/
|
||||
#define CH_USE_TRACE
|
||||
|
||||
#endif /* _CHCONF_H_ */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -59,4 +59,10 @@ void chSysHalt(void) {
|
|||
*/
|
||||
void chSysSwitchI(Context *oldp, Context *newp) {}
|
||||
|
||||
/**
|
||||
* Prints a message on the system console (if any).
|
||||
*/
|
||||
void chSysPuts(char *msg) {
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -25,14 +25,20 @@
|
|||
#ifndef _CHCORE_H_
|
||||
#define _CHCORE_H_
|
||||
|
||||
/*
|
||||
* Stack saved context.
|
||||
/**
|
||||
* Interrupt saved context.
|
||||
*/
|
||||
struct stackregs {
|
||||
struct extctx {
|
||||
};
|
||||
|
||||
/**
|
||||
* System saved context.
|
||||
*/
|
||||
struct intctx {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct stackregs *sp;
|
||||
struct intctx *sp;
|
||||
} Context;
|
||||
|
||||
/**
|
||||
|
@ -52,12 +58,25 @@ typedef struct {
|
|||
*/
|
||||
#define INT_REQUIRED_STACK 0
|
||||
|
||||
/**
|
||||
* Enforces a stack size alignment.
|
||||
*/
|
||||
#define StackAlign(n) (n)
|
||||
|
||||
/**
|
||||
* Macro to be used when allocating stack spaces, it adds the system-specific
|
||||
* overhead.
|
||||
*/
|
||||
#define UserStackSize(n) (sizeof(Thread) + \
|
||||
sizeof(struct stackregs) + (n) + (INT_REQUIRED_STACK))
|
||||
#define UserStackSize(n) StackAlign(sizeof(Thread) + \
|
||||
sizeof(struct intctx) + \
|
||||
sizeof(struct extctx) + \
|
||||
(n) + (INT_REQUIRED_STACK))
|
||||
|
||||
/**
|
||||
* Macro used to allocate a thread working area aligned as both position and
|
||||
* size.
|
||||
*/
|
||||
#define WorkingArea(s, n) BYTE8 s[UserStackSize(n)];
|
||||
|
||||
/**
|
||||
* Enters the ChibiOS/RT system mutual exclusion zone, the implementation is
|
||||
|
@ -81,14 +100,10 @@ typedef struct {
|
|||
*/
|
||||
#define chSysUnlock()
|
||||
|
||||
/**
|
||||
* Prints a message on the system console (if any).
|
||||
*/
|
||||
#define chSysPuts(msg) {}
|
||||
|
||||
void _IdleThread(void *p);
|
||||
void chSysHalt(void);
|
||||
void chSysSwitchI(Context *oldp, Context *newp);
|
||||
void chSysPuts(char *msg);
|
||||
|
||||
#endif /* _CHCORE_H_ */
|
||||
|
||||
|
|
Loading…
Reference in New Issue