1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     os_Memory.h
4   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
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   $Rev: 35674 $
11  *---------------------------------------------------------------------------
12 
13 
14 */
15 
16 /* Please see man pages for details
17 
18 
19 
20 */
21 
22 #ifndef NN_OS_OS_MEMORY_H_
23 #define NN_OS_OS_MEMORY_H_
24 
25 #include <nn/types.h>
26 #include <nn/Handle.h>
27 #include <nn/svc.h>
28 #include <nn/os/CTR/os_MemoryConfig.h>
29 
30 #ifdef __cplusplus
31 
32 #include <nn/util/util_NonCopyable.h>
33 #include <nn/os/os_SvcTypes.autogen.h>
34 #include <nn/util/util_Result.h>
35 
36 #define NN_OS_DEVICE_MEMORY_SIZE (32 * 1024 * 1024) // 32MB
37 
38 namespace nn{ namespace os{
39 
40 /* Please see man pages for details
41 
42 
43 
44 
45 
46 */
47 const size_t DEVICE_MEMORY_SIZE NN_ATTRIBUTE_DEPRECATED = NN_OS_DEVICE_MEMORY_SIZE;
48 
49 /* Please see man pages for details
50 
51 
52 
53 
54 */
55 void InitializeDeviceMemory() NN_ATTRIBUTE_DEPRECATED;
56 
57 /*
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 */
72 void SetupHeapForMemoryBlock(size_t heapSize);
73 
74 
75 
76 
77 /*
78 
79 
80 
81 
82 
83 
84 
85 */
86 uptr GetDeviceMemoryAddress();
87 
88 
89 
90 /*
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 */
101 Result SetDeviceMemorySize(size_t size);
102 
103 
104 
105 /*
106 
107 
108 
109 
110 */
111 size_t GetDeviceMemorySize();
112 
113 
114 
115 /*
116 
117 
118 
119 
120 
121 
122 
123 */
GetHeapAddress()124 inline uptr GetHeapAddress() { return NN_OS_ADDR_HEAP_BEGIN; }
125 
126 
127 
128 /*
129 
130 
131 
132 
133 
134 
135 
136 */
137 Result SetHeapSize(size_t size);
138 
139 
140 
141 /*
142 
143 
144 
145 
146 */
147 size_t GetHeapSize();
148 
149 
150 
151 }} // namespace nn::os
152 
153 #endif // __cplusplus
154 
155 // C declarations follow
156 
157 #include <nn/util/detail/util_CLibImpl.h>
158 
159 /* Please see man pages for details
160 
161 
162 */
163 
164 /* Please see man pages for details
165 
166 */
167 NN_EXTERN_C void nnosInitializeDeviceMemory(void);
168 
169 /* Please see man pages for details
170 
171 */
172 NN_EXTERN_C uptr nnosGetDeviceMemoryAddress(void);
173 
174 /*
175 
176 */
177 
178 /* NN_OS_MEMORY_H_ */
179 #endif /* NN_OS_OS_MEMORY_H_ */
180