1 // Copyright 2018 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #pragma once
6 
7 #include <inc/config.h>
8 #include <targetos.h>
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 // Flags for Semaphore/Queue Mode for Task Queueing
15 #define OS_FIFO 0
16 
17 // Flags for Wait-Option
18 #define WAIT_FOREVER -1
19 
20 typedef struct scb* SEM;  /* Semaphore Control Block */
21 
22 // Semaphore Related Routines
23 SEM semCreate(const char name[8], int init_count, int mode);
24 void semDelete(SEM* semp);
25 void semPost(SEM sem);
26 void semPostBin(SEM sem);
27 int semPend(SEM sem, int wait_opt);
28 int semPendBin(SEM sem, int wait_opt);
29 SEM semGetId(const char name[8]);
30 
31 #define ENOMEM 12 // out of memory
32 
33 #ifdef __cplusplus
34 }
35 #endif
36