]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
3 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r | |
4 | This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | Debug.c\r | |
14 | \r | |
15 | Abstract:\r | |
16 | \r | |
17 | Revision History:\r | |
18 | \r | |
19 | **/\r | |
20 | \r | |
21 | #include "DxeIpl.h"\r | |
22 | #include <Library/SerialPortLib.h>\r | |
23 | #include "SerialStatusCode.h"\r | |
24 | #include "Debug.h"\r | |
25 | \r | |
26 | UINT8 *mCursor;\r | |
27 | UINT8 mHeaderIndex = 10;\r | |
28 | \r | |
29 | \r | |
30 | VOID\r | |
31 | PrintHeader (\r | |
32 | CHAR8 Char\r | |
33 | )\r | |
34 | {\r | |
35 | *(UINT8 *)(UINTN)(0x000b8000 + mHeaderIndex) = Char;\r | |
36 | mHeaderIndex += 2;\r | |
37 | }\r | |
38 | \r | |
39 | VOID\r | |
40 | ClearScreen (\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 | |
54 | VOID\r | |
55 | PrintString (\r | |
56 | IN CONST CHAR8 *FormatString,\r | |
57 | ...\r | |
58 | )\r | |
59 | {\r | |
60 | UINTN Index;\r | |
61 | CHAR8 PrintBuffer[1000];\r | |
62 | VA_LIST Marker;\r | |
63 | \r | |
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 | |
71 | } else {\r | |
72 | *mCursor = (UINT8) PrintBuffer[Index];\r | |
73 | mCursor += 2;\r | |
74 | }\r | |
75 | }\r | |
76 | \r | |
77 | //\r | |
78 | // All information also output to serial port.\r | |
79 | //\r | |
80 | SerialPortWrite ((UINT8 *) PrintBuffer, Index);\r | |
81 | }\r | |
82 | \r |