]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/DxeIpl/Debug.c
Update the copyright notice format
[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
24 UINT8 *mCursor;
25 UINT8 mHeaderIndex = 10;
26
27
28 VOID
29 PrintHeader (
30 CHAR8 Char
31 )
32 {
33 *(UINT8 *)(UINTN)(0x000b8000 + mHeaderIndex) = Char;
34 mHeaderIndex += 2;
35 }
36
37 VOID
38 ClearScreen (
39 VOID
40 )
41 {
42 UINT32 Index;
43
44 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);
45 for (Index = 0; Index < 80 * 49; Index++) {
46 *mCursor = ' ';
47 mCursor += 2;
48 }
49 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);
50 }
51
52 VOID
53 PrintValue (
54 UINT32 Value
55 )
56 {
57 UINT32 Index;
58 UINT8 Char;
59
60 for (Index = 0; Index < 8; Index++) {
61 Char = (UINT8)(((Value >> ((7 - Index) * 4)) & 0x0f) + '0');
62 if (Char > '9') {
63 Char = (UINT8) (Char - '0' - 10 + 'A');
64 }
65 *mCursor = Char;
66 mCursor += 2;
67 }
68 }
69
70 VOID
71 PrintValue64 (
72 UINT64 Value
73 )
74 {
75 PrintValue ((UINT32) RShiftU64 (Value, 32));
76 PrintValue ((UINT32) Value);
77 }
78
79
80
81 VOID
82 PrintString (
83 UINT8 *String
84 )
85 {
86 UINT32 Index;
87
88 for (Index = 0; String[Index] != 0; Index++) {
89 if (String[Index] == '\n') {
90 mCursor = (UINT8 *)(UINTN)(0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));
91 } else {
92 *mCursor = String[Index];
93 mCursor += 2;
94 }
95 }
96
97 //
98 // All information also output to serial port.
99 //
100 DebugSerialPrint ((CHAR8*)String);
101 }
102