blob: a2c4576cf9ff3fa50e303cf03d1c042a40b45f75 [file] [log] [blame]
Arend van Spriel5b435de2011-10-05 13:19:03 +02001/*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _BRCMF_DBG_H_
18#define _BRCMF_DBG_H_
19
Franky Lin87633492011-12-16 18:37:17 -080020/* message levels */
21#define BRCMF_ERROR_VAL 0x0001
22#define BRCMF_TRACE_VAL 0x0002
23#define BRCMF_INFO_VAL 0x0004
24#define BRCMF_DATA_VAL 0x0008
25#define BRCMF_CTL_VAL 0x0010
26#define BRCMF_TIMER_VAL 0x0020
27#define BRCMF_HDRS_VAL 0x0040
28#define BRCMF_BYTES_VAL 0x0080
29#define BRCMF_INTR_VAL 0x0100
30#define BRCMF_GLOM_VAL 0x0400
31#define BRCMF_EVENT_VAL 0x0800
32#define BRCMF_BTA_VAL 0x1000
33#define BRCMF_ISCAN_VAL 0x2000
34
Joe Perches8ae74652012-01-15 00:38:38 -080035#if defined(DEBUG)
Arend van Spriel5b435de2011-10-05 13:19:03 +020036
37#define brcmf_dbg(level, fmt, ...) \
38do { \
39 if (BRCMF_ERROR_VAL == BRCMF_##level##_VAL) { \
40 if (brcmf_msg_level & BRCMF_##level##_VAL) { \
41 if (net_ratelimit()) \
Joe Perchesd6400c22012-01-15 00:38:39 -080042 pr_debug("%s: " fmt, \
43 __func__, ##__VA_ARGS__); \
Arend van Spriel5b435de2011-10-05 13:19:03 +020044 } \
45 } else { \
46 if (brcmf_msg_level & BRCMF_##level##_VAL) { \
Joe Perchesd6400c22012-01-15 00:38:39 -080047 pr_debug("%s: " fmt, \
48 __func__, ##__VA_ARGS__); \
Arend van Spriel5b435de2011-10-05 13:19:03 +020049 } \
50 } \
51} while (0)
52
53#define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL)
54#define BRCMF_CTL_ON() (brcmf_msg_level & BRCMF_CTL_VAL)
55#define BRCMF_HDRS_ON() (brcmf_msg_level & BRCMF_HDRS_VAL)
56#define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL)
57#define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL)
58
Joe Perches8ae74652012-01-15 00:38:38 -080059#else /* (defined DEBUG) || (defined DEBUG) */
Arend van Spriel5b435de2011-10-05 13:19:03 +020060
61#define brcmf_dbg(level, fmt, ...) no_printk(fmt, ##__VA_ARGS__)
62
63#define BRCMF_DATA_ON() 0
64#define BRCMF_CTL_ON() 0
65#define BRCMF_HDRS_ON() 0
66#define BRCMF_BYTES_ON() 0
67#define BRCMF_GLOM_ON() 0
68
Joe Perches8ae74652012-01-15 00:38:38 -080069#endif /* defined(DEBUG) */
Arend van Spriel5b435de2011-10-05 13:19:03 +020070
Joe Perches1e023822012-01-15 00:38:40 -080071#define brcmf_dbg_hex_dump(test, data, len, fmt, ...) \
72do { \
73 if (test) \
74 brcmu_dbg_hex_dump(data, len, fmt, ##__VA_ARGS__); \
75} while (0)
76
Arend van Spriel5b435de2011-10-05 13:19:03 +020077extern int brcmf_msg_level;
78
79#endif /* _BRCMF_DBG_H_ */