]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/DxeIpl/Debug.c
Patch from open source community for CryptoPkg to allow it to build for ARM using...
[mirror_edk2.git] / DuetPkg / DxeIpl / Debug.c
CommitLineData
18b84857 1/** @file\r
ca162103 2\r
b1f700a8
HT
3Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
ca162103 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13 Debug.c\r
14\r
15Abstract:\r
16\r
17Revision History:\r
18\r
18b84857 19**/\r
ca162103 20\r
21#include "DxeIpl.h"\r
40b499c6 22#include "SerialStatusCode.h"\r
01b024f1 23#include "Debug.h"\r
ca162103 24\r
25UINT8 *mCursor;\r
26UINT8 mHeaderIndex = 10;\r
27\r
28\r
29VOID\r
30PrintHeader (\r
31 CHAR8 Char\r
32 )\r
33{\r
34 *(UINT8 *)(UINTN)(0x000b8000 + mHeaderIndex) = Char;\r
35 mHeaderIndex += 2;\r
36}\r
37\r
38VOID\r
39ClearScreen (\r
40 VOID\r
41 )\r
42{\r
43 UINT32 Index;\r
44\r
45 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r
46 for (Index = 0; Index < 80 * 49; Index++) {\r
47 *mCursor = ' ';\r
48 mCursor += 2;\r
49 }\r
50 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r
51}\r
52\r
53VOID\r
54PrintValue (\r
55 UINT32 Value\r
56 )\r
57{\r
58 UINT32 Index;\r
01b024f1 59 CHAR8 Char;\r
60 CHAR8 String[9];\r
ca162103 61\r
62 for (Index = 0; Index < 8; Index++) {\r
e188a609 63 Char = (UINT8)(((Value >> ((7 - Index) * 4)) & 0x0f) + '0');\r
ca162103 64 if (Char > '9') {\r
e188a609 65 Char = (UINT8) (Char - '0' - 10 + 'A');\r
ca162103 66 }\r
01b024f1 67 String[Index] = Char;\r
ca162103 68 }\r
01b024f1 69\r
70 String[sizeof (String) - 1] = '\0';\r
71\r
72 PrintString (String);\r
ca162103 73}\r
74\r
75VOID\r
76PrintValue64 (\r
77 UINT64 Value\r
78 )\r
79{\r
80 PrintValue ((UINT32) RShiftU64 (Value, 32));\r
81 PrintValue ((UINT32) Value);\r
82}\r
83\r
84\r
85\r
86VOID\r
87PrintString (\r
01b024f1 88 CHAR8 *String\r
ca162103 89 )\r
90{\r
91 UINT32 Index;\r
92\r
93 for (Index = 0; String[Index] != 0; Index++) {\r
94 if (String[Index] == '\n') {\r
95 mCursor = (UINT8 *)(UINTN)(0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));\r
96 } else {\r
97 *mCursor = String[Index];\r
98 mCursor += 2;\r
99 }\r
100 }\r
d26b17e3 101 \r
102 //\r
103 // All information also output to serial port.\r
104 //\r
8941b53e 105 DebugSerialPrint ((CHAR8*)String);\r
ca162103 106}\r
107\r