]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
3e99020d | 3 | Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r |
4ea9375a | 4 | This program and the accompanying materials \r |
3eb9473e | 5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | EfiUiLib.h\r | |
14 | \r | |
15 | Abstract:\r | |
16 | Collection of usefull UI functions.\r | |
17 | \r | |
18 | Revision History:\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | #ifndef _EFI_UI_LIB_H_\r | |
23 | #define _EFI_UI_LIB_H_\r | |
24 | \r | |
25 | #include "Tiano.h"\r | |
26 | #include "TianoTypes.h"\r | |
27 | #include "EfiDriverLib.h"\r | |
28 | \r | |
29 | CHAR16 *\r | |
30 | StrHzToString (\r | |
31 | OUT CHAR16 *String,\r | |
32 | IN UINT64 Val\r | |
33 | )\r | |
34 | /*++\r | |
35 | \r | |
36 | Routine Description:\r | |
37 | Converts frequency in Hz to Unicode string. \r | |
38 | Three significant digits are delivered. Used for processor info display.\r | |
39 | \r | |
40 | Arguments:\r | |
41 | String - string that will contain the frequency.\r | |
42 | Val - value to convert, minimum is 100000 i.e., 0.1 MHz.\r | |
43 | \r | |
44 | Returns:\r | |
45 | String that contains the frequency.\r | |
46 | \r | |
47 | --*/\r | |
48 | ;\r | |
49 | \r | |
50 | CHAR16 *\r | |
51 | StrBytesToString (\r | |
52 | OUT CHAR16 *String,\r | |
53 | IN UINT64 Val\r | |
54 | )\r | |
55 | /*++\r | |
56 | \r | |
57 | Routine Description:\r | |
58 | Converts size in bytes to Unicode string.\r | |
59 | Used for memory/cache size display.\r | |
60 | \r | |
61 | Arguments:\r | |
62 | String - string that will contain the value\r | |
63 | Val - value to convert in bytes\r | |
64 | \r | |
65 | Returns:\r | |
66 | String that contains the value.\r | |
67 | \r | |
68 | --*/\r | |
69 | ;\r | |
70 | \r | |
71 | CHAR16 *\r | |
72 | StrVersionToString (\r | |
73 | OUT CHAR16 *String,\r | |
74 | IN UINT8 Version\r | |
75 | )\r | |
76 | /*++\r | |
77 | \r | |
78 | Routine Description:\r | |
79 | Converts 8 bit version value to Unicode string.\r | |
80 | The upper nibble contains the upper part, the lower nibble contains the minor part.\r | |
81 | The output format is <major>.<minor>.\r | |
82 | \r | |
83 | Arguments:\r | |
84 | String - string that will contain the version value\r | |
85 | Version - Version value to convert\r | |
86 | \r | |
87 | Returns:\r | |
88 | String that contains the version value.\r | |
89 | \r | |
90 | --*/\r | |
91 | ;\r | |
92 | \r | |
93 | CHAR16 *\r | |
94 | StrMacToString (\r | |
95 | OUT CHAR16 *String,\r | |
96 | IN EFI_MAC_ADDRESS *MacAddr,\r | |
97 | IN UINT32 AddrSize\r | |
98 | )\r | |
99 | /*++\r | |
100 | \r | |
101 | Routine Description:\r | |
102 | Converts MAC address to Unicode string.\r | |
103 | The value is 64-bit and the resulting string will be 12\r | |
104 | digit hex number in pairs of digits separated by dashes.\r | |
105 | \r | |
106 | Arguments:\r | |
107 | String - string that will contain the value\r | |
108 | MacAddr - MAC address to convert\r | |
109 | AddrSize - Size of address\r | |
110 | \r | |
111 | Returns:\r | |
112 | String that contains the value.\r | |
113 | \r | |
114 | --*/\r | |
115 | ;\r | |
116 | \r | |
117 | CHAR16 *\r | |
118 | StrIp4AdrToString (\r | |
119 | OUT CHAR16 *String,\r | |
120 | IN EFI_IPv4_ADDRESS *Ip4Addr\r | |
121 | )\r | |
122 | /*++\r | |
123 | \r | |
124 | Routine Description:\r | |
125 | Converts IP v4 address to Unicode string.\r | |
126 | The value is 64-bit and the resulting string will\r | |
127 | be four decimal values 0-255 separated by dots.\r | |
128 | \r | |
129 | Arguments:\r | |
130 | String - string that will contain the value\r | |
131 | Ip4Addr - IP v4 address to convert from\r | |
132 | \r | |
133 | Returns:\r | |
134 | \r | |
135 | String that contain the value\r | |
136 | \r | |
137 | --*/\r | |
138 | ;\r | |
139 | \r | |
140 | EFI_STATUS\r | |
141 | StrStringToIp4Adr (\r | |
142 | OUT EFI_IPv4_ADDRESS *Ip4Addr,\r | |
143 | IN CHAR16 *String\r | |
144 | )\r | |
145 | /*++\r | |
146 | \r | |
147 | Routine Description:\r | |
148 | Parses and converts Unicode string to IP v4 address.\r | |
149 | The value will 64-bit.\r | |
150 | The string must be four decimal values 0-255 separated by dots.\r | |
151 | The string is parsed and format verified.\r | |
152 | \r | |
153 | Arguments:\r | |
154 | Ip4Addr - pointer to the variable to store the value to\r | |
155 | String - string that contains the value to parse and convert\r | |
156 | \r | |
157 | Returns:\r | |
158 | EFI_SUCCESS - if successful\r | |
159 | EFI_INVALID_PARAMETER - if String contains invalid IP v4 format\r | |
160 | \r | |
161 | --*/\r | |
162 | ;\r | |
163 | \r | |
164 | CHAR16 *\r | |
165 | Ascii2Unicode (\r | |
166 | OUT CHAR16 *UnicodeStr,\r | |
167 | IN CHAR8 *AsciiStr\r | |
168 | )\r | |
169 | /*++\r | |
170 | \r | |
171 | Routine Description:\r | |
172 | Converts ASCII characters to Unicode.\r | |
173 | \r | |
174 | Arguments:\r | |
175 | UnicodeStr - the Unicode string to be written to. The buffer must be large enough.\r | |
176 | AsciiStr - The ASCII string to be converted.\r | |
177 | \r | |
178 | Returns:\r | |
179 | The address to the Unicode string - same as UnicodeStr.\r | |
180 | \r | |
181 | --*/\r | |
182 | ;\r | |
183 | \r | |
184 | CHAR8 *\r | |
185 | Unicode2Ascii (\r | |
186 | OUT CHAR8 *AsciiStr,\r | |
187 | IN CHAR16 *UnicodeStr\r | |
188 | )\r | |
189 | /*++\r | |
190 | \r | |
191 | Routine Description:\r | |
192 | Converts ASCII characters to Unicode.\r | |
193 | Assumes that the Unicode characters are only these defined in the ASCII set.\r | |
194 | \r | |
195 | Arguments:\r | |
196 | AsciiStr - The ASCII string to be written to. The buffer must be large enough.\r | |
197 | UnicodeStr - the Unicode string to be converted.\r | |
198 | \r | |
199 | Returns:\r | |
200 | The address to the ASCII string - same as AsciiStr.\r | |
201 | \r | |
202 | --*/\r | |
203 | ;\r | |
204 | \r | |
3e99020d LG |
205 | EFI_STATUS\r |
206 | EfiStringToValue (\r | |
207 | OUT UINT64 *Val,\r | |
208 | IN CHAR16 *String,\r | |
209 | OUT UINT8 *EndIdx OPTIONAL\r | |
210 | )\r | |
211 | /*++\r | |
212 | \r | |
213 | Routine Description:\r | |
214 | Parses and converts Unicode string to decimal value.\r | |
215 | The returned value is 64-bit.\r | |
216 | The string is expected in decimal format,\r | |
217 | the string is parsed and format verified.\r | |
218 | \r | |
219 | Arguments:\r | |
220 | Val - pointer to the variable to store the value to\r | |
221 | String - string that contains the value to parse and convert\r | |
222 | EndIdx - index on which the parsing stopped. It points to the\r | |
223 | first character that was not part of the returned Val.\r | |
224 | It's valid only if the function returns success.\r | |
225 | It's optional and it could be NULL.\r | |
226 | \r | |
227 | Returns:\r | |
228 | EFI_SUCCESS - if successful\r | |
229 | EFI_INVALID_PARAMETER - if String is in unexpected format\r | |
230 | \r | |
231 | --*/\r | |
232 | ;\r | |
233 | \r | |
3eb9473e | 234 | #endif\r |