aboutsummaryrefslogtreecommitdiffstats
path: root/src/chsem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/chsem.c')
-rw-r--r--src/chsem.c129
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 */
/** @} */