summaryrefslogtreecommitdiff
path: root/EDK/Foundation/Library/Dxe/Include/EfiUiLib.h
blob: 0e2bc597c4282a0495cbf9eac9ebb92fbbab350f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*++

Copyright (c) 2004, Intel Corporation                                                         
All rights reserved. This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

Module Name:
  EfiUiLib.h

Abstract:
  Collection of usefull UI functions.

Revision History:

--*/

#ifndef _EFI_UI_LIB_H_
#define _EFI_UI_LIB_H_

#include "Tiano.h"
#include "TianoTypes.h"
#include "EfiDriverLib.h"

CHAR16  *
StrHzToString (
  OUT CHAR16         *String,
  IN  UINT64         Val
  )
/*++

Routine Description:
  Converts frequency in Hz to Unicode string. 
  Three significant digits are delivered. Used for processor info display.

Arguments:
  String - string that will contain the frequency.
  Val    - value to convert, minimum is  100000 i.e., 0.1 MHz.

Returns:
  String that contains the frequency.

--*/
;

CHAR16  *
StrBytesToString (
  OUT CHAR16         *String,
  IN  UINT64         Val
  )
/*++

Routine Description:
  Converts size in bytes to Unicode string.
  Used for memory/cache size display.

Arguments:
  String - string that will contain the value
  Val    - value to convert in bytes

Returns:
  String that contains the value.

--*/
;

CHAR16  *
StrVersionToString (
  OUT CHAR16          *String,
  IN  UINT8           Version
  )
/*++

Routine Description:
  Converts 8 bit version value to Unicode string.
  The upper nibble contains the upper part, the lower nibble contains the minor part.
  The output format is <major>.<minor>.

Arguments:
  String  - string that will contain the version value
  Version - Version value to convert
  
Returns:
  String that contains the version value.

--*/
;

CHAR16  *
StrMacToString (
  OUT CHAR16              *String,
  IN  EFI_MAC_ADDRESS     *MacAddr,
  IN  UINT32              AddrSize
  )
/*++

Routine Description:
  Converts MAC address to Unicode string.
  The value is 64-bit and the resulting string will be 12
  digit hex number in pairs of digits separated by dashes.

Arguments:
  String - string that will contain the value
  MacAddr     - MAC address to convert
  AddrSize    - Size of address
  
Returns:
  String that contains the value.

--*/
;

CHAR16  *
StrIp4AdrToString (
  OUT CHAR16             *String,
  IN  EFI_IPv4_ADDRESS   *Ip4Addr
  )
/*++

Routine Description:
  Converts IP v4 address to Unicode string.
  The value is 64-bit and the resulting string will
  be four decimal values 0-255 separated by dots.

Arguments:
  String  - string that will contain the value
  Ip4Addr - IP v4 address to convert from

Returns:

  String that contain the value

--*/
;

EFI_STATUS
StrStringToIp4Adr (
  OUT EFI_IPv4_ADDRESS   *Ip4Addr,
  IN  CHAR16             *String
  )
/*++

Routine Description:
  Parses and converts Unicode string to IP v4 address.
  The value will 64-bit.
  The string must be four decimal values 0-255 separated by dots.
  The string is parsed and format verified.

Arguments:
  Ip4Addr - pointer to the variable to store the value to
  String  - string that contains the value to parse and convert

Returns:
  EFI_SUCCESS           - if successful
  EFI_INVALID_PARAMETER - if String contains invalid IP v4 format

--*/
;

CHAR16  *
Ascii2Unicode (
  OUT CHAR16         *UnicodeStr,
  IN  CHAR8          *AsciiStr
  )
/*++

Routine Description:
  Converts ASCII characters to Unicode.

Arguments:
  UnicodeStr - the Unicode string to be written to. The buffer must be large enough.
  AsciiStr   - The ASCII string to be converted.

Returns:
  The address to the Unicode string - same as UnicodeStr.

--*/
;

CHAR8   *
Unicode2Ascii (
  OUT CHAR8          *AsciiStr,
  IN  CHAR16         *UnicodeStr
  )
/*++

Routine Description:
  Converts ASCII characters to Unicode.
  Assumes that the Unicode characters are only these defined in the ASCII set.

Arguments:
  AsciiStr   - The ASCII string to be written to. The buffer must be large enough.
  UnicodeStr - the Unicode string to be converted.

Returns:
  The address to the ASCII string - same as AsciiStr.

--*/
;

#endif