A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 80 lines 2.4 kB view raw
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/*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 40 41extern unsigned char logdiskfbuffer[MAX_LOGDISKF_SIZE]; 42extern int logfdiskindex; 43 44#define LOGDISK_LEVEL 1 45 46#if LOGDISK_LEVEL > 0 /*serious errors or problems*/ 47 #define ERRORF(...) _logdiskf(__func__,'E', __VA_ARGS__) 48#else 49 #define ERRORF(...) 50#endif 51 52#if LOGDISK_LEVEL > 1 /*matters of concern*/ 53 #define WARNF(...) _logdiskf(__func__, 'W', __VA_ARGS__) 54#else 55 #define WARNF(...) 56#endif 57 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 63 64/*__FILE__ would be better but is difficult to make work with the build system*/ 65//#define logdiskf(...) _logdiskf(__func__, 1, __VA_ARGS__) 66 67void _logdiskf(const char* file, const char level, 68 const char *format, ...) ATTRIBUTE_PRINTF(3, 4); 69 70#else /* !ROCKBOX_HAS_LOGDISKF */ 71 72/* built without logdiskf() support enabled, replace logdiskf() by DEBUGF() */ 73#define ERRORF DEBUGF 74#define WARNF DEBUGF 75#define NOTEF DEBUGF 76 77#endif 78#endif /* LOGDISKF_H */ 79 80