1 /*---------------------------------------------------------------------------*
2 
3   Copyright (C) 2010-2011 Nintendo.  All rights reserved.
4 
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law.  They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10 
11  *---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*
13   Project:  OS Semaphore API
14   File:     OSSemaphore.h
15 
16   Copyright (C) 2001 Nintendo.  All rights reserved.
17 
18   These coded instructions, statements, and computer programs contain
19   proprietary information of Nintendo of America Inc. and/or Nintendo
20   Company Ltd., and are protected by Federal copyright law.  They may
21   not be disclosed to third parties or copied or duplicated in any form,
22   in whole or in part, without the prior written consent of Nintendo.
23 
24  *---------------------------------------------------------------------------*/
25 
26 #ifndef __OSSEMAPHORE_H__
27 #define __OSSEMAPHORE_H__
28 
29 #define OSSEMAPHORE_TXT_TAG 0x73506852
30 
31 #include <cafe/os/OSThread.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 typedef struct OSSemaphore
38 {
39     u32           txtTag;           // 'sPhR' 0x73506852
40     char *        name;             // debug name or NULL
41     u32           os_reserved1;
42 
43     s32           count;
44     OSThreadQueue queue;
45 } OSSemaphore;
46 
47 void OSInitSemaphore    ( OSSemaphore* sem, s32 count );
48 void OSInitSemaphoreEx  ( OSSemaphore* sem, s32 count, char * name );
49 
50 s32  OSWaitSemaphore    ( OSSemaphore* sem );
51 s32  OSTryWaitSemaphore ( OSSemaphore* sem );
52 s32  OSSignalSemaphore  ( OSSemaphore* sem );
53 s32  OSGetSemaphoreCount( OSSemaphore* sem );
54 
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif  // __OSSEMAPHORE_H__
61 
62