|
ChibiOS/RT
2.5.1 |
|
Debug APIs and services:
chSysDisable().chSysSuspend() chSysEnable().chSysLock().chSysUnlock().chSysLockFromIsr().chSysUnlockFromIsr().CH_IRQ_PROLOGUE().CH_IRQ_EPILOGUE().Data Structures | |
| struct | ch_swc_event_t |
| Trace buffer record. More... | |
| struct | ch_trace_buffer_t |
| Trace buffer header. More... | |
Functions | |
| void | _trace_init (void) |
| Trace circular buffer subsystem initialization. | |
| void | dbg_trace (Thread *otp) |
| Inserts in the circular debug trace buffer a context switch record. | |
| void | dbg_check_disable (void) |
Guard code for chSysDisable(). | |
| void | dbg_check_suspend (void) |
Guard code for chSysSuspend(). | |
| void | dbg_check_enable (void) |
Guard code for chSysEnable(). | |
| void | dbg_check_lock (void) |
Guard code for chSysLock(). | |
| void | dbg_check_unlock (void) |
Guard code for chSysUnlock(). | |
| void | dbg_check_lock_from_isr (void) |
Guard code for chSysLockFromIsr(). | |
| void | dbg_check_unlock_from_isr (void) |
Guard code for chSysUnlockFromIsr(). | |
| void | dbg_check_enter_isr (void) |
Guard code for CH_IRQ_PROLOGUE(). | |
| void | dbg_check_leave_isr (void) |
Guard code for CH_IRQ_EPILOGUE(). | |
| void | chDbgCheckClassI (void) |
| I-class functions context check. | |
| void | chDbgCheckClassS (void) |
| S-class functions context check. | |
| void | chDbgPanic (const char *msg) |
| Prints a panic message on the console and then halts the system. | |
Variables | |
| cnt_t | dbg_isr_cnt |
| ISR nesting level. | |
| cnt_t | dbg_lock_cnt |
| Lock nesting level. | |
| ch_trace_buffer_t | dbg_trace_buffer |
| Public trace buffer. | |
| const char * | dbg_panic_msg |
| Pointer to the panic message. | |
Debug related settings | |
| #define | CH_TRACE_BUFFER_SIZE 64 |
| Trace buffer entries. | |
| #define | CH_STACK_FILL_VALUE 0x55 |
| Fill value for thread stack area in debug mode. | |
| #define | CH_THREAD_FILL_VALUE 0xFF |
| Fill value for thread area in debug mode. | |
Macro Functions | |
| #define | chDbgCheck(c, func) |
| Function parameter check. | |
| #define | chDbgAssert(c, m, r) |
| Condition assertion. | |
| void _trace_init | ( | void | ) |
Trace circular buffer subsystem initialization.
Definition at line 222 of file chdebug.c.
References CH_TRACE_BUFFER_SIZE, ch_trace_buffer_t::tb_buffer, ch_trace_buffer_t::tb_ptr, and ch_trace_buffer_t::tb_size.
Referenced by chSysInit().
| void dbg_trace | ( | Thread * | otp | ) |
Inserts in the circular debug trace buffer a context switch record.
| [in] | otp | the thread being switched out |
Definition at line 235 of file chdebug.c.
References CH_TRACE_BUFFER_SIZE, chTimeNow, currp, Thread::p_state, ch_swc_event_t::se_state, ch_swc_event_t::se_time, ch_swc_event_t::se_tp, ch_swc_event_t::se_wtobjp, ch_trace_buffer_t::tb_buffer, ch_trace_buffer_t::tb_ptr, and Thread::wtobjp.
| void dbg_check_disable | ( | void | ) |
Guard code for chSysDisable().
Definition at line 74 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.

| void dbg_check_suspend | ( | void | ) |
Guard code for chSysSuspend().
Definition at line 85 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.

| void dbg_check_enable | ( | void | ) |
Guard code for chSysEnable().
Definition at line 96 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.

| void dbg_check_lock | ( | void | ) |
Guard code for chSysLock().
Definition at line 107 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.
Referenced by _port_switch_from_isr().

