More registry-related changes, removed some complexity from asm port modules thanks to registry changes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14170 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
0b1cc7db27
commit
42d5fca126
|
@ -39,16 +39,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -44,16 +44,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -44,16 +44,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -44,16 +44,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -44,16 +44,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -44,16 +44,10 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -44,16 +44,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -44,16 +44,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -44,13 +44,8 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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 CURRENT_OFFSET 12
|
||||||
#define CONTEXT_OFFSET 12
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
#define CURRENT_OFFSET 0 /* nil.current */
|
||||||
|
|
|
@ -44,16 +44,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -41,11 +41,7 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#if defined(_CHIBIOS_RT_CONF_)
|
||||||
#if CH_CFG_USE_REGISTRY
|
|
||||||
#define CONTEXT_OFFSET "20"
|
|
||||||
#else
|
|
||||||
#define CONTEXT_OFFSET "12"
|
#define CONTEXT_OFFSET "12"
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CONTEXT_OFFSET "0"
|
#define CONTEXT_OFFSET "0"
|
||||||
|
|
|
@ -55,16 +55,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -56,16 +56,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -52,16 +52,9 @@
|
||||||
* RTOS-specific context offset.
|
* RTOS-specific context offset.
|
||||||
*/
|
*/
|
||||||
#if defined(_CHIBIOS_RT_CONF_)
|
#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
|
#define CONTEXT_OFFSET 12
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(_CHIBIOS_NIL_CONF_)
|
#elif defined(_CHIBIOS_NIL_CONF_)
|
||||||
#define CURRENT_OFFSET 0 /* nil.current */
|
|
||||||
#define CONTEXT_OFFSET 0
|
#define CONTEXT_OFFSET 0
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -122,14 +122,13 @@ struct ch_thread {
|
||||||
ch_priority_queue_t pqueue; /**< @brief Threads ordered queues
|
ch_priority_queue_t pqueue; /**< @brief Threads ordered queues
|
||||||
element. */
|
element. */
|
||||||
} hdr;
|
} 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.
|
* @brief Processor context.
|
||||||
*/
|
*/
|
||||||
struct port_context ctx;
|
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__)
|
#if (CH_CFG_SMP_MODE != FALSE) || defined(__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief OS instance owner of this thread.
|
* @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.
|
* @note The priority field must be initialized to zero.
|
||||||
*/
|
*/
|
||||||
ch_priority_queue_t pqueue;
|
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.
|
* @brief The currently running thread.
|
||||||
*/
|
*/
|
||||||
|
@ -358,6 +350,12 @@ struct ch_os_instance {
|
||||||
* @brief Virtual timers delta list header.
|
* @brief Virtual timers delta list header.
|
||||||
*/
|
*/
|
||||||
virtual_timers_list_t vtlist;
|
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.
|
* @brief Main thread descriptor.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -89,7 +89,7 @@ typedef struct {
|
||||||
* @param[in] oip pointer to the OS instance
|
* @param[in] oip pointer to the OS instance
|
||||||
* @param[in] tp thread to add to the registry
|
* @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. */
|
/* External declarations. */
|
||||||
|
|
|
@ -136,7 +136,7 @@ thread_t *chRegFirstThread(void) {
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
p = (uint8_t *)currcore->rlist.registry.next;
|
p = (uint8_t *)currcore->reglist.next;
|
||||||
tp = (thread_t *)(p - offsetof(thread_t, rqueue));
|
tp = (thread_t *)(p - offsetof(thread_t, rqueue));
|
||||||
#if CH_CFG_USE_DYNAMIC == TRUE
|
#if CH_CFG_USE_DYNAMIC == TRUE
|
||||||
tp->refs++;
|
tp->refs++;
|
||||||
|
@ -165,7 +165,7 @@ thread_t *chRegNextThread(thread_t *tp) {
|
||||||
|
|
||||||
/* Next element in the registry queue.*/
|
/* Next element in the registry queue.*/
|
||||||
nqp = tp->rqueue.next;
|
nqp = tp->rqueue.next;
|
||||||
if (nqp == &currcore->rlist.registry) {
|
if (nqp == &currcore->reglist) {
|
||||||
ntp = NULL;
|
ntp = NULL;
|
||||||
}
|
}
|
||||||
#if CH_CFG_USE_DYNAMIC == TRUE
|
#if CH_CFG_USE_DYNAMIC == TRUE
|
||||||
|
|
|
@ -319,7 +319,7 @@ void chSchObjectInit(os_instance_t *oip,
|
||||||
|
|
||||||
/* Registry initialization.*/
|
/* Registry initialization.*/
|
||||||
#if CH_CFG_USE_REGISTRY == TRUE
|
#if CH_CFG_USE_REGISTRY == TRUE
|
||||||
ch_queue_init(&oip->rlist.registry);
|
ch_queue_init(&oip->reglist);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Virtual timers list initialization.*/
|
/* Virtual timers list initialization.*/
|
||||||
|
|
|
@ -248,15 +248,15 @@ bool chSysIntegrityCheckI(unsigned testmask) {
|
||||||
|
|
||||||
/* Scanning the ready list forward.*/
|
/* Scanning the ready list forward.*/
|
||||||
n = (cnt_t)0;
|
n = (cnt_t)0;
|
||||||
qp = oip->rlist.registry.next;
|
qp = oip->reglist.next;
|
||||||
while (qp != &oip->rlist.registry) {
|
while (qp != &oip->reglist) {
|
||||||
n++;
|
n++;
|
||||||
qp = qp->next;
|
qp = qp->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scanning the ready list backward.*/
|
/* Scanning the ready list backward.*/
|
||||||
qp = oip->rlist.registry.prev;
|
qp = oip->reglist.prev;
|
||||||
while (qp != &oip->rlist.registry) {
|
while (qp != &oip->reglist) {
|
||||||
n--;
|
n--;
|
||||||
qp = qp->prev;
|
qp = qp->prev;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue