]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/DxeIpl/Debug.c
Change DUET DxeIpl to use SerialPort instead of manipulating serial port directly.
[mirror_edk2.git] / DuetPkg / DxeIpl / Debug.c
CommitLineData
18b84857 1/** @file\r
ca162103 2\r
b68b78e6 3Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
b1f700a8 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
b68b78e6 22#include <Library/SerialPortLib.h>\r
40b499c6 23#include "SerialStatusCode.h"\r
01b024f1 24#include "Debug.h"\r
ca162103 25\r
26UINT8 *mCursor;\r
27UINT8 mHeaderIndex = 10;\r
28\r
29\r
30VOID\r
31PrintHeader (\r
32 CHAR8 Char\r
33 )\r
34{\r
35 *(UINT8 *)(UINTN)(0x000b8000 + mHeaderIndex) = Char;\r
36 mHeaderIndex += 2;\r
37}\r
38\r
39VOID\r
40ClearScreen (\r
41 VOID\r
42 )\r
43{\r
44 UINT32 Index;\r
45\r
46 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r
47 for (Index = 0; Index < 80 * 49; Index++) {\r
48 *mCursor = ' ';\r
49 mCursor += 2;\r
50 }\r
51 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);\r
52}\r
53\r
ca162103 54VOID\r
55PrintString (\r
b68b78e6
RN
56 IN CONST CHAR8 *FormatString,\r
57 ...\r
ca162103 58 )\r
59{\r
b68b78e6
RN
60 UINTN Index;\r
61 CHAR8 PrintBuffer[1000];\r
62 VA_LIST Marker;\r
ca162103 63\r
b68b78e6
RN
64 VA_START (Marker, FormatString);\r
65 AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);\r
66 VA_END (Marker);\r
67\r
68 for (Index = 0; PrintBuffer[Index] != 0; Index++) {\r
69 if (PrintBuffer[Index] == '\n') {\r
70 mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));\r
ca162103 71 } else {\r
b68b78e6 72 *mCursor = (UINT8) PrintBuffer[Index];\r
ca162103 73 mCursor += 2;\r
74 }\r
75 }\r
b68b78e6 76\r
d26b17e3 77 //\r
78 // All information also output to serial port.\r
79 //\r
b68b78e6 80 SerialPortWrite (PrintBuffer, Index);\r
ca162103 81}\r
82\r