Linux Audio

Check our new training course

Open-source upstreaming

Need help get the support for your hardware in upstream Linux?
Loading...
v4.17
 
  1/*
  2 * This file is part of wl12xx
  3 *
  4 * Copyright (C) 2011 Texas Instruments. All rights reserved.
  5 * Copyright (C) 2008-2009 Nokia Corporation
  6 *
  7 * Contact: Luciano Coelho <coelho@ti.com>
  8 *
  9 * This program is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU General Public License
 11 * version 2 as published by the Free Software Foundation.
 12 *
 13 * This program is distributed in the hope that it will be useful, but
 14 * WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16 * General Public License for more details.
 17 *
 18 * You should have received a copy of the GNU General Public License
 19 * along with this program; if not, write to the Free Software
 20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 21 * 02110-1301 USA
 22 *
 23 */
 24
 25#ifndef __DEBUG_H__
 26#define __DEBUG_H__
 27
 28#include <linux/bitops.h>
 29#include <linux/printk.h>
 30
 31#define DRIVER_NAME "wlcore"
 32#define DRIVER_PREFIX DRIVER_NAME ": "
 33
 34enum {
 35	DEBUG_NONE	= 0,
 36	DEBUG_IRQ	= BIT(0),
 37	DEBUG_SPI	= BIT(1),
 38	DEBUG_BOOT	= BIT(2),
 39	DEBUG_MAILBOX	= BIT(3),
 40	DEBUG_TESTMODE	= BIT(4),
 41	DEBUG_EVENT	= BIT(5),
 42	DEBUG_TX	= BIT(6),
 43	DEBUG_RX	= BIT(7),
 44	DEBUG_SCAN	= BIT(8),
 45	DEBUG_CRYPT	= BIT(9),
 46	DEBUG_PSM	= BIT(10),
 47	DEBUG_MAC80211	= BIT(11),
 48	DEBUG_CMD	= BIT(12),
 49	DEBUG_ACX	= BIT(13),
 50	DEBUG_SDIO	= BIT(14),
 51	DEBUG_FILTERS   = BIT(15),
 52	DEBUG_ADHOC     = BIT(16),
 53	DEBUG_AP	= BIT(17),
 54	DEBUG_PROBE	= BIT(18),
 55	DEBUG_IO	= BIT(19),
 56	DEBUG_MASTER	= (DEBUG_ADHOC | DEBUG_AP),
 57	DEBUG_ALL	= ~0,
 58};
 59
 60extern u32 wl12xx_debug_level;
 61
 62#define DEBUG_DUMP_LIMIT 1024
 63
 64#define wl1271_error(fmt, arg...) \
 65	pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg)
 66
 67#define wl1271_warning(fmt, arg...) \
 68	pr_warn(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
 69
 70#define wl1271_notice(fmt, arg...) \
 71	pr_info(DRIVER_PREFIX fmt "\n", ##arg)
 72
 73#define wl1271_info(fmt, arg...) \
 74	pr_info(DRIVER_PREFIX fmt "\n", ##arg)
 75
 76/* define the debug macro differently if dynamic debug is supported */
 77#if defined(CONFIG_DYNAMIC_DEBUG)
 78#define wl1271_debug(level, fmt, arg...) \
 79	do { \
 80		if (unlikely(level & wl12xx_debug_level)) \
 81			dynamic_pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \
 82	} while (0)
 83#else
 84#define wl1271_debug(level, fmt, arg...) \
 85	do { \
 86		if (unlikely(level & wl12xx_debug_level)) \
 87			printk(KERN_DEBUG pr_fmt(DRIVER_PREFIX fmt "\n"), \
 88			       ##arg); \
 89	} while (0)
 90#endif
 91
 92#define wl1271_dump(level, prefix, buf, len)				      \
 93	do {								      \
 94		if (level & wl12xx_debug_level)				      \
 95			print_hex_dump_debug(DRIVER_PREFIX prefix,	      \
 96					DUMP_PREFIX_OFFSET, 16, 1,	      \
 97					buf,				      \
 98					min_t(size_t, len, DEBUG_DUMP_LIMIT), \
 99					0);				      \
100	} while (0)
101
102#define wl1271_dump_ascii(level, prefix, buf, len)			      \
103	do {								      \
104		if (level & wl12xx_debug_level)				      \
105			print_hex_dump_debug(DRIVER_PREFIX prefix,	      \
106					DUMP_PREFIX_OFFSET, 16, 1,	      \
107					buf,				      \
108					min_t(size_t, len, DEBUG_DUMP_LIMIT), \
109					true);				      \
110	} while (0)
111
112#endif /* __DEBUG_H__ */
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0-only */
 2/*
 3 * This file is part of wl12xx
 4 *
 5 * Copyright (C) 2011 Texas Instruments. All rights reserved.
 6 * Copyright (C) 2008-2009 Nokia Corporation
 7 *
 8 * Contact: Luciano Coelho <coelho@ti.com>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 9 */
10
11#ifndef __DEBUG_H__
12#define __DEBUG_H__
13
14#include <linux/bitops.h>
15#include <linux/printk.h>
16
17#define DRIVER_NAME "wlcore"
18#define DRIVER_PREFIX DRIVER_NAME ": "
19
20enum {
21	DEBUG_NONE	= 0,
22	DEBUG_IRQ	= BIT(0),
23	DEBUG_SPI	= BIT(1),
24	DEBUG_BOOT	= BIT(2),
25	DEBUG_MAILBOX	= BIT(3),
26	DEBUG_TESTMODE	= BIT(4),
27	DEBUG_EVENT	= BIT(5),
28	DEBUG_TX	= BIT(6),
29	DEBUG_RX	= BIT(7),
30	DEBUG_SCAN	= BIT(8),
31	DEBUG_CRYPT	= BIT(9),
32	DEBUG_PSM	= BIT(10),
33	DEBUG_MAC80211	= BIT(11),
34	DEBUG_CMD	= BIT(12),
35	DEBUG_ACX	= BIT(13),
36	DEBUG_SDIO	= BIT(14),
37	DEBUG_FILTERS   = BIT(15),
38	DEBUG_ADHOC     = BIT(16),
39	DEBUG_AP	= BIT(17),
40	DEBUG_PROBE	= BIT(18),
41	DEBUG_IO	= BIT(19),
42	DEBUG_MASTER	= (DEBUG_ADHOC | DEBUG_AP),
43	DEBUG_ALL	= ~0,
44};
45
46extern u32 wl12xx_debug_level;
47
48#define DEBUG_DUMP_LIMIT 1024
49
50#define wl1271_error(fmt, arg...) \
51	pr_err(DRIVER_PREFIX "ERROR " fmt "\n", ##arg)
52
53#define wl1271_warning(fmt, arg...) \
54	pr_warn(DRIVER_PREFIX "WARNING " fmt "\n", ##arg)
55
56#define wl1271_notice(fmt, arg...) \
57	pr_info(DRIVER_PREFIX fmt "\n", ##arg)
58
59#define wl1271_info(fmt, arg...) \
60	pr_info(DRIVER_PREFIX fmt "\n", ##arg)
61
62/* define the debug macro differently if dynamic debug is supported */
63#if defined(CONFIG_DYNAMIC_DEBUG)
64#define wl1271_debug(level, fmt, arg...) \
65	do { \
66		if (unlikely(level & wl12xx_debug_level)) \
67			dynamic_pr_debug(DRIVER_PREFIX fmt "\n", ##arg); \
68	} while (0)
69#else
70#define wl1271_debug(level, fmt, arg...) \
71	do { \
72		if (unlikely(level & wl12xx_debug_level)) \
73			printk(KERN_DEBUG pr_fmt(DRIVER_PREFIX fmt "\n"), \
74			       ##arg); \
75	} while (0)
76#endif
77
78#define wl1271_dump(level, prefix, buf, len)				      \
79	do {								      \
80		if (level & wl12xx_debug_level)				      \
81			print_hex_dump_debug(DRIVER_PREFIX prefix,	      \
82					DUMP_PREFIX_OFFSET, 16, 1,	      \
83					buf,				      \
84					min_t(size_t, len, DEBUG_DUMP_LIMIT), \
85					0);				      \
86	} while (0)
87
88#define wl1271_dump_ascii(level, prefix, buf, len)			      \
89	do {								      \
90		if (level & wl12xx_debug_level)				      \
91			print_hex_dump_debug(DRIVER_PREFIX prefix,	      \
92					DUMP_PREFIX_OFFSET, 16, 1,	      \
93					buf,				      \
94					min_t(size_t, len, DEBUG_DUMP_LIMIT), \
95					true);				      \
96	} while (0)
97
98#endif /* __DEBUG_H__ */