aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-03-11 16:42:20 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2008-03-11 16:42:20 +0000
commit869cacb3d442841c83034736e1f1702fc9bb2d8e (patch)
treeb555a8ee87081ec068929e1bdd082319744f7153
parent88c256ae5265f5d6a7ffa25dc17f693e036256bf (diff)
downloadChibiOS-869cacb3d442841c83034736e1f1702fc9bb2d8e.tar.gz
ChibiOS-869cacb3d442841c83034736e1f1702fc9bb2d8e.tar.bz2
ChibiOS-869cacb3d442841c83034736e1f1702fc9bb2d8e.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@223 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--readme.txt2
-rw-r--r--src/chschd.c5
-rw-r--r--src/include/threads.h24
3 files changed, 16 insertions, 15 deletions
diff --git a/readme.txt b/readme.txt
index 537642ebb..00a8baabe 100644
--- a/readme.txt
+++ b/readme.txt
@@ -65,6 +65,8 @@ 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.
- 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.
diff --git a/src/chschd.c b/src/chschd.c
index b7f52c96d..7c45e009e 100644
--- a/src/chschd.c
+++ b/src/chschd.c
@@ -24,7 +24,7 @@
#include <ch.h>
-/** @cond never*/
+/** @cond never */
ReadyList rlist;
/** @endcond */
@@ -58,10 +58,11 @@ INLINE void chSchReadyI(Thread *tp, msg_t msg) {
#else
void chSchReadyI(Thread *tp, msg_t msg) {
#endif
- Thread *cp = rlist.r_queue.p_next;
+ Thread *cp;
tp->p_state = PRREADY;
tp->p_rdymsg = msg;
+ cp = rlist.r_queue.p_next;
while (cp->p_prio >= tp->p_prio)
cp = cp->p_next;
/* Insertion on p_prev.*/
diff --git a/src/include/threads.h b/src/include/threads.h
index 11674b322..d9bb467b9 100644
--- a/src/include/threads.h
+++ b/src/include/threads.h
@@ -107,30 +107,28 @@ struct Thread {
#endif
};
-/** Thread state: Reserved.*/
-#define PRFREE 0
+/** Thread state: Thread in the ready list.*/
+#define PRREADY 0
/** Thread state: Current.*/
#define PRCURR 1
-/** Thread state: Thread in the ready list.*/
-#define PRREADY 2
/** Thread state: Thread created in suspended state.*/
-#define PRSUSPENDED 3
+#define PRSUSPENDED 2
/** Thread state: Waiting on a semaphore.*/
-#define PRWTSEM 4
+#define PRWTSEM 3
/** Thread state: Waiting on a mutex.*/
-#define PRWTMTX 5
+#define PRWTMTX 4
/** Thread state: Waiting in \p chThdSleep() or \p chThdSleepUntil().*/
-#define PRSLEEP 6
+#define PRSLEEP 5
/** Thread state: Waiting in \p chThdWait().*/
-#define PRWAIT 7
+#define PRWAIT 6
/** Thread state: Waiting in \p chEvtWait().*/
-#define PRWTEVENT 8
+#define PRWTEVENT 7
/** Thread state: Waiting in \p chMsgSend().*/
-#define PRSNDMSG 9
+#define PRSNDMSG 8
/** Thread state: Waiting in \p chMsgWait().*/
-#define PRWTMSG 10
+#define PRWTMSG 9
/** Thread state: After termination.*/
-#define PREXIT 11
+#define PREXIT 10
#ifdef CH_USE_TERMINATE
/** Thread option: Termination requested flag.*/