xref: /openbmc/libcper/include/libcper/BaseTypes.h (revision 8121f7e95c3040dbeb1b2726d2a53f8a157442a5)
1 /** @file
2   Processor or Compiler specific defines for all supported processors.
3 
4   This file is stand alone self consistent set of definitions.
5 
6   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
7   SPDX-License-Identifier: BSD-2-Clause-Patent
8 
9 **/
10 
11 #ifndef CPER_BASETYPES_H
12 #define CPER_BASETYPES_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <stdint.h>
19 #include <limits.h>
20 
21 ///
22 /// 8-byte unsigned value
23 ///
24 typedef unsigned long long UINT64;
25 ///
26 /// 8-byte signed value
27 ///
28 typedef long long INT64;
29 ///
30 /// 4-byte unsigned value
31 ///
32 typedef unsigned int UINT32;
33 ///
34 /// 4-byte signed value
35 ///
36 typedef int INT32;
37 ///
38 /// 2-byte unsigned value
39 ///
40 typedef unsigned short UINT16;
41 ///
42 /// 2-byte Character.  Unless otherwise specified all strings are stored in the
43 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
44 ///
45 typedef unsigned short CHAR16;
46 ///
47 /// 2-byte signed value
48 ///
49 typedef short INT16;
50 ///
51 /// Logical Boolean.  1-byte value containing 0 for FALSE or a 1 for TRUE.  Other
52 /// values are undefined.
53 ///
54 typedef unsigned char BOOLEAN;
55 ///
56 /// 1-byte unsigned value
57 ///
58 typedef unsigned char UINT8;
59 ///
60 /// 1-byte Character
61 ///
62 typedef char CHAR8;
63 ///
64 /// 1-byte signed value
65 ///
66 typedef signed char INT8;
67 //
68 // Basical data type definitions introduced in UEFI.
69 //
70 typedef struct {
71 	UINT32 Data1;
72 	UINT16 Data2;
73 	UINT16 Data3;
74 	UINT8 Data4[8];
75 } EFI_GUID;
76 
77 /**
78   Returns a 16-bit signature built from 2 ASCII characters.
79 
80   This macro returns a 16-bit value built from the two ASCII characters specified
81   by A and B.
82 
83   @param  A    The first ASCII character.
84   @param  B    The second ASCII character.
85 
86   @return A 16-bit value built from the two ASCII characters specified by A and B.
87 
88 **/
89 #define SIGNATURE_16(A, B) ((A) | ((B) << 8))
90 /**
91   Returns a 32-bit signature built from 4 ASCII characters.
92 
93   This macro returns a 32-bit value built from the four ASCII characters specified
94   by A, B, C, and D.
95 
96   @param  A    The first ASCII character.
97   @param  B    The second ASCII character.
98   @param  C    The third ASCII character.
99   @param  D    The fourth ASCII character.
100 
101   @return A 32-bit value built from the two ASCII characters specified by A, B,
102           C and D.
103 
104 **/
105 #define SIGNATURE_32(A, B, C, D)                                               \
106 	(SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16))
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif
113