Renamed internal tracer functions.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9242 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
Giovanni Di Sirio 2016-04-05 10:47:57 +00:00
parent fbb8e86676
commit ce4f94eff6
5 changed files with 31 additions and 29 deletions

View File

@ -130,7 +130,7 @@
PORT_IRQ_PROLOGUE(); \
CH_CFG_IRQ_PROLOGUE_HOOK(); \
_stats_increase_irq(); \
_dbg_trace_isr_enter(__func__); \
_trace_isr_enter(__func__); \
_dbg_check_enter_isr()
/**
@ -143,7 +143,7 @@
*/
#define CH_IRQ_EPILOGUE() \
_dbg_check_leave_isr(); \
_dbg_trace_isr_leave(__func__); \
_trace_isr_leave(__func__); \
CH_CFG_IRQ_EPILOGUE_HOOK(); \
PORT_IRQ_EPILOGUE()
@ -285,7 +285,7 @@
*/
#define chSysSwitch(ntp, otp) { \
\
_dbg_trace_switch(otp); \
_trace_switch(ntp, otp); \
_stats_ctxswc(ntp, otp); \
CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp); \
port_switch(ntp, otp); \

View File

@ -48,7 +48,7 @@
* @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_SWITCH 1U
#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
order to interface 3rd parties tracing tools.*/
#if CH_DBG_TRACE_MASK == CH_DBG_TRACE_MASK_DISABLED
#if !defined(_dbg_trace_init)
#define _dbg_trace_init()
#if !defined(_trace_init)
#define _trace_init()
#endif
#if !defined(_dbg_trace_switch)
#define _dbg_trace_switch(otp)
#if !defined(_trace_switch)
#define _trace_switch(ntp, otp)
#endif
#if !defined(_dbg_trace_isr_enter)
#define _dbg_trace_isr_enter(isr)
#if !defined(_trace_isr_enter)
#define _trace_isr_enter(isr)
#endif
#if !defined(_dbg_trace_isr_leave)
#define _dbg_trace_isr_leave(isr)
#if !defined(_trace_isr_leave)
#define _trace_isr_leave(isr)
#endif
#if !defined(_dbg_trace_halt)
#define _dbg_trace_halt(reason)
#if !defined(_trace_halt)
#define _trace_halt(reason)
#endif
#if !defined(chDbgWriteTraceI)
#define chDbgWriteTraceI(up1, up2)
@ -232,11 +232,11 @@ typedef struct {
extern "C" {
#endif
#if (CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_DISABLED) || defined(__DOXYGEN__)
void _dbg_trace_init(void);
void _dbg_trace_switch(thread_t *otp);
void _dbg_trace_isr_enter(const char *isr);
void _dbg_trace_isr_leave(const char *isr);
void _dbg_trace_halt(const char *reason);
void _trace_init(void);
void _trace_switch(thread_t *ntp, thread_t *otp);
void _trace_isr_enter(const char *isr);
void _trace_isr_leave(const char *isr);
void _trace_halt(const char *reason);
void chDbgWriteTraceI(void *up1, void *up2);
void chDbgWriteTrace(void *up1, void *up2);
void chDbgSuspendTraceI(uint16_t mask);

View File

@ -51,6 +51,7 @@ endif
else
KERNSRC := $(CHIBIOS)/os/rt/src/chsys.c \
$(CHIBIOS)/os/rt/src/chdebug.c \
$(CHIBIOS)/os/rt/src/chtrace.c \
$(CHIBIOS)/os/rt/src/chvt.c \
$(CHIBIOS)/os/rt/src/chschd.c \
$(CHIBIOS)/os/rt/src/chthreads.c \

View File

@ -101,6 +101,7 @@ void chSysInit(void) {
_scheduler_init();
_vt_init();
_trace_init();
#if CH_DBG_SYSTEM_STATE_CHECK == TRUE
ch.dbg.isr_cnt = (cnt_t)0;
@ -118,9 +119,6 @@ void chSysInit(void) {
#if CH_DBG_STATISTICS == TRUE
_stats_init();
#endif
#if CH_DBG_TRACE_MASK != CH_DBG_TRACE_MASK_DISABLED
_dbg_trace_init();
#endif
#if CH_CFG_NO_IDLE_THREAD == FALSE
/* Now this instructions flow becomes the main thread.*/
@ -199,7 +197,7 @@ void chSysHalt(const char *reason) {
CH_CFG_SYSTEM_HALT_HOOK(reason);
/* Logging the event.*/
_dbg_trace_halt(reason);
_trace_halt(reason);
/* Pointing to the passed message.*/
ch.dbg.panic_msg = reason;

View File

@ -82,10 +82,10 @@ static NOINLINE void trace_next(void) {
* @brief Trace circular buffer subsystem initialization.
* @note Internal use only.
*/
void _dbg_trace_init(void) {
void _trace_init(void) {
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.ptr = &ch.dbg.trace_buffer.buffer[0];
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.
*
* @param[in] ntp the thread being switched in
* @param[in] otp the thread being switched out
*
* @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) {
ch.dbg.trace_buffer.ptr->type = CH_TRACE_TYPE_SWITCH;
@ -118,7 +121,7 @@ void _dbg_trace_switch(thread_t *otp) {
*
* @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) {
port_lock_from_isr();
@ -137,7 +140,7 @@ void _dbg_trace_isr_enter(const char *isr) {
*
* @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) {
port_lock_from_isr();
@ -156,7 +159,7 @@ void _dbg_trace_isr_leave(const char *isr) {
*
* @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) {
ch.dbg.trace_buffer.ptr->type = CH_TRACE_TYPE_HALT;