diff --git a/readme.txt b/readme.txt index 499345d66..92a80bf84 100644 --- a/readme.txt +++ b/readme.txt @@ -40,7 +40,7 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet. ***************************************************************************** *** 0.5.3 *** -- Removed the chMsgSendTimeout() API, it was conceptually flawed because +- Removed the chMsgSendTimeout() API, it was conceptually flawed because, after sending a message, the sender *has* to wait for the answer or the next sender in queue would receive it instead (the messages server has no way to know that the sender is gone because a timeout). @@ -49,8 +49,9 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet. - Removed the test case for chMsgSendTimeout() from the test suite. - Space saved by reorganizing the timeout code into a single scheduler function. +- Space optimizations in the semaphores code. - The API chThdSleepUntil() become a macro saving some more code space. -- Because all the above changes the kernel code (ARM) is over 600 bytes +- Because all the above changes the kernel code (ARM) is over 700 bytes smaller. *** 0.5.2 *** diff --git a/src/chevents.c b/src/chevents.c index 72ca7c182..9fd2e4543 100644 --- a/src/chevents.c +++ b/src/chevents.c @@ -53,9 +53,9 @@ void chEvtRegister(EventSource *esp, EventListener *elp, t_eventid eid) { * @param elp pointer to the \p EventListener structure * @note If the event listener is not registered on the specified event source * then the function does nothing. - * @note For optimal performance perform the unregister operations in inverse - * order of the register operations (elements are found on top of the - * list). + * @note For optimal performance it is better to perform the unregister + * operations in inverse order of the register operations (elements are + * found on top of the list). */ void chEvtUnregister(EventSource *esp, EventListener *elp) { EventListener *p = (EventListener *)esp; diff --git a/src/chschd.c b/src/chschd.c index 92a0fbb0d..1242ea275 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -90,6 +90,7 @@ void chSchGoSleepS(t_tstate newstate) { chSysSwitchI(otp, currp); } +#ifdef CH_USE_VIRTUAL_TIMERS static void wakeup(void *p) { if (((Thread *)p)->p_state == PRWTSEM) @@ -116,6 +117,7 @@ t_msg chSchGoSleepTimeoutS(t_tstate newstate, t_time time) { chVTResetI(&vt); return currp->p_rdymsg; } +#endif /* CH_USE_VIRTUAL_TIMERS */ /** * Wakeups a thread, the thread is inserted into the ready list or made diff --git a/src/chsem.c b/src/chsem.c index ceaa64399..edec3b5db 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -47,18 +47,11 @@ void chSemInit(Semaphore *sp, t_cnt n) { * \p RDY_RESET. */ void chSemReset(Semaphore *sp, t_cnt n) { - t_cnt cnt; - chDbgAssert(n >= 0, "chsem.c, chSemReset()"); chSysLock(); - cnt = sp->s_cnt; - sp->s_cnt = n; - if (cnt < 0) { - while (cnt++) - chSchReadyI(fifo_remove(&sp->s_queue), RDY_RESET); - chSchRescheduleS(); - } + chSemResetI(sp, n); + chSchRescheduleS(); chSysUnlock(); }