]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/IfrSupportLib.h
HII Library Class interface refine.
[mirror_edk2.git] / MdeModulePkg / Include / Library / IfrSupportLib.h
index 73ddcaab784fffaabc121fa7a3d8538a8ce31556..3c7b264d0670c93ed64b4605292a0c4f566c0680 100644 (file)
 #ifndef _IFR_SUPPORT_LIBRARY_H_\r
 #define _IFR_SUPPORT_LIBRARY_H_\r
 \r
-\r
-#include <Protocol/HiiFont.h>\r
-#include <Protocol/HiiImage.h>\r
-#include <Protocol/HiiString.h>\r
-#include <Protocol/HiiDatabase.h>\r
-#include <Protocol/HiiConfigRouting.h>\r
-#include <Protocol/HiiConfigAccess.h>\r
-#include <Protocol/FormBrowser2.h>\r
-#include <Protocol/SimpleTextOut.h>\r
-\r
-#include <Guid/GlobalVariable.h>\r
-\r
-//\r
-// The architectural variable "Lang" and "LangCodes" are deprecated in UEFI\r
-// specification. While, UEFI specification also states that these deprecated\r
-// variables may be provided for backwards compatibility.\r
-\r
-#define EFI_LANGUAGE_VARIABLE           L"Lang"\r
-#define EFI_LANGUAGE_CODES_VARIABLE     L"LangCodes"\r
-\r
-#define UEFI_LANGUAGE_VARIABLE          L"PlatformLang"\r
-#define UEFI_LANGUAGE_CODES_VARIABLE    L"PlatformLangCodes"\r
-\r
-#define INVALID_VARSTORE_ID             0\r
-\r
-#define QUESTION_FLAGS              (EFI_IFR_FLAG_READ_ONLY | EFI_IFR_FLAG_CALLBACK | EFI_IFR_FLAG_RESET_REQUIRED | EFI_IFR_FLAG_OPTIONS_ONLY)\r
-#define QUESTION_FLAGS_MASK         (~QUESTION_FLAGS)\r
-\r
 #pragma pack(1)\r
 typedef struct {\r
   EFI_STRING_ID       StringToken;\r
@@ -439,8 +411,8 @@ CreateStringOpCode (
 \r
     @param ConfigRequest           The Config request string. If set to NULL, all the\r
                                    configurable elements will be extracted from BlockNameArray.\r
-    @param ConfigAltResp           The returned <ConfigAltResp>.\r
     @param Progress                On return, points to a character in the Request.\r
+    @param ConfigAltResp           The returned <ConfigAltResp>.\r
     @param Guid                    GUID of the buffer storage.\r
     @param Name                    Name of the buffer storage.\r
     @param DriverHandle            The DriverHandle which is used to invoke HiiDatabase\r
@@ -452,7 +424,8 @@ CreateStringOpCode (
                                    The sequential input parameters will be number of\r
                                    AltCfgId and DefaultValueArray pairs. When set to 0,\r
                                    there will be no <AltResp>.\r
-\r
+    @param  ...                    Variable argument list.                   \r
+    \r
     retval EFI_OUT_OF_RESOURCES  Run out of memory resource.\r
     retval EFI_INVALID_PARAMETER ConfigAltResp is NULL.\r
     retval EFI_SUCCESS           Operation successful.\r
@@ -631,6 +604,7 @@ ConstructConfigHdr (
 \r
 **/\r
 BOOLEAN\r
+EFIAPI\r
 IsConfigHdrMatch (\r
   IN EFI_STRING                ConfigString,\r
   IN EFI_GUID                  *StorageGuid, OPTIONAL\r
@@ -764,4 +738,118 @@ IfrLibCreatePopUp2 (
   )\r
 ;\r
 \r
+/**\r
+  Test if  a Unicode character is a hexadecimal digit. If true, the input\r
+  Unicode character is converted to a byte. \r
+\r
+  This function tests if a Unicode character is a hexadecimal digit. If true, the input\r
+  Unicode character is converted to a byte. For example, Unicode character\r
+  L'A' will be converted to 0x0A. \r
+\r
+  If Digit is NULL, then ASSERT.\r
+\r
+  @param  Digit       The output hexadecimal digit.\r
+\r
+  @param  Char        The input Unicode character.\r
+\r
+  @retval TRUE        Char is in the range of Hexadecimal number. Digit is updated\r
+                      to the byte value of the number.\r
+  @retval FALSE       Char is not in the range of Hexadecimal number. Digit is keep\r
+                      intact.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsHexDigit (\r
+  OUT UINT8      *Digit,\r
+  IN  CHAR16      Char\r
+  )\r
+;\r
+\r
+\r
+/** \r
+  Convert binary buffer to a Unicode String in a specified sequence. \r
+\r
+  This function converts bytes in the memory block pointed by Buffer to a Unicode String Str. \r
+  Each byte will be represented by two Unicode characters. For example, byte 0xA1 will \r
+  be converted into two Unicode character L'A' and L'1'. In the output String, the Unicode Character \r
+  for the Most Significant Nibble will be put before the Unicode Character for the Least Significant\r
+  Nibble. The output string for the buffer containing a single byte 0xA1 will be L"A1". \r
+  For a buffer with multiple bytes, the Unicode character produced by the first byte will be put into the \r
+  the last character in the output string. The one next to first byte will be put into the\r
+  character before the last character. This rules applies to the rest of the bytes. The Unicode\r
+  character by the last byte will be put into the first character in the output string. For example,\r
+  the input buffer for a 64-bits unsigned integer 0x12345678abcdef1234 will be converted to\r
+  a Unicode string equal to L"12345678abcdef1234".\r
+\r
+  @param String                        On input, String is pointed to the buffer allocated for the convertion.\r
+  @param StringLen                     The Length of String buffer to hold the output String. The length must include the tailing '\0' character.\r
+                                       The StringLen required to convert a N bytes Buffer will be a least equal to or greater \r
+                                       than 2*N + 1.\r
+  @param Buffer                        The pointer to a input buffer.\r
+  @param BufferSizeInBytes             Length in bytes of the input buffer.\r
+  \r
+\r
+  @retval  EFI_SUCCESS                 The convertion is successful. All bytes in Buffer has been convert to the corresponding\r
+                                       Unicode character and placed into the right place in String.\r
+  @retval  EFI_BUFFER_TOO_SMALL        StringSizeInBytes is smaller than 2 * N + 1the number of bytes required to\r
+                                       complete the convertion. \r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+BufToHexString (\r
+  IN OUT       CHAR16               *String,\r
+  IN OUT       UINTN                *StringLen,\r
+  IN     CONST UINT8                *Buffer,\r
+  IN           UINTN                BufferSizeInBytes\r
+  )\r
+;\r
+\r
+\r
+/**\r
+  Convert a Unicode string consisting of hexadecimal characters to a output byte buffer.\r
+\r
+  This function converts a Unicode string consisting of characters in the range of Hexadecimal\r
+  character (L'0' to L'9', L'A' to L'F' and L'a' to L'f') to a output byte buffer. The function will stop\r
+  at the first non-hexadecimal character or the NULL character. The convertion process can be\r
+  simply viewed as the reverse operations defined by BufToHexString. Two Unicode characters will be \r
+  converted into one byte. The first Unicode character represents the Most Significant Nibble and the\r
+  second Unicode character represents the Least Significant Nibble in the output byte. \r
+  The first pair of Unicode characters represents the last byte in the output buffer. The second pair of Unicode \r
+  characters represent the  the byte preceding the last byte. This rule applies to the rest pairs of bytes. \r
+  The last pair represent the first byte in the output buffer. \r
+\r
+  For example, a Unciode String L"12345678" will be converted into a buffer wil the following bytes \r
+  (first byte is the byte in the lowest memory address): "0x78, 0x56, 0x34, 0x12".\r
+\r
+  If String has N valid hexadecimal characters for conversion,  the caller must make sure Buffer is at least \r
+  N/2 (if N is even) or (N+1)/2 (if N if odd) bytes. \r
+\r
+  If either Buffer, BufferSizeInBytes or String is NULL, then ASSERT ().\r
+\r
+  @param Buffer                      The output buffer allocated by the caller.\r
+  @param BufferSizeInBytes           On input, the size in bytes of Buffer. On output, it is updated to \r
+                                     contain the size of the Buffer which is actually used for the converstion.\r
+                                     For Unicode string with 2*N hexadecimal characters (not including the \r
+                                     tailing NULL character), N bytes of Buffer will be used for the output.\r
+  @param String                      The input hexadecimal string.\r
+  @param ConvertedStrLen             The number of hexadecimal characters used to produce content in output\r
+                                     buffer Buffer.\r
+\r
+  @retval  RETURN_BUFFER_TOO_SMALL   The input BufferSizeInBytes is too small to hold the output. BufferSizeInBytes\r
+                                     will be updated to the size required for the converstion.\r
+  @retval  RETURN_SUCCESS            The convertion is successful or the first Unicode character from String\r
+                                     is hexadecimal. If ConvertedStrLen is not NULL, it is updated\r
+                                     to the number of hexadecimal character used for the converstion.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+HexStringToBuf (\r
+  OUT          UINT8                    *Buffer,   \r
+  IN OUT       UINTN                    *BufferSizeInBytes,\r
+  IN     CONST CHAR16                   *String,\r
+  OUT          UINTN                    *ConvertedStrLen  OPTIONAL\r
+  )\r
+;\r
+\r
 #endif\r