Architecture-related improvements.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14234 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-04-19 12:38:45 +00:00
parent df5405f7cf
commit 09945f4cc8
5 changed files with 51 additions and 21 deletions

View File

@ -78,42 +78,50 @@
* + {static} chSchGoSleepS()
* + {static} chSchGoSleepTimeoutS()
* }
* class tm_calibration_t {
* # __tm_calibration_init()
* }
* class system_debug_t {
* # __dbg_object_init()
* }
* class trace_buffer_t {
* }
* class tm_calibration_t {
* # __trace_init()
* }
* class kernel_stats_t {
* # __stats_object_init()
* }
* class ch_system_t <<(S,#FF7700) Singleton>> {
* class registry_t {
* - queue : ch_queue_t
* + chRegObjectInit()
* + {static} chRegFirstThread()
* + {static} chRegNextThread()
* + {static} chRegFindThreadByName()
* + {static} chRegFindThreadByPointer()
* + {static} chRegFindThreadByWorkingArea()
* }
* class ch_system_t {
* + state : ch_system_state_t
* # reglist : registry_t
* # tmc : tm_calibration_t
* # instances[] : os_instance_t *
* }
* class os_instance_t {
* # rlist : ready_list_t
* # vtlist : virtual_timers_list_t
* # reglist : registry_t
* # mainthread : thread_t
* # dbg : system_debug_t
* # trace_buffer : trace_buffer_t
* # kernel_stats : kernel_stats_t
* + chInstanceObjectInit()
* }
* class registry {
* # reglist : ch_queue_t
* + chRegFirstThread()
* + chRegNextThread()
* + chRegFindThreadByName()
* + chRegFindThreadByPointer()
* + chRegFindThreadByWorkingArea()
* }
* class thread_t {
* .. union ..
* - list : ch_list_t
* - queue : ch_queue_t
* - pqueue : ch_pqueue_t
* .. end union ..
* - owner : os_instance_t
* - rqueue : ch_queue_t
* - ctx : port_context
* + {static} chThdCreate()
@ -134,11 +142,11 @@
* System ..> "Port Layer" : use
* System *-- "1" ch_system_t : system\nroot object
* System *-- "1..2" os_instance_t
* ch_system_t *-- "1" registry : SMP mode\nonly
* ch_system_t *-- "1" registry_t : SMP mode\nonly
* ch_system_t *-- "1" tm_calibration_t
* ch_system_t o-- "1..*" os_instance_t : registered\ninstances
* os_instance_t *-- "1" thread_t : Main\nThread
* os_instance_t *-- "1" registry : Non-SMP mode\nonly
* os_instance_t *-- "1" registry_t : Non-SMP mode\nonly
* os_instance_t *-- "1" system_debug_t
* os_instance_t *-- "1" trace_buffer_t
* os_instance_t *-- "1" kernel_stats_t
@ -146,7 +154,7 @@
* Scheduler ..> ready_list_t : use
* thread_t o-- "0..*" thread_t : waiting\ntermination
* thread_t o-- "1" os_instance_t : owner\ninstance
* thread_t "1..*" --o registry : alive\nthreads
* thread_t "1..*" --o registry_t : alive\nthreads
* ready_list_t o-- "1..*" thread_t : ready\nthreads
* ready_list_t o-- "1" thread_t : current\nthread
* ready_list_t "1" --* os_instance_t : instance\nready list
@ -170,7 +178,7 @@
* - systime : systime_t
* - lasttime : systime_t
* - laststamp : uint64_t
* # __vt_init()
* # __vt_object_init()
* }
* }
*

View File

@ -131,6 +131,16 @@ typedef struct ch_virtual_timers_list {
#endif
} virtual_timers_list_t;
/**
* @brief Type of a registry structure.
*/
typedef struct ch_registry {
/**
* @brief Registry queue header.
*/
ch_queue_t queue;
} registry_t;
/**
* @brief Type of a thread reference.
*/
@ -405,7 +415,7 @@ struct ch_os_instance {
* @brief Registry header.
* @note This field is present only if the SMP mode is disabled.
*/
ch_queue_t reglist;
registry_t reglist;
#endif
/**
* @brief Core associated to this instance.
@ -467,7 +477,7 @@ typedef struct ch_system {
* @brief Registry header.
* @note This field is present only if the SMP mode is enabled.
*/
ch_queue_t reglist;
registry_t reglist;
#endif
#if defined(PORT_SYSTEM_EXTRA_FIELDS) || defined(__DOXYGEN__)
/* Extra fields from port layer.*/

View File

@ -78,9 +78,9 @@ typedef struct {
* @brief Access to the registry list header.
*/
#if (CH_CFG_SMP_MODE == TRUE) || defined(__DOXYGEN__)
#define REG_HEADER(oip) (&ch_system.reglist)
#define REG_HEADER(oip) (&ch_system.reglist.queue)
#else
#define REG_HEADER(oip) (&(oip)->reglist)
#define REG_HEADER(oip) (&(oip)->reglist.queue)
#endif
/**
@ -123,6 +123,18 @@ extern "C" {
/* Module inline functions. */
/*===========================================================================*/
/**
* @brief Initializes a registry.
*
* @param[out] rp pointer to a @p registry_t structure
*
* @init
*/
static inline void chRegObjectInit(registry_t *rp) {
ch_queue_init(&rp->queue);
}
/**
* @brief Sets the current thread name.
* @pre This function only stores the pointer to the name if the option

View File

@ -113,7 +113,7 @@ void chInstanceObjectInit(os_instance_t *oip,
#if (CH_CFG_USE_REGISTRY == TRUE) && (CH_CFG_SMP_MODE == FALSE)
/* Registry initialization when SMP mode is disabled.*/
ch_queue_init(&oip->reglist);
chRegObjectInit(&oip->reglist);
#endif
/* Virtual timers list initialization.*/

View File

@ -165,7 +165,7 @@ void chSysInit(void) {
#if (CH_CFG_USE_REGISTRY == TRUE) && (CH_CFG_SMP_MODE == TRUE)
/* Registry initialization when SMP mode is enabled.*/
ch_queue_init(&ch_system.reglist);
chRegObjectInit(&ch_system.reglist);
#endif
#if CH_CFG_USE_TM == TRUE