]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/Common/CommonLib.h
ShellPkg: Fix EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID to match UEFI Shell 2.1 spec
[mirror_edk2.git] / BaseTools / Source / C / Common / CommonLib.h
1 /** @file
2
3 Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 CommonLib.h
15
16 Abstract:
17
18 Common library assistance routines.
19
20 **/
21
22 #ifndef _EFI_COMMON_LIB_H
23 #define _EFI_COMMON_LIB_H
24
25 #include <Common/UefiBaseTypes.h>
26 #include <Common/BuildVersion.h>
27 #define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
28 //
29 // Function declarations
30 //
31 VOID
32 PeiZeroMem (
33 IN VOID *Buffer,
34 IN UINTN Size
35 )
36 ;
37
38 VOID
39 PeiCopyMem (
40 IN VOID *Destination,
41 IN VOID *Source,
42 IN UINTN Length
43 )
44 ;
45
46 VOID
47 ZeroMem (
48 IN VOID *Buffer,
49 IN UINTN Size
50 )
51 ;
52
53 VOID
54 CopyMem (
55 IN VOID *Destination,
56 IN VOID *Source,
57 IN UINTN Length
58 )
59 ;
60
61 INTN
62 CompareGuid (
63 IN EFI_GUID *Guid1,
64 IN EFI_GUID *Guid2
65 )
66 ;
67
68 EFI_STATUS
69 GetFileImage (
70 IN CHAR8 *InputFileName,
71 OUT CHAR8 **InputFileImage,
72 OUT UINT32 *BytesRead
73 )
74 ;
75
76 EFI_STATUS
77 PutFileImage (
78 IN CHAR8 *OutputFileName,
79 IN CHAR8 *OutputFileImage,
80 IN UINT32 BytesToWrite
81 )
82 ;
83 /*++
84
85 Routine Description:
86
87 This function opens a file and writes OutputFileImage into the file.
88
89 Arguments:
90
91 OutputFileName The name of the file to write.
92 OutputFileImage A pointer to the memory buffer.
93 BytesToWrite The size of the memory buffer.
94
95 Returns:
96
97 EFI_SUCCESS The function completed successfully.
98 EFI_INVALID_PARAMETER One of the input parameters was invalid.
99 EFI_ABORTED An error occurred.
100 EFI_OUT_OF_RESOURCES No resource to complete operations.
101
102 **/
103
104 UINT8
105 CalculateChecksum8 (
106 IN UINT8 *Buffer,
107 IN UINTN Size
108 )
109 ;
110
111 UINT8
112 CalculateSum8 (
113 IN UINT8 *Buffer,
114 IN UINTN Size
115 )
116 ;
117
118 UINT16
119 CalculateChecksum16 (
120 IN UINT16 *Buffer,
121 IN UINTN Size
122 )
123 ;
124
125 UINT16
126 CalculateSum16 (
127 IN UINT16 *Buffer,
128 IN UINTN Size
129 )
130 ;
131
132 EFI_STATUS
133 PrintGuid (
134 IN EFI_GUID *Guid
135 )
136 ;
137
138 #define PRINTED_GUID_BUFFER_SIZE 37 // including null-termination
139 EFI_STATUS
140 PrintGuidToBuffer (
141 IN EFI_GUID *Guid,
142 IN OUT UINT8 *Buffer,
143 IN UINT32 BufferLen,
144 IN BOOLEAN Uppercase
145 )
146 ;
147
148 #define ASSERT(x) assert(x)
149
150 #ifdef __GNUC__
151 #include <stdio.h>
152 #include <sys/stat.h>
153 #define stricmp strcasecmp
154 #define _stricmp strcasecmp
155 #define strnicmp strncasecmp
156 #define strcmpi strcasecmp
157 size_t _filelength(int fd);
158 #ifndef __CYGWIN__
159 char *strlwr(char *s);
160 #endif
161 #endif
162
163 //
164 // On windows, mkdir only has one parameter.
165 // On unix, it has two parameters
166 //
167 #if defined(__GNUC__)
168 #define mkdir(dir, perm) mkdir(dir, perm)
169 #else
170 #define mkdir(dir, perm) mkdir(dir)
171 #endif
172
173 #endif