]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/DxeIpl/Debug.c
IntelFrameworkModulePkg KbDxe: Execute key notify func at TPL_CALLBACK
[mirror_edk2.git] / DuetPkg / DxeIpl / Debug.c
1 /** @file
2
3 Copyright (c) 2006 - 2011, 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 <Library/SerialPortLib.h>
23 #include "SerialStatusCode.h"
24 #include "Debug.h"
25
26 UINT8 *mCursor;
27 UINT8 mHeaderIndex = 10;
28
29
30 VOID
31 PrintHeader (
32 CHAR8 Char
33 )
34 {
35 *(UINT8 *)(UINTN)(0x000b8000 + mHeaderIndex) = Char;
36 mHeaderIndex += 2;
37 }
38
39 VOID
40 ClearScreen (
41 VOID
42 )
43 {
44 UINT32 Index;
45
46 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);
47 for (Index = 0; Index < 80 * 49; Index++) {
48 *mCursor = ' ';
49 mCursor += 2;
50 }
51 mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);
52 }
53
54 VOID
55 EFIAPI
56 PrintString (
57 IN CONST CHAR8 *FormatString,
58 ...
59 )
60 {
61 UINTN Index;
62 CHAR8 PrintBuffer[1000];
63 VA_LIST Marker;
64
65 VA_START (Marker, FormatString);
66 AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);
67 VA_END (Marker);
68
69 for (Index = 0; PrintBuffer[Index] != 0; Index++) {
70 if (PrintBuffer[Index] == '\n') {
71 mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));
72 } else {
73 *mCursor = (UINT8) PrintBuffer[Index];
74 mCursor += 2;
75 }
76 }
77
78 //
79 // All information also output to serial port.
80 //
81 SerialPortWrite ((UINT8 *) PrintBuffer, Index);
82 }
83