2008-03-19 06:11:21 +01:00
|
|
|
/** @file
|
2007-12-21 09:48:38 +01:00
|
|
|
|
2011-06-23 10:31:18 +02:00
|
|
|
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
2010-04-28 14:39:50 +02:00
|
|
|
This program and the accompanying materials
|
2007-12-21 09:48:38 +01:00
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
Module Name:
|
|
|
|
Debug.c
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
|
|
|
|
Revision History:
|
|
|
|
|
2008-03-19 06:11:21 +01:00
|
|
|
**/
|
2007-12-21 09:48:38 +01:00
|
|
|
|
|
|
|
#include "DxeIpl.h"
|
2011-06-23 10:31:18 +02:00
|
|
|
#include <Library/SerialPortLib.h>
|
2009-03-25 15:29:29 +01:00
|
|
|
#include "SerialStatusCode.h"
|
2010-10-16 20:51:32 +02:00
|
|
|
#include "Debug.h"
|
2007-12-21 09:48:38 +01:00
|
|
|
|
|
|
|
UINT8 *mCursor;
|
|
|
|
UINT8 mHeaderIndex = 10;
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
|
|
|
PrintHeader (
|
|
|
|
CHAR8 Char
|
|
|
|
)
|
|
|
|
{
|
|
|
|
*(UINT8 *)(UINTN)(0x000b8000 + mHeaderIndex) = Char;
|
|
|
|
mHeaderIndex += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
ClearScreen (
|
|
|
|
VOID
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINT32 Index;
|
|
|
|
|
|
|
|
mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);
|
|
|
|
for (Index = 0; Index < 80 * 49; Index++) {
|
|
|
|
*mCursor = ' ';
|
|
|
|
mCursor += 2;
|
|
|
|
}
|
|
|
|
mCursor = (UINT8 *)(UINTN)(0x000b8000 + 160);
|
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
|
|
|
PrintString (
|
2011-06-23 10:31:18 +02:00
|
|
|
IN CONST CHAR8 *FormatString,
|
|
|
|
...
|
2007-12-21 09:48:38 +01:00
|
|
|
)
|
|
|
|
{
|
2011-06-23 10:31:18 +02:00
|
|
|
UINTN Index;
|
|
|
|
CHAR8 PrintBuffer[1000];
|
|
|
|
VA_LIST Marker;
|
2007-12-21 09:48:38 +01:00
|
|
|
|
2011-06-23 10:31:18 +02:00
|
|
|
VA_START (Marker, FormatString);
|
|
|
|
AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);
|
|
|
|
VA_END (Marker);
|
|
|
|
|
|
|
|
for (Index = 0; PrintBuffer[Index] != 0; Index++) {
|
|
|
|
if (PrintBuffer[Index] == '\n') {
|
|
|
|
mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));
|
2007-12-21 09:48:38 +01:00
|
|
|
} else {
|
2011-06-23 10:31:18 +02:00
|
|
|
*mCursor = (UINT8) PrintBuffer[Index];
|
2007-12-21 09:48:38 +01:00
|
|
|
mCursor += 2;
|
|
|
|
}
|
|
|
|
}
|
2011-06-23 10:31:18 +02:00
|
|
|
|
2009-03-25 10:10:47 +01:00
|
|
|
//
|
|
|
|
// All information also output to serial port.
|
|
|
|
//
|
2011-06-27 08:03:06 +02:00
|
|
|
SerialPortWrite ((UINT8 *) PrintBuffer, Index);
|
2007-12-21 09:48:38 +01:00
|
|
|
}
|
|
|
|
|