git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@430 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
fceb645e35
commit
a474010e54
|
@ -102,10 +102,9 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @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
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
* in the kernel.*/
|
* in the kernel.*/
|
||||||
|
|
|
@ -102,10 +102,9 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @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
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
* in the kernel.*/
|
* in the kernel.*/
|
||||||
|
|
|
@ -102,10 +102,9 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @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
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
* in the kernel.*/
|
* in the kernel.*/
|
||||||
|
|
|
@ -102,7 +102,6 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @note requires \p CH_USE_EVENTS.*/
|
||||||
//#define CH_USE_EXIT_EVENT
|
//#define CH_USE_EXIT_EVENT
|
||||||
|
|
|
@ -102,10 +102,9 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @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
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
* in the kernel.*/
|
* in the kernel.*/
|
||||||
|
|
|
@ -102,10 +102,9 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @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
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
* in the kernel.*/
|
* in the kernel.*/
|
||||||
|
|
|
@ -102,10 +102,9 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @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
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
* in the kernel.*/
|
* in the kernel.*/
|
||||||
|
|
|
@ -102,10 +102,9 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @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
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
* in the kernel.*/
|
* in the kernel.*/
|
||||||
|
|
|
@ -103,10 +103,9 @@
|
||||||
|
|
||||||
/** Configuration option: if specified then the
|
/** Configuration option: if specified then the
|
||||||
* \p chThdGetExitEventSource() function is included in the kernel.
|
* \p chThdGetExitEventSource() function is included in the kernel.
|
||||||
* @deprecated
|
|
||||||
* @note requires \p CH_USE_MESSAGES.
|
* @note requires \p CH_USE_MESSAGES.
|
||||||
* @note requires \p CH_USE_EVENTS.*/
|
* @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
|
/** Configuration option: if specified then the I/O queues APIs are included
|
||||||
* in the kernel.*/
|
* in the kernel.*/
|
||||||
|
|
|
@ -38,10 +38,11 @@
|
||||||
* <li>No static setup at compile time, there is no need to configure a maximum
|
* <li>No static setup at compile time, there is no need to configure a maximum
|
||||||
* number of all the above resources.</li>
|
* number of all the above resources.</li>
|
||||||
* <li>No *need* for a memory allocator, all the kernel structures are static
|
* <li>No *need* for a memory allocator, all the kernel structures are static
|
||||||
* and declaratively allocated. A memory allocator can be used in your
|
* and declaratively allocated.</li>
|
||||||
* application but it is not required by the ChibiOS/RT itself.</li>
|
|
||||||
* <li>Threads, Semaphores, Event Sources, Virtual Timers creation/deletion at
|
* <li>Threads, Semaphores, Event Sources, Virtual Timers creation/deletion at
|
||||||
* runtime.</li>
|
* runtime.</li>
|
||||||
|
* <li>Optional, thread safe, Heap Allocator subsystem.</li>
|
||||||
|
* <li>Optional, thread safe, Memory Pools Allocator subsystem.</li>
|
||||||
* <li>Blocking and non blocking I/O channels with timeout and events generation
|
* <li>Blocking and non blocking I/O channels with timeout and events generation
|
||||||
* capability.</li>
|
* capability.</li>
|
||||||
* <li>Minimal system requirements: about 8KiB ROM with all options enabled and
|
* <li>Minimal system requirements: about 8KiB ROM with all options enabled and
|
||||||
|
|
|
@ -93,13 +93,13 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||||
code to the Thread structure.
|
code to the Thread structure.
|
||||||
- FIX: Corrected the wrong definition of the chThdResumeI() macro.
|
- FIX: Corrected the wrong definition of the chThdResumeI() macro.
|
||||||
- FIX: The API chSemWaitTimeout() was missing in the documentation.
|
- 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
|
- CHANGE: Now the chThdResume() asserts that the thread is in PRSUSPEND state
|
||||||
rather than test it.
|
rather than test it.
|
||||||
- CHANGE: Removed the CH_USE_TERMINATE, CH_USE_SLEEP, CH_USE_SUSPEND and
|
- 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
|
CH_USE_RESUME configuration options in order to make the chconf.h file
|
||||||
simpler. The related functions are very small and almost always required.
|
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
|
- CHANGE: The P_MSGBYPRIO thread option has been removed, now the threads
|
||||||
always serve messages in priority order if the CH_USE_MESSAGES_PRIORITY
|
always serve messages in priority order if the CH_USE_MESSAGES_PRIORITY
|
||||||
configuration option is active.
|
configuration option is active.
|
||||||
|
|
30
src/chmtx.c
30
src/chmtx.c
|
@ -149,8 +149,8 @@ bool_t chMtxTryLockS(Mutex *mp) {
|
||||||
/**
|
/**
|
||||||
* Unlocks the next owned mutex in reverse lock order.
|
* Unlocks the next owned mutex in reverse lock order.
|
||||||
*/
|
*/
|
||||||
void chMtxUnlock(void) {
|
Mutex *chMtxUnlock(void) {
|
||||||
Mutex *mp;
|
Mutex *ump, *mp;
|
||||||
|
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
|
||||||
|
@ -158,16 +158,16 @@ void chMtxUnlock(void) {
|
||||||
"chmtx.c, chMtxUnlock()");
|
"chmtx.c, chMtxUnlock()");
|
||||||
|
|
||||||
/* remove the top Mutex from the Threads's owned mutexes list */
|
/* remove the top Mutex from the Threads's owned mutexes list */
|
||||||
mp = currp->p_mtxlist;
|
ump = currp->p_mtxlist;
|
||||||
currp->p_mtxlist = mp->m_next;
|
currp->p_mtxlist = ump->m_next;
|
||||||
/* mark the Mutex as not owned */
|
/* 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 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 */
|
/* 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.
|
* Recalculates the optimal thread priority by scanning the owned mutexes list.
|
||||||
*/
|
*/
|
||||||
|
@ -187,6 +187,7 @@ void chMtxUnlock(void) {
|
||||||
chSchWakeupS(tp, RDY_OK);
|
chSchWakeupS(tp, RDY_OK);
|
||||||
}
|
}
|
||||||
chSysUnlock();
|
chSysUnlock();
|
||||||
|
return ump;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -195,8 +196,8 @@ void chMtxUnlock(void) {
|
||||||
* block.
|
* block.
|
||||||
* @note This function does not reschedule internally.
|
* @note This function does not reschedule internally.
|
||||||
*/
|
*/
|
||||||
void chMtxUnlockS(void) {
|
Mutex *chMtxUnlockS(void) {
|
||||||
Mutex *mp;
|
Mutex *ump, *mp;
|
||||||
|
|
||||||
chDbgAssert((currp->p_mtxlist != NULL) && (currp->p_mtxlist->m_owner == currp),
|
chDbgAssert((currp->p_mtxlist != NULL) && (currp->p_mtxlist->m_owner == currp),
|
||||||
"chmtx.c, chMtxUnlockS()");
|
"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.
|
* Removes the top Mutex from the owned mutexes list and marks it as not owned.
|
||||||
*/
|
*/
|
||||||
mp = currp->p_mtxlist;
|
ump = currp->p_mtxlist;
|
||||||
currp->p_mtxlist = mp->m_next;
|
currp->p_mtxlist = ump->m_next;
|
||||||
mp->m_owner = NULL;
|
ump->m_owner = NULL;
|
||||||
/*
|
/*
|
||||||
* If a thread is waiting on the mutex then the hard part begins.
|
* If a thread is waiting on the mutex then the hard part begins.
|
||||||
*/
|
*/
|
||||||
if (chMtxQueueNotEmptyS(mp)) {
|
if (chMtxQueueNotEmptyS(ump)) {
|
||||||
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.
|
* Recalculates the optimal thread priority by scanning the owned mutexes list.
|
||||||
*/
|
*/
|
||||||
|
@ -225,6 +226,7 @@ void chMtxUnlockS(void) {
|
||||||
currp->p_prio = newprio;
|
currp->p_prio = newprio;
|
||||||
chSchReadyI(tp);
|
chSchReadyI(tp);
|
||||||
}
|
}
|
||||||
|
return ump;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -46,8 +46,8 @@ extern "C" {
|
||||||
void chMtxLockS(Mutex *mp);
|
void chMtxLockS(Mutex *mp);
|
||||||
bool_t chMtxTryLock(Mutex *mp);
|
bool_t chMtxTryLock(Mutex *mp);
|
||||||
bool_t chMtxTryLockS(Mutex *mp);
|
bool_t chMtxTryLockS(Mutex *mp);
|
||||||
void chMtxUnlock(void);
|
Mutex *chMtxUnlock(void);
|
||||||
void chMtxUnlockS(void);
|
Mutex *chMtxUnlockS(void);
|
||||||
void chMtxUnlockAll(void);
|
void chMtxUnlockAll(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue