From a474010e54534785366d1924554f5452725499b0 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 11 Sep 2008 15:03:25 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@430 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-AT91SAM7X-GCC/chconf.h | 3 +-- demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h | 3 +-- demos/ARM7-LPC214x-G++/chconf.h | 3 +-- demos/ARM7-LPC214x-GCC-minimal/chconf.h | 1 - demos/ARM7-LPC214x-GCC/chconf.h | 3 +-- demos/ARMCM3-STM32F103-GCC/chconf.h | 3 +-- demos/AVR-AT90CANx-GCC/chconf.h | 3 +-- demos/AVR-ATmega128-GCC/chconf.h | 3 +-- demos/MSP430-MSP430x1611-GCC/chconf.h | 3 +-- docs/ch.txt | 5 +++-- readme.txt | 4 ++-- src/chmtx.c | 30 ++++++++++++++++-------------- src/include/mutexes.h | 4 ++-- 13 files changed, 31 insertions(+), 37 deletions(-) diff --git a/demos/ARM7-AT91SAM7X-GCC/chconf.h b/demos/ARM7-AT91SAM7X-GCC/chconf.h index 181dde8f4..57cc9d013 100644 --- a/demos/ARM7-AT91SAM7X-GCC/chconf.h +++ b/demos/ARM7-AT91SAM7X-GCC/chconf.h @@ -102,10 +102,9 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ -//#define CH_USE_EXIT_EVENT +#define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h b/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h index 181dde8f4..57cc9d013 100644 --- a/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h +++ b/demos/ARM7-AT91SAM7X-WEB-GCC/chconf.h @@ -102,10 +102,9 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ -//#define CH_USE_EXIT_EVENT +#define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ diff --git a/demos/ARM7-LPC214x-G++/chconf.h b/demos/ARM7-LPC214x-G++/chconf.h index 8ac22dec5..292074816 100644 --- a/demos/ARM7-LPC214x-G++/chconf.h +++ b/demos/ARM7-LPC214x-G++/chconf.h @@ -102,10 +102,9 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ -//#define CH_USE_EXIT_EVENT +#define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ diff --git a/demos/ARM7-LPC214x-GCC-minimal/chconf.h b/demos/ARM7-LPC214x-GCC-minimal/chconf.h index fbd6f7d0e..206272504 100644 --- a/demos/ARM7-LPC214x-GCC-minimal/chconf.h +++ b/demos/ARM7-LPC214x-GCC-minimal/chconf.h @@ -102,7 +102,6 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ //#define CH_USE_EXIT_EVENT diff --git a/demos/ARM7-LPC214x-GCC/chconf.h b/demos/ARM7-LPC214x-GCC/chconf.h index 181dde8f4..57cc9d013 100644 --- a/demos/ARM7-LPC214x-GCC/chconf.h +++ b/demos/ARM7-LPC214x-GCC/chconf.h @@ -102,10 +102,9 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ -//#define CH_USE_EXIT_EVENT +#define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ diff --git a/demos/ARMCM3-STM32F103-GCC/chconf.h b/demos/ARMCM3-STM32F103-GCC/chconf.h index 181dde8f4..57cc9d013 100644 --- a/demos/ARMCM3-STM32F103-GCC/chconf.h +++ b/demos/ARMCM3-STM32F103-GCC/chconf.h @@ -102,10 +102,9 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ -//#define CH_USE_EXIT_EVENT +#define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ diff --git a/demos/AVR-AT90CANx-GCC/chconf.h b/demos/AVR-AT90CANx-GCC/chconf.h index 1d9f2acff..eca46b974 100644 --- a/demos/AVR-AT90CANx-GCC/chconf.h +++ b/demos/AVR-AT90CANx-GCC/chconf.h @@ -102,10 +102,9 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ -//#define CH_USE_EXIT_EVENT +#define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ diff --git a/demos/AVR-ATmega128-GCC/chconf.h b/demos/AVR-ATmega128-GCC/chconf.h index 736c4064e..c44cd39d5 100644 --- a/demos/AVR-ATmega128-GCC/chconf.h +++ b/demos/AVR-ATmega128-GCC/chconf.h @@ -102,10 +102,9 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ -//#define CH_USE_EXIT_EVENT +#define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ diff --git a/demos/MSP430-MSP430x1611-GCC/chconf.h b/demos/MSP430-MSP430x1611-GCC/chconf.h index feb1a78ab..0d1773a6a 100644 --- a/demos/MSP430-MSP430x1611-GCC/chconf.h +++ b/demos/MSP430-MSP430x1611-GCC/chconf.h @@ -103,10 +103,9 @@ /** Configuration option: if specified then the * \p chThdGetExitEventSource() function is included in the kernel. - * @deprecated * @note requires \p CH_USE_MESSAGES. * @note requires \p CH_USE_EVENTS.*/ -//#define CH_USE_EXIT_EVENT +#define CH_USE_EXIT_EVENT /** Configuration option: if specified then the I/O queues APIs are included * in the kernel.*/ diff --git a/docs/ch.txt b/docs/ch.txt index 307dc6765..8ad0db828 100644 --- a/docs/ch.txt +++ b/docs/ch.txt @@ -38,10 +38,11 @@ *
  • No static setup at compile time, there is no need to configure a maximum * number of all the above resources.
  • *
  • No *need* for a memory allocator, all the kernel structures are static - * and declaratively allocated. A memory allocator can be used in your - * application but it is not required by the ChibiOS/RT itself.
  • + * and declaratively allocated. *
  • Threads, Semaphores, Event Sources, Virtual Timers creation/deletion at * runtime.
  • + *
  • Optional, thread safe, Heap Allocator subsystem.
  • + *
  • Optional, thread safe, Memory Pools Allocator subsystem.
  • *
  • Blocking and non blocking I/O channels with timeout and events generation * capability.
  • *
  • Minimal system requirements: about 8KiB ROM with all options enabled and diff --git a/readme.txt b/readme.txt index a05b811b0..b900210f8 100644 --- a/readme.txt +++ b/readme.txt @@ -93,13 +93,13 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, code to the Thread structure. - FIX: Corrected the wrong definition of the chThdResumeI() macro. - FIX: The API chSemWaitTimeout() was missing in the documentation. +- CHANGE: Modified the chMtxUnlock() and chMtxUnlockS() APIs to return the + pointer to the released mutex instead of void. - CHANGE: Now the chThdResume() asserts that the thread is in PRSUSPEND state rather than test it. - CHANGE: Removed the CH_USE_TERMINATE, CH_USE_SLEEP, CH_USE_SUSPEND and CH_USE_RESUME configuration options in order to make the chconf.h file simpler. The related functions are very small and almost always required. -- CHANGE: The CH_USE_EXIT_EVENT configuration option and related functions are - now deprecated. - CHANGE: The P_MSGBYPRIO thread option has been removed, now the threads always serve messages in priority order if the CH_USE_MESSAGES_PRIORITY configuration option is active. diff --git a/src/chmtx.c b/src/chmtx.c index 7ab8ae613..f5dbaca43 100644 --- a/src/chmtx.c +++ b/src/chmtx.c @@ -149,8 +149,8 @@ bool_t chMtxTryLockS(Mutex *mp) { /** * Unlocks the next owned mutex in reverse lock order. */ -void chMtxUnlock(void) { - Mutex *mp; +Mutex *chMtxUnlock(void) { + Mutex *ump, *mp; chSysLock(); @@ -158,16 +158,16 @@ void chMtxUnlock(void) { "chmtx.c, chMtxUnlock()"); /* remove the top Mutex from the Threads's owned mutexes list */ - mp = currp->p_mtxlist; - currp->p_mtxlist = mp->m_next; + ump = currp->p_mtxlist; + currp->p_mtxlist = ump->m_next; /* mark the Mutex as not owned */ - mp->m_owner = NULL; + ump->m_owner = NULL; /* * If a thread is waiting on the mutex then the hard part begins. */ - if (chMtxQueueNotEmptyS(mp)) { + if (chMtxQueueNotEmptyS(ump)) { /* get the highest priority thread waiting for the unlocked mutex */ - Thread *tp = fifo_remove(&mp->m_queue); + Thread *tp = fifo_remove(&ump->m_queue); /* * Recalculates the optimal thread priority by scanning the owned mutexes list. */ @@ -187,6 +187,7 @@ void chMtxUnlock(void) { chSchWakeupS(tp, RDY_OK); } chSysUnlock(); + return ump; } /** @@ -195,8 +196,8 @@ void chMtxUnlock(void) { * block. * @note This function does not reschedule internally. */ -void chMtxUnlockS(void) { - Mutex *mp; +Mutex *chMtxUnlockS(void) { + Mutex *ump, *mp; chDbgAssert((currp->p_mtxlist != NULL) && (currp->p_mtxlist->m_owner == currp), "chmtx.c, chMtxUnlockS()"); @@ -204,14 +205,14 @@ void chMtxUnlockS(void) { /* * Removes the top Mutex from the owned mutexes list and marks it as not owned. */ - mp = currp->p_mtxlist; - currp->p_mtxlist = mp->m_next; - mp->m_owner = NULL; + ump = currp->p_mtxlist; + currp->p_mtxlist = ump->m_next; + ump->m_owner = NULL; /* * If a thread is waiting on the mutex then the hard part begins. */ - if (chMtxQueueNotEmptyS(mp)) { - Thread *tp = fifo_remove(&mp->m_queue); + if (chMtxQueueNotEmptyS(ump)) { + Thread *tp = fifo_remove(&ump->m_queue); /* * Recalculates the optimal thread priority by scanning the owned mutexes list. */ @@ -225,6 +226,7 @@ void chMtxUnlockS(void) { currp->p_prio = newprio; chSchReadyI(tp); } + return ump; } /** diff --git a/src/include/mutexes.h b/src/include/mutexes.h index 3a550dc76..dcb2039ff 100644 --- a/src/include/mutexes.h +++ b/src/include/mutexes.h @@ -46,8 +46,8 @@ extern "C" { void chMtxLockS(Mutex *mp); bool_t chMtxTryLock(Mutex *mp); bool_t chMtxTryLockS(Mutex *mp); - void chMtxUnlock(void); - void chMtxUnlockS(void); + Mutex *chMtxUnlock(void); + Mutex *chMtxUnlockS(void); void chMtxUnlockAll(void); #ifdef __cplusplus } -- cgit v1.2.3