Piotr Haber | 8e21df2 | 2012-11-28 21:44:08 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2012 Broadcom Corporation |
Arend van Spriel | 1b2c2e7 | 2013-01-02 15:12:38 +0100 | [diff] [blame] | 3 | * Copyright (c) 2012 Canonical Ltd. |
Piotr Haber | 8e21df2 | 2012-11-28 21:44:08 +0100 | [diff] [blame] | 4 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above |
| 7 | * copyright notice and this permission notice appear in all copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
| 12 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 14 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 15 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 17 | #ifndef _BRCMS_DEBUG_H_ |
| 18 | #define _BRCMS_DEBUG_H_ |
| 19 | |
| 20 | #include <linux/device.h> |
| 21 | #include <linux/bcma/bcma.h> |
| 22 | #include <net/cfg80211.h> |
| 23 | #include <net/mac80211.h> |
| 24 | #include "main.h" |
| 25 | #include "mac80211_if.h" |
| 26 | |
Joe Perches | fbbdcc0 | 2012-11-21 10:17:34 -0800 | [diff] [blame] | 27 | __printf(2, 3) |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 28 | void __brcms_info(struct device *dev, const char *fmt, ...); |
Joe Perches | fbbdcc0 | 2012-11-21 10:17:34 -0800 | [diff] [blame] | 29 | __printf(2, 3) |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 30 | void __brcms_warn(struct device *dev, const char *fmt, ...); |
Joe Perches | fbbdcc0 | 2012-11-21 10:17:34 -0800 | [diff] [blame] | 31 | __printf(2, 3) |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 32 | void __brcms_err(struct device *dev, const char *fmt, ...); |
Joe Perches | fbbdcc0 | 2012-11-21 10:17:34 -0800 | [diff] [blame] | 33 | __printf(2, 3) |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 34 | void __brcms_crit(struct device *dev, const char *fmt, ...); |
| 35 | |
| 36 | #if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING) |
Joe Perches | fbbdcc0 | 2012-11-21 10:17:34 -0800 | [diff] [blame] | 37 | __printf(4, 5) |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 38 | void __brcms_dbg(struct device *dev, u32 level, const char *func, |
| 39 | const char *fmt, ...); |
| 40 | #else |
Joe Perches | fbbdcc0 | 2012-11-21 10:17:34 -0800 | [diff] [blame] | 41 | static inline __printf(4, 5) |
| 42 | void __brcms_dbg(struct device *dev, u32 level, const char *func, |
| 43 | const char *fmt, ...) |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 44 | { |
| 45 | } |
| 46 | #endif |
| 47 | |
| 48 | /* |
| 49 | * Debug macros cannot be used when wlc is uninitialized. Generally |
| 50 | * this means any code that could run before brcms_c_attach() has |
| 51 | * returned successfully probably shouldn't use the following macros. |
| 52 | */ |
| 53 | |
| 54 | #define brcms_dbg(core, l, f, a...) __brcms_dbg(&(core)->dev, l, __func__, f, ##a) |
| 55 | #define brcms_info(core, f, a...) __brcms_info(&(core)->dev, f, ##a) |
| 56 | #define brcms_warn(core, f, a...) __brcms_warn(&(core)->dev, f, ##a) |
| 57 | #define brcms_err(core, f, a...) __brcms_err(&(core)->dev, f, ##a) |
| 58 | #define brcms_crit(core, f, a...) __brcms_crit(&(core)->dev, f, ##a) |
| 59 | |
Seth Forshee | 913911f | 2012-11-15 08:08:04 -0600 | [diff] [blame] | 60 | #define brcms_dbg_info(core, f, a...) brcms_dbg(core, BRCM_DL_INFO, f, ##a) |
| 61 | #define brcms_dbg_mac80211(core, f, a...) brcms_dbg(core, BRCM_DL_MAC80211, f, ##a) |
Seth Forshee | 5ce58bb | 2012-11-15 08:08:05 -0600 | [diff] [blame] | 62 | #define brcms_dbg_rx(core, f, a...) brcms_dbg(core, BRCM_DL_RX, f, ##a) |
| 63 | #define brcms_dbg_tx(core, f, a...) brcms_dbg(core, BRCM_DL_TX, f, ##a) |
Seth Forshee | 229a41d | 2012-11-15 08:08:06 -0600 | [diff] [blame] | 64 | #define brcms_dbg_int(core, f, a...) brcms_dbg(core, BRCM_DL_INT, f, ##a) |
Seth Forshee | 90123e0 | 2012-11-15 08:08:07 -0600 | [diff] [blame] | 65 | #define brcms_dbg_dma(core, f, a...) brcms_dbg(core, BRCM_DL_DMA, f, ##a) |
Seth Forshee | 5211fa2 | 2012-11-15 08:08:08 -0600 | [diff] [blame] | 66 | #define brcms_dbg_ht(core, f, a...) brcms_dbg(core, BRCM_DL_HT, f, ##a) |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 67 | |
Piotr Haber | 8e21df2 | 2012-11-28 21:44:08 +0100 | [diff] [blame] | 68 | struct brcms_pub; |
| 69 | void brcms_debugfs_init(void); |
| 70 | void brcms_debugfs_exit(void); |
| 71 | int brcms_debugfs_attach(struct brcms_pub *drvr); |
| 72 | void brcms_debugfs_detach(struct brcms_pub *drvr); |
| 73 | struct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr); |
| 74 | void brcms_debugfs_create_files(struct brcms_pub *drvr); |
| 75 | |
Seth Forshee | 269de12 | 2012-11-15 08:08:02 -0600 | [diff] [blame] | 76 | #endif /* _BRCMS_DEBUG_H_ */ |