eficommonlib.h
来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 1,300 行 · 第 1/2 页
H
1,300 行
UINT64
RShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
/*++
Routine Description:
This routine allows a 64 bit value to be right shifted by 32 bits and returns the
shifted value.
Count is valid up 63. (Only Bits 0-5 is valid for Count)
Arguments:
Operand - Value to be shifted
Count - Number of times to shift right.
Returns:
Value shifted right identified by the Count.
--*/
;
UINT64
LShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
/*++
Routine Description:
This routine allows a 64 bit value to be left shifted by 32 bits and
returns the shifted value.
Count is valid up 63. (Only Bits 0-5 is valid for Count)
Arguments:
Operand - Value to be shifted
Count - Number of times to shift left.
Returns:
Value shifted left identified by the Count.
--*/
;
UINT64
Power10U64 (
IN UINT64 Operand,
IN UINTN Power
)
/*++
Routine Description:
Raise 10 to the power of Power, and multiply the result with Operand
Arguments:
Operand - multiplicand
Power - power
Returns:
Operand * 10 ^ Power
--*/
;
UINT8
Log2 (
IN UINT64 Operand
)
/*++
Routine Description:
Calculates and floors logarithms based on 2
Arguments:
Operand - value to calculate logarithm
Returns:
The largest integer that is less than or equal
to the logarithm of Operand based on 2
--*/
;
UINT64
GetPowerOfTwo (
IN UINT64 Input
)
/*++
Routine Description:
Calculates the largest integer that is both
a power of two and less than Input
Arguments:
Input - value to calculate power of two
Returns:
the largest integer that is both a power of
two and less than Input
--*/
;
//
// Unicode String primatives
//
VOID
EfiStrCpy (
IN CHAR16 *Destination,
IN CHAR16 *Source
)
/*++
Routine Description:
Copy the Unicode string Source to Destination.
Arguments:
Destination - Location to copy string
Source - String to copy
Returns:
NONE
--*/
;
VOID
EfiStrnCpy (
OUT CHAR16 *Dst,
IN CHAR16 *Src,
IN UINTN Length
)
/*++
Routine Description:
Copy a string from source to destination
Arguments:
Dst Destination string
Src Source string
Length Length of destination string
Returns:
--*/
;
UINTN
EfiStrLen (
IN CHAR16 *String
)
/*++
Routine Description:
Return the number of Unicode characters in String. This is not the same as
the length of the string in bytes.
Arguments:
String - String to process
Returns:
Number of Unicode characters in String
--*/
;
UINTN
EfiStrSize (
IN CHAR16 *String
)
/*++
Routine Description:
Return the number bytes in the Unicode String. This is not the same as
the length of the string in characters. The string size includes the NULL
Arguments:
String - String to process
Returns:
Number of bytes in String
--*/
;
INTN
EfiStrCmp (
IN CHAR16 *String,
IN CHAR16 *String2
)
/*++
Routine Description:
Return the alphabetic relationship between two stirngs.
Arguments:
String - Compare to String2
String2 - Compare to String
Returns:
0 - Identical
> 0 - String is alphabeticly greater than String2
< 0 - String is alphabeticly less than String2
--*/
;
VOID
EfiStrCat (
IN CHAR16 *Destination,
IN CHAR16 *Source
)
/*++
Routine Description:
Concatinate Source on the end of Destination
Arguments:
Destination - String to added to the end of.
Source - String to concatinate.
Returns:
NONE
--*/
;
VOID
EfiStrnCat (
IN CHAR16 *Dest,
IN CHAR16 *Src,
IN UINTN Length
)
/*++
Routine Description:
Concatinate Source on the end of Destination
Arguments:
Dst Destination string
Src Source string
Length Length of destination string
Returns:
--*/
;
UINTN
EfiAsciiStrLen (
IN CHAR8 *String
)
/*++
Routine Description:
Return the number of Ascii characters in String. This is not the same as
the length of the string in bytes.
Arguments:
String - String to process
Returns:
Number of Unicode characters in String
--*/
;
CHAR8 *
EfiAsciiStrCpy (
IN CHAR8 *Destination,
IN CHAR8 *Source
)
/*++
Routine Description:
Copy the Ascii string Source to Destination.
Arguments:
Destination - Location to copy string
Source - String to copy
Returns:
Pointer just pass the end of Destination
--*/
;
VOID
EfiAsciiStrnCpy (
OUT CHAR8 *Dst,
IN CHAR8 *Src,
IN UINTN Length
)
/*++
Routine Description:
Copy the Ascii string from source to destination
Arguments:
Dst Destination string
Src Source string
Length Length of destination string
Returns:
--*/
;
UINTN
EfiAsciiStrSize (
IN CHAR8 *String
)
/*++
Routine Description:
Return the number bytes in the Ascii String. This is not the same as
the length of the string in characters. The string size includes the NULL
Arguments:
String - String to process
Returns:
Number of bytes in String
--*/
;
INTN
EfiAsciiStrCmp (
IN CHAR8 *String,
IN CHAR8 *String2
)
/*++
Routine Description:
Compare the Ascii string pointed by String to the string pointed by String2.
Arguments:
String - String to process
String2 - The other string to process
Returns:
Return a positive integer if String is lexicall greater than String2; Zero if
the two strings are identical; and a negative interger if String is lexically
less than String2.
--*/
;
VOID
EfiAsciiStrCat (
IN CHAR8 *Destination,
IN CHAR8 *Source
)
/*++
Routine Description:
Concatinate Source on the end of Destination
Arguments:
Destination - String to added to the end of.
Source - String to concatinate.
Returns:
NONE
--*/
;
VOID
EfiAsciiStrnCat (
IN CHAR8 *Destination,
IN CHAR8 *Source,
IN UINTN Length
)
/*++
Routine Description:
Concatinate Source on the end of Destination
Arguments:
Destination - String to added to the end of.
Source - String to concatinate.
Returns:
NONE
--*/
;
//
// Print primitives
//
#define LEFT_JUSTIFY 0x01
#define PREFIX_SIGN 0x02
#define PREFIX_BLANK 0x04
#define COMMA_TYPE 0x08
#define LONG_TYPE 0x10
#define PREFIX_ZERO 0x20
//
// Length of temp string buffer to store value string.
//
#define CHARACTER_NUMBER_FOR_VALUE 30
UINTN
EfiValueToHexStr (
IN OUT CHAR16 *Buffer,
IN UINT64 Value,
IN UINTN Flags,
IN UINTN Width
)
/*++
Routine Description:
VSPrint worker function that prints a Value as a hex number in Buffer
Arguments:
Buffer - Location to place ascii hex string of Value.
Value - Hex value to convert to a string in Buffer.
Flags - Flags to use in printing Hex string, see file header for details.
Width - Width of hex value.
Returns:
Number of characters printed.
--*/
;
UINTN
EfiValueToString (
IN OUT CHAR16 *Buffer,
IN INT64 Value,
IN UINTN Flags,
IN UINTN Width
)
/*++
Routine Description:
VSPrint worker function that prints a Value as a decimal number in Buffer
Arguments:
Buffer - Location to place ascii decimal number string of Value.
Value - Decimal value to convert to a string in Buffer.
Flags - Flags to use in printing decimal string, see file header for details.
Width - Width of hex value.
Returns:
Number of characters printed.
--*/
;
BOOLEAN
IsHexDigit (
OUT UINT8 *Digit,
IN CHAR16 Char
)
/*++
Routine Description:
Determines if a Unicode character is a hexadecimal digit.
The test is case insensitive.
Arguments:
Digit - Pointer to byte that receives the value of the hex character.
Char - Unicode character to test.
Returns:
TRUE - If the character is a hexadecimal digit.
FALSE - Otherwise.
--*/
;
CHAR16
NibbleToHexChar (
UINT8 Nibble
)
/*++
Routine Description:
Converts the low nibble of a byte to hex unicode character.
Arguments:
Nibble - lower nibble of a byte.
Returns:
Hex unicode character.
--*/
;
EFI_STATUS
HexStringToBuf (
IN OUT UINT8 *Buf,
IN OUT UINTN *Len,
IN CHAR16 *Str,
OUT UINTN *ConvertedStrLen OPTIONAL
)
/*++
Routine Description:
Converts Unicode string to binary buffer.
The conversion may be partial.
The first character in the string that is not hex digit stops the conversion.
At a minimum, any blob of data could be represented as a hex string.
Arguments:
Buf - Pointer to buffer that receives the data.
Len - Length in bytes of the buffer to hold converted data.
If routine return with EFI_SUCCESS, containing length of converted data.
If routine return with EFI_BUFFER_TOO_SMALL, containg length of buffer desired.
Str - String to be converted from.
ConvertedStrLen - Length of the Hex String consumed.
Returns:
EFI_SUCCESS: Routine Success.
EFI_BUFFER_TOO_SMALL: The buffer is too small to hold converted data.
EFI_
--*/
;
EFI_STATUS
BufToHexString (
IN OUT CHAR16 *Str,
IN OUT UINTN *HexStringBufferLength,
IN UINT8 *Buf,
IN UINTN Len
)
/*++
Routine Description:
Converts binary buffer to Unicode string.
At a minimum, any blob of data could be represented as a hex string.
Arguments:
Str - Pointer to the string.
HexStringBufferLength - Length in bytes of buffer to hold the hex string. Includes tailing '\0' character.
If routine return with EFI_SUCCESS, containing length of hex string buffer.
If routine return with EFI_BUFFER_TOO_SMALL, containg length of hex string buffer desired.
Buf - Buffer to be converted from.
Len - Length in bytes of the buffer to be converted.
Returns:
EFI_SUCCESS: Routine success.
EFI_BUFFER_TOO_SMALL: The hex string buffer is too small.
--*/
;
VOID
EfiStrTrim (
IN OUT CHAR16 *str,
IN CHAR16 CharC
)
/*++
Routine Description:
Removes (trims) specified leading and trailing characters from a string.
Arguments:
str - Pointer to the null-terminated string to be trimmed. On return,
str will hold the trimmed string.
CharC - Character will be trimmed from str.
Returns:
None
--*/
;
CHAR16*
EfiStrStr (
IN CHAR16 *String,
IN CHAR16 *StrCharSet
)
/*++
Routine Description:
Find a substring.
Arguments:
String - Null-terminated string to search.
StrCharSet - Null-terminated string to search for.
Returns:
The address of the first occurrence of the matching substring if successful, or NULL otherwise.
--*/
;
CHAR8*
EfiAsciiStrStr (
IN CHAR8 *String,
IN CHAR8 *StrCharSet
)
/*++
Routine Description:
Find a Ascii substring.
Arguments:
String - Null-terminated Ascii string to search.
StrCharSet - Null-terminated Ascii string to search for.
Returns:
The address of the first occurrence of the matching Ascii substring if successful, or NULL otherwise.
--*/
;
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?