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

master
gdisirio 2008-01-07 14:06:46 +00:00
parent 14d3b059c2
commit b1db8a9f7f
12 changed files with 71 additions and 3 deletions

View File

@ -107,6 +107,11 @@
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
//#define CH_USE_MESSAGES_EVENT //#define CH_USE_MESSAGES_EVENT
/** Configuration option: If enabled then the threads have an option to serve
* messages by priority instead of FIFO order.
* @note requires \p CH_USE_MESSAGES.*/
//#define CH_USE_MESSAGES_PRIORITY
/** Configuration option: if specified then the /** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel. * \p chThdGetExitEventSource() function is included in the kernel.
* @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_MESSAGES.

View File

@ -107,6 +107,11 @@
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
#define CH_USE_MESSAGES_EVENT #define CH_USE_MESSAGES_EVENT
/** Configuration option: If enabled then the threads have an option to serve
* messages by priority instead of FIFO order.
* @note requires \p CH_USE_MESSAGES.*/
#define CH_USE_MESSAGES_PRIORITY
/** Configuration option: if specified then the /** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel. * \p chThdGetExitEventSource() function is included in the kernel.
* @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_MESSAGES.

View File

@ -108,6 +108,11 @@
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
#define CH_USE_MESSAGES_EVENT #define CH_USE_MESSAGES_EVENT
/** Configuration option: If enabled then the threads have an option to serve
* messages by priority instead of FIFO order.
* @note requires \p CH_USE_MESSAGES.*/
#define CH_USE_MESSAGES_PRIORITY
/** Configuration option: if specified then the /** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel. * \p chThdGetExitEventSource() function is included in the kernel.
* @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_MESSAGES.

View File

@ -112,6 +112,11 @@
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
#define CH_USE_MESSAGES_EVENT #define CH_USE_MESSAGES_EVENT
/** Configuration option: If enabled then the threads have an option to serve
* messages by priority instead of FIFO order.
* @note requires \p CH_USE_MESSAGES.*/
#define CH_USE_MESSAGES_PRIORITY
/** Configuration option: if specified then the /** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel. * \p chThdGetExitEventSource() function is included in the kernel.
* @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_MESSAGES.

View File

@ -112,6 +112,11 @@
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
#define CH_USE_MESSAGES_EVENT #define CH_USE_MESSAGES_EVENT
/** Configuration option: If enabled then the threads have an option to serve
* messages by priority instead of FIFO order.
* @note requires \p CH_USE_MESSAGES.*/
#define CH_USE_MESSAGES_PRIORITY
/** Configuration option: if specified then the /** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel. * \p chThdGetExitEventSource() function is included in the kernel.
* @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_MESSAGES.

View File

@ -4,7 +4,7 @@
# Project related configuration options # Project related configuration options
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
PROJECT_NAME = ChibiOS/RT PROJECT_NAME = ChibiOS/RT
PROJECT_NUMBER = "0.5.0 beta" PROJECT_NUMBER = "0.5.1 beta"
OUTPUT_DIRECTORY = . OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English OUTPUT_LANGUAGE = English
@ -243,6 +243,7 @@ PREDEFINED = __JUST_STUBS__ \
CH_USE_MESSAGES \ CH_USE_MESSAGES \
CH_USE_MESSAGES_TIMEOUT \ CH_USE_MESSAGES_TIMEOUT \
CH_USE_MESSAGES_EVENT \ CH_USE_MESSAGES_EVENT \
CH_USE_MESSAGES_PRIORITY \
CH_USE_SEMSW \ CH_USE_SEMSW \
CH_USE_DEBUG \ CH_USE_DEBUG \
CH_USE_TRACE CH_USE_TRACE

View File

@ -305,7 +305,10 @@
* be carryed in both directions. Data is not copyed between the client and * be carryed in both directions. Data is not copyed between the client and
* server threads but just a pointer passed so the exchange is very time * server threads but just a pointer passed so the exchange is very time
* efficient.<br> * efficient.<br>
* Messages are always processed in FIFO order.<br> * Messages are usually processed in FIFO order but it is possible to process
* them in priority order by specifying \p P_MSGBYPRIO when creating a server
* thread, \p CH_USE_MESSAGES_PRIORITY must also be specified in \p chconf.h
* in order to enable the feature.<br>
* Threads do not need to allocate space for message queues, the mechanism * Threads do not need to allocate space for message queues, the mechanism
* just requires two extra pointers in the \p Thread structure (the message * just requires two extra pointers in the \p Thread structure (the message
* queue header).<br> * queue header).<br>

View File

@ -13,7 +13,7 @@ Homepage</h2>
</tr> </tr>
<tr> <tr>
<td style="text-align: center; vertical-align: top; width: 150px;">Current <td style="text-align: center; vertical-align: top; width: 150px;">Current
Version 0.5.0<br> Version 0.5.1<br>
-<br> -<br>
<a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><br> <a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><br>
<a href="html/index.html" target="_top" rel="me">Documentation</a><br> <a href="html/index.html" target="_top" rel="me">Documentation</a><br>

View File

@ -40,6 +40,17 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
***************************************************************************** *****************************************************************************
*** 0.5.1 *** *** 0.5.1 ***
- NEW: Priority enqueing for messages can be optionally enabled by specifying
the P_MSGBYPRIO option when creating a server thread.
This change allows the implementation of a priority ceiling protocol into
message servers threads. Threads serving messages by priority and threads
serving messages in FIFO orded can exist at the same time in the system.
This feature can be enabled or disabled by removing the option
CH_USE_MESSAGES_PRIORITY into the chconf.h file.
Note: This option brings a small overhead when sending a message regardless
if in FIFO or priority order, if you dont need priority ordering for your
messages it is better disable the feature in chconf.h. It also saves some
space.
- Added to the ARM demos load scripts the capability to load code in RAM - Added to the ARM demos load scripts the capability to load code in RAM
instead flash, the function must be marked as: instead flash, the function must be marked as:
__attribute__((section(".ramtext"))) __attribute__((section(".ramtext")))

View File

@ -36,7 +36,14 @@ t_msg chMsgSend(Thread *tp, t_msg msg) {
chSysLock(); chSysLock();
#ifdef CH_USE_MESSAGES_PRIORITY
if (tp->p_flags & P_MSGBYPRIO)
prio_insert(currp, &tp->p_msgqueue);
else
fifo_insert(currp, &tp->p_msgqueue);
#else
fifo_insert(currp, &tp->p_msgqueue); fifo_insert(currp, &tp->p_msgqueue);
#endif
currp->p_msg = msg; currp->p_msg = msg;
if (tp->p_state == PRWTMSG) if (tp->p_state == PRWTMSG)
chSchReadyI(tp, RDY_OK); chSchReadyI(tp, RDY_OK);
@ -67,7 +74,14 @@ t_msg chMsgSendWithEvent(Thread *tp, t_msg msg, EventSource *esp) {
chSysLock(); chSysLock();
chDbgAssert(tp->p_state != PRWTMSG, "chmsg.c, chMsgSendWithEvent()"); chDbgAssert(tp->p_state != PRWTMSG, "chmsg.c, chMsgSendWithEvent()");
#ifdef CH_USE_MESSAGES_PRIORITY
if (tp->p_flags & P_MSGBYPRIO)
prio_insert(currp, &tp->p_msgqueue);
else
fifo_insert(currp, &tp->p_msgqueue);
#else
fifo_insert(currp, &tp->p_msgqueue); fifo_insert(currp, &tp->p_msgqueue);
#endif
chEvtSendI(esp); chEvtSendI(esp);
currp->p_msg = msg; currp->p_msg = msg;
chSchGoSleepS(PRSNDMSG); chSchGoSleepS(PRSNDMSG);
@ -107,7 +121,14 @@ t_msg chMsgSendTimeout(Thread *tp, t_msg msg, t_time time) {
chSysLock(); chSysLock();
chVTSetI(&vt, time, wakeup, currp); chVTSetI(&vt, time, wakeup, currp);
#ifdef CH_USE_MESSAGES_PRIORITY
if (tp->p_flags & P_MSGBYPRIO)
prio_insert(currp, &tp->p_msgqueue);
else
fifo_insert(currp, &tp->p_msgqueue);
#else
fifo_insert(currp, &tp->p_msgqueue); fifo_insert(currp, &tp->p_msgqueue);
#endif
if (tp->p_state == PRWTMSG) if (tp->p_state == PRWTMSG)
chSchReadyI(tp, RDY_OK); chSchReadyI(tp, RDY_OK);
currp->p_msg = msg; currp->p_msg = msg;

View File

@ -135,6 +135,8 @@ struct Thread {
#define P_TERMINATE 1 #define P_TERMINATE 1
/** Thread option: Create suspended thread.*/ /** Thread option: Create suspended thread.*/
#define P_SUSPENDED 2 #define P_SUSPENDED 2
/** Thread option: Serve messages by priority instead of FIFO order.*/
#define P_MSGBYPRIO 4
/** Pseudo priority used by the ready list header, do not use.*/ /** Pseudo priority used by the ready list header, do not use.*/
#define NOPRIO 0 #define NOPRIO 0

View File

@ -108,6 +108,11 @@
* @note requires \p CH_USE_VIRTUAL_TIMERS.*/ * @note requires \p CH_USE_VIRTUAL_TIMERS.*/
#define CH_USE_MESSAGES_EVENT #define CH_USE_MESSAGES_EVENT
/** Configuration option: If enabled then the threads have an option to serve
* messages by priority instead of FIFO order.
* @note requires \p CH_USE_MESSAGES.*/
#define CH_USE_MESSAGES_PRIORITY
/** Configuration option: if specified then the /** Configuration option: if specified then the
* \p chThdGetExitEventSource() function is included in the kernel. * \p chThdGetExitEventSource() function is included in the kernel.
* @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_MESSAGES.