1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
18 #include "simple_printf.h"
\r
21 #ifndef CFG_RAMLOG_SIZE
\r
22 #define CFG_RAMLOG_SIZE 2000
25 static unsigned char ramlog[CFG_RAMLOG_SIZE] __attribute__ ((section (".ramlog")));
\r
26 static unsigned ramlog_curr __attribute__ ((section (".ramlog")));
\r
27 static unsigned ramlog_session __attribute__ ((section (".ramlog")));
\r
29 static FILE *ramlogFile = 0;
\r
32 void ramlog_chr( char c ) {
\r
33 ramlog[ramlog_curr++] = c;
\r
34 if( ramlog_curr >= CFG_RAMLOG_SIZE ) {
\r
39 void ramlog_puts( char *str ) {
\r
47 void ramlog_printf( const char *format, ... ) {
\r
49 // Fast and ugly ramlog support.
\r
52 va_start(args,format);
\r
54 rv = vfprintf(ramlogFile,format, args);
\r
61 if( ramlog_curr>CFG_RAMLOG_SIZE)
\r
67 ramlogFile = fopen("ramlog","a");
\r
71 simple_sprintf(buf, "Session (%d)\n", ramlog_session);
\r