From 84e044f176cee7c6946b24c36c90f63534b5b369 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Jul 2013 12:22:31 +0000 Subject: Renamed Thread to thread_t. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@5995 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 645172833..d567393c1 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -65,31 +65,31 @@ ROMCONST chdebug_t ch_debug = { (CH_KERNEL_PATCH) << 0), (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)sizeof (thread_t), + (uint8_t)_offsetof(thread_t, p_prio), + (uint8_t)_offsetof(thread_t, p_ctx), + (uint8_t)_offsetof(thread_t, p_newer), + (uint8_t)_offsetof(thread_t, p_older), + (uint8_t)_offsetof(thread_t, p_name), #if CH_DBG_ENABLE_STACK_CHECK - (uint8_t)_offsetof(Thread, p_stklimit), + (uint8_t)_offsetof(thread_t, p_stklimit), #else (uint8_t)0, #endif - (uint8_t)_offsetof(Thread, p_state), - (uint8_t)_offsetof(Thread, p_flags), + (uint8_t)_offsetof(thread_t, p_state), + (uint8_t)_offsetof(thread_t, p_flags), #if CH_USE_DYNAMIC - (uint8_t)_offsetof(Thread, p_refs), + (uint8_t)_offsetof(thread_t, p_refs), #else (uint8_t)0, #endif #if CH_TIME_QUANTUM > 0 - (uint8_t)_offsetof(Thread, p_preempt), + (uint8_t)_offsetof(thread_t, p_preempt), #else (uint8_t)0, #endif #if CH_DBG_THREADS_PROFILING - (uint8_t)_offsetof(Thread, p_time) + (uint8_t)_offsetof(thread_t, p_time) #else (uint8_t)0 #endif @@ -107,8 +107,8 @@ ROMCONST chdebug_t ch_debug = { * * @api */ -Thread *chRegFirstThread(void) { - Thread *tp; +thread_t *chRegFirstThread(void) { + thread_t *tp; chSysLock(); tp = rlist.r_newer; @@ -130,12 +130,12 @@ Thread *chRegFirstThread(void) { * * @api */ -Thread *chRegNextThread(Thread *tp) { - Thread *ntp; +thread_t *chRegNextThread(thread_t *tp) { + thread_t *ntp; chSysLock(); ntp = tp->p_newer; - if (ntp == (Thread *)&rlist) + if (ntp == (thread_t *)&rlist) ntp = NULL; #if CH_USE_DYNAMIC else { -- cgit v1.2.3 From 25ddb1c801f06a3be7171e20dcfd46d11a75f112 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 19 Jul 2013 14:51:35 +0000 Subject: First cleanup pass finished, queues and streams not yet removed. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@5999 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index d567393c1..832ef0ce9 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -50,9 +50,29 @@ #if CH_USE_REGISTRY || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Module exported variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module local types. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module local variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Module local functions. */ +/*===========================================================================*/ + #define _offsetof(st, m) \ ((size_t)((char *)&((st *)0)->m - (char *)0)) +/*===========================================================================*/ +/* Module exported functions. */ +/*===========================================================================*/ + /* * OS signature in ROM plus debug-related information. */ -- cgit v1.2.3 From 49d71a01abeefa000a4cd7a556052d826b096d49 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 20 Jul 2013 10:12:44 +0000 Subject: Renamed or added prefix to all hernel configuration options. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6010 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index 832ef0ce9..b43341edd 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -42,13 +42,13 @@ * terminating threads can pulse an event source and an event handler * can perform a scansion of the registry in order to recover the * memory. - * @pre In order to use the threads registry the @p CH_USE_REGISTRY option + * @pre In order to use the threads registry the @p CH_CFG_USE_REGISTRY option * must be enabled in @p chconf.h. * @{ */ #include "ch.h" -#if CH_USE_REGISTRY || defined(__DOXYGEN__) +#if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__) /*===========================================================================*/ /* Module exported variables. */ @@ -98,12 +98,12 @@ ROMCONST chdebug_t ch_debug = { #endif (uint8_t)_offsetof(thread_t, p_state), (uint8_t)_offsetof(thread_t, p_flags), -#if CH_USE_DYNAMIC +#if CH_CFG_USE_DYNAMIC (uint8_t)_offsetof(thread_t, p_refs), #else (uint8_t)0, #endif -#if CH_TIME_QUANTUM > 0 +#if CH_CFG_TIME_QUANTUM > 0 (uint8_t)_offsetof(thread_t, p_preempt), #else (uint8_t)0, @@ -132,7 +132,7 @@ thread_t *chRegFirstThread(void) { chSysLock(); tp = rlist.r_newer; -#if CH_USE_DYNAMIC +#if CH_CFG_USE_DYNAMIC tp->p_refs++; #endif chSysUnlock(); @@ -157,7 +157,7 @@ thread_t *chRegNextThread(thread_t *tp) { ntp = tp->p_newer; if (ntp == (thread_t *)&rlist) ntp = NULL; -#if CH_USE_DYNAMIC +#if CH_CFG_USE_DYNAMIC else { chDbgAssert(ntp->p_refs < 255, "chRegNextThread(), #1", "too many references"); @@ -165,12 +165,12 @@ thread_t *chRegNextThread(thread_t *tp) { } #endif chSysUnlock(); -#if CH_USE_DYNAMIC +#if CH_CFG_USE_DYNAMIC chThdRelease(tp); #endif return ntp; } -#endif /* CH_USE_REGISTRY */ +#endif /* CH_CFG_USE_REGISTRY */ /** @} */ -- cgit v1.2.3 From c3dc5598c315f4650bfcd1e595104a2ace7aa87c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Aug 2013 08:07:43 +0000 Subject: Global variables consolidation. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6116 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index b43341edd..b0d241fee 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -42,8 +42,8 @@ * terminating threads can pulse an event source and an event handler * can perform a scansion of the registry in order to recover the * memory. - * @pre In order to use the threads registry the @p CH_CFG_USE_REGISTRY option - * must be enabled in @p chconf.h. + * @pre In order to use the threads registry the @p CH_CFG_USE_REGISTRY + * option must be enabled in @p chconf.h. * @{ */ #include "ch.h" @@ -66,7 +66,7 @@ /* Module local functions. */ /*===========================================================================*/ -#define _offsetof(st, m) \ +#define _offsetof(st, m) \ ((size_t)((char *)&((st *)0)->m - (char *)0)) /*===========================================================================*/ @@ -131,7 +131,7 @@ thread_t *chRegFirstThread(void) { thread_t *tp; chSysLock(); - tp = rlist.r_newer; + tp = ch.rlist.r_newer; #if CH_CFG_USE_DYNAMIC tp->p_refs++; #endif @@ -155,7 +155,7 @@ thread_t *chRegNextThread(thread_t *tp) { chSysLock(); ntp = tp->p_newer; - if (ntp == (thread_t *)&rlist) + if (ntp == (thread_t *)&ch.rlist) ntp = NULL; #if CH_CFG_USE_DYNAMIC else { -- cgit v1.2.3 From eb7a1a15b23341693864c6fc13ac5eab5c1d6122 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Aug 2013 14:50:32 +0000 Subject: Removed 2nd parameter to assertion and check macros. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6122 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'os/kernel/src/chregistry.c') diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index b0d241fee..685d0c109 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -159,8 +159,7 @@ thread_t *chRegNextThread(thread_t *tp) { ntp = NULL; #if CH_CFG_USE_DYNAMIC else { - chDbgAssert(ntp->p_refs < 255, "chRegNextThread(), #1", - "too many references"); + chDbgAssert(ntp->p_refs < 255, "too many references"); ntp->p_refs++; } #endif -- cgit v1.2.3 From a1435e018bfc9919cb76b1356509ecc883767fb4 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 10 Aug 2013 14:51:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6123 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/kernel/src/chregistry.c | 175 --------------------------------------------- 1 file changed, 175 deletions(-) delete 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 deleted file mode 100644 index 685d0c109..000000000 --- a/os/kernel/src/chregistry.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, - 2011,2012,2013 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 - * @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, 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.
- * 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. - * @pre In order to use the threads registry the @p CH_CFG_USE_REGISTRY - * option must be enabled in @p chconf.h. - * @{ - */ -#include "ch.h" - -#if CH_CFG_USE_REGISTRY || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Module exported variables. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Module local types. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Module local variables. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Module local functions. */ -/*===========================================================================*/ - -#define _offsetof(st, m) \ - ((size_t)((char *)&((st *)0)->m - (char *)0)) - -/*===========================================================================*/ -/* Module exported functions. */ -/*===========================================================================*/ - -/* - * OS signature in ROM plus debug-related information. - */ -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), - (uint8_t)sizeof (void *), - (uint8_t)sizeof (systime_t), - (uint8_t)sizeof (thread_t), - (uint8_t)_offsetof(thread_t, p_prio), - (uint8_t)_offsetof(thread_t, p_ctx), - (uint8_t)_offsetof(thread_t, p_newer), - (uint8_t)_offsetof(thread_t, p_older), - (uint8_t)_offsetof(thread_t, p_name), -#if CH_DBG_ENABLE_STACK_CHECK - (uint8_t)_offsetof(thread_t, p_stklimit), -#else - (uint8_t)0, -#endif - (uint8_t)_offsetof(thread_t, p_state), - (uint8_t)_offsetof(thread_t, p_flags), -#if CH_CFG_USE_DYNAMIC - (uint8_t)_offsetof(thread_t, p_refs), -#else - (uint8_t)0, -#endif -#if CH_CFG_TIME_QUANTUM > 0 - (uint8_t)_offsetof(thread_t, p_preempt), -#else - (uint8_t)0, -#endif -#if CH_DBG_THREADS_PROFILING - (uint8_t)_offsetof(thread_t, p_time) -#else - (uint8_t)0 -#endif -}; - -/** - * @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. 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 most ancient thread. - * - * @api - */ -thread_t *chRegFirstThread(void) { - thread_t *tp; - - chSysLock(); - tp = ch.rlist.r_newer; -#if CH_CFG_USE_DYNAMIC - tp->p_refs++; -#endif - 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. - * - * @api - */ -thread_t *chRegNextThread(thread_t *tp) { - thread_t *ntp; - - chSysLock(); - ntp = tp->p_newer; - if (ntp == (thread_t *)&ch.rlist) - ntp = NULL; -#if CH_CFG_USE_DYNAMIC - else { - chDbgAssert(ntp->p_refs < 255, "too many references"); - ntp->p_refs++; - } -#endif - chSysUnlock(); -#if CH_CFG_USE_DYNAMIC - chThdRelease(tp); -#endif - return ntp; -} - -#endif /* CH_CFG_USE_REGISTRY */ - -/** @} */ -- cgit v1.2.3