Renamed internal tracer functions.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9242 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
fbb8e86676
commit
ce4f94eff6
|
@ -130,7 +130,7 @@
|
||||||
PORT_IRQ_PROLOGUE(); \
|
PORT_IRQ_PROLOGUE(); \
|
||||||
CH_CFG_IRQ_PROLOGUE_HOOK(); \
|
CH_CFG_IRQ_PROLOGUE_HOOK(); \
|
||||||
_stats_increase_irq(); \
|
_stats_increase_irq(); \
|
||||||
_dbg_trace_isr_enter(__func__); \
|
_trace_isr_enter(__func__); \
|
||||||
_dbg_check_enter_isr()
|
_dbg_check_enter_isr()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,7 +143,7 @@
|
||||||
*/
|
*/
|
||||||
#define CH_IRQ_EPILOGUE() \
|
#define CH_IRQ_EPILOGUE() \
|
||||||
_dbg_check_leave_isr(); \
|
_dbg_check_leave_isr(); \
|
||||||
_dbg_trace_isr_leave(__func__); \
|
_trace_isr_leave(__func__); \
|
||||||
CH_CFG_IRQ_EPILOGUE_HOOK(); \
|
CH_CFG_IRQ_EPILOGUE_HOOK(); \
|
||||||
PORT_IRQ_EPILOGUE()
|
PORT_IRQ_EPILOGUE()
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@
|
||||||
*/
|
*/
|
||||||
#define chSysSwitch(ntp, otp) { \
|
#define chSysSwitch(ntp, otp) { \
|
||||||
\
|
\
|
||||||
_dbg_trace_switch(otp); \
|
_trace_switch(ntp, otp); \
|
||||||
_stats_ctxswc(ntp, otp); \
|
_stats_ctxswc(ntp, otp); \
|
||||||
CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
|
CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
|
||||||
port_switch(ntp, otp); \
|
port_switch(ntp, otp); \
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
* @name Events to trace
|
* @name Events to trace
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define CH_DBG_TRACE_MASK_DISABLED -1
|
#define CH_DBG_TRACE_MASK_DISABLED 255U
|
||||||
#define CH_DBG_TRACE_MASK_NONE 0U
|
#define CH_DBG_TRACE_MASK_NONE 0U
|
||||||
#define CH_DBG_TRACE_MASK_SWITCH 1U
|
#define CH_DBG_TRACE_MASK_SWITCH 1U
|
||||||
#define CH_DBG_TRACE_MASK_ISR 2U
|
#define CH_DBG_TRACE_MASK_ISR 2U
|
||||||
|
@ -201,20 +201,20 @@ typedef struct {
|
||||||
an empty macro. Note that the macros can be externally redefined in
|
an empty macro. Note that the macros can be externally redefined in
|
||||||
order to interface 3rd parties tracing tools.*/
|
order to interface 3rd parties tracing tools.*/
|
||||||
#if CH_DBG_TRACE_MASK == CH_DBG_TRACE_MASK_DISABLED
|
#if CH_DBG_TRACE_MASK == CH_DBG_TRACE_MASK_DISABLED
|
||||||
#if !defined(_dbg_trace_init)
|
#if !defined(_trace_init)
|
||||||
#define _dbg_trace_init()
|
#define _trace_init()
|
||||||
#endif
|
#endif
|
||||||
#if !defined(_dbg_trace_switch)
|
#if !defined(_trace_switch)
|
||||||
#define _dbg_trace_switch(otp)
|
#define _trace_switch(ntp, otp)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(_dbg_trace_isr_enter)
|
#if !defined(_trace_isr_enter)
|
||||||
#define _dbg_trace_isr_enter(isr)
|
#define _trace_isr_enter(isr)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(_dbg_trace_isr_leave)
|
#if !defined(_trace_isr_leave)
|
||||||
#define _dbg_trace_isr_leave(isr)
|
#define _trace_isr_leave(isr)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(_dbg_trace_halt)
|
#if !defined(_trace_halt)
|
||||||
#define _dbg_trace_halt(reason)
|
#define _trace_halt(reason)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(chDbgWriteTraceI)
|
#if !defined(chDbgWriteTraceI)
|
||||||
#define chDbgWriteTraceI(up1, up2)
|
#define chDbgWriteTraceI(up1, up2)
|
||||||
|
@ -232,11 +232,11 @@ typedef struct {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
#if (CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_DISABLED) || defined(__DOXYGEN__)
|
#if (CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_DISABLED) || defined(__DOXYGEN__)
|
||||||
void _dbg_trace_init(void);
|
void _trace_init(void);
|
||||||
void _dbg_trace_switch(thread_t *otp);
|
void _trace_switch(thread_t *ntp, thread_t *otp);
|
||||||
void _dbg_trace_isr_enter(const char *isr);
|
void _trace_isr_enter(const char *isr);
|
||||||
void _dbg_trace_isr_leave(const char *isr);
|
void _trace_isr_leave(const char *isr);
|
||||||
void _dbg_trace_halt(const char *reason);
|
void _trace_halt(const char *reason);
|
||||||
void chDbgWriteTraceI(void *up1, void *up2);
|
void chDbgWriteTraceI(void *up1, void *up2);
|
||||||
void chDbgWriteTrace(void *up1, void *up2);
|
void chDbgWriteTrace(void *up1, void *up2);
|
||||||
void chDbgSuspendTraceI(uint16_t mask);
|
void chDbgSuspendTraceI(uint16_t mask);
|
||||||
|
|
|
@ -51,6 +51,7 @@ endif
|
||||||
else
|
else
|
||||||
KERNSRC := $(CHIBIOS)/os/rt/src/chsys.c \
|
KERNSRC := $(CHIBIOS)/os/rt/src/chsys.c \
|
||||||
$(CHIBIOS)/os/rt/src/chdebug.c \
|
$(CHIBIOS)/os/rt/src/chdebug.c \
|
||||||
|
$(CHIBIOS)/os/rt/src/chtrace.c \
|
||||||
$(CHIBIOS)/os/rt/src/chvt.c \
|
$(CHIBIOS)/os/rt/src/chvt.c \
|
||||||
$(CHIBIOS)/os/rt/src/chschd.c \
|
$(CHIBIOS)/os/rt/src/chschd.c \
|
||||||
$(CHIBIOS)/os/rt/src/chthreads.c \
|
$(CHIBIOS)/os/rt/src/chthreads.c \
|
||||||
|
|
|
@ -101,6 +101,7 @@ void chSysInit(void) {
|
||||||
|
|
||||||
_scheduler_init();
|
_scheduler_init();
|
||||||
_vt_init();
|
_vt_init();
|
||||||
|
_trace_init();
|
||||||
|
|
||||||
#if CH_DBG_SYSTEM_STATE_CHECK == TRUE
|
#if CH_DBG_SYSTEM_STATE_CHECK == TRUE
|
||||||
ch.dbg.isr_cnt = (cnt_t)0;
|
ch.dbg.isr_cnt = (cnt_t)0;
|
||||||
|
@ -118,9 +119,6 @@ void chSysInit(void) {
|
||||||
#if CH_DBG_STATISTICS == TRUE
|
#if CH_DBG_STATISTICS == TRUE
|
||||||
_stats_init();
|
_stats_init();
|
||||||
#endif
|
#endif
|
||||||
#if CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_DISABLED
|
|
||||||
_dbg_trace_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CH_CFG_NO_IDLE_THREAD == FALSE
|
#if CH_CFG_NO_IDLE_THREAD == FALSE
|
||||||
/* Now this instructions flow becomes the main thread.*/
|
/* Now this instructions flow becomes the main thread.*/
|
||||||
|
@ -199,7 +197,7 @@ void chSysHalt(const char *reason) {
|
||||||
CH_CFG_SYSTEM_HALT_HOOK(reason);
|
CH_CFG_SYSTEM_HALT_HOOK(reason);
|
||||||
|
|
||||||
/* Logging the event.*/
|
/* Logging the event.*/
|
||||||
_dbg_trace_halt(reason);
|
_trace_halt(reason);
|
||||||
|
|
||||||
/* Pointing to the passed message.*/
|
/* Pointing to the passed message.*/
|
||||||
ch.dbg.panic_msg = reason;
|
ch.dbg.panic_msg = reason;
|
||||||
|
|
|
@ -82,10 +82,10 @@ static NOINLINE void trace_next(void) {
|
||||||
* @brief Trace circular buffer subsystem initialization.
|
* @brief Trace circular buffer subsystem initialization.
|
||||||
* @note Internal use only.
|
* @note Internal use only.
|
||||||
*/
|
*/
|
||||||
void _dbg_trace_init(void) {
|
void _trace_init(void) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
ch.dbg.trace_buffer.suspended = CH_DBG_TRACE_MASK;
|
ch.dbg.trace_buffer.suspended = (uint16_t)CH_DBG_TRACE_MASK;
|
||||||
ch.dbg.trace_buffer.size = CH_DBG_TRACE_BUFFER_SIZE;
|
ch.dbg.trace_buffer.size = CH_DBG_TRACE_BUFFER_SIZE;
|
||||||
ch.dbg.trace_buffer.ptr = &ch.dbg.trace_buffer.buffer[0];
|
ch.dbg.trace_buffer.ptr = &ch.dbg.trace_buffer.buffer[0];
|
||||||
for (i = 0U; i < (unsigned)CH_DBG_TRACE_BUFFER_SIZE; i++) {
|
for (i = 0U; i < (unsigned)CH_DBG_TRACE_BUFFER_SIZE; i++) {
|
||||||
|
@ -96,11 +96,14 @@ void _dbg_trace_init(void) {
|
||||||
/**
|
/**
|
||||||
* @brief Inserts in the circular debug trace buffer a context switch record.
|
* @brief Inserts in the circular debug trace buffer a context switch record.
|
||||||
*
|
*
|
||||||
|
* @param[in] ntp the thread being switched in
|
||||||
* @param[in] otp the thread being switched out
|
* @param[in] otp the thread being switched out
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void _dbg_trace_switch(thread_t *otp) {
|
void _trace_switch(thread_t *ntp, thread_t *otp) {
|
||||||
|
|
||||||
|
(void)ntp;
|
||||||
|
|
||||||
if ((ch.dbg.trace_buffer.suspended & CH_DBG_TRACE_MASK_SWITCH) == 0U) {
|
if ((ch.dbg.trace_buffer.suspended & CH_DBG_TRACE_MASK_SWITCH) == 0U) {
|
||||||
ch.dbg.trace_buffer.ptr->type = CH_TRACE_TYPE_SWITCH;
|
ch.dbg.trace_buffer.ptr->type = CH_TRACE_TYPE_SWITCH;
|
||||||
|
@ -118,7 +121,7 @@ void _dbg_trace_switch(thread_t *otp) {
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void _dbg_trace_isr_enter(const char *isr) {
|
void _trace_isr_enter(const char *isr) {
|
||||||
|
|
||||||
if ((ch.dbg.trace_buffer.suspended & CH_DBG_TRACE_MASK_ISR) == 0U) {
|
if ((ch.dbg.trace_buffer.suspended & CH_DBG_TRACE_MASK_ISR) == 0U) {
|
||||||
port_lock_from_isr();
|
port_lock_from_isr();
|
||||||
|
@ -137,7 +140,7 @@ void _dbg_trace_isr_enter(const char *isr) {
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void _dbg_trace_isr_leave(const char *isr) {
|
void _trace_isr_leave(const char *isr) {
|
||||||
|
|
||||||
if ((ch.dbg.trace_buffer.suspended & CH_DBG_TRACE_MASK_ISR) == 0U) {
|
if ((ch.dbg.trace_buffer.suspended & CH_DBG_TRACE_MASK_ISR) == 0U) {
|
||||||
port_lock_from_isr();
|
port_lock_from_isr();
|
||||||
|
@ -156,7 +159,7 @@ void _dbg_trace_isr_leave(const char *isr) {
|
||||||
*
|
*
|
||||||
* @notapi
|
* @notapi
|
||||||
*/
|
*/
|
||||||
void _dbg_trace_halt(const char *reason) {
|
void _trace_halt(const char *reason) {
|
||||||
|
|
||||||
if ((ch.dbg.trace_buffer.suspended & CH_DBG_TRACE_MASK_HALT) == 0U) {
|
if ((ch.dbg.trace_buffer.suspended & CH_DBG_TRACE_MASK_HALT) == 0U) {
|
||||||
ch.dbg.trace_buffer.ptr->type = CH_TRACE_TYPE_HALT;
|
ch.dbg.trace_buffer.ptr->type = CH_TRACE_TYPE_HALT;
|
||||||
|
|
Loading…
Reference in New Issue