1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     svc_Inlines.h
4 
5   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 18179 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_SVC_SVC_INLINES_H_
17 #define NN_SVC_SVC_INLINES_H_
18 
19 #include <nn/types.h>
20 #include <nn/Handle.h>
21 #include <nn/Result.h>
22 #include <nn/svc/svc_Stub.h>
23 #include <nn/os/os_SvcTypes.autogen.h>
24 
25 
26 
27 #ifdef __cplusplus
28 
29 namespace nn {
30 namespace svc {
31 
CreateEvent(Handle * pOut,bool isManualReset)32     inline Result CreateEvent(Handle* pOut, bool isManualReset)
33     {
34         const os::ResetType rt = (isManualReset ? os::RESET_TYPE_STICKY: os::RESET_TYPE_ONESHOT);
35         return CreateEvent(pOut, rt);
36     }
CreateTimer(Handle * pOut,bool isManualReset)37     inline Result CreateTimer(Handle* pOut, bool isManualReset)
38     {
39         const os::ResetType rt = (isManualReset ? os::RESET_TYPE_STICKY: os::RESET_TYPE_ONESHOT);
40         return CreateTimer(pOut, rt);
41     }
WaitSynchronization(s32 * pOut,Handle handles[],s32 numHandles,bool waitAll,s64 timeout)42     inline Result WaitSynchronization(s32* pOut, Handle handles[], s32 numHandles, bool waitAll, s64 timeout)
43     {
44 //        if( numHandles == 1 )
45 //        {
46 //            *pOut = 0;
47 //            return WaitSynchronization1(handles[0], timeout);
48 //        }
49 //        else
50 //        {
51             return WaitSynchronizationN(pOut, handles, numHandles, waitAll, timeout);
52 //        }
53     }
AllocateSharedMemory(Handle * pOut,size_t size,bit32 myPermission,bit32 otherPermission)54     inline Result AllocateSharedMemory(Handle* pOut, size_t size, bit32 myPermission, bit32 otherPermission)
55     {
56         return CreateMemoryBlock(pOut, NULL, size, myPermission, otherPermission);
57     }
MapSharedMemory(Handle sm,uptr addr,bit32 permission)58     inline Result MapSharedMemory(Handle sm, uptr addr, bit32 permission)
59     {
60         const bit32 p2 = (os::MEMORY_PERMISSION_READ | os::MEMORY_PERMISSION_WRITE);
61         return MapMemoryBlock(sm, addr, permission, p2);
62     }
UnmapSharedMemory(Handle sm,uptr addr)63     inline Result UnmapSharedMemory(Handle sm, uptr addr)
64     {
65         return UnmapMemoryBlock(sm, addr);
66     }
67 
68 } // end of namespace svc
69 } // end of namespace nn
70 
71 #endif  // ifdef __cplusplus
72 
73 
74 
75 
76 #endif  // ifndef NN_SVC_SVC_INLINES_H_
77