From 53e4f68189cf27bc49f2d92bc869c93bd886876b Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 1 Feb 2009 13:24:54 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@706 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- readme.txt | 6 ++-- src/include/threads.h | 77 +++++++++++++++++++------------------------ 2 files changed, 37 insertions(+), 46 deletions(-) diff --git a/readme.txt b/readme.txt index c3828509a..b90d51ef7 100644 --- a/readme.txt +++ b/readme.txt @@ -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 optimization). - 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, - the trace buffer field cse_tid is now populated with a simple hash of the - thread pointer. + 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 + thread pointer as thread identifier. - CHANGE: Renamed the macros chSysIRQEnter() and chSysIRQExit() in 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 diff --git a/src/include/threads.h b/src/include/threads.h index 00f5e2714..00a948c3f 100644 --- a/src/include/threads.h +++ b/src/include/threads.h @@ -34,23 +34,19 @@ * shrinking the @p Thread structure. */ struct Thread { - /** Next @p Thread in the threads list.*/ - Thread *p_next; + Thread *p_next; /**< Next @p Thread in the threads + list/queue.*/ /* End of the fields shared with the ThreadsList structure. */ - /** Previous @p Thread in the threads list.*/ - Thread *p_prev; + Thread *p_prev; /**< Previous @p Thread in the thread + queue.*/ /* End of the fields shared with the ThreadsQueue structure. */ - /** The thread priority.*/ - tprio_t p_prio; + tprio_t p_prio; /**< Thread priority.*/ /* End of the fields shared with the ReadyList structure. */ - /** Current thread state.*/ - tstate_t p_state; - /** Mode flags. */ - tmode_t p_flags; - /** Machine dependent processor context.*/ - struct context p_ctx; + tstate_t p_state; /**< Current thread state.*/ + tmode_t p_flags; /**< Various flags.*/ + struct context p_ctx; /**< Processor context.*/ #ifdef CH_USE_NESTED_LOCKS - cnt_t p_locks; + cnt_t p_locks; /**< Number of nested locks.*/ #endif /* * The following fields are merged in unions because they are all @@ -58,61 +54,56 @@ struct Thread { * thread in the system. */ union { - /** Thread wakeup code (only valid when exiting the @p PRREADY state).*/ - msg_t p_rdymsg; - /** The thread exit code (only while in @p PREXIT state).*/ - msg_t p_exitcode; + msg_t p_rdymsg; /**< Thread wakeup code.*/ + msg_t p_exitcode; /**< The thread exit code + (@p PREXIT state).*/ #ifdef CH_USE_SEMAPHORES - /** Semaphore where the thread is waiting on (only in @p PRWTSEM state).*/ - Semaphore *p_wtsemp; + Semaphore *p_wtsemp; /**< Semaphore where the thread is + waiting on (@p PRWTSEM state).*/ #endif #ifdef CH_USE_MUTEXES - /** Mutex where the thread is waiting on (only in @p PRWTMTX state).*/ - Mutex *p_wtmtxp; + Mutex *p_wtmtxp; /**< Mutex where the thread is waiting + on (@p PRWTMTX state).*/ #endif #ifdef CH_USE_CONDVARS - /** CondVar where the thread is waiting on (only in @p PRWTCOND state).*/ - CondVar *p_wtcondp; + CondVar *p_wtcondp; /**< CondVar where the thread is + waiting on (@p PRWTCOND state).*/ #endif #ifdef CH_USE_MESSAGES - /** Destination thread for message send (only in @p PRSNDMSG state).*/ - Thread *p_wtthdp; + Thread *p_wtthdp; /**< Destination thread for message + send @p PRSNDMSG state).*/ #endif #ifdef CH_USE_EVENTS - /** Enabled events mask (only while in @p PRWTOREVT or @p PRWTANDEVT - states). */ - eventmask_t p_ewmask; + eventmask_t p_ewmask; /**< Enabled events mask (@p PRWTOREVT + or @p PRWTANDEVT states).*/ #endif #ifdef CH_USE_TRACE - /** Kernel object where the thread is waiting on. It is only valid when - the thread is some sleeping states.*/ - void *p_wtobjp; + void *p_wtobjp; /**< Generic kernel object pointer used + for opaque access.*/ #endif }; /* * Start of the optional fields. */ #ifdef CH_USE_WAITEXIT - /** The list of the threads waiting for this thread termination. */ - Thread *p_waiting; + Thread *p_waiting; /**< Thread waiting for termination.*/ #endif #ifdef CH_USE_MESSAGES - ThreadsQueue p_msgqueue; - msg_t p_msg; + ThreadsQueue p_msgqueue; /**< Message queue.*/ + msg_t p_msg; /**< The message.*/ #endif #ifdef CH_USE_EVENTS - /** Pending events mask. */ - eventmask_t p_epending; + eventmask_t p_epending; /**< Pending events mask.*/ #endif #ifdef CH_USE_MUTEXES - /** List of mutexes owned by this thread, @p NULL terminated. */ - Mutex *p_mtxlist; - /** Thread's own, non-inherited, priority. */ - tprio_t p_realprio; + Mutex *p_mtxlist; /**< List of the mutexes owned by this + thread, @p NULL terminated.*/ + tprio_t p_realprio; /**< Thread's own, non-inherited, + priority.*/ #endif #if defined(CH_USE_DYNAMIC) && defined(CH_USE_MEMPOOLS) - /** Memory Pool where the thread workspace is returned. */ - void *p_mpool; + void *p_mpool; /**< Memory Pool where the thread + workspace is returned.*/ #endif /* Extra fields defined in chconf.h */ THREAD_EXT_FIELDS