git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@225 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
7500baf6cd
commit
1422b47cc4
|
@ -63,11 +63,13 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not tested on hardware yet.
|
||||||
*** 0.6.1 ***
|
*** 0.6.1 ***
|
||||||
- Removed some redundant checks from the scheduler code: improved threads
|
- Removed some redundant checks from the scheduler code: improved threads
|
||||||
flyback time.
|
flyback time.
|
||||||
- Manual optimization in chSchReadyI(), it seems GCC is missing some obvious
|
- Huge scheduler speed improvement obtained by removing the 2nd parameter to
|
||||||
code optimizations here. Both code size and speed improved.
|
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,
|
- 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
|
the Atmel chip does not require it, the option is still present on the
|
||||||
LPC21xx demos. This saves significant ROM space.
|
LPC21xx demos. This saves significant ROM space.
|
||||||
|
- Fixes to the doxigen documentation.
|
||||||
|
|
||||||
*** 0.6.0 ***
|
*** 0.6.0 ***
|
||||||
- Code refactory, all the old sized-integer definitions like LONG32, UWORD16
|
- Code refactory, all the old sized-integer definitions like LONG32, UWORD16
|
||||||
|
|
|
@ -114,7 +114,7 @@ void chEvtSendI(EventSource *esp) {
|
||||||
|
|
||||||
tp->p_epending |= EventMask(elp->el_id);
|
tp->p_epending |= EventMask(elp->el_id);
|
||||||
if ((tp->p_state == PRWTEVENT) && (tp->p_epending & tp->p_ewmask))
|
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;
|
elp = elp->el_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ msg_t chMsgSend(Thread *tp, msg_t msg) {
|
||||||
currp->p_msg = msg;
|
currp->p_msg = msg;
|
||||||
currp->p_wtthdp = tp;
|
currp->p_wtthdp = tp;
|
||||||
if (tp->p_state == PRWTMSG)
|
if (tp->p_state == PRWTMSG)
|
||||||
chSchReadyI(tp, RDY_OK);
|
chSchReadyI(tp);
|
||||||
chSchGoSleepS(PRSNDMSG);
|
chSchGoSleepS(PRSNDMSG);
|
||||||
msg = currp->p_rdymsg;
|
msg = currp->p_rdymsg;
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ void chMtxLockS(Mutex *mp) {
|
||||||
prio_insert(dequeue(tp), &tp->p_wtthdp->p_msgqueue);
|
prio_insert(dequeue(tp), &tp->p_wtthdp->p_msgqueue);
|
||||||
#endif
|
#endif
|
||||||
case PRREADY:
|
case PRREADY:
|
||||||
chSchReadyI(dequeue(tp), RDY_OK);
|
chSchReadyI(dequeue(tp));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ void chMtxUnlockS(void) {
|
||||||
mp = mp->m_next;
|
mp = mp->m_next;
|
||||||
}
|
}
|
||||||
currp->p_prio = newprio;
|
currp->p_prio = newprio;
|
||||||
chSchReadyI(tp, RDY_OK);
|
chSchReadyI(tp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ void chMtxUnlockAll(void) {
|
||||||
currp->p_mtxlist = mp->m_next;
|
currp->p_mtxlist = mp->m_next;
|
||||||
mp->m_owner = NULL;
|
mp->m_owner = NULL;
|
||||||
if (chMtxQueueNotEmptyS(mp))
|
if (chMtxQueueNotEmptyS(mp))
|
||||||
chSchReadyI(fifo_remove(&mp->m_queue), RDY_OK);
|
chSchReadyI(fifo_remove(&mp->m_queue));
|
||||||
} while (currp->p_mtxlist != NULL);
|
} while (currp->p_mtxlist != NULL);
|
||||||
currp->p_prio = currp->p_realprio;
|
currp->p_prio = currp->p_realprio;
|
||||||
chSchRescheduleS();
|
chSchRescheduleS();
|
||||||
|
|
19
src/chschd.c
19
src/chschd.c
|
@ -45,7 +45,6 @@ void chSchInit(void) {
|
||||||
/**
|
/**
|
||||||
* Inserts a thread in the Ready List.
|
* Inserts a thread in the Ready List.
|
||||||
* @param tp the Thread to be made ready
|
* @param tp the Thread to be made ready
|
||||||
* @param msg message to the awakened thread
|
|
||||||
* @return the Thread pointer
|
* @return the Thread pointer
|
||||||
* @note The function must be called in the system mutex zone.
|
* @note The function must be called in the system mutex zone.
|
||||||
* @note The function does not reschedule, the \p chSchRescheduleS() should
|
* @note The function does not reschedule, the \p chSchRescheduleS() should
|
||||||
|
@ -54,20 +53,21 @@ void chSchInit(void) {
|
||||||
*/
|
*/
|
||||||
#ifdef CH_OPTIMIZE_SPEED
|
#ifdef CH_OPTIMIZE_SPEED
|
||||||
/* NOTE: it is inlined in this module only.*/
|
/* NOTE: it is inlined in this module only.*/
|
||||||
INLINE void chSchReadyI(Thread *tp, msg_t msg) {
|
INLINE Thread *chSchReadyI(Thread *tp) {
|
||||||
#else
|
#else
|
||||||
void chSchReadyI(Thread *tp, msg_t msg) {
|
void chSchReadyI(Thread *tp) {
|
||||||
#endif
|
#endif
|
||||||
Thread *cp;
|
Thread *cp;
|
||||||
|
|
||||||
tp->p_state = PRREADY;
|
tp->p_state = PRREADY;
|
||||||
tp->p_rdymsg = msg;
|
// tp->p_rdymsg = RDY_OK;
|
||||||
cp = rlist.r_queue.p_next;
|
cp = rlist.r_queue.p_next;
|
||||||
while (cp->p_prio >= tp->p_prio)
|
while (cp->p_prio >= tp->p_prio)
|
||||||
cp = cp->p_next;
|
cp = cp->p_next;
|
||||||
/* Insertion on p_prev.*/
|
/* Insertion on p_prev.*/
|
||||||
tp->p_prev = (tp->p_next = cp)->p_prev;
|
tp->p_prev = (tp->p_next = cp)->p_prev;
|
||||||
tp->p_prev->p_next = cp->p_prev = tp;
|
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
|
* priority thread becomes running. The threads states are described into
|
||||||
* \p threads.h
|
* \p threads.h
|
||||||
* @param newstate the new thread state
|
* @param newstate the new thread state
|
||||||
* @return the wakeup message
|
|
||||||
* @note The function must be called in the system mutex zone.
|
* @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.
|
* @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)
|
if (((Thread *)p)->p_state == PRWTSEM)
|
||||||
chSemFastSignalI(((Thread *)p)->p_wtsemp);
|
chSemFastSignalI(((Thread *)p)->p_wtsemp);
|
||||||
#endif
|
#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) {
|
void chSchWakeupS(Thread *ntp, msg_t msg) {
|
||||||
|
|
||||||
|
ntp->p_rdymsg = msg;
|
||||||
if (ntp->p_prio <= currp->p_prio)
|
if (ntp->p_prio <= currp->p_prio)
|
||||||
chSchReadyI(ntp, msg);
|
chSchReadyI(ntp);
|
||||||
else {
|
else {
|
||||||
Thread *otp = currp;
|
Thread *otp = currp;
|
||||||
ntp->p_rdymsg = msg;
|
chSchReadyI(otp);
|
||||||
chSchReadyI(otp, RDY_OK);
|
|
||||||
(currp = ntp)->p_state = PRCURR;
|
(currp = ntp)->p_state = PRCURR;
|
||||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||||
#ifdef CH_USE_TRACE
|
#ifdef CH_USE_TRACE
|
||||||
|
@ -160,7 +159,7 @@ void chSchWakeupS(Thread *ntp, msg_t msg) {
|
||||||
void chSchDoRescheduleI(void) {
|
void chSchDoRescheduleI(void) {
|
||||||
Thread *otp = currp;
|
Thread *otp = currp;
|
||||||
|
|
||||||
chSchReadyI(otp, RDY_OK);
|
chSchReadyI(otp);
|
||||||
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
(currp = fifo_remove(&rlist.r_queue))->p_state = PRCURR;
|
||||||
rlist.r_preempt = CH_TIME_QUANTUM;
|
rlist.r_preempt = CH_TIME_QUANTUM;
|
||||||
#ifdef CH_USE_TRACE
|
#ifdef CH_USE_TRACE
|
||||||
|
|
|
@ -72,7 +72,7 @@ void chSemResetI(Semaphore *sp, cnt_t n) {
|
||||||
cnt = sp->s_cnt;
|
cnt = sp->s_cnt;
|
||||||
sp->s_cnt = n;
|
sp->s_cnt = n;
|
||||||
while (cnt++ < 0)
|
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) {
|
void chSemSignalI(Semaphore *sp) {
|
||||||
|
|
||||||
if (sp->s_cnt++ < 0)
|
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
|
#ifdef CH_USE_SEMSW
|
||||||
|
@ -191,7 +191,7 @@ void chSemSignalWait(Semaphore *sps, Semaphore *spw) {
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
if (sps->s_cnt++ < 0)
|
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) {
|
if (--spw->s_cnt < 0) {
|
||||||
fifo_insert(currp, &spw->s_queue);
|
fifo_insert(currp, &spw->s_queue);
|
||||||
|
|
|
@ -218,7 +218,7 @@ void chThdExit(msg_t msg) {
|
||||||
currp->p_exitcode = msg;
|
currp->p_exitcode = msg;
|
||||||
#ifdef CH_USE_WAITEXIT
|
#ifdef CH_USE_WAITEXIT
|
||||||
while (notempty(&currp->p_waiting))
|
while (notempty(&currp->p_waiting))
|
||||||
chSchReadyI(list_remove(&currp->p_waiting), RDY_OK);
|
chSchReadyI(list_remove(&currp->p_waiting));
|
||||||
#endif
|
#endif
|
||||||
#ifdef CH_USE_EXIT_EVENT
|
#ifdef CH_USE_EXIT_EVENT
|
||||||
chEvtSendI(&currp->p_exitesource);
|
chEvtSendI(&currp->p_exitesource);
|
||||||
|
|
|
@ -58,7 +58,7 @@ extern ReadyList rlist;
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void chSchInit(void);
|
void chSchInit(void);
|
||||||
void chSchReadyI(Thread *tp, msg_t msg);
|
Thread *chSchReadyI(Thread *tp);
|
||||||
void chSchGoSleepS(tstate_t newstate);
|
void chSchGoSleepS(tstate_t newstate);
|
||||||
msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time);
|
msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time);
|
||||||
void chSchWakeupS(Thread *tp, msg_t msg);
|
void chSchWakeupS(Thread *tp, msg_t msg);
|
||||||
|
|
Loading…
Reference in New Issue