summaryrefslogtreecommitdiff
path: root/firmware/export/logdiskf.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/export/logdiskf.h')
-rw-r--r--firmware/export/logdiskf.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/firmware/export/logdiskf.h b/firmware/export/logdiskf.h
new file mode 100644
index 0000000000..628662fdba
--- /dev/null
+++ b/firmware/export/logdiskf.h
@@ -0,0 +1,81 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2012 by Michael Giacomelli
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef LOGDISKF_H
22#define LOGDISKF_H
23#include <config.h>
24#include <stdbool.h>
25#include "gcc_extensions.h"
26#include "debug.h"
27
28#ifdef ROCKBOX_HAS_LOGDISKF
29
30void init_logdiskf(void);
31
32#ifndef __PCTOOL__
33
34/*large memory devices spin up the disk much less often*/
35#if MEMORYSIZE > 32
36 #define MAX_LOGDISKF_SIZE 8192
37#elif MEMORYSIZE > 8
38 #define MAX_LOGDISKF_SIZE 4096
39#else
40 #define MAX_LOGDISKF_SIZE 1024
41#endif
42
43extern unsigned char logdiskfbuffer[MAX_LOGDISKF_SIZE];
44extern int logfdiskindex;
45#endif /* __PCTOOL__ */
46
47
48#define LOGDISK_LEVEL 1
49
50#if LOGDISK_LEVEL > 0 /*serious errors or problems*/
51 #define ERRORF(...) _logdiskf(__func__,'E', __VA_ARGS__)
52#else
53 #define ERRORF(...)
54#endif
55
56#if LOGDISK_LEVEL > 1 /*matters of concern*/
57 #define WARNF(...) _logdiskf(__func__, 'W', __VA_ARGS__)
58#else
59 #define WARNF(...)
60#endif
61
62#if LOGDISK_LEVEL > 2 /*useful for debug only*/
63 #define NOTEF(...) _logdiskf(__func__, 'N', __VA_ARGS__)
64#else
65 #define NOTEF(...) /*TODO: rename DEBUGF later*/
66#endif
67
68/*__FILE__ would be better but is difficult to make work with the build system*/
69//#define logdiskf(...) _logdiskf(__func__, 1, __VA_ARGS__)
70
71void _logdiskf(const char* file, const char level,
72 const char *format, ...) ATTRIBUTE_PRINTF(3, 4);
73
74#else /* !ROCKBOX_HAS_LOGF */
75
76/* built without logdiskf() support enabled, replace logdiskf() by DEBUGF() */
77#define logdiskf(f,args...) DEBUGF(f"\n",##args)
78
79#endif /* !ROCKBOX_HAS_LOGDISKF */
80
81#endif /* LOGDISKF_H */