]>
Commit | Line | Data |
---|---|---|
93e3992d | 1 | /**@file |
2 | Copyright (c) 2007, Intel Corporation | |
3 | ||
4 | All rights reserved. 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 | ||
13 | **/ | |
14 | ||
15 | #ifndef __R8_LIB_H__ | |
16 | #define __R8_LIB_H__ | |
17 | ||
18 | ||
19 | /** | |
20 | Compare whether two names of languages are identical. | |
21 | ||
22 | @param Language1 Name of language 1 | |
23 | @param Language2 Name of language 2 | |
24 | ||
25 | @retval TRUE same | |
26 | @retval FALSE not same | |
27 | ||
28 | **/ | |
29 | BOOLEAN | |
30 | R8_EfiLibCompareLanguage ( | |
31 | IN CHAR8 *Language1, | |
32 | IN CHAR8 *Language2 | |
33 | ) | |
34 | ; | |
35 | ||
36 | ||
37 | ||
38 | ||
39 | /** | |
40 | Converts binary buffer to Unicode string. | |
41 | At a minimum, any blob of data could be represented as a hex string. | |
42 | ||
43 | @param Str Pointer to the string. | |
44 | @param HexStringBufferLength Length in bytes of buffer to hold the hex string. | |
45 | Includes tailing '\0' character. If routine return | |
46 | with EFI_SUCCESS, containing length of hex string | |
47 | buffer. If routine return with | |
48 | EFI_BUFFER_TOO_SMALL, containg length of hex | |
49 | string buffer desired. | |
50 | @param Buf Buffer to be converted from. | |
51 | @param Len Length in bytes of the buffer to be converted. | |
52 | ||
53 | @retval EFI_SUCCESS Routine success. | |
54 | @retval EFI_BUFFER_TOO_SMALL The hex string buffer is too small. | |
55 | ||
56 | **/ | |
57 | EFI_STATUS | |
58 | R8_BufToHexString ( | |
59 | IN OUT CHAR16 *Str, | |
60 | IN OUT UINTN *HexStringBufferLength, | |
61 | IN UINT8 *Buf, | |
62 | IN UINTN Len | |
63 | ) | |
64 | ; | |
65 | ||
66 | ||
67 | ||
68 | ||
69 | /** | |
70 | Converts Unicode string to binary buffer. | |
71 | The conversion may be partial. | |
72 | The first character in the string that is not hex digit stops the conversion. | |
73 | At a minimum, any blob of data could be represented as a hex string. | |
74 | ||
75 | @param Buf Pointer to buffer that receives the data. | |
76 | @param Len Length in bytes of the buffer to hold converted | |
77 | data. If routine return with EFI_SUCCESS, | |
78 | containing length of converted data. If routine | |
79 | return with EFI_BUFFER_TOO_SMALL, containg length | |
80 | of buffer desired. | |
81 | @param Str String to be converted from. | |
82 | @param ConvertedStrLen Length of the Hex String consumed. | |
83 | ||
84 | @retval EFI_SUCCESS Routine Success. | |
85 | @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold converted data. | |
86 | ||
87 | **/ | |
88 | EFI_STATUS | |
89 | R8_HexStringToBuf ( | |
90 | IN OUT UINT8 *Buf, | |
91 | IN OUT UINTN *Len, | |
92 | IN CHAR16 *Str, | |
93 | OUT UINTN *ConvertedStrLen OPTIONAL | |
94 | ) | |
95 | ; | |
96 | ||
97 | ||
98 | ||
99 | ||
100 | /** | |
101 | Determines if a Unicode character is a hexadecimal digit. | |
102 | The test is case insensitive. | |
103 | ||
104 | @param Digit Pointer to byte that receives the value of the hex | |
105 | character. | |
106 | @param Char Unicode character to test. | |
107 | ||
108 | @retval TRUE If the character is a hexadecimal digit. | |
109 | @retval FALSE Otherwise. | |
110 | ||
111 | **/ | |
112 | BOOLEAN | |
113 | R8_IsHexDigit ( | |
114 | OUT UINT8 *Digit, | |
115 | IN CHAR16 Char | |
116 | ) | |
117 | ; | |
118 | ||
119 | ||
120 | #endif | |
121 |