diff --git a/os/common/ports/ARM/compilers/GCC/chcoreasm.S b/os/common/ports/ARM/compilers/GCC/chcoreasm.S index 7d2782e9e..c5feeaf8f 100644 --- a/os/common/ports/ARM/compilers/GCC/chcoreasm.S +++ b/os/common/ports/ARM/compilers/GCC/chcoreasm.S @@ -39,16 +39,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/ARMv6-M-RP2/compilers/GCC/chcoreasm.S b/os/common/ports/ARMv6-M-RP2/compilers/GCC/chcoreasm.S index 45d3f420f..e8c908725 100644 --- a/os/common/ports/ARMv6-M-RP2/compilers/GCC/chcoreasm.S +++ b/os/common/ports/ARMv6-M-RP2/compilers/GCC/chcoreasm.S @@ -44,16 +44,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/ARMv6-M/compilers/GCC/chcoreasm.S b/os/common/ports/ARMv6-M/compilers/GCC/chcoreasm.S index a3c92b73d..29886d9c0 100644 --- a/os/common/ports/ARMv6-M/compilers/GCC/chcoreasm.S +++ b/os/common/ports/ARMv6-M/compilers/GCC/chcoreasm.S @@ -44,16 +44,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/ARMv6-M/compilers/IAR/chcoreasm.s b/os/common/ports/ARMv6-M/compilers/IAR/chcoreasm.s index 416a7a670..c238b6eb2 100644 --- a/os/common/ports/ARMv6-M/compilers/IAR/chcoreasm.s +++ b/os/common/ports/ARMv6-M/compilers/IAR/chcoreasm.s @@ -44,16 +44,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/ARMv6-M/compilers/RVCT/chcoreasm.s b/os/common/ports/ARMv6-M/compilers/RVCT/chcoreasm.s index d213fb514..5e501de20 100644 --- a/os/common/ports/ARMv6-M/compilers/RVCT/chcoreasm.s +++ b/os/common/ports/ARMv6-M/compilers/RVCT/chcoreasm.s @@ -44,16 +44,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/ARMv7-M/compilers/GCC/chcoreasm.S b/os/common/ports/ARMv7-M/compilers/GCC/chcoreasm.S index a642885da..9d668d491 100644 --- a/os/common/ports/ARMv7-M/compilers/GCC/chcoreasm.S +++ b/os/common/ports/ARMv7-M/compilers/GCC/chcoreasm.S @@ -44,16 +44,10 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 #endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/ARMv7-M/compilers/IAR/chcoreasm.s b/os/common/ports/ARMv7-M/compilers/IAR/chcoreasm.s index a4bf85c97..98f91e255 100644 --- a/os/common/ports/ARMv7-M/compilers/IAR/chcoreasm.s +++ b/os/common/ports/ARMv7-M/compilers/IAR/chcoreasm.s @@ -44,16 +44,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/ARMv7-M/compilers/RVCT/chcoreasm.s b/os/common/ports/ARMv7-M/compilers/RVCT/chcoreasm.s index 51e4df65a..e0479057a 100644 --- a/os/common/ports/ARMv7-M/compilers/RVCT/chcoreasm.s +++ b/os/common/ports/ARMv7-M/compilers/RVCT/chcoreasm.s @@ -44,16 +44,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/ARMv8-M-ML-TZ/compilers/GCC/chcoreasm.S b/os/common/ports/ARMv8-M-ML-TZ/compilers/GCC/chcoreasm.S index 603482989..b731217cd 100644 --- a/os/common/ports/ARMv8-M-ML-TZ/compilers/GCC/chcoreasm.S +++ b/os/common/ports/ARMv8-M-ML-TZ/compilers/GCC/chcoreasm.S @@ -44,13 +44,8 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else #define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) #define CURRENT_OFFSET 0 /* nil.current */ diff --git a/os/common/ports/ARMv8-M-ML/compilers/GCC/chcoreasm.S b/os/common/ports/ARMv8-M-ML/compilers/GCC/chcoreasm.S index 8efe75efd..6a1321af3 100644 --- a/os/common/ports/ARMv8-M-ML/compilers/GCC/chcoreasm.S +++ b/os/common/ports/ARMv8-M-ML/compilers/GCC/chcoreasm.S @@ -44,16 +44,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/SIMIA32/chcore.c b/os/common/ports/SIMIA32/chcore.c index 951cdcea6..f58e2c5fb 100644 --- a/os/common/ports/SIMIA32/chcore.c +++ b/os/common/ports/SIMIA32/chcore.c @@ -41,11 +41,7 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CONTEXT_OFFSET "20" -#else #define CONTEXT_OFFSET "12" -#endif #elif defined(_CHIBIOS_NIL_CONF_) #define CONTEXT_OFFSET "0" diff --git a/os/common/ports/e200/compilers/CW/chcoreasm.s b/os/common/ports/e200/compilers/CW/chcoreasm.s index a6e9f5698..011f05d2c 100644 --- a/os/common/ports/e200/compilers/CW/chcoreasm.s +++ b/os/common/ports/e200/compilers/CW/chcoreasm.s @@ -55,16 +55,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/e200/compilers/GCC/chcoreasm.S b/os/common/ports/e200/compilers/GCC/chcoreasm.S index f00119934..d27b3e5d1 100644 --- a/os/common/ports/e200/compilers/GCC/chcoreasm.S +++ b/os/common/ports/e200/compilers/GCC/chcoreasm.S @@ -56,16 +56,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/common/ports/e200/compilers/GHS/chcoreasm.s b/os/common/ports/e200/compilers/GHS/chcoreasm.s index 7883b83bd..fee2ff272 100644 --- a/os/common/ports/e200/compilers/GHS/chcoreasm.s +++ b/os/common/ports/e200/compilers/GHS/chcoreasm.s @@ -52,16 +52,9 @@ * RTOS-specific context offset. */ #if defined(_CHIBIOS_RT_CONF_) -#if CH_CFG_USE_REGISTRY -#define CURRENT_OFFSET 20 /* ch.rlist.current */ -#define CONTEXT_OFFSET 20 -#else -#define CURRENT_OFFSET 12 #define CONTEXT_OFFSET 12 -#endif #elif defined(_CHIBIOS_NIL_CONF_) -#define CURRENT_OFFSET 0 /* nil.current */ #define CONTEXT_OFFSET 0 #else diff --git a/os/rt/include/chobjects.h b/os/rt/include/chobjects.h index 3ec745c0e..94d436ffd 100644 --- a/os/rt/include/chobjects.h +++ b/os/rt/include/chobjects.h @@ -122,14 +122,13 @@ struct ch_thread { ch_priority_queue_t pqueue; /**< @brief Threads ordered queues element. */ } hdr; -#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__) - ch_queue_t rqueue; /**< @brief Registry queue element. */ -#endif - /* End of the fields shared with the ReadyList structure. */ /** * @brief Processor context. */ struct port_context ctx; +#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__) + ch_queue_t rqueue; /**< @brief Registry queue element. */ +#endif #if (CH_CFG_SMP_MODE != FALSE) || defined(__DOXYGEN__) /** * @brief OS instance owner of this thread. @@ -302,13 +301,6 @@ typedef struct ch_ready_list { * @note The priority field must be initialized to zero. */ ch_priority_queue_t pqueue; -#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__) - /** - * @brief Registry header. - */ - ch_queue_t registry; -#endif - /* End of the fields shared with the thread_t structure.*/ /** * @brief The currently running thread. */ @@ -358,6 +350,12 @@ struct ch_os_instance { * @brief Virtual timers delta list header. */ virtual_timers_list_t vtlist; +#if (CH_CFG_USE_REGISTRY == TRUE) || defined(__DOXYGEN__) + /** + * @brief Registry header. + */ + ch_queue_t reglist; +#endif /** * @brief Main thread descriptor. */ diff --git a/os/rt/include/chregistry.h b/os/rt/include/chregistry.h index 4e43e349d..a5c57efad 100644 --- a/os/rt/include/chregistry.h +++ b/os/rt/include/chregistry.h @@ -89,7 +89,7 @@ typedef struct { * @param[in] oip pointer to the OS instance * @param[in] tp thread to add to the registry */ -#define REG_INSERT(oip, tp) ch_queue_insert(&(tp)->rqueue, &(oip)->rlist.registry) +#define REG_INSERT(oip, tp) ch_queue_insert(&(tp)->rqueue, &(oip)->reglist) /*===========================================================================*/ /* External declarations. */ diff --git a/os/rt/src/chregistry.c b/os/rt/src/chregistry.c index 47af060c9..bf4ffc0fb 100644 --- a/os/rt/src/chregistry.c +++ b/os/rt/src/chregistry.c @@ -136,7 +136,7 @@ thread_t *chRegFirstThread(void) { uint8_t *p; chSysLock(); - p = (uint8_t *)currcore->rlist.registry.next; + p = (uint8_t *)currcore->reglist.next; tp = (thread_t *)(p - offsetof(thread_t, rqueue)); #if CH_CFG_USE_DYNAMIC == TRUE tp->refs++; @@ -165,7 +165,7 @@ thread_t *chRegNextThread(thread_t *tp) { /* Next element in the registry queue.*/ nqp = tp->rqueue.next; - if (nqp == &currcore->rlist.registry) { + if (nqp == &currcore->reglist) { ntp = NULL; } #if CH_CFG_USE_DYNAMIC == TRUE diff --git a/os/rt/src/chschd.c b/os/rt/src/chschd.c index 4590d5327..665618917 100644 --- a/os/rt/src/chschd.c +++ b/os/rt/src/chschd.c @@ -319,7 +319,7 @@ void chSchObjectInit(os_instance_t *oip, /* Registry initialization.*/ #if CH_CFG_USE_REGISTRY == TRUE - ch_queue_init(&oip->rlist.registry); + ch_queue_init(&oip->reglist); #endif /* Virtual timers list initialization.*/ diff --git a/os/rt/src/chsys.c b/os/rt/src/chsys.c index 8a20e2269..944f78884 100644 --- a/os/rt/src/chsys.c +++ b/os/rt/src/chsys.c @@ -248,15 +248,15 @@ bool chSysIntegrityCheckI(unsigned testmask) { /* Scanning the ready list forward.*/ n = (cnt_t)0; - qp = oip->rlist.registry.next; - while (qp != &oip->rlist.registry) { + qp = oip->reglist.next; + while (qp != &oip->reglist) { n++; qp = qp->next; } /* Scanning the ready list backward.*/ - qp = oip->rlist.registry.prev; - while (qp != &oip->rlist.registry) { + qp = oip->reglist.prev; + while (qp != &oip->reglist) { n--; qp = qp->prev; }