]> git.proxmox.com Git - mirror_edk2.git/blame - DuetPkg/DxeIpl/Debug.c
DuetPkg DxeIpl and EfiLdr: Add the missing EFIAPI for the function
[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
d9c86bee 55EFIAPI\r
ca162103 56PrintString (\r
b68b78e6
RN
57 IN CONST CHAR8 *FormatString,\r
58 ...\r
ca162103 59 )\r
60{\r
b68b78e6
RN
61 UINTN Index;\r
62 CHAR8 PrintBuffer[1000];\r
63 VA_LIST Marker;\r
ca162103 64\r
b68b78e6
RN
65 VA_START (Marker, FormatString);\r
66 AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);\r
67 VA_END (Marker);\r
68\r
69 for (Index = 0; PrintBuffer[Index] != 0; Index++) {\r
70 if (PrintBuffer[Index] == '\n') {\r
71 mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));\r
ca162103 72 } else {\r
b68b78e6 73 *mCursor = (UINT8) PrintBuffer[Index];\r
ca162103 74 mCursor += 2;\r
75 }\r
76 }\r
b68b78e6 77\r
d26b17e3 78 //\r
79 // All information also output to serial port.\r
80 //\r
fd99d1a9 81 SerialPortWrite ((UINT8 *) PrintBuffer, Index);\r
ca162103 82}\r
83\r