1 /** @file
2 
3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4 
5 
6   This program and the accompanying materials are licensed and made available under
7 
8   the terms and conditions of the BSD License that accompanies this distribution.
9 
10   The full text of the license may be found at
11 
12   http://opensource.org/licenses/bsd-license.php.
13 
14 
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 
22 
23 
24 Module Name:
25 
26     SetupFunctions.c
27 
AsciiToUnicode(IN CHAR8 * AsciiString,IN CHAR16 * UnicodeString)28 Abstract:
29 
30 Revision History
31 
32 --*/
33 
34 #include "PlatformSetupDxe.h"
35 
36 VOID
37 AsciiToUnicode (
38   IN    CHAR8     *AsciiString,
39   IN    CHAR16    *UnicodeString
40   )
41 {
42   UINT8           Index;
43 
44   Index = 0;
45   while (AsciiString[Index] != 0) {
46     UnicodeString[Index] = (CHAR16)AsciiString[Index];
47     Index++;
48   }
49 }
50 
51 VOID
52 SwapEntries (
53   IN  CHAR8 *Data
54   )
55 {
56   UINT16  Index;
57   CHAR8   Temp8;
58 
59   Index = 0;
60   while (Data[Index] != 0 && Data[Index+1] != 0) {
61     Temp8 = Data[Index];
ConvertBase10ToRaw(IN EFI_EXP_BASE10_DATA * Data)62     Data[Index] = Data[Index+1];
63     Data[Index+1] = Temp8;
64     Index +=2;
65   }
66 
67   return;
68 }
69 
70 UINT32
71 ConvertBase10ToRaw (
72   IN  EFI_EXP_BASE10_DATA             *Data)
73 {
74   UINTN         Index;
75   UINT32        RawData;
76 
ConvertBase2ToRaw(IN EFI_EXP_BASE2_DATA * Data)77   RawData = Data->Value;
78   for (Index = 0; Index < (UINTN) Data->Exponent; Index++) {
79      RawData *= 10;
80   }
81 
82   return  RawData;
83 }
84 
85 UINT32
86 ConvertBase2ToRaw (
87   IN  EFI_EXP_BASE2_DATA             *Data)
88 {
89   UINTN         Index;
90   UINT32        RawData;
91 
92   RawData = Data->Value;
93   for (Index = 0; Index < (UINTN) Data->Exponent; Index++) {
94      RawData <<= 1;
95   }
96 
97   return  RawData;
98 }
99 
100