Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file IxOsPrintf.h |
| 3 | * |
| 4 | * @brief this file contains the API of the @ref IxOsServices component |
| 5 | * |
| 6 | * @par |
| 7 | * IXP400 SW Release version 2.0 |
| 8 | * |
| 9 | * -- Copyright Notice -- |
| 10 | * |
| 11 | * @par |
| 12 | * Copyright 2001-2005, Intel Corporation. |
| 13 | * All rights reserved. |
| 14 | * |
| 15 | * @par |
Wolfgang Denk | c57eadc | 2013-07-28 22:12:47 +0200 | [diff] [blame] | 16 | * SPDX-License-Identifier: BSD-3-Clause |
Wolfgang Denk | 4646d2a | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 17 | * @par |
| 18 | * -- End of Copyright Notice -- |
| 19 | */ |
| 20 | |
| 21 | #include "IxTypes.h" |
| 22 | |
| 23 | #ifndef IxOsPrintf_H |
| 24 | |
| 25 | #ifndef __doxygen_hide |
| 26 | #define IxOsPrintf_H |
| 27 | #endif /* __doxygen_hide */ |
| 28 | |
| 29 | #ifdef __wince |
| 30 | |
| 31 | #ifndef IX_USE_SERCONSOLE |
| 32 | |
| 33 | static int |
| 34 | ixLogMsg( |
| 35 | char *pFormat, |
| 36 | ... |
| 37 | ) |
| 38 | { |
| 39 | #ifndef IN_KERNEL |
| 40 | static WCHAR pOutputString[256]; |
| 41 | static char pNarrowStr[256]; |
| 42 | int returnCnt = 0; |
| 43 | va_list ap; |
| 44 | |
| 45 | pOutputString[0] = 0; |
| 46 | pNarrowStr[0] = 0; |
| 47 | |
| 48 | va_start(ap, pFormat); |
| 49 | |
| 50 | returnCnt = _vsnprintf(pNarrowStr, 256, pFormat, ap); |
| 51 | |
| 52 | MultiByteToWideChar( |
| 53 | CP_ACP, |
| 54 | MB_PRECOMPOSED, |
| 55 | pNarrowStr, |
| 56 | -1, |
| 57 | pOutputString, |
| 58 | 256 |
| 59 | ); |
| 60 | |
| 61 | OutputDebugString(pOutputString); |
| 62 | |
| 63 | return returnCnt; |
| 64 | #else |
| 65 | return 0; |
| 66 | #endif |
| 67 | } |
| 68 | #define printf ixLogMsg |
| 69 | |
| 70 | #endif /* IX_USE_SERCONSOLE */ |
| 71 | |
| 72 | #endif /* __wince */ |
| 73 | |
| 74 | /** |
| 75 | * @} IxOsPrintf |
| 76 | */ |
| 77 | |
| 78 | #endif /* IxOsPrintf_H */ |