aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-03-12 11:24:24 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-03-12 11:24:24 +0000
commit1422b47cc4e0a979ff02e9d8fb1bb0005f0ebbb9 (patch)
tree6038803fa0fb48739a9ade81d45f5d774a1b9931
parent7500baf6cd6457ce77b5a474031f35bd5b30fb6a (diff)
downloadChibiOS-1422b47cc4e0a979ff02e9d8fb1bb0005f0ebbb9.tar.gz
ChibiOS-1422b47cc4e0a979ff02e9d8fb1bb0005f0ebbb9.tar.bz2
ChibiOS-1422b47cc4e0a979ff02e9d8fb1bb0005f0ebbb9.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@225 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--readme.txt6
-rw-r--r--src/chevents.c2
-rw-r--r--src/chmsg.c2
-rw-r--r--src/chmtx.c6
-rw-r--r--src/chschd.c19
-rw-r--r--src/chsem.c6
-rw-r--r--src/chthreads.c2
-rw-r--r--src/include/scheduler.h2
8 files changed, 23 insertions, 22 deletions
diff --git a/readme.txt b/readme.txt
index 96c9fe235..38d5a85da 100644
--- a/readme.txt
+++ b/readme.txt
@@ -63,11 +63,13 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not tested on hardware yet.
*** 0.6.1 ***
- Removed some redundant checks from the scheduler code: improved threads
flyback time.
-- Manual optimization in chSchReadyI(), it seems GCC is missing some obvious
- code optimizations here. Both code size and speed improved.
+- Huge scheduler speed improvement obtained by removing the 2nd parameter to
+ the chSchReadyI() API and manually assigning the message value only where
+ is really needed (very few points in the code).
- Removed the -falign-functions=16 option from the AT91SAM7X demo makefiles,
the Atmel chip does not require it, the option is still present on the
LPC21xx demos. This saves significant ROM space.
+- Fixes to the doxigen documentation.
*** 0.6.0 ***
- Code refactory, all the old sized-integer definitions like LONG32, UWORD16
diff --git a/src/chevents.c b/src/chevents.c
index 75ac8b322..93f28f0ec 100644
--- a/src/chevents.c
+++ b/src/chevents.c
@@ -114,7 +114,7 @@ void chEvtSendI(EventSource *esp) {
tp->p_epending |= EventMask(elp->el_id);
if ((tp->p_state == PRWTEVENT) && (tp->p_epending & tp->p_ewmask))
- chSchReadyI(tp, RDY_OK);
+ chSchReadyI(tp)->p_rdymsg = RDY_OK;
elp = elp->el_next;
}
}
diff --git a/src/chmsg.c b/src/chmsg.c
index ae90c8264..8c6fa779f 100644
--- a/src/chmsg.c
+++ b/src/chmsg.c
@@ -47,7 +47,7 @@ msg_t chMsgSend(Thread *tp, msg_t msg) {
currp->p_msg = msg;
currp->p_wtthdp = tp;
if (tp->p_state == PRWTMSG)
- chSchReadyI(tp, RDY_OK);
+ chSchReadyI(tp);
chSchGoSleepS(PRSNDMSG);
msg = currp->p_rdymsg;
diff --git a/src/chmtx.c b/src/chmtx.c
index 6d9e4e18f..a6379836d 100644
--- a/src/chmtx.c
+++ b/src/chmtx.c
@@ -79,7 +79,7 @@ void chMtxLockS(Mutex *mp) {
prio_insert(dequeue(tp), &tp->p_wtthdp->p_msgqueue);
#endif
case PRREADY:
- chSchReadyI(dequeue(tp), RDY_OK);
+ chSchReadyI(dequeue(tp));
}
break;
}
@@ -209,7 +209,7 @@ void chMtxUnlockS(void) {
mp = mp->m_next;
}
currp->p_prio = newprio;
- chSchReadyI(tp, RDY_OK);
+ chSchReadyI(tp);
}
}
@@ -229,7 +229,7 @@ void chMtxUnlockAll(void) {
currp->p_mtxlist = mp->m_next;
mp->m_owner = NULL;
if (chMtxQueueNotEmptyS(mp))
- chSchReadyI(fifo_remove(&mp->m_queue), RDY_OK);
+ chSchReadyI(fifo_remove(&mp->m_queue));
} while (currp->p_mtxlist != NULL);
currp->p_prio = currp->p_realprio;
chSchRescheduleS();
diff --git a/src/chschd.c b/src/chschd.c
index c0be50524..20e5f5d78 100644
--- a/src/chschd.c
+++ b/src/chschd.c
@@ -45,7 +45,6 @@ void chSchInit(void) {
/**
* Inserts a thread in the Ready List.
* @param tp the Thread to be made ready
- * @param msg message to the awakened thread
* @return the Thread pointer
* @note The function must be called in the system mutex zone.
* @note The function does not reschedule, the \p chSchRescheduleS() should
@@ -54,20 +53,21 @@ void chSchInit(void) {
*/
#ifdef CH_OPTIMIZE_SPEED
/* NOTE: it is inlined in this module only.*/
-INLINE void chSchReadyI(Thread *tp, msg_t msg) {
+INLINE Thread *chSchReadyI(Thread *tp) {
#else
-void chSchReadyI(Thread *tp, msg_t msg) {
+void chSchReadyI(Thread *tp) {
#endif
Thread *cp;
tp->p_state = PRREADY;
- tp->p_rdymsg = msg;
+// tp->p_rdymsg = RDY_OK;
cp = rlist.r_queue.p_next;
while (cp->p_prio >= tp->p_prio)
cp = cp->p_next;
/* Insertion on p_prev.*/
tp->p_prev = (tp->p_next = cp)->p_prev;
tp->p_prev->p_next = cp->p_prev = tp;
+ return tp;
}
/**
@@ -75,7 +75,6 @@ void chSchReadyI(Thread *tp, msg_t msg) {
* priority thread becomes running. The threads states are described into
* \p threads.h
* @param newstate the new thread state
- * @return the wakeup message
* @note The function must be called in the system mutex zone.
* @note The function is not meant to be used in the user code directly.
*/
@@ -101,7 +100,7 @@ static void wakeup(void *p) {
if (((Thread *)p)->p_state == PRWTSEM)
chSemFastSignalI(((Thread *)p)->p_wtsemp);
#endif
- chSchReadyI(p, RDY_TIMEOUT);
+ chSchReadyI(p)->p_rdymsg = RDY_TIMEOUT;;
}
/**
@@ -138,12 +137,12 @@ msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time) {
*/
void chSchWakeupS(Thread *ntp, msg_t msg) {
+ ntp->p_rdymsg = msg;
if (ntp->p_prio <= currp->p_prio)
- chSchReadyI(ntp, msg);
+ chSchReadyI(ntp);
else {
Thread *otp = currp;
- ntp->p_rdymsg = msg;
- chSchReadyI(otp, RDY_OK);
+ chSchReadyI(otp);
(currp = ntp)->p_state = PRCURR;
rlist.r_preempt = CH_TIME_QUANTUM;
#ifdef CH_USE_TRACE
@@ -160,7 +159,7 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
void chSchDoRescheduleI(void) {
Thread *otp = currp;
- chSchReadyI(otp, RDY_OK);
+ chSchReadyI(otp);
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
rlist.r_preempt = CH_TIME_QUANTUM;
#ifdef CH_USE_TRACE
diff --git a/src/chsem.c b/src/chsem.c
index cbbac8909..6953fb846 100644
--- a/src/chsem.c
+++ b/src/chsem.c
@@ -72,7 +72,7 @@ void chSemResetI(Semaphore *sp, cnt_t n) {
cnt = sp->s_cnt;
sp->s_cnt = n;
while (cnt++ < 0)
- chSchReadyI(fifo_remove(&sp->s_queue), RDY_RESET);
+ chSchReadyI(fifo_remove(&sp->s_queue))->p_rdymsg = RDY_RESET;
}
/**
@@ -175,7 +175,7 @@ void chSemSignal(Semaphore *sp) {
void chSemSignalI(Semaphore *sp) {
if (sp->s_cnt++ < 0)
- chSchReadyI(fifo_remove(&sp->s_queue), RDY_OK);
+ chSchReadyI(fifo_remove(&sp->s_queue))->p_rdymsg = RDY_OK;
}
#ifdef CH_USE_SEMSW
@@ -191,7 +191,7 @@ void chSemSignalWait(Semaphore *sps, Semaphore *spw) {
chSysLock();
if (sps->s_cnt++ < 0)
- chSchReadyI(fifo_remove(&sps->s_queue), RDY_OK);
+ chSchReadyI(fifo_remove(&sps->s_queue))->p_rdymsg = RDY_OK;
if (--spw->s_cnt < 0) {
fifo_insert(currp, &spw->s_queue);
diff --git a/src/chthreads.c b/src/chthreads.c
index 1dcda4597..9944bedb0 100644
--- a/src/chthreads.c
+++ b/src/chthreads.c
@@ -218,7 +218,7 @@ void chThdExit(msg_t msg) {
currp->p_exitcode = msg;
#ifdef CH_USE_WAITEXIT
while (notempty(&currp->p_waiting))
- chSchReadyI(list_remove(&currp->p_waiting), RDY_OK);
+ chSchReadyI(list_remove(&currp->p_waiting));
#endif
#ifdef CH_USE_EXIT_EVENT
chEvtSendI(&currp->p_exitesource);
diff --git a/src/include/scheduler.h b/src/include/scheduler.h
index 0cd4bff7a..0235a7c97 100644
--- a/src/include/scheduler.h
+++ b/src/include/scheduler.h
@@ -58,7 +58,7 @@ extern ReadyList rlist;
extern "C" {
#endif
void chSchInit(void);
- void chSchReadyI(Thread *tp, msg_t msg);
+ Thread *chSchReadyI(Thread *tp);
void chSchGoSleepS(tstate_t newstate);
msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time);
void chSchWakeupS(Thread *tp, msg_t msg);