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