logcom.cpp revision dcaccf9a8ab0ad326f03044c134d635b721584ed
/* $Id$ */
/** @file
* innotek Portable Runtime - Logging to Serial Port.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Defined Constants And Macros *
*******************************************************************************/
/** Comport to log to (COM2).
//#define UART_BASE 0x2f8 /* COM2 */
/*******************************************************************************
* Header Files *
*******************************************************************************/
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
/**
* Prints a formatted string to the serial port used for logging.
*
* @returns Number of bytes written.
* @param pszFormat Format string.
* @param ... Optional arguments specified in the format string.
*/
{
return cb;
}
/**
* Prints a formatted string to the serial port used for logging.
*
* @returns Number of bytes written.
* @param pszFormat Format string.
* @param args Optional arguments specified in the format string.
*/
{
}
/**
* Callback for RTLogFormatV which writes to the com port.
* See PFNLOGOUTPUT() for details.
*/
{
if (cbChars)
return cbChars;
}
/**
* Write log buffer to COM port.
*
* @param pach Pointer to the buffer to write.
* @param cb Number of bytes to write.
*/
{
{
/* expand \n -> \r\n */
if (*pu8 == '\n')
/* Check if port is ready. */
register unsigned cMaxWait = ~0;
do
{
cMaxWait--;
/* write */
}
}