ChibiOS 21.11.4
|
System events tracing service.
Trace record types | |
#define | CH_TRACE_TYPE_UNUSED 0U |
#define | CH_TRACE_TYPE_READY 1U |
#define | CH_TRACE_TYPE_SWITCH 2U |
#define | CH_TRACE_TYPE_ISR_ENTER 3U |
#define | CH_TRACE_TYPE_ISR_LEAVE 4U |
#define | CH_TRACE_TYPE_HALT 5U |
#define | CH_TRACE_TYPE_USER 6U |
Events to trace | |
#define | CH_DBG_TRACE_MASK_DISABLED 255U |
#define | CH_DBG_TRACE_MASK_NONE 0U |
#define | CH_DBG_TRACE_MASK_READY 1U |
#define | CH_DBG_TRACE_MASK_SWITCH 2U |
#define | CH_DBG_TRACE_MASK_ISR 4U |
#define | CH_DBG_TRACE_MASK_HALT 8U |
#define | CH_DBG_TRACE_MASK_USER 16U |
#define | CH_DBG_TRACE_MASK_SLOW |
#define | CH_DBG_TRACE_MASK_ALL |
Debug related settings | |
#define | CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED |
Trace buffer entries. | |
#define | CH_DBG_TRACE_BUFFER_SIZE 128 |
Trace buffer entries. |
Data Structures | |
struct | trace_event_t |
Trace buffer record. More... | |
struct | trace_buffer_t |
Trace buffer header. More... |
Macros | |
#define | __trace_ready(tp, msg) |
#define | __trace_switch(ntp, otp) |
#define | __trace_isr_enter(isr) |
#define | __trace_isr_leave(isr) |
#define | __trace_halt(reason) |
#define | chDbgWriteTraceI(up1, up2) |
#define | chDbgWriteTrace(up1, up2) |
Functions | |
static NOINLINE void | trace_next (os_instance_t *oip) |
Writes a time stamp and increases the trace buffer pointer. | |
void | __trace_object_init (trace_buffer_t *tbp) |
Circular trace buffer initialization. | |
void | __trace_ready (thread_t *tp, msg_t msg) |
Inserts in the circular debug trace buffer a ready record. | |
void | __trace_switch (thread_t *ntp, thread_t *otp) |
Inserts in the circular debug trace buffer a context switch record. | |
void | __trace_isr_enter (const char *isr) |
Inserts in the circular debug trace buffer an ISR-enter record. | |
void | __trace_isr_leave (const char *isr) |
Inserts in the circular debug trace buffer an ISR-leave record. | |
void | __trace_halt (const char *reason) |
Inserts in the circular debug trace buffer an halt record. | |
void | chTraceWriteI (void *up1, void *up2) |
Adds an user trace record to the trace buffer. | |
void | chTraceWrite (void *up1, void *up2) |
Adds an user trace record to the trace buffer. | |
void | chTraceSuspendI (uint16_t mask) |
Suspends one or more trace events. | |
void | chTraceSuspend (uint16_t mask) |
Suspends one or more trace events. | |
void | chTraceResumeI (uint16_t mask) |
Resumes one or more trace events. | |
void | chTraceResume (uint16_t mask) |
Resumes one or more trace events. |
#define CH_TRACE_TYPE_UNUSED 0U |
Definition at line 39 of file chtrace.h.
Referenced by __trace_object_init().
#define CH_TRACE_TYPE_READY 1U |
Definition at line 40 of file chtrace.h.
Referenced by __trace_ready().
#define CH_TRACE_TYPE_SWITCH 2U |
Definition at line 41 of file chtrace.h.
Referenced by __trace_switch().
#define CH_TRACE_TYPE_ISR_ENTER 3U |
Definition at line 42 of file chtrace.h.
Referenced by __trace_isr_enter().
#define CH_TRACE_TYPE_ISR_LEAVE 4U |
Definition at line 43 of file chtrace.h.
Referenced by __trace_isr_leave().
#define CH_TRACE_TYPE_HALT 5U |
Definition at line 44 of file chtrace.h.
Referenced by __trace_halt().
#define CH_TRACE_TYPE_USER 6U |
Definition at line 45 of file chtrace.h.
Referenced by chTraceWriteI().
#define CH_DBG_TRACE_MASK_READY 1U |
Definition at line 54 of file chtrace.h.
Referenced by __trace_ready().
#define CH_DBG_TRACE_MASK_SWITCH 2U |
Definition at line 55 of file chtrace.h.
Referenced by __trace_switch().
#define CH_DBG_TRACE_MASK_ISR 4U |
Definition at line 56 of file chtrace.h.
Referenced by __trace_isr_enter(), and __trace_isr_leave().
#define CH_DBG_TRACE_MASK_HALT 8U |
Definition at line 57 of file chtrace.h.
Referenced by __trace_halt().
#define CH_DBG_TRACE_MASK_USER 16U |
Definition at line 58 of file chtrace.h.
Referenced by chTraceWriteI().
#define CH_DBG_TRACE_MASK_SLOW |
#define CH_DBG_TRACE_MASK_ALL |
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED |
#define CH_DBG_TRACE_BUFFER_SIZE 128 |
Trace buffer entries.
CH_DBG_TRACE_MASK
is different from CH_DBG_TRACE_MASK_DISABLED
. Definition at line 91 of file chtrace.h.
Referenced by __trace_object_init(), and trace_next().
#define __trace_ready | ( | tp, | |
msg ) |
Definition at line 221 of file chtrace.h.
Referenced by __sch_ready_ahead(), and __sch_ready_behind().
#define __trace_halt | ( | reason | ) |
Definition at line 233 of file chtrace.h.
Referenced by chSysHalt().
|
static |
Writes a time stamp and increases the trace buffer pointer.
Definition at line 57 of file chtrace.c.
References trace_buffer_t::buffer, CH_CFG_TRACE_HOOK, CH_DBG_TRACE_BUFFER_SIZE, chSysGetRealtimeCounterX, chVTGetSystemTimeX, NOINLINE, trace_buffer_t::ptr, trace_event_t::rtstamp, trace_event_t::time, and ch_os_instance::trace_buffer.
Referenced by __trace_halt(), __trace_isr_enter(), __trace_isr_leave(), __trace_ready(), __trace_switch(), and chTraceWriteI().
void __trace_object_init | ( | trace_buffer_t * | tbp | ) |
Circular trace buffer initialization.
[out] | tbp | pointer to the trace_buffer_t structure |
Definition at line 88 of file chtrace.c.
References trace_buffer_t::buffer, CH_DBG_TRACE_BUFFER_SIZE, CH_DBG_TRACE_MASK, CH_TRACE_TYPE_UNUSED, trace_buffer_t::ptr, trace_buffer_t::size, trace_buffer_t::suspended, and trace_event_t::type.
Referenced by chInstanceObjectInit().
Inserts in the circular debug trace buffer a ready record.
[in] | tp | the thread that just become ready |
[in] | msg | the thread ready message |
Definition at line 107 of file chtrace.c.
References CH_DBG_TRACE_MASK_READY, CH_TRACE_TYPE_READY, currcore, trace_event_t::msg, trace_buffer_t::ptr, trace_event_t::rdy, ch_thread::state, trace_event_t::state, trace_buffer_t::suspended, trace_event_t::tp, ch_os_instance::trace_buffer, trace_next(), trace_event_t::type, and trace_event_t::u.
Inserts in the circular debug trace buffer a context switch record.
[in] | ntp | the thread being switched in |
[in] | otp | the thread being switched out |
Definition at line 127 of file chtrace.c.
References CH_DBG_TRACE_MASK_SWITCH, CH_TRACE_TYPE_SWITCH, currcore, trace_event_t::ntp, trace_buffer_t::ptr, ch_thread::state, trace_event_t::state, trace_buffer_t::suspended, trace_event_t::sw, ch_os_instance::trace_buffer, trace_next(), trace_event_t::type, ch_thread::u, trace_event_t::u, ch_thread::wtobjp, and trace_event_t::wtobjp.
void __trace_isr_enter | ( | const char * | isr | ) |
Inserts in the circular debug trace buffer an ISR-enter record.
[in] | isr | name of the isr |
Definition at line 146 of file chtrace.c.
References CH_DBG_TRACE_MASK_ISR, CH_TRACE_TYPE_ISR_ENTER, currcore, trace_event_t::isr, trace_event_t::name, port_lock_from_isr(), port_unlock_from_isr(), trace_buffer_t::ptr, trace_event_t::state, trace_buffer_t::suspended, ch_os_instance::trace_buffer, trace_next(), trace_event_t::type, and trace_event_t::u.
void __trace_isr_leave | ( | const char * | isr | ) |
Inserts in the circular debug trace buffer an ISR-leave record.
[in] | isr | name of the isr |
Definition at line 166 of file chtrace.c.
References CH_DBG_TRACE_MASK_ISR, CH_TRACE_TYPE_ISR_LEAVE, currcore, trace_event_t::isr, trace_event_t::name, port_lock_from_isr(), port_unlock_from_isr(), trace_buffer_t::ptr, trace_event_t::state, trace_buffer_t::suspended, ch_os_instance::trace_buffer, trace_next(), trace_event_t::type, and trace_event_t::u.
void __trace_halt | ( | const char * | reason | ) |
Inserts in the circular debug trace buffer an halt record.
[in] | reason | the halt error string |
Definition at line 186 of file chtrace.c.
References CH_DBG_TRACE_MASK_HALT, CH_TRACE_TYPE_HALT, currcore, trace_event_t::halt, trace_buffer_t::ptr, trace_event_t::reason, trace_event_t::state, trace_buffer_t::suspended, ch_os_instance::trace_buffer, trace_next(), trace_event_t::type, and trace_event_t::u.
void chTraceWriteI | ( | void * | up1, |
void * | up2 ) |
Adds an user trace record to the trace buffer.
[in] | up1 | user parameter 1 |
[in] | up2 | user parameter 2 |
Definition at line 205 of file chtrace.c.
References CH_DBG_TRACE_MASK_USER, CH_TRACE_TYPE_USER, chDbgCheckClassI, currcore, trace_buffer_t::ptr, trace_event_t::state, trace_buffer_t::suspended, ch_os_instance::trace_buffer, trace_next(), trace_event_t::type, trace_event_t::u, trace_event_t::up1, trace_event_t::up2, and trace_event_t::user.
Referenced by chTraceWrite().
void chTraceWrite | ( | void * | up1, |
void * | up2 ) |
Adds an user trace record to the trace buffer.
[in] | up1 | user parameter 1 |
[in] | up2 | user parameter 2 |
Definition at line 227 of file chtrace.c.
References chSysLock, chSysUnlock, and chTraceWriteI().
void chTraceSuspendI | ( | uint16_t | mask | ) |
Suspends one or more trace events.
[in] | mask | mask of the trace events to be suspended |
Definition at line 241 of file chtrace.c.
References chDbgCheckClassI, and currcore.
Referenced by chTraceSuspend().
void chTraceSuspend | ( | uint16_t | mask | ) |
Suspends one or more trace events.
[in] | mask | mask of the trace events to be suspended |
Definition at line 255 of file chtrace.c.
References chSysLock, chSysUnlock, and chTraceSuspendI().
void chTraceResumeI | ( | uint16_t | mask | ) |
Resumes one or more trace events.
[in] | mask | mask of the trace events to be resumed |
Definition at line 269 of file chtrace.c.
References chDbgCheckClassI, and currcore.
Referenced by chTraceResume().
void chTraceResume | ( | uint16_t | mask | ) |
Resumes one or more trace events.
[in] | mask | mask of the trace events to be resumed |
Definition at line 283 of file chtrace.c.
References chSysLock, chSysUnlock, and chTraceResumeI().