1 /*
2 * Copyright 2014, General Dynamics C4 Systems
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7 #pragma once
8
9 #include <types.h>
10 #include <object/structures.h>
11
12 void sendSignal(notification_t *ntfnPtr, word_t badge);
13 void receiveSignal(tcb_t *thread, cap_t cap, bool_t isBlocking);
14 void cancelAllSignals(notification_t *ntfnPtr);
15 void cancelSignal(tcb_t *threadPtr, notification_t *ntfnPtr);
16 void completeSignal(notification_t *ntfnPtr, tcb_t *tcb);
17 void unbindMaybeNotification(notification_t *ntfnPtr);
18 void unbindNotification(tcb_t *tcb);
19 void bindNotification(tcb_t *tcb, notification_t *ntfnPtr);
20 #ifdef CONFIG_KERNEL_MCS
21 void reorderNTFN(notification_t *notification, tcb_t *thread);
22
maybeReturnSchedContext(notification_t * ntfnPtr,tcb_t * tcb)23 static inline void maybeReturnSchedContext(notification_t *ntfnPtr, tcb_t *tcb)
24 {
25
26 sched_context_t *sc = SC_PTR(notification_ptr_get_ntfnSchedContext(ntfnPtr));
27 if (sc != NULL && sc == tcb->tcbSchedContext) {
28 tcb->tcbSchedContext = NULL;
29 sc->scTcb = NULL;
30 /* If the current thread returns its sched context then it should not
31 by default continue running. */
32 if (tcb == NODE_STATE(ksCurThread)) {
33 rescheduleRequired();
34 }
35 }
36 }
37 #endif
38
39
40