| void dbg_check_unlock | ( | void | ) |
Guard code for chSysUnlock().
Definition at line 119 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.
Referenced by _port_switch_from_isr().

| void dbg_check_lock_from_isr | ( | void | ) |
Guard code for chSysLockFromIsr().
Definition at line 131 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.

| void dbg_check_unlock_from_isr | ( | void | ) |
Guard code for chSysUnlockFromIsr().
Definition at line 143 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.

| void dbg_check_enter_isr | ( | void | ) |
Guard code for CH_IRQ_PROLOGUE().
Definition at line 155 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, dbg_lock_cnt, port_lock_from_isr, and port_unlock_from_isr.

| void dbg_check_leave_isr | ( | void | ) |
Guard code for CH_IRQ_EPILOGUE().
Definition at line 169 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, dbg_lock_cnt, port_lock_from_isr, and port_unlock_from_isr.

| void chDbgCheckClassI | ( | void | ) |
I-class functions context check.
Verifies that the system is in an appropriate state for invoking an I-class API function. A panic is generated if the state is not compatible.
Definition at line 186 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.
Referenced by adcStartConversionI(), adcStopConversionI(), chCondBroadcastI(), chCondSignalI(), chCoreAllocI(), chEvtBroadcastFlagsI(), chEvtSignalI(), chIQPutI(), chIQResetI(), chMBFetchI(), chMBPostAheadI(), chMBPostI(), chOQGetI(), chOQResetI(), chPoolAllocI(), chPoolFreeI(), chSchReadyI(), chSemAddCounterI(), chSemResetI(), chSemSignalI(), chSysTimerHandlerI(), chThdCreateI(), chVTResetI(), chVTSetI(), gptStartContinuousI(), gptStartOneShotI(), gptStopTimerI(), sdIncomingDataI(), sdRequestDataI(), uartStartReceiveI(), uartStartSendI(), uartStopReceiveI(), uartStopSendI(), usbDisableEndpointsI(), usbInitEndpointI(), usbStallReceiveI(), usbStallTransmitI(), usbStartReceiveI(), and usbStartTransmitI().

| void chDbgCheckClassS | ( | void | ) |
S-class functions context check.
Verifies that the system is in an appropriate state for invoking an S-class API function. A panic is generated if the state is not compatible.
Definition at line 200 of file chdebug.c.
References chDbgPanic(), dbg_isr_cnt, and dbg_lock_cnt.
Referenced by chCondWaitS(), chCondWaitTimeoutS(), chMBFetchS(), chMBPostAheadS(), chMBPostS(), chMtxLockS(), chMtxTryLockS(), chMtxUnlockS(), chSchGoSleepS(), chSchGoSleepTimeoutS(), chSchRescheduleS(), chSchWakeupS(), chSemWaitS(), and chSemWaitTimeoutS().

| void chDbgPanic | ( | const char * | msg | ) |
Prints a panic message on the console and then halts the system.
| [in] | msg | the pointer to the panic message string |
Definition at line 264 of file chdebug.c.
References chSysHalt, and dbg_panic_msg.
Referenced by chDbgCheckClassI(), chDbgCheckClassS(), dbg_check_disable(), dbg_check_enable(), dbg_check_enter_isr(), dbg_check_leave_isr(), dbg_check_lock(), dbg_check_lock_from_isr(), dbg_check_suspend(), dbg_check_unlock(), and dbg_check_unlock_from_isr().
ISR nesting level.
Definition at line 62 of file chdebug.c.
Referenced by chDbgCheckClassI(), chDbgCheckClassS(), dbg_check_disable(), dbg_check_enable(), dbg_check_enter_isr(), dbg_check_leave_isr(), dbg_check_lock(), dbg_check_lock_from_isr(), dbg_check_suspend(), dbg_check_unlock(), and dbg_check_unlock_from_isr().
Lock nesting level.
Definition at line 67 of file chdebug.c.
Referenced by chDbgCheckClassI(), chDbgCheckClassS(), dbg_check_disable(), dbg_check_enable(), dbg_check_enter_isr(), dbg_check_leave_isr(), dbg_check_lock(), dbg_check_lock_from_isr(), dbg_check_suspend(), dbg_check_unlock(), and dbg_check_unlock_from_isr().
| const char* dbg_panic_msg |
Pointer to the panic message.
This pointer is meant to be accessed through the debugger, it is written once and then the system is halted.
Definition at line 257 of file chdebug.c.
Referenced by chDbgPanic().
| #define CH_TRACE_BUFFER_SIZE 64 |
Trace buffer entries.
Definition at line 52 of file chdebug.h.
Referenced by _trace_init(), and dbg_trace().
| #define CH_STACK_FILL_VALUE 0x55 |
Fill value for thread stack area in debug mode.
Definition at line 59 of file chdebug.h.
Referenced by chThdCreateFromHeap(), chThdCreateFromMemoryPool(), and chThdCreateStatic().
| #define CH_THREAD_FILL_VALUE 0xFF |
Fill value for thread area in debug mode.
Definition at line 70 of file chdebug.h.
Referenced by chThdCreateFromHeap(), chThdCreateFromMemoryPool(), and chThdCreateStatic().
| #define chDbgCheck | ( | c, | |
| func | |||
| ) |
{ \
if (!(c)) \
chDbgPanic(__QUOTE_THIS(func)"()"); \
}
Function parameter check.
If the condition check fails then the kernel panics and halts.
CH_DBG_ENABLE_CHECKS switch is specified in chconf.h else the macro does nothing.| [in] | c | the condition to be verified to be true |
| [in] | func | the undecorated function name |
Definition at line 156 of file chdebug.h.
Referenced by adcAcquireBus(), adcReleaseBus(), adcStart(), adcStartConversionI(), adcStop(), adcStopConversion(), adcStopConversionI(), canReceive(), canSleep(), canStart(), canStop(), canTransmit(), canWakeup(), chCondBroadcastI(), chCondInit(), chCondSignal(), chCondSignalI(), chCondWaitS(), chCondWaitTimeoutS(), chEvtBroadcastFlagsI(), chEvtDispatch(), chEvtRegisterMask(), chEvtSignal(), chEvtSignalI(), chEvtUnregister(), chHeapFree(), chHeapInit(), chIQReadTimeout(), chMBFetchI(), chMBFetchS(), chMBInit(), chMBPostAheadI(), chMBPostAheadS(), chMBPostI(), chMBPostS(), chMBReset(), chMsgSend(), chMtxInit(), chMtxLockS(), chMtxTryLockS(), chOQWriteTimeout(), chPoolAllocI(), chPoolFreeI(), chPoolInit(), chPoolLoadArray(), chSemAddCounterI(), chSemInit(), chSemResetI(), chSemSignal(), chSemSignalI(), chSemWaitS(), chSemWaitTimeoutS(), chThdCreateFromMemoryPool(), chThdCreateI(), chThdSetPriority(), chThdSleep(), chThdWait(), chVTResetI(), chVTSetI(), extChannelDisable(), extChannelEnable(), extSetChannelModeI(), extStart(), extStop(), gptStart(), gptStartContinuousI(), gptStartOneShotI(), gptStop(), gptStopTimerI(), i2cAcquireBus(), i2cGetErrors(), i2cMasterReceiveTimeout(), i2cMasterTransmitTimeout(), i2cReleaseBus(), i2cStart(), i2cStop(), i2sStart(), i2sStartExchange(), i2sStartExchangeContinuous(), i2sStop(), i2sStopExchange(), icuDisable(), icuEnable(), icuStart(), icuStop(), macPollLinkStatus(), macReleaseReceiveDescriptor(), macReleaseTransmitDescriptor(), macStart(), macStop(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), mmcConnect(), mmcDisconnect(), mmcErase(), mmcGetInfo(), mmcSequentialRead(), mmcSequentialWrite(), mmcStart(), mmcStartSequentialRead(), mmcStartSequentialWrite(), mmcStop(), mmcStopSequentialRead(), mmcStopSequentialWrite(), mmcSync(), palReadBus(), palSetBusMode(), palWriteBus(), pwmChangePeriod(), pwmDisableChannel(), pwmEnableChannel(), pwmStart(), pwmStop(), rtcGetAlarm(), rtcGetTime(), rtcGetTimeFat(), rtcSetAlarm(), rtcSetCallback(), rtcSetTime(), sdcConnect(), sdcDisconnect(), sdcErase(), sdcGetAndClearErrors(), sdcGetInfo(), sdcRead(), sdcStart(), sdcStop(), sdcSync(), sdcWrite(), sdIncomingDataI(), sdRequestDataI(), sdStart(), sdStop(), sduStart(), sduStop(), spiAcquireBus(), spiExchange(), spiIgnore(), spiReceive(), spiReleaseBus(), spiSelect(), spiSend(), spiStart(), spiStartExchange(), spiStartIgnore(), spiStartReceive(), spiStartSend(), spiStop(), spiUnselect(), stStart(), stStop(), uartStart(), uartStartReceive(), uartStartReceiveI(), uartStartSend(), uartStartSendI(), uartStop(), uartStopReceive(), uartStopReceiveI(), uartStopSend(), uartStopSendI(), usbDisableEndpointsI(), usbInitEndpointI(), usbStallReceiveI(), usbStallTransmitI(), usbStart(), usbStartReceiveI(), usbStartTransmitI(), and usbStop().
| #define chDbgAssert | ( | c, | |
| m, | |||
| r | |||
| ) |
{ \
if (!(c)) \
chDbgPanic(m); \
}
Condition assertion.
If the condition check fails then the kernel panics with the specified message and halts.
CH_DBG_ENABLE_ASSERTS switch is specified in chconf.h else the macro does nothing. | [in] | c | the condition to be verified to be true |
| [in] | m | the text message |
| [in] | r | a remark string |
Definition at line 195 of file chdebug.h.
Referenced by adcConvert(), adcStart(), adcStartConversionI(), adcStop(), adcStopConversion(), adcStopConversionI(), canReceive(), canSleep(), canStart(), canStop(), canTransmit(), canWakeup(), chCondWaitS(), chCondWaitTimeoutS(), chEvtDispatch(), chHeapFree(), chMsgRelease(), chMtxLockS(), chMtxUnlock(), chMtxUnlockS(), chRegNextThread(), chSchReadyI(), chSemAddCounterI(), chSemResetI(), chSemSignal(), chSemSignalI(), chSemWaitS(), chSemWaitTimeoutS(), chThdAddRef(), chThdExitS(), chThdRelease(), chThdResume(), chThdWait(), chVTResetI(), extChannelDisable(), extChannelEnable(), extSetChannelModeI(), extStart(), extStop(), gptPolledDelay(), gptStart(), gptStartContinuousI(), gptStartOneShotI(), gptStop(), gptStopTimerI(), i2cMasterReceiveTimeout(), i2cMasterTransmitTimeout(), i2cStart(), i2cStop(), i2sStart(), i2sStartExchange(), i2sStartExchangeContinuous(), i2sStop(), i2sStopExchange(), icuDisable(), icuEnable(), icuStart(), icuStop(), macPollLinkStatus(), macStart(), macStop(), macWaitReceiveDescriptor(), macWaitTransmitDescriptor(), mmcConnect(), mmcDisconnect(), mmcStart(), mmcStartSequentialRead(), mmcStartSequentialWrite(), mmcStop(), pwmChangePeriod(), pwmDisableChannel(), pwmEnableChannel(), pwmStart(), pwmStop(), sdcConnect(), sdcDisconnect(), sdcErase(), sdcGetAndClearErrors(), sdcRead(), sdcStart(), sdcStop(), sdcWrite(), sdStart(), sdStop(), sduStart(), sduStop(), spiExchange(), spiIgnore(), spiReceive(), spiSelect(), spiSend(), spiStart(), spiStartExchange(), spiStartIgnore(), spiStartReceive(), spiStartSend(), spiStop(), spiUnselect(), stStart(), stStop(), uartStart(), uartStartReceive(), uartStartReceiveI(), uartStartSend(), uartStartSendI(), uartStop(), uartStopReceive(), uartStopReceiveI(), uartStopSend(), uartStopSendI(), usbDisableEndpointsI(), usbInitEndpointI(), usbStart(), and usbStop().