diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-12-16 19:01:30 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-12-16 19:01:30 +0000 |
commit | 430010715e7a9af17185412273165674f3b58f20 (patch) | |
tree | 595c6897e48c954b29cc2b2e03855937f23fc182 /src/chsem.c | |
parent | b196b277b9fe301ee2fa73f45be4d5e55d74e402 (diff) | |
download | ChibiOS-430010715e7a9af17185412273165674f3b58f20.tar.gz ChibiOS-430010715e7a9af17185412273165674f3b58f20.tar.bz2 ChibiOS-430010715e7a9af17185412273165674f3b58f20.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@141 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chsem.c')
-rw-r--r-- | src/chsem.c | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/src/chsem.c b/src/chsem.c index 083e25412..8e5073248 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -225,135 +225,6 @@ void chSemSignalWait(Semaphore *sps, Semaphore *spw) { }
#endif /* CH_USE_SEMSW */
-#ifdef CH_USE_RT_SEMAPHORES
-/*
- * Inserts a thread into a list ordering it by priority.
- * @param tp the pointer to the thread to be inserted in the list
- * @param tqp the pointer to the threads list header
- * @note Usually you dont need to use this function in the user code unless
- * you want to create some custom threads synchronization mechanism.
- */
-static void prioenq(Thread *tp, ThreadsQueue *tqp) {
- Thread *cp;
-
- cp = tqp->p_next;
- while ((cp != (Thread *)tqp) && (cp->p_prio >= tp->p_prio))
- cp = cp->p_next;
- // Insertion on p_prev
- tp->p_prev = (tp->p_next = cp)->p_prev;
- tp->p_prev->p_next = cp->p_prev = tp;
-}
-
-/**
- * Performs a wait operation on a semaphore with priority boost.
- * @param sp pointer to a \p Semaphore structure
- * @note The function is available only if the \p CH_USE_RT_SEMAPHORES
- * option is enabled in \p chconf.h.
- */
-void chSemRaisePrioWait(Semaphore *sp) {
-
- chSysLock();
-
- if (--sp->s_cnt < 0) {
- prioenq(currp, &sp->s_queue);
- currp->p_semp = sp;
- chSchGoSleepS(PRWTSEM);
- }
-
- if (!currp->p_rtcnt++)
- currp->p_prio += MEPRIO;
-
- chSysUnlock();
-}
-
-/**
- * Performs a signal operation on a semaphore with return to normal priority.
- * @param sp pointer to a \p Semaphore structure
- * @note The function is available only if the \p CH_USE_RT_SEMAPHORES
- * option is enabled in \p chconf.h.
- */
-void chSemLowerPrioSignal(Semaphore *sp) {
-
- chSysLock();
-
- if (!--currp->p_rtcnt) {
- currp->p_prio -= MEPRIO;
- if (sp->s_cnt++ < 0)
- chSchReadyI(fifo_remove(&sp->s_queue), RDY_OK);
- chSchRescheduleS();
- }
- else if (sp->s_cnt++ < 0)
- chSchWakeupS(fifo_remove(&sp->s_queue), RDY_OK);
-
- chSysUnlock();
-}
-
-#ifdef CH_USE_SEMSW
-/**
- * Performs atomic signal and wait operations on two semaphores with priority
- * boost.
- * @param sps pointer to a \p Semaphore structure to be signaled
- * @param spw pointer to a \p Semaphore structure to be wait on
- * @note The function is available only if the \p CH_USE_RT_SEMAPHORES
- * option is enabled in \p chconf.h.
- */
-void chSemRaisePrioSignalWait(Semaphore *sps, Semaphore *spw) {
-
- chSysLock();
-
- if (sps->s_cnt++ < 0)
- chSchReadyI(fifo_remove(&sps->s_queue), RDY_OK);
-
- if (--spw->s_cnt < 0) {
- prioenq(currp, &spw->s_queue);
- currp->p_semp = spw;
- chSchGoSleepS(PRWTSEM);
-
- if (!currp->p_rtcnt++)
- currp->p_prio += MEPRIO;
- }
- else {
- if (!currp->p_rtcnt++)
- currp->p_prio += MEPRIO;
-
- chSchRescheduleS(); // Really needed ?
- }
-
- chSysUnlock();
-}
-
-/**
- * Performs atomic signal and wait operations on two semaphores with return
- * to normal priority.
- * @param sps pointer to a \p Semaphore structure to be signaled
- * @param spw pointer to a \p Semaphore structure to be wait on
- * @note The function is available only if the \p CH_USE_RT_SEMAPHORES
- * option is enabled in \p chconf.h.
- */
-void chSemLowerPrioSignalWait(Semaphore *sps, Semaphore *spw) {
-
- chSysLock();
-
- if (!--currp->p_rtcnt)
- currp->p_prio -= MEPRIO;
-
- if (sps->s_cnt++ < 0)
- chSchReadyI(fifo_remove(&sps->s_queue), RDY_OK);
-
- if (--spw->s_cnt < 0) {
- fifo_insert(currp, &spw->s_queue); // fifo_insert() because the spw is a normal sem.
- currp->p_semp = spw;
- chSchGoSleepS(PRWTSEM);
- }
- else
- chSchRescheduleS();
-
- chSysUnlock();
-}
-#endif /* CH_USE_SEMSW */
-
-#endif /* CH_USE_RT_SEMAPHORES */
-
#endif /* CH_USE_SEMAPHORES */
/** @} */
|