From ca20fd81f6f5cba290763cf08243f582841cf770 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 2 Feb 2010 21:27:53 +0000 Subject: Forgot files... git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1560 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 os/kernel/src/chregistry.c (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c new file mode 100644 index 000000000..186d97e35 --- /dev/null +++ b/os/kernel/src/chregistry.c @@ -0,0 +1,77 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file chregistry.c + * @brief Threads registry code. + * @addtogroup registry + * @{ + */ +#include "ch.h" + +#if CH_USE_REGISTRY + +/** + * @brief Returns the first thread in the system. + * @details Returns the most ancient thread in the system, usually this is + * the main thread unless it terminated. + * @note A reference is added to the returned thread in order to make sure + * it status is not lost. + * + * @return A reference to the first thread. + */ +Thread *chRegFirstThread(void) { + Thread *tp; + + chSysLock(); + (tp = rlist.p_newer)->p_refs++; + chSysUnlock(); + return tp; +} + +/** + * @brief Returns the thread next to the specified one. + * @details The reference counter of the specified thread is decremented and + * the reference counter of the returned thread is incremented. + * + * @param[in] tp pointer to the thread + * @return A reference to the next thread. + * @retval NULL if there is no next thread. + */ +Thread *chRegNextThread(Thread *tp) { + + chSysLock(); + chDbgAssert(tp->p_refs > 0, "chRegNextThread(), #1", + "not referenced"); + tp->p_refs--; + if (tp->p_newer != (Thread *)&rlist) { + tp = tp->p_newer; + chDbgAssert(tp->p_refs < 255, "chRegNextThread(), #2", + "too many references"); + tp->p_refs++; + } + else + tp = NULL; + chSysUnlock(); + return tp; +} + +#endif /* CH_USE_REGISTRY */ + +/** @} */ -- cgit v1.2.3 From 217d1529c1a126054fbdb9e071cd103194fd499e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Feb 2010 18:40:10 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1564 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 186d97e35..b02d5f1fb 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -33,6 +33,8 @@ * the main thread unless it terminated. * @note A reference is added to the returned thread in order to make sure * it status is not lost. + * @note This function cannot return @p NULL because there is always at + * least one thread in the system. * * @return A reference to the first thread. */ -- cgit v1.2.3 From f17db1931e95f5ebb42f557b6eead2bf1320db5a Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 6 Feb 2010 10:55:53 +0000 Subject: Reformatted doxygen tags into the kernel sources to make them more readable. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1567 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index b02d5f1fb..05573acbf 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -18,8 +18,9 @@ */ /** - * @file chregistry.c - * @brief Threads registry code. + * @file chregistry.c + * @brief Threads registry code. + * * @addtogroup registry * @{ */ @@ -36,7 +37,7 @@ * @note This function cannot return @p NULL because there is always at * least one thread in the system. * - * @return A reference to the first thread. + * @return A reference to the first thread. */ Thread *chRegFirstThread(void) { Thread *tp; @@ -52,9 +53,9 @@ Thread *chRegFirstThread(void) { * @details The reference counter of the specified thread is decremented and * the reference counter of the returned thread is incremented. * - * @param[in] tp pointer to the thread - * @return A reference to the next thread. - * @retval NULL if there is no next thread. + * @param[in] tp pointer to the thread + * @return A reference to the next thread. + * @retval NULL if there is no next thread. */ Thread *chRegNextThread(Thread *tp) { -- cgit v1.2.3 From 4d832fdf1c1ca932d16198df7b3c04dcd083e7e2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 12 Feb 2010 18:51:48 +0000 Subject: Few fixes to the new code after the batch build test. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1592 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 05573acbf..b6555df40 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -43,7 +43,10 @@ Thread *chRegFirstThread(void) { Thread *tp; chSysLock(); - (tp = rlist.p_newer)->p_refs++; + tp = rlist.p_newer; +#if CH_USE_DYNAMIC + tp->p_refs++; +#endif chSysUnlock(); return tp; } @@ -60,14 +63,18 @@ Thread *chRegFirstThread(void) { Thread *chRegNextThread(Thread *tp) { chSysLock(); +#if CH_USE_DYNAMIC chDbgAssert(tp->p_refs > 0, "chRegNextThread(), #1", "not referenced"); tp->p_refs--; +#endif if (tp->p_newer != (Thread *)&rlist) { tp = tp->p_newer; +#if CH_USE_DYNAMIC chDbgAssert(tp->p_refs < 255, "chRegNextThread(), #2", "too many references"); tp->p_refs++; +#endif } else tp = NULL; -- cgit v1.2.3 From 157b6f9695e7f72f2d54b231c19cb4045710ed01 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Feb 2010 07:24:53 +0000 Subject: Updated license dates. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1646 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index b6555df40..8d4ffa4e8 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -1,5 +1,5 @@ /* - ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. This file is part of ChibiOS/RT. @@ -37,7 +37,7 @@ * @note This function cannot return @p NULL because there is always at * least one thread in the system. * - * @return A reference to the first thread. + * @return A reference to the first thread. */ Thread *chRegFirstThread(void) { Thread *tp; @@ -55,7 +55,7 @@ Thread *chRegFirstThread(void) { * @brief Returns the thread next to the specified one. * @details The reference counter of the specified thread is decremented and * the reference counter of the returned thread is incremented. - * + * * @param[in] tp pointer to the thread * @return A reference to the next thread. * @retval NULL if there is no next thread. -- cgit v1.2.3 From ad3d21e81592481539a56e93234f5bf1fa2c0504 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 16 Mar 2010 19:36:21 +0000 Subject: Documentation reorganization. Moved the description from kernel.dox into the source code for ease of editing and reference. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1746 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 8d4ffa4e8..4dca52534 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -22,6 +22,9 @@ * @brief Threads registry code. * * @addtogroup registry + * @details Threads Registry related APIs and services.
+ * In order to use the threads registry the @p CH_USE_REGISTRY option + * must be enabled in @p chconf.h. * @{ */ #include "ch.h" -- cgit v1.2.3 From 392c2fe70d224c4f564ebab5dcd3f0d607a546f0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 17 Mar 2010 13:04:42 +0000 Subject: Fixed bug 2971878 . git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1747 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 4dca52534..5ed8ace2e 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -23,6 +23,16 @@ * * @addtogroup registry * @details Threads Registry related APIs and services.
+ * The threads Threads Registry is a double linked list that holds + * all the active threads in the system.
+ * The registry is meant to be mainly a debug feature, as example + * through the registry a debugger can enumerate the active threads + * in any given moment or the shell can print the active threads and + * their state.
+ * Another possible use is for centralized threads memory management, + * terminating threads can pulse an event source and an event handler + * can perform a scansion of the registry in order to recover the + * memory.
* In order to use the threads registry the @p CH_USE_REGISTRY option * must be enabled in @p chconf.h. * @{ @@ -64,25 +74,24 @@ Thread *chRegFirstThread(void) { * @retval NULL if there is no next thread. */ Thread *chRegNextThread(Thread *tp) { + Thread *ntp; chSysLock(); + ntp = tp->p_newer; + if (ntp == (Thread *)&rlist) + ntp = NULL; #if CH_USE_DYNAMIC - chDbgAssert(tp->p_refs > 0, "chRegNextThread(), #1", - "not referenced"); - tp->p_refs--; -#endif - if (tp->p_newer != (Thread *)&rlist) { - tp = tp->p_newer; -#if CH_USE_DYNAMIC - chDbgAssert(tp->p_refs < 255, "chRegNextThread(), #2", + else { + chDbgAssert(ntp->p_refs < 255, "chRegNextThread(), #1", "too many references"); - tp->p_refs++; -#endif + ntp->p_refs++; } - else - tp = NULL; +#endif chSysUnlock(); - return tp; +#if CH_USE_DYNAMIC + chThdRelease(tp); +#endif + return ntp; } #endif /* CH_USE_REGISTRY */ -- cgit v1.2.3 From 7ae3e3227ee895c3ed5ac3358411b07276c7838e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 17 Mar 2010 16:24:43 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1748 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 5ed8ace2e..ad5cd7fc1 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -22,13 +22,21 @@ * @brief Threads registry code. * * @addtogroup registry - * @details Threads Registry related APIs and services.
- * The threads Threads Registry is a double linked list that holds - * all the active threads in the system.
- * The registry is meant to be mainly a debug feature, as example - * through the registry a debugger can enumerate the active threads - * in any given moment or the shell can print the active threads and - * their state.
+ * @details Threads Registry related APIs and services. + * + *

Operation mode

+ * The Threads Registry is a double linked list that holds all the + * active threads in the system.
+ * Operations defined for the registry: + * - First, returns the first, in creation order, active thread + * in the system. + * - Next, returns the next, in creation order, active thread + * in the system. + * . + * The registry is meant to be mainly a debug feature, as example, + * using the registry a debugger can enumerate the active threads + * in any given moment or the shell can print the active threads + * and their state.
* Another possible use is for centralized threads memory management, * terminating threads can pulse an event source and an event handler * can perform a scansion of the registry in order to recover the -- cgit v1.2.3 From b61fb43e6cc681f9fc53a5efb116accc13e0d35d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Mar 2010 15:45:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1756 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index ad5cd7fc1..c561d8ca6 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -64,7 +64,7 @@ Thread *chRegFirstThread(void) { Thread *tp; chSysLock(); - tp = rlist.p_newer; + tp = rlist.r_newer; #if CH_USE_DYNAMIC tp->p_refs++; #endif -- cgit v1.2.3 From 9ffea7e261ec4016d788abbbf7c4a6d3a78e0a04 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 18 Sep 2010 06:48:56 +0000 Subject: Documentation improvements, renamed some event APIs. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2179 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index c561d8ca6..216758c85 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -40,25 +40,24 @@ * Another possible use is for centralized threads memory management, * terminating threads can pulse an event source and an event handler * can perform a scansion of the registry in order to recover the - * memory.
- * In order to use the threads registry the @p CH_USE_REGISTRY option + * memory. + * @pre In order to use the threads registry the @p CH_USE_REGISTRY option * must be enabled in @p chconf.h. * @{ */ #include "ch.h" -#if CH_USE_REGISTRY +#if CH_USE_REGISTRY || defined(__DOXYGEN__) /** * @brief Returns the first thread in the system. * @details Returns the most ancient thread in the system, usually this is - * the main thread unless it terminated. - * @note A reference is added to the returned thread in order to make sure - * it status is not lost. + * the main thread unless it terminated. A reference is added to the + * returned thread in order to make sure its status is not lost. * @note This function cannot return @p NULL because there is always at * least one thread in the system. * - * @return A reference to the first thread. + * @return A reference to the most ancient thread. */ Thread *chRegFirstThread(void) { Thread *tp; -- cgit v1.2.3 From 07351222e6d0b6b3dcd4f50ecb18bc09e7402d1c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 21 Sep 2010 10:22:06 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2184 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 216758c85..95893de85 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -58,6 +58,8 @@ * least one thread in the system. * * @return A reference to the most ancient thread. + * + * @api */ Thread *chRegFirstThread(void) { Thread *tp; @@ -79,6 +81,8 @@ Thread *chRegFirstThread(void) { * @param[in] tp pointer to the thread * @return A reference to the next thread. * @retval NULL if there is no next thread. + * + * @api */ Thread *chRegNextThread(Thread *tp) { Thread *ntp; -- cgit v1.2.3 From 009e8d28c38ef6b6797318aee29ca90910753988 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 11 Nov 2010 11:04:05 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2346 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 95893de85..e95ad21a8 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -33,7 +33,7 @@ * - Next, returns the next, in creation order, active thread * in the system. * . - * The registry is meant to be mainly a debug feature, as example, + * The registry is meant to be mainly a debug feature, for example, * using the registry a debugger can enumerate the active threads * in any given moment or the shell can print the active threads * and their state.
-- cgit v1.2.3 From e7e79a6ccb4f3e320b2b8b7bad1b14d65218641d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 18 Mar 2011 18:38:08 +0000 Subject: License updated. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2827 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index e95ad21a8..9eabe71c0 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -1,5 +1,6 @@ /* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 From de5dcbba856524599a8f06d3a9bdbf1b01db44c2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 21 Jan 2012 14:29:42 +0000 Subject: License text updated with new year. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3846 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 9eabe71c0..52c180a3a 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011 Giovanni Di Sirio. + 2011,2012 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3 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/src/chregistry.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'os/kernel/src/chregistry.c') 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 From d51331c78ad8c4c5ad4769d6271cb0e06c11beb1 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 22 Aug 2012 15:11:04 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4614 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 57 +++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 5036a52bc..4a383a379 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -50,34 +50,11 @@ #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 +#define THD_OFFSET(field) (uint8_t)((size_t)&_mainthread.field - \ + (size_t)&_mainthread) -/** - * @brief OS signature in ROM plus debug-related information. +/* + * OS signature in ROM plus debug-related information. */ ROMCONST chroot_t ch_root = { "CHRT", @@ -87,12 +64,30 @@ ROMCONST chroot_t ch_root = { (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)sizeof (systime_t), + THD_OFFSET(p_prio), + THD_OFFSET(p_ctx), + THD_OFFSET(p_newer), + THD_OFFSET(p_older), + THD_OFFSET(p_name), +#if CH_DBG_ENABLE_STACK_CHECK + THD_OFFSET(p_stklimit), +#else (uint8_t)0, +#endif + THD_OFFSET(p_state), + THD_OFFSET(p_flags), +#if CH_USE_DYNAMIC + THD_OFFSET(p_refs), +#else + (uint8_t)0, +#endif +#if CH_TIME_QUANTUM > 0 + THD_OFFSET(p_preempt), +#else (uint8_t)0, - &rlist, - &vtlist +#endif + THD_OFFSET(p_time) }; /** -- cgit v1.2.3 From 03cba7d3085ad61c55902c790099c691938eee55 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 22 Aug 2012 16:33:49 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4615 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 4a383a379..2e63a13f6 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -50,8 +50,8 @@ #if CH_USE_REGISTRY || defined(__DOXYGEN__) -#define THD_OFFSET(field) (uint8_t)((size_t)&_mainthread.field - \ - (size_t)&_mainthread) +#define offsetof(st, m) \ + ((size_t)((char *)&((st *)0)->m - (char *)0)) /* * OS signature in ROM plus debug-related information. @@ -65,29 +65,30 @@ ROMCONST chroot_t ch_root = { (CH_KERNEL_PATCH) << 0), (uint8_t)sizeof (void *), (uint8_t)sizeof (systime_t), - THD_OFFSET(p_prio), - THD_OFFSET(p_ctx), - THD_OFFSET(p_newer), - THD_OFFSET(p_older), - THD_OFFSET(p_name), + (uint8_t)sizeof (Thread), + (uint8_t)offsetof(Thread, p_prio), + (uint8_t)offsetof(Thread, p_ctx), + (uint8_t)offsetof(Thread, p_newer), + (uint8_t)offsetof(Thread, p_older), + (uint8_t)offsetof(Thread, p_name), #if CH_DBG_ENABLE_STACK_CHECK - THD_OFFSET(p_stklimit), + (uint8_t)offsetof(Thread, p_stklimit), #else (uint8_t)0, #endif - THD_OFFSET(p_state), - THD_OFFSET(p_flags), + (uint8_t)offsetof(Thread, p_state), + (uint8_t)offsetof(Thread, p_flags), #if CH_USE_DYNAMIC - THD_OFFSET(p_refs), + (uint8_t)offsetof(Thread, p_refs), #else (uint8_t)0, #endif #if CH_TIME_QUANTUM > 0 - THD_OFFSET(p_preempt), + (uint8_t)offsetof(Thread, p_preempt), #else (uint8_t)0, #endif - THD_OFFSET(p_time) + (uint8_t)offsetof(Thread, p_time) }; /** -- cgit v1.2.3 From f200dd71c5c0909a1b0a89e55082b4b9935a06d6 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 22 Aug 2012 16:36:18 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4616 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 2e63a13f6..971133457 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -50,7 +50,7 @@ #if CH_USE_REGISTRY || defined(__DOXYGEN__) -#define offsetof(st, m) \ +#define _offsetof(st, m) \ ((size_t)((char *)&((st *)0)->m - (char *)0)) /* @@ -66,29 +66,29 @@ ROMCONST chroot_t ch_root = { (uint8_t)sizeof (void *), (uint8_t)sizeof (systime_t), (uint8_t)sizeof (Thread), - (uint8_t)offsetof(Thread, p_prio), - (uint8_t)offsetof(Thread, p_ctx), - (uint8_t)offsetof(Thread, p_newer), - (uint8_t)offsetof(Thread, p_older), - (uint8_t)offsetof(Thread, p_name), + (uint8_t)_offsetof(Thread, p_prio), + (uint8_t)_offsetof(Thread, p_ctx), + (uint8_t)_offsetof(Thread, p_newer), + (uint8_t)_offsetof(Thread, p_older), + (uint8_t)_offsetof(Thread, p_name), #if CH_DBG_ENABLE_STACK_CHECK - (uint8_t)offsetof(Thread, p_stklimit), + (uint8_t)_offsetof(Thread, p_stklimit), #else (uint8_t)0, #endif - (uint8_t)offsetof(Thread, p_state), - (uint8_t)offsetof(Thread, p_flags), + (uint8_t)_offsetof(Thread, p_state), + (uint8_t)_offsetof(Thread, p_flags), #if CH_USE_DYNAMIC - (uint8_t)offsetof(Thread, p_refs), + (uint8_t)_offsetof(Thread, p_refs), #else (uint8_t)0, #endif #if CH_TIME_QUANTUM > 0 - (uint8_t)offsetof(Thread, p_preempt), + (uint8_t)_offsetof(Thread, p_preempt), #else (uint8_t)0, #endif - (uint8_t)offsetof(Thread, p_time) + (uint8_t)_offsetof(Thread, p_time) }; /** -- cgit v1.2.3 From c17f03701a8d102888ce06752c3b53fc9bd2ddac Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Oct 2012 13:52:13 +0000 Subject: Added GC persistence to the ch_debug object (ex ch_root). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4732 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 971133457..976e3a51a 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -56,9 +56,9 @@ /* * OS signature in ROM plus debug-related information. */ -ROMCONST chroot_t ch_root = { +volatile ROMCONST chdebug_t ch_debug = { "CHRT", - (uint8_t)sizeof (chroot_t), + (uint8_t)sizeof (chdebug_t), (uint8_t)0, (uint16_t)((CH_KERNEL_MAJOR << 11) | (CH_KERNEL_MINOR << 6) | -- cgit v1.2.3 From 6d1ecacaf4a001fea2af72ec3682ace59f45adb8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 3 Oct 2012 19:35:13 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4733 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 976e3a51a..8b9f40f85 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -56,10 +56,10 @@ /* * OS signature in ROM plus debug-related information. */ -volatile ROMCONST chdebug_t ch_debug = { - "CHRT", - (uint8_t)sizeof (chdebug_t), +ROMCONST chdebug_t ch_debug = { + "main", (uint8_t)0, + (uint8_t)sizeof (chdebug_t), (uint16_t)((CH_KERNEL_MAJOR << 11) | (CH_KERNEL_MINOR << 6) | (CH_KERNEL_PATCH) << 0), -- cgit v1.2.3 From 9e120509c1647811681472008ed7668ef17283ce Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 13 Oct 2012 11:05:55 +0000 Subject: Fixed bug 3576776. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4759 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 8b9f40f85..5a28ac2fb 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -88,7 +88,11 @@ ROMCONST chdebug_t ch_debug = { #else (uint8_t)0, #endif +#if CH_DBG_THREADS_PROFILING (uint8_t)_offsetof(Thread, p_time) +#else + (uint8_t)0 +#endif }; /** -- cgit v1.2.3 From 184a71345c6a36a9a8664eda8fbcc3ea728267a8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 2 Feb 2013 10:58:09 +0000 Subject: Updated license years. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5102 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 5a28ac2fb..645172833 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -1,6 +1,6 @@ /* ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012 Giovanni Di Sirio. + 2011,2012,2013 Giovanni Di Sirio. This file is part of ChibiOS/RT. -- cgit v1.2.3