xref: /freebsd/usr.sbin/bluetooth/rtlbtfw/rtlbt_dbg.h (revision 5036d9652a5701d00e9e40ea942c278e9f77d33d)
1*5036d965SVladimir Kondratyev /*-
2*5036d965SVladimir Kondratyev  * SPDX-License-Identifier: BSD-2-Clause
3*5036d965SVladimir Kondratyev  *
4*5036d965SVladimir Kondratyev  * Copyright (c) 2013 Adrian Chadd <adrian@freebsd.org>
5*5036d965SVladimir Kondratyev  * Copyright (c) 2019 Vladimir Kondratyev <wulf@FreeBSD.org>
6*5036d965SVladimir Kondratyev  *
7*5036d965SVladimir Kondratyev  * Redistribution and use in source and binary forms, with or without
8*5036d965SVladimir Kondratyev  * modification, are permitted provided that the following conditions
9*5036d965SVladimir Kondratyev  * are met:
10*5036d965SVladimir Kondratyev  * 1. Redistributions of source code must retain the above copyright
11*5036d965SVladimir Kondratyev  *    notice, this list of conditions and the following disclaimer.
12*5036d965SVladimir Kondratyev  * 2. Redistributions in binary form must reproduce the above copyright
13*5036d965SVladimir Kondratyev  *    notice, this list of conditions and the following disclaimer in the
14*5036d965SVladimir Kondratyev  *    documentation and/or other materials provided with the distribution.
15*5036d965SVladimir Kondratyev  *
16*5036d965SVladimir Kondratyev  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*5036d965SVladimir Kondratyev  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*5036d965SVladimir Kondratyev  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*5036d965SVladimir Kondratyev  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*5036d965SVladimir Kondratyev  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*5036d965SVladimir Kondratyev  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*5036d965SVladimir Kondratyev  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*5036d965SVladimir Kondratyev  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*5036d965SVladimir Kondratyev  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*5036d965SVladimir Kondratyev  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*5036d965SVladimir Kondratyev  * SUCH DAMAGE.
27*5036d965SVladimir Kondratyev  */
28*5036d965SVladimir Kondratyev 
29*5036d965SVladimir Kondratyev #ifndef	__RTLBT_DEBUG_H__
30*5036d965SVladimir Kondratyev #define	__RTLBT_DEBUG_H__
31*5036d965SVladimir Kondratyev 
32*5036d965SVladimir Kondratyev extern	int rtlbt_do_debug;
33*5036d965SVladimir Kondratyev extern	int rtlbt_do_info;
34*5036d965SVladimir Kondratyev 
35*5036d965SVladimir Kondratyev #define	rtlbt_err(fmt, ...)						\
36*5036d965SVladimir Kondratyev 	fprintf(stderr, "rtlbtfw: %s: "fmt"\n", __func__, ##__VA_ARGS__)
37*5036d965SVladimir Kondratyev #define	rtlbt_info(fmt, ...)	do {					\
38*5036d965SVladimir Kondratyev 	if (rtlbt_do_info)						\
39*5036d965SVladimir Kondratyev 		fprintf(stderr, "%s: "fmt"\n", __func__, ##__VA_ARGS__);\
40*5036d965SVladimir Kondratyev } while (0)
41*5036d965SVladimir Kondratyev #define	rtlbt_debug(fmt, ...)	do {					\
42*5036d965SVladimir Kondratyev 	if (rtlbt_do_debug)						\
43*5036d965SVladimir Kondratyev 		fprintf(stderr, "%s: "fmt"\n", __func__, ##__VA_ARGS__);\
44*5036d965SVladimir Kondratyev } while (0)
45*5036d965SVladimir Kondratyev 
46*5036d965SVladimir Kondratyev #endif
47