1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     types.h
4 
5   Copyright (C) Nintendo.  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: 51157 $
14  *---------------------------------------------------------------------------*/
15 
16 /*!
17     @file
18 
19     :include nn/types.h
20 */
21 
22 #ifndef NN_TYPES_H_
23 #define NN_TYPES_H_
24 
25 
26 // TORIAEZU: Transition period provision.
27 #ifdef  SDK_ASM
28     #define NN_SWITCH_INCLUDE_FROM_NON_C
29 #endif
30 
31 
32 #ifdef  NN_SWITCH_INCLUDE_FROM_NON_C
33 #else  // ifdef NN_SWITCH_INCLUDE_FROM_NON_C
34 
35 	#if !defined(_MSC_VER) || (1500 < _MSC_VER && _MSC_VER < 1700 )
36 	    #include <inttypes.h>
37 	#endif
38 
39     #include <stddef.h>
40     #include <stdarg.h>
41 
42     #ifndef __cplusplus
43         #include <stdbool.h>
44     #endif
45 
46 
47 	#include <types.h>
48 
49 //! @addtogroup  nn_types  Basic type definitions.
50 //! @brief  These are the definitions of basic types used by the SDK.
51 //! @{
52 
53 #if 0
54     //! 8-bit unsigned integer type.
55     typedef unsigned char           u8;
56     //! 16-bit unsigned integer type.
57     typedef unsigned short int      u16;
58     //! 32-bit unsigned integer type.
59     typedef unsigned int            u32;
60     //! 64-bit unsigned integer type.
61     typedef unsigned long long int  u64;
62 
63     //! 8-bit signed integer type.
64     typedef signed char             s8;
65     //! 16-bit signed integer type.
66     typedef signed short int        s16;
67     //! 32-bit signed integer type.
68     typedef signed int              s32;
69     //! 64-bit signed integer type.
70     typedef signed long long int    s64;
71 #endif
72 
73     //! Signed address integer type.
74     typedef intptr_t                sptr;
75     //! Unsigned address integer type.
76     typedef uintptr_t               uptr;
77 
78     //! 8-bit character type.
79     typedef char                    char8;
80     //! 16-bit character type.
81 #ifndef __CHAR16_DEFINED
82     typedef wchar_t                 char16;
83 #define __CHAR16_DEFINED
84 #endif
85 
86 #if 0
87     typedef volatile u8             vu8;
88     typedef volatile u16            vu16;
89     typedef volatile u32            vu32;
90     typedef volatile u64            vu64;
91 
92     typedef volatile s8             vs8;
93     typedef volatile s16            vs16;
94     typedef volatile s32            vs32;
95     typedef volatile s64            vs64;
96 #endif
97 
98 #ifdef  NN_SWITCH_INCLUDE_FROM_NON_C
99     //! Single-precision floating-point value type.
100     typedef float                   f32;
101     //! Double-precision floating-point value type.
102     typedef double                  f64;
103 
104     typedef volatile f32            vf32;
105     typedef volatile f64            vf64;
106 #endif // NN_SWITCH_INCLUDE_FROM_NON_C
107 
108     //! 8-bit data type.
109     typedef unsigned char           bit8;
110     //! 16-bit data type.
111     typedef unsigned short          bit16;
112     //! 32-bit data type.
113     typedef unsigned int            bit32;
114     //! 64-bit data type.
115     typedef unsigned long long int  bit64;
116 
117 //! @}
118 
119 
120     /*
121         Macros and types used with <tt>io_register_list_XX.h</tt>
122 */
123 
124     typedef u8      REGType8;
125     typedef u16     REGType16;
126     typedef u32     REGType32;
127     typedef u64     REGType64;
128 
129     typedef vu8     REGType8v;
130     typedef vu16    REGType16v;
131     typedef vu32    REGType32v;
132     typedef vu64    REGType64v;
133 
134     #ifdef __cplusplus
135     namespace nn
136     {
137         typedef bit64 ProgramId;
138         typedef bit64 TitleId;
139 
140         struct ProductCode
141         {
142             char    code[16];
143         };
144 
145         struct ProductInfo
146         {
147             char    productCode[16];
148             bit16   companyCode;
149             u16     remasterVersion;
150         };
151     }
152     #endif
153 
154 #endif // ifdef NN_SWITCH_INCLUDE_FROM_NON_C else
155 
156 #ifndef IOP_BUILD
157 #include <cafe/base/ppc_asm_user.h>
158 #undef CTR
159 
160 #endif
161 
162 /* NN_TYPES_H_ */
163 #endif
164