aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-06-02 11:17:33 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-06-02 11:17:33 +0000
commit4ee79187645d1a2687f81de3f19320acbce733c8 (patch)
tree08cd2209833aa2982220a6320b63bd950ccf6dc5
parentbf019ef89dcbb31160f8c7dd4a4a2dc3f2ee1a22 (diff)
downloadChibiOS-4ee79187645d1a2687f81de3f19320acbce733c8.tar.gz
ChibiOS-4ee79187645d1a2687f81de3f19320acbce733c8.tar.bz2
ChibiOS-4ee79187645d1a2687f81de3f19320acbce733c8.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1982 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--docs/reports/kernel.txt36
-rw-r--r--os/kernel/src/chsem.c8
-rw-r--r--readme.txt1
3 files changed, 23 insertions, 22 deletions
diff --git a/docs/reports/kernel.txt b/docs/reports/kernel.txt
index 1e29c5269..7f28feee6 100644
--- a/docs/reports/kernel.txt
+++ b/docs/reports/kernel.txt
@@ -20,13 +20,13 @@ Platform : PowerPC
OS Setup : Full kernel
Compiler : powerpc-eabi-gcc (Sourcery G++ Lite 4.4-79) 4.4.1
Options : -Os -DCH_OPTIMIZE_SPEED=TRUE
-Kernel Size = 9576
+Kernel Size = 9572
Platform : PowerPC
OS Setup : Full kernel
Compiler : powerpc-eabi-gcc (Sourcery G++ Lite 4.4-79) 4.4.1
Options : -Os -DCH_OPTIMIZE_SPEED=FALSE
-Kernel Size = 9092
+Kernel Size = 9088
Platform : PowerPC
OS Setup : Minimal kernel
@@ -38,13 +38,13 @@ Platform : ARM Cortex-M3
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=TRUE
-Kernel Size = 5748
+Kernel Size = 5752
Platform : ARM Cortex-M3
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=FALSE
-Kernel Size = 5280
+Kernel Size = 5284
Platform : ARM Cortex-M3
OS Setup : Minimal kernel
@@ -92,13 +92,13 @@ Platform : ARM Cortex-M0
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=TRUE
-Kernel Size = 5060
+Kernel Size = 5064
Platform : ARM Cortex-M0
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=FALSE
-Kernel Size = 4872
+Kernel Size = 4876
Platform : ARM Cortex-M0
OS Setup : Minimal kernel
@@ -128,13 +128,13 @@ Platform : ARM7TDMI (ARM mode)
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -DCH_OPTIMIZE_SPEED=TRUE
-Kernel Size = 8380
+Kernel Size = 8388
Platform : ARM7TDMI (ARM mode)
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -DCH_OPTIMIZE_SPEED=FALSE
-Kernel Size = 7928
+Kernel Size = 7936
Platform : ARM7TDMI (ARM mode)
OS Setup : Minimal kernel
@@ -164,13 +164,13 @@ Platform : ARM7TDMI (ARM mode)
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=TRUE
-Kernel Size = 8100
+Kernel Size = 8108
Platform : ARM7TDMI (ARM mode)
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=FALSE
-Kernel Size = 7660
+Kernel Size = 7668
Platform : ARM7TDMI (ARM mode)
OS Setup : Minimal kernel
@@ -200,13 +200,13 @@ Platform : ARM7TDMI (THUMB mode)
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=TRUE -DTHUMB -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING
-Kernel Size = 5604
+Kernel Size = 5608
Platform : ARM7TDMI (THUMB mode)
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -mthumb -DCH_OPTIMIZE_SPEED=FALSE -DTHUMB -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING
-Kernel Size = 5396
+Kernel Size = 5400
Platform : ARM7TDMI (THUMB mode)
OS Setup : Minimal kernel
@@ -236,13 +236,13 @@ Platform : ARM7TDMI (THUMB mode)
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -mthumb -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=TRUE -DTHUMB -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING
-Kernel Size = 5456
+Kernel Size = 5460
Platform : ARM7TDMI (THUMB mode)
OS Setup : Full kernel
Compiler : arm-none-eabi-gcc (GCC) 4.5.0
Options : -O2 -mthumb -ffixed-r7 -DCH_CURRP_REGISTER_CACHE=\"r7\" -DCH_OPTIMIZE_SPEED=FALSE -DTHUMB -DTHUMB_PRESENT -DTHUMB_NO_INTERWORKING
-Kernel Size = 5264
+Kernel Size = 5268
Platform : ARM7TDMI (THUMB mode)
OS Setup : Minimal kernel
@@ -272,13 +272,13 @@ Platform : MSP430
OS Setup : Full kernel
Compiler : msp430-gcc (GCC) 3.2.3
Options : -O2 -DCH_OPTIMIZE_SPEED=TRUE
-Kernel Size = 5556
+Kernel Size = 5544
Platform : MSP430
OS Setup : Full kernel
Compiler : msp430-gcc (GCC) 3.2.3
Options : -O2 -DCH_OPTIMIZE_SPEED=FALSE
-Kernel Size = 5032
+Kernel Size = 5008
Platform : MSP430
OS Setup : Minimal kernel
@@ -290,13 +290,13 @@ Platform : MSP430
OS Setup : Full kernel
Compiler : msp430-gcc (GCC) 3.2.3
Options : -Os -DCH_OPTIMIZE_SPEED=TRUE
-Kernel Size = 5492
+Kernel Size = 5480
Platform : MSP430
OS Setup : Full kernel
Compiler : msp430-gcc (GCC) 3.2.3
Options : -Os -DCH_OPTIMIZE_SPEED=FALSE
-Kernel Size = 4988
+Kernel Size = 4964
Platform : MSP430
OS Setup : Minimal kernel
diff --git a/os/kernel/src/chsem.c b/os/kernel/src/chsem.c
index 2a86a14f6..2959b4d63 100644
--- a/os/kernel/src/chsem.c
+++ b/os/kernel/src/chsem.c
@@ -117,7 +117,7 @@ void chSemResetI(Semaphore *sp, cnt_t n) {
cnt = sp->s_cnt;
sp->s_cnt = n;
- while (cnt++ < 0)
+ while (++cnt <= 0)
chSchReadyI(lifo_remove(&sp->s_queue))->p_u.rdymsg = RDY_RESET;
}
@@ -220,7 +220,7 @@ void chSemSignal(Semaphore *sp) {
chDbgCheck(sp != NULL, "chSemSignal");
chSysLock();
- if (sp->s_cnt++ < 0)
+ if (++sp->s_cnt <= 0)
chSchWakeupS(fifo_remove(&sp->s_queue), RDY_OK);
chSysUnlock();
}
@@ -235,7 +235,7 @@ void chSemSignalI(Semaphore *sp) {
chDbgCheck(sp != NULL, "chSemSignalI");
- if (sp->s_cnt++ < 0) {
+ if (++sp->s_cnt <= 0) {
/* note, it is done this way in order to allow a tail call on
chSchReadyI().*/
Thread *tp = fifo_remove(&sp->s_queue);
@@ -261,7 +261,7 @@ msg_t chSemSignalWait(Semaphore *sps, Semaphore *spw) {
chDbgCheck((sps != NULL) && (spw != NULL), "chSemSignalWait");
chSysLock();
- if (sps->s_cnt++ < 0)
+ if (++sps->s_cnt <= 0)
chSchReadyI(fifo_remove(&sps->s_queue))->p_u.rdymsg = RDY_OK;
if (--spw->s_cnt < 0) {
Thread *ctp = currp;
diff --git a/readme.txt b/readme.txt
index 8dca85605..5e9768656 100644
--- a/readme.txt
+++ b/readme.txt
@@ -60,6 +60,7 @@
*** 1.5.9 ***
- FIX: Fixed STM8 UART3 driver (bug 3009145).
+- OPT: Small size optimization in the semaphores subsystem.
*** 1.5.8 ***
- FIX: Fixed missing files from ST library zip file (bug 3006629).