2 * carl9170user - userspace testing utility for ar9170 devices
6 * Copyright 2009, 2010 Christian Lamparter <chunkeey@googlemail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef __CARL9170USER_DEBUG_H
24 #define __CARL9170USER_DEBUG_H
40 extern bool print_message_debug_level;
41 extern enum debug_level_t debug_level;
43 #define __fprintf(lvl, fmt, args...) do { \
44 if (lvl <= debug_level) { \
45 if (print_message_debug_level) \
46 fprintf(dbg_lvl_to_fh(lvl), "<%d>:" fmt, lvl, ##args); \
48 fprintf(dbg_lvl_to_fh(lvl), fmt, ##args); \
52 #define dbg(fmt, args...) __fprintf(VERBOSE, fmt, ##args)
53 #define info(fmt, args...) __fprintf(INFO, fmt, ##args)
54 #define warn(fmt, args...) __fprintf(WARNING, fmt, ##args)
55 #define err(fmt, args...) __fprintf(ERROR, fmt, ##args)
60 __fprintf(ERROR, "!!!=>BUG IN function \"%s\" at line %d<=!!! %s\n", \
61 __func__, __LINE__, #a); \
67 FILE *dbg_lvl_to_fh(const enum debug_level_t lvl);
68 void init_debug(void);
69 void print_hex_dump_bytes(const enum debug_level_t lvl, const char *prefix,
70 const void *buf, size_t len);
72 #endif /* __CARL9170USER_DEBUG_H */