;------------------------------------------------------------------------------\r
+; @file\r
+; Serial port debug support macros\r
;\r
-; Copyright (c) 2008, Intel Corporation\r
+; Copyright (c) 2008 - 2009, Intel Corporation\r
; All rights reserved. This program and the accompanying materials\r
; are licensed and made available under the terms and conditions of the BSD License\r
; which accompanies this distribution. The full text of the license may be found at\r
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
;\r
-; Module Name:\r
-;\r
-; SerialDebug.asm\r
-;\r
-; Abstract:\r
-;\r
-; Serial port support macros\r
-;\r
;------------------------------------------------------------------------------\r
\r
-BITS 16\r
-\r
;//---------------------------------------------\r
;// UART Register Offsets\r
;//---------------------------------------------\r
out dx, al\r
%endmacro\r
\r
-%macro writeToSerialPort 1\r
+%macro debugShowCharacter 1\r
waitForSerialTxReady\r
outToSerialPort 0, %1\r
%endmacro\r
\r
-real16InitSerialPort:\r
+%macro debugShowHexDigit 1\r
+ %if (%1 < 0xa)\r
+ debugShowCharacter BYTE ('0' + (%1))\r
+ %else\r
+ debugShowCharacter BYTE ('a' + ((%1) - 0xa))\r
+ %endif\r
+%endmacro\r
+\r
+%macro debugNewline 0\r
+ debugShowCharacter `\r`\r
+ debugShowCharacter `\n`\r
+%endmacro\r
+\r
+%macro debugShowPostCode 1\r
+ debugShowHexDigit (((%1) >> 4) & 0xf)\r
+ debugShowHexDigit ((%1) & 0xf)\r
+ debugNewline\r
+%endmacro\r
+\r
+BITS 16\r
+\r
+%macro debugInitialize 0\r
+ jmp real16InitDebug\r
+real16InitDebugReturn:\r
+%endmacro\r
+\r
+real16InitDebug:\r
;\r
; Set communications format\r
;\r
;\r
outToSerialPort LCR_OFFSET, SERIAL_DEFAULT_LCR\r
\r
- jmp real16SerialPortInitReturn\r
+ jmp real16InitDebugReturn\r
\r