git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@706 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2009-02-01 13:24:54 +00:00
parent 155dd60be0
commit 53e4f68189
2 changed files with 37 additions and 46 deletions

View File

@ -86,9 +86,9 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
use less RAM in stack frames (note, this is an ARM7 thumb mode specific use less RAM in stack frames (note, this is an ARM7 thumb mode specific
optimization). optimization).
- CHANGE: Removed the field p_tid from the Thread structure and the related - CHANGE: Removed the field p_tid from the Thread structure and the related
code, this improved the thread creation scores (~2%) and saves some RAM, code, this improved the thread creation scores (~2%) and saves some RAM.
the trace buffer field cse_tid is now populated with a simple hash of the The trace buffer field cse_tid is now populated with a simple hash of the
thread pointer. thread pointer as thread identifier.
- CHANGE: Renamed the macros chSysIRQEnter() and chSysIRQExit() in - CHANGE: Renamed the macros chSysIRQEnter() and chSysIRQExit() in
CH_IRQ_PROLOGUE() and CH_IRQ_EPILOGUE() in order to make very clear that CH_IRQ_PROLOGUE() and CH_IRQ_EPILOGUE() in order to make very clear that
those are not functions but inlined code. Also introduced a new macro those are not functions but inlined code. Also introduced a new macro

View File

@ -34,23 +34,19 @@
* shrinking the @p Thread structure. * shrinking the @p Thread structure.
*/ */
struct Thread { struct Thread {
/** Next @p Thread in the threads list.*/ Thread *p_next; /**< Next @p Thread in the threads
Thread *p_next; list/queue.*/
/* End of the fields shared with the ThreadsList structure. */ /* End of the fields shared with the ThreadsList structure. */
/** Previous @p Thread in the threads list.*/ Thread *p_prev; /**< Previous @p Thread in the thread
Thread *p_prev; queue.*/
/* End of the fields shared with the ThreadsQueue structure. */ /* End of the fields shared with the ThreadsQueue structure. */
/** The thread priority.*/ tprio_t p_prio; /**< Thread priority.*/
tprio_t p_prio;
/* End of the fields shared with the ReadyList structure. */ /* End of the fields shared with the ReadyList structure. */
/** Current thread state.*/ tstate_t p_state; /**< Current thread state.*/
tstate_t p_state; tmode_t p_flags; /**< Various flags.*/
/** Mode flags. */ struct context p_ctx; /**< Processor context.*/
tmode_t p_flags;
/** Machine dependent processor context.*/
struct context p_ctx;
#ifdef CH_USE_NESTED_LOCKS #ifdef CH_USE_NESTED_LOCKS
cnt_t p_locks; cnt_t p_locks; /**< Number of nested locks.*/
#endif #endif
/* /*
* The following fields are merged in unions because they are all * The following fields are merged in unions because they are all
@ -58,61 +54,56 @@ struct Thread {
* thread in the system. * thread in the system.
*/ */
union { union {
/** Thread wakeup code (only valid when exiting the @p PRREADY state).*/ msg_t p_rdymsg; /**< Thread wakeup code.*/
msg_t p_rdymsg; msg_t p_exitcode; /**< The thread exit code
/** The thread exit code (only while in @p PREXIT state).*/ (@p PREXIT state).*/
msg_t p_exitcode;
#ifdef CH_USE_SEMAPHORES #ifdef CH_USE_SEMAPHORES
/** Semaphore where the thread is waiting on (only in @p PRWTSEM state).*/ Semaphore *p_wtsemp; /**< Semaphore where the thread is
Semaphore *p_wtsemp; waiting on (@p PRWTSEM state).*/
#endif #endif
#ifdef CH_USE_MUTEXES #ifdef CH_USE_MUTEXES
/** Mutex where the thread is waiting on (only in @p PRWTMTX state).*/ Mutex *p_wtmtxp; /**< Mutex where the thread is waiting
Mutex *p_wtmtxp; on (@p PRWTMTX state).*/
#endif #endif
#ifdef CH_USE_CONDVARS #ifdef CH_USE_CONDVARS
/** CondVar where the thread is waiting on (only in @p PRWTCOND state).*/ CondVar *p_wtcondp; /**< CondVar where the thread is
CondVar *p_wtcondp; waiting on (@p PRWTCOND state).*/
#endif #endif
#ifdef CH_USE_MESSAGES #ifdef CH_USE_MESSAGES
/** Destination thread for message send (only in @p PRSNDMSG state).*/ Thread *p_wtthdp; /**< Destination thread for message
Thread *p_wtthdp; send @p PRSNDMSG state).*/
#endif #endif
#ifdef CH_USE_EVENTS #ifdef CH_USE_EVENTS
/** Enabled events mask (only while in @p PRWTOREVT or @p PRWTANDEVT eventmask_t p_ewmask; /**< Enabled events mask (@p PRWTOREVT
states). */ or @p PRWTANDEVT states).*/
eventmask_t p_ewmask;
#endif #endif
#ifdef CH_USE_TRACE #ifdef CH_USE_TRACE
/** Kernel object where the thread is waiting on. It is only valid when void *p_wtobjp; /**< Generic kernel object pointer used
the thread is some sleeping states.*/ for opaque access.*/
void *p_wtobjp;
#endif #endif
}; };
/* /*
* Start of the optional fields. * Start of the optional fields.
*/ */
#ifdef CH_USE_WAITEXIT #ifdef CH_USE_WAITEXIT
/** The list of the threads waiting for this thread termination. */ Thread *p_waiting; /**< Thread waiting for termination.*/
Thread *p_waiting;
#endif #endif
#ifdef CH_USE_MESSAGES #ifdef CH_USE_MESSAGES
ThreadsQueue p_msgqueue; ThreadsQueue p_msgqueue; /**< Message queue.*/
msg_t p_msg; msg_t p_msg; /**< The message.*/
#endif #endif
#ifdef CH_USE_EVENTS #ifdef CH_USE_EVENTS
/** Pending events mask. */ eventmask_t p_epending; /**< Pending events mask.*/
eventmask_t p_epending;
#endif #endif
#ifdef CH_USE_MUTEXES #ifdef CH_USE_MUTEXES
/** List of mutexes owned by this thread, @p NULL terminated. */ Mutex *p_mtxlist; /**< List of the mutexes owned by this
Mutex *p_mtxlist; thread, @p NULL terminated.*/
/** Thread's own, non-inherited, priority. */ tprio_t p_realprio; /**< Thread's own, non-inherited,
tprio_t p_realprio; priority.*/
#endif #endif
#if defined(CH_USE_DYNAMIC) && defined(CH_USE_MEMPOOLS) #if defined(CH_USE_DYNAMIC) && defined(CH_USE_MEMPOOLS)
/** Memory Pool where the thread workspace is returned. */ void *p_mpool; /**< Memory Pool where the thread
void *p_mpool; workspace is returned.*/
#endif #endif
/* Extra fields defined in chconf.h */ /* Extra fields defined in chconf.h */
THREAD_EXT_FIELDS THREAD_EXT_FIELDS