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

master
gdisirio 2008-03-12 11:24:24 +00:00
parent 7500baf6cd
commit 1422b47cc4
8 changed files with 23 additions and 22 deletions

View File

@ -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

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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();

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);