]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/EfiLdr/Debug.c
DuetPkg: Removing ipf which is no longer supported from edk2.
[mirror_edk2.git] / DuetPkg / EfiLdr / Debug.c
CommitLineData
9071550e 1/*++\r
2\r
b68b78e6 3Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
b1f700a8 4This program and the accompanying materials \r
9071550e 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
19--*/\r
20#include "EfiLdr.h"\r
21#include "Debug.h"\r
22\r
23UINT8 *mCursor;\r
24UINT8 mHeaderIndex = 10;\r
25\r
b68b78e6 26\r
9071550e 27VOID\r
28PrintHeader (\r
29 CHAR8 Char\r
30 )\r
31{\r
32 *(UINT8 *)(UINTN)(0x000b8000 + mHeaderIndex) = Char;\r
33 mHeaderIndex += 2;\r
34}\r
35\r
36VOID\r
37ClearScreen (\r
38 VOID\r
39 )\r
40{\r
41 UINT32 Index;\r
42\r
43 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r
44 for (Index = 0; Index < 80 * 49; Index++) {\r
45 *mCursor = ' ';\r
46 mCursor += 2;\r
47 }\r
48 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r
49}\r
50\r
9071550e 51VOID\r
d9c86bee 52EFIAPI\r
9071550e 53PrintString (\r
b68b78e6
RN
54 IN CONST CHAR8 *FormatString,\r
55 ...\r
9071550e 56 )\r
57{\r
b68b78e6
RN
58 UINTN Index;\r
59 CHAR8 PrintBuffer[256];\r
60 VA_LIST Marker;\r
61\r
62 VA_START (Marker, FormatString);\r
63 AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);\r
64 VA_END (Marker);\r
9071550e 65\r
b68b78e6
RN
66 for (Index = 0; PrintBuffer[Index] != 0; Index++) {\r
67 if (PrintBuffer[Index] == '\n') {\r
68 mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));\r
9071550e 69 } else {\r
b68b78e6 70 *mCursor = (UINT8) PrintBuffer[Index];\r
9071550e 71 mCursor += 2;\r
72 }\r
73 }\r
6fc74eaa 74\r
75 //\r
76 // All information also output to serial port.\r
77 //\r
8de06925 78 SerialPortWrite ((UINT8 *) PrintBuffer, Index);\r
9071550e 79}\r
80\r