From 1409bd15bd3bfa57c042caaed6d4b755e23ca235 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 14 Nov 2014 11:07:04 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7507 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/rt/include/chdebug.h | 13 +++------- os/rt/include/chschd.h | 64 ++++++++++++++++++++++++++-------------------- os/rt/include/chsystypes.h | 5 ++++ os/rt/include/chtm.h | 10 ++++++++ 4 files changed, 54 insertions(+), 38 deletions(-) (limited to 'os/rt/include') diff --git a/os/rt/include/chdebug.h b/os/rt/include/chdebug.h index d0223ef10..d8643ea64 100644 --- a/os/rt/include/chdebug.h +++ b/os/rt/include/chdebug.h @@ -71,13 +71,6 @@ /* Derived constants and error checks. */ /*===========================================================================*/ -#if CH_DBG_ENABLE_ASSERTS || CH_DBG_ENABLE_CHECKS || \ - CH_DBG_ENABLE_STACK_CHECK || CH_DBG_SYSTEM_STATE_CHECK -#define CH_DBG_ENABLED TRUE -#else -#define CH_DBG_ENABLED FALSE -#endif - /*===========================================================================*/ /* Module data structures and types. */ /*===========================================================================*/ @@ -129,8 +122,8 @@ typedef struct { /*===========================================================================*/ #if CH_DBG_SYSTEM_STATE_CHECK -#define _dbg_enter_lock() (ch.dbg_lock_cnt = 1) -#define _dbg_leave_lock() (ch.dbg_lock_cnt = 0) +#define _dbg_enter_lock() (ch.dbg.lock_cnt = 1) +#define _dbg_leave_lock() (ch.dbg.lock_cnt = 0) #endif /* When the state checker feature is disabled then the following functions @@ -221,7 +214,7 @@ extern "C" { void chDbgCheckClassS(void); #endif #if CH_DBG_ENABLE_TRACE || defined(__DOXYGEN__) - void _trace_init(void); + void _dbg_trace_init(void); void _dbg_trace(thread_t *otp); #endif #ifdef __cplusplus diff --git a/os/rt/include/chschd.h b/os/rt/include/chschd.h index 8a7a59aae..f2deb3b92 100644 --- a/os/rt/include/chschd.h +++ b/os/rt/include/chschd.h @@ -284,6 +284,36 @@ struct ch_ready_list { thread. */ }; +/** + * @brief System debug data structure. + */ +struct ch_system_debug { + /** + * @brief Pointer to the panic message. + * @details This pointer is meant to be accessed through the debugger, it is + * written once and then the system is halted. + * @note Accesses to this pointer must never be optimized out so the + * field itself is declared volatile. + */ + const char * volatile panic_msg; +#if CH_DBG_SYSTEM_STATE_CHECK || defined(__DOXYGEN__) + /** + * @brief ISR nesting level. + */ + cnt_t isr_cnt; + /** + * @brief Lock nesting level. + */ + cnt_t lock_cnt; +#endif +#if CH_DBG_ENABLE_TRACE || defined(__DOXYGEN__) + /** + * @brief Public trace buffer. + */ + ch_trace_buffer_t trace_buffer; +#endif +}; + /** * @brief System data structure. * @note This structure contain all the data areas used by the OS except @@ -298,11 +328,15 @@ struct ch_system { * @brief Virtual timers delta list header. */ virtual_timers_list_t vtlist; + /** + * @brief System debug. + */ + system_debug_t dbg; #if CH_CFG_USE_TM || defined(__DOXYGEN__) /** - * @brief Measurement calibration value. + * @brief Time measurement calibration data. */ - rtcnt_t measurement_offset; + tm_calibration_t tm; #endif #if CH_DBG_STATISTICS || defined(__DOXYGEN__) /** @@ -310,32 +344,6 @@ struct ch_system { */ kernel_stats_t kernel_stats; #endif -#if CH_DBG_ENABLED || defined(__DOXYGEN__) - /** - * @brief Pointer to the panic message. - * @details This pointer is meant to be accessed through the debugger, it is - * written once and then the system is halted. - * @note Accesses to this pointer must never be optimized out so the - * field itself is declared volatile. - */ - const char * volatile dbg_panic_msg; -#endif -#if CH_DBG_SYSTEM_STATE_CHECK || defined(__DOXYGEN__) - /** - * @brief ISR nesting level. - */ - cnt_t dbg_isr_cnt; - /** - * @brief Lock nesting level. - */ - cnt_t dbg_lock_cnt; -#endif -#if CH_DBG_ENABLE_TRACE || defined(__DOXYGEN__) - /** - * @brief Public trace buffer. - */ - ch_trace_buffer_t dbg_trace_buffer; -#endif }; /*===========================================================================*/ diff --git a/os/rt/include/chsystypes.h b/os/rt/include/chsystypes.h index 2a64488db..cf42b80bc 100644 --- a/os/rt/include/chsystypes.h +++ b/os/rt/include/chsystypes.h @@ -97,6 +97,11 @@ typedef struct ch_virtual_timer virtual_timer_t; */ typedef struct ch_virtual_timers_list virtual_timers_list_t; +/** + * @brief Type of a system debug structure. + */ +typedef struct ch_system_debug system_debug_t; + /** * @brief Type of system data structure. */ diff --git a/os/rt/include/chtm.h b/os/rt/include/chtm.h index 73850aad7..1bcd4b452 100644 --- a/os/rt/include/chtm.h +++ b/os/rt/include/chtm.h @@ -51,6 +51,16 @@ /* Module data structures and types. */ /*===========================================================================*/ +/** + * @brief Type of a time measurement calibration data. + */ +typedef struct { + /** + * @brief Measurement calibration value. + */ + rtcnt_t offset; +} tm_calibration_t; + /** * @brief Type of a Time Measurement object. * @note The maximum measurable time period depends on the implementation -- cgit v1.2.3