git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8940 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
5181b1e391
commit
a2072b5560
|
@ -231,6 +231,16 @@ struct ch_thread {
|
|||
* @brief Current thread state.
|
||||
*/
|
||||
tstate_t state;
|
||||
/**
|
||||
* @brief Various thread flags.
|
||||
*/
|
||||
tmode_t flags;
|
||||
#if (CH_CFG_USE_DYNAMIC == TRUE) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief References to this thread.
|
||||
*/
|
||||
trefs_t refs;
|
||||
#endif
|
||||
/**
|
||||
* @brief Number of ticks remaining to this thread.
|
||||
*/
|
||||
|
@ -340,6 +350,13 @@ struct ch_thread {
|
|||
*/
|
||||
tprio_t realprio;
|
||||
#endif
|
||||
#if ((CH_CFG_USE_DYNAMIC == TRUE) && (CH_CFG_USE_MEMPOOLS == TRUE)) || \
|
||||
defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Memory Pool where the thread workspace is returned.
|
||||
*/
|
||||
void *mpool;
|
||||
#endif
|
||||
#if (CH_DBG_STATISTICS == TRUE) || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief Thread statistics.
|
||||
|
|
10
os/rt/rt.mk
10
os/rt/rt.mk
|
@ -35,6 +35,9 @@ endif
|
|||
ifneq ($(findstring CH_CFG_USE_QUEUES TRUE,$(CHCONF)),)
|
||||
KERNSRC += $(CHIBIOS)/os/rt/src/chqueues.c
|
||||
endif
|
||||
ifneq ($(findstring CH_CFG_USE_DYNAMIC TRUE,$(CHCONF)),)
|
||||
KERNSRC += $(CHIBIOS)/os/rt/src/chdynamic.c
|
||||
endif
|
||||
ifneq ($(findstring CH_CFG_USE_MAILBOXES TRUE,$(CHCONF)),)
|
||||
KERNSRC += $(CHIBIOS)/os/common/oslib/src/chmboxes.c
|
||||
endif
|
||||
|
@ -47,9 +50,6 @@ endif
|
|||
ifneq ($(findstring CH_CFG_USE_MEMPOOLS TRUE,$(CHCONF)),)
|
||||
KERNSRC += $(CHIBIOS)/os/common/oslib/src/chmempools.c
|
||||
endif
|
||||
ifneq ($(findstring CH_CFG_USE_DYNAMIC TRUE,$(CHCONF)),)
|
||||
KERNSRC += $(CHIBIOS)/os/common/oslib/src/chdynamic.c
|
||||
endif
|
||||
else
|
||||
KERNSRC := $(CHIBIOS)/os/rt/src/chsys.c \
|
||||
$(CHIBIOS)/os/rt/src/chdebug.c \
|
||||
|
@ -65,11 +65,11 @@ KERNSRC := $(CHIBIOS)/os/rt/src/chsys.c \
|
|||
$(CHIBIOS)/os/rt/src/chevents.c \
|
||||
$(CHIBIOS)/os/rt/src/chmsg.c \
|
||||
$(CHIBIOS)/os/rt/src/chqueues.c \
|
||||
$(CHIBIOS)/os/rt/src/chdynamic.c \
|
||||
$(CHIBIOS)/os/common/oslib/src/chmboxes.c \
|
||||
$(CHIBIOS)/os/common/oslib/src/chmemcore.c \
|
||||
$(CHIBIOS)/os/common/oslib/src/chheap.c \
|
||||
$(CHIBIOS)/os/common/oslib/src/chmempools.c \
|
||||
$(CHIBIOS)/os/common/oslib/src/chdynamic.c
|
||||
$(CHIBIOS)/os/common/oslib/src/chmempools.c
|
||||
endif
|
||||
|
||||
# Required include directories
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*
|
||||
* @addtogroup dynamic_threads
|
||||
* @details Dynamic threads related APIs and services.
|
||||
* @note Compatible with RT only.
|
||||
* @{
|
||||
*/
|
||||
|
|
@ -101,8 +101,12 @@ ROMCONST chdebug_t ch_debug = {
|
|||
(uint8_t)0,
|
||||
#endif
|
||||
(uint8_t)_offsetof(thread_t, state),
|
||||
(uint8_t)0, /* Flags no more part of the structure. */
|
||||
(uint8_t)0, /* Refs no more part of the structure. */
|
||||
(uint8_t)_offsetof(thread_t, flags),
|
||||
#if CH_CFG_USE_DYNAMIC == TRUE
|
||||
(uint8_t)_offsetof(thread_t, refs),
|
||||
#else
|
||||
(uint8_t)0,
|
||||
#endif
|
||||
#if CH_CFG_TIME_QUANTUM > 0
|
||||
(uint8_t)_offsetof(thread_t, preempt),
|
||||
#else
|
||||
|
@ -132,6 +136,9 @@ thread_t *chRegFirstThread(void) {
|
|||
|
||||
chSysLock();
|
||||
tp = ch.rlist.newer;
|
||||
#if CH_CFG_USE_DYNAMIC == TRUE
|
||||
tp->refs++;
|
||||
#endif
|
||||
chSysUnlock();
|
||||
|
||||
return tp;
|
||||
|
@ -158,7 +165,16 @@ thread_t *chRegNextThread(thread_t *tp) {
|
|||
/*lint -restore*/
|
||||
ntp = NULL;
|
||||
}
|
||||
#if CH_CFG_USE_DYNAMIC == TRUE
|
||||
else {
|
||||
chDbgAssert(ntp->refs < (trefs_t)255, "too many references");
|
||||
ntp->refs++;
|
||||
}
|
||||
#endif
|
||||
chSysUnlock();
|
||||
#if CH_CFG_USE_DYNAMIC == TRUE
|
||||
chThdRelease(tp);
|
||||
#endif
|
||||
|
||||
return ntp;
|
||||
}
|
||||
|
@ -186,7 +202,6 @@ thread_t *chRegFindThreadByName(const char *name) {
|
|||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CH_CFG_USE_REGISTRY == TRUE */
|
||||
|
||||
/**
|
||||
* @brief Confirms that a pointer is a valid thread pointer.
|
||||
|
@ -212,4 +227,6 @@ thread_t *chRegFindThreadByPointer(thread_t *tp) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* CH_CFG_USE_REGISTRY == TRUE */
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -129,6 +129,7 @@ void chSysInit(void) {
|
|||
|
||||
/* Setting up the caller as current thread.*/
|
||||
currp->state = CH_STATE_CURRENT;
|
||||
currp->flags = CH_FLAG_MODE_STATIC;
|
||||
|
||||
/* Port layer initialization last because it depend on some of the
|
||||
initializations performed before.*/
|
||||
|
|
|
@ -175,6 +175,7 @@ thread_t *chThdCreateSuspendedI(const thread_descriptor_t *tdp) {
|
|||
|
||||
/* Initial state.*/
|
||||
tp->state = CH_STATE_WTSTART;
|
||||
tp->flags = CH_FLAG_MODE_STATIC;
|
||||
|
||||
/* Stack boundary.*/
|
||||
tp->stklimit = tdp->wbase;
|
||||
|
|
Loading…
Reference in New Issue