summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/ExtendedIfrSupportLib/R8Lib.h
blob: 0e1ab4daee951ce52ca9319dc0453e5df19ee58f (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
/** @file
  <Todo: Add file description>

Copyright (c) 2007 - 2008, Intel Corporation. <BR>
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.

**/



/**
  Converts binary buffer to Unicode string.
  At a minimum, any blob of data could be represented as a hex string.

  @param  Str                    Pointer to the string.
  @param  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.
  @param  Buf                    Buffer to be converted from.
  @param  Len                    Length in bytes of the buffer to be converted.

  @retval EFI_SUCCESS            Routine success.
  @retval EFI_BUFFER_TOO_SMALL   The hex string buffer is too small.

**/
EFI_STATUS
R8_BufToHexString (
  IN OUT CHAR16                    *Str,
  IN OUT UINTN                     *HexStringBufferLength,
  IN     UINT8                     *Buf,
  IN     UINTN                      Len
  )
;




/**
  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.

  @param  Buf                    Pointer to buffer that receives the data.
  @param  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.
  @param  Str                    String to be converted from.
  @param  ConvertedStrLen        Length of the Hex String consumed.

  @retval EFI_SUCCESS            Routine Success.
  @retval EFI_BUFFER_TOO_SMALL   The buffer is too small to hold converted data.

**/
EFI_STATUS
R8_HexStringToBuf (
  IN OUT UINT8                     *Buf,
  IN OUT UINTN                    *Len,
  IN     CHAR16                    *Str,
  OUT    UINTN                     *ConvertedStrLen  OPTIONAL
  )
;

/**
  Determines if a Unicode character is a hexadecimal digit.
  The test is case insensitive.

  @param  Digit                  Pointer to byte that receives the value of the hex
                                 character.
  @param  Char                   Unicode character to test.

  @retval TRUE                   If the character is a hexadecimal digit.
  @retval FALSE                  Otherwise.

**/
BOOLEAN
R8_IsHexDigit (
  OUT UINT8      *Digit,
  IN  CHAR16      Char
  )
;