From 4bdf358424068f452a4d5a450e6001a03ca4f819 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 22 Aug 2012 14:23:02 +0000 Subject: Added mem git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4613 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/include/chregistry.h | 17 ++++++++++++++++ os/kernel/src/chregistry.c | 45 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'os') diff --git a/os/kernel/include/chregistry.h b/os/kernel/include/chregistry.h index ad1bdf207..2b1d35795 100644 --- a/os/kernel/include/chregistry.h +++ b/os/kernel/include/chregistry.h @@ -30,6 +30,23 @@ #define _CHREGISTRY_H_ #if CH_USE_REGISTRY || defined(__DOXYGEN__) + +/** + * @brief ChibiOS/RT memory signature record. + */ +typedef struct { + char ch_identifier[4]; /**< @brief Always set to "CHRT". */ + uint8_t ch_size; /**< @brief Size of this structure. */ + uint8_t ch_reserved5; /**< @brief Reserved field. */ + uint16_t ch_version; /**< @brief Encoded ChibiOS/RT version. */ + uint8_t ch_ptrsize; /**< @brief Size of a pointer. */ + uint8_t ch_options; /**< @brief Enable options bits mask. */ + uint8_t ch_reserved10; /**< @brief Reserved field. */ + uint8_t ch_reserved11; /**< @brief Reserved field. */ + ReadyList *ch_rlist; /**< @brief Pointer to the ready list. */ + VTList *ch_vtlist; /**< @brief Pointer to the timers list. */ +} chroot_t; + /** * @name Macro Functions * @{ diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 52c180a3a..5036a52bc 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -50,6 +50,51 @@ #if CH_USE_REGISTRY || defined(__DOXYGEN__) +/* Converting configuration options in bit masks in order to be encoded in + the global variable ch_root.*/ +#if CH_DBG_ENABLE_STACK_CHECK +#define MSK_DBG_ENABLE_STACK_CHECK 1 +#else +#define MSK_DBG_ENABLE_STACK_CHECK 0 +#endif + +#if CH_USE_DYNAMIC +#define MSK_USE_DYNAMIC 2 +#else +#define MSK_USE_DYNAMIC 0 +#endif + +#if CH_TIME_QUANTUM > 0 +#define MSK_TIME_QUANTUM 4 +#else +#define MSK_TIME_QUANTUM 0 +#endif + +#if CH_DBG_THREADS_PROFILING +#define MSK_DBG_THREADS_PROFILING 8 +#else +#define MSK_DBG_THREADS_PROFILING 0 +#endif + +/** + * @brief OS signature in ROM plus debug-related information. + */ +ROMCONST chroot_t ch_root = { + "CHRT", + (uint8_t)sizeof (chroot_t), + (uint8_t)0, + (uint16_t)((CH_KERNEL_MAJOR << 11) | + (CH_KERNEL_MINOR << 6) | + (CH_KERNEL_PATCH) << 0), + (uint8_t)sizeof (void *), + (uint8_t)(MSK_DBG_THREADS_PROFILING | MSK_TIME_QUANTUM | + MSK_USE_DYNAMIC | MSK_DBG_ENABLE_STACK_CHECK), + (uint8_t)0, + (uint8_t)0, + &rlist, + &vtlist +}; + /** * @brief Returns the first thread in the system. * @details Returns the most ancient thread in the system, usually this is -- cgit v1.2.3