Update bulgarian.lang by Zahari Yurukov
[maemo-rb.git] / firmware / export / logdiskf.h
blob76ab78606da5d6277dec5a98d9997c620c3d6b0a
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2012 by Michael Giacomelli
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 ****************************************************************************/
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"
28 #ifdef ROCKBOX_HAS_LOGDISKF
30 void init_logdiskf(void);
32 /*large memory devices spin up the disk much less often*/
33 #if MEMORYSIZE > 32
34 #define MAX_LOGDISKF_SIZE 8192
35 #elif MEMORYSIZE > 8
36 #define MAX_LOGDISKF_SIZE 4096
37 #else
38 #define MAX_LOGDISKF_SIZE 1024
39 #endif
41 extern unsigned char logdiskfbuffer[MAX_LOGDISKF_SIZE];
42 extern int logfdiskindex;
44 #define LOGDISK_LEVEL 1
46 #if LOGDISK_LEVEL > 0 /*serious errors or problems*/
47 #define ERRORF(...) _logdiskf(__func__,'E', __VA_ARGS__)
48 #else
49 #define ERRORF(...)
50 #endif
52 #if LOGDISK_LEVEL > 1 /*matters of concern*/
53 #define WARNF(...) _logdiskf(__func__, 'W', __VA_ARGS__)
54 #else
55 #define WARNF(...)
56 #endif
58 #if LOGDISK_LEVEL > 2 /*useful for debug only*/
59 #define NOTEF(...) _logdiskf(__func__, 'N', __VA_ARGS__)
60 #else
61 #define NOTEF(...) /*TODO: rename DEBUGF later*/
62 #endif
64 /*__FILE__ would be better but is difficult to make work with the build system*/
65 //#define logdiskf(...) _logdiskf(__func__, 1, __VA_ARGS__)
67 void _logdiskf(const char* file, const char level,
68 const char *format, ...) ATTRIBUTE_PRINTF(3, 4);
70 #else /* !ROCKBOX_HAS_LOGDISKF */
72 /* built without logdiskf() support enabled, replace logdiskf() by DEBUGF() */
73 #define ERRORF DEBUGF
74 #define WARNF DEBUGF
75 #define NOTEF DEBUGF
77 #endif
78 #endif /* LOGDISKF_H */