Implement a C version lcd-as-memframe.c and move it and the asm to firmware/asm.
[maemo-rb.git] / firmware / target / hosted / debug-hosted.c
blob35c487958b1f48376ef76912313ab8a2a7d4f8e2
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (c) 2002 Daniel Stenberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include <stdarg.h>
23 #include <stdio.h>
24 #include <string.h>
26 #ifdef WIN32
27 static unsigned old_cp;
29 void debug_exit(void)
31 /* Reset console output codepage */
32 SetConsoleOutputCP(old_cp);
35 void debug_init(void)
37 old_cp = GetConsoleOutputCP();
38 /* Set console output codepage to UTF8. Only works
39 * correctly when the console uses a truetype font. */
40 SetConsoleOutputCP(65001);
41 atexit(debug_exit);
43 #else
44 void debug_init(void)
46 /* nothing to be done */
48 #endif
50 void debugf(const char *fmt, ...)
52 va_list ap;
53 va_start( ap, fmt );
54 vfprintf( stderr, fmt, ap );
55 va_end( ap );
58 void ldebugf(const char* file, int line, const char *fmt, ...)
60 va_list ap;
61 va_start( ap, fmt );
62 fprintf( stderr, "%s:%d ", file, line );
63 vfprintf( stderr, fmt, ap );
64 va_end( ap );