linux/drivers/net/wireless/realtek/rtlwifi/debug.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2009-2012  Realtek Corporation.*/

#ifndef __RTL_DEBUG_H__
#define __RTL_DEBUG_H__

/*--------------------------------------------------------------
			Debug level
--------------------------------------------------------------*/
/*
 *Fatal bug.
 *For example, Tx/Rx/IO locked up,
 *memory access violation,
 *resource allocation failed,
 *unexpected HW behavior, HW BUG
 *and so on.
 */
/*#define DBG_EMERG			0 */

/*
 *Abnormal, rare, or unexpeted cases.
 *For example, Packet/IO Ctl canceled,
 *device suprisely unremoved and so on.
 */
#define DBG_WARNING

/*
 *Normal case driver developer should
 *open, we can see link status like
 *assoc/AddBA/DHCP/adapter start and
 *so on basic and useful infromations.
 */
#define DBG_DMESG

/*
 *Normal case with useful information
 *about current SW or HW state.
 *For example, Tx/Rx descriptor to fill,
 *Tx/Rx descriptor completed status,
 *SW protocol state change, dynamic
 *mechanism state change and so on.
 */
#define DBG_LOUD

/*
 *Normal case with detail execution
 *flow or information.
 */
#define DBG_TRACE

/*--------------------------------------------------------------
		Define the rt_trace components
--------------------------------------------------------------*/
#define COMP_ERR
#define COMP_FW
#define COMP_INIT
#define COMP_RECV
#define COMP_SEND
#define COMP_MLME
#define COMP_SCAN
#define COMP_INTR
#define COMP_LED
#define COMP_SEC
#define COMP_BEACON
#define COMP_RATE
#define COMP_RXDESC
#define COMP_DIG
#define COMP_TXAGC
#define COMP_HIPWR
#define COMP_POWER
#define COMP_POWER_TRACKING
#define COMP_BB_POWERSAVING
#define COMP_SWAS
#define COMP_RF
#define COMP_TURBO
#define COMP_RATR
#define COMP_CMD
#define COMP_EFUSE
#define COMP_QOS
#define COMP_MAC80211
#define COMP_REGD
#define COMP_CHAN
#define COMP_USB
#define COMP_EASY_CONCURRENT
#define COMP_BT_COEXIST
#define COMP_IQK
#define COMP_TX_REPORT

/*--------------------------------------------------------------
		Define the rt_print components
--------------------------------------------------------------*/
/* Define EEPROM and EFUSE  check module bit*/
#define EEPROM_W
#define EFUSE_PG
#define EFUSE_READ_ALL

/* Define init check for module bit*/
#define INIT_EEPROM
#define INIT_TXPOWER
#define INIT_IQK
#define INIT_RF

/* Define PHY-BB/RF/MAC check module bit */
#define PHY_BBR
#define PHY_BBW
#define PHY_RFR
#define PHY_RFW
#define PHY_MACR
#define PHY_MACW
#define PHY_ALLR
#define PHY_ALLW
#define PHY_TXPWR
#define PHY_PWRDIFF

/* Define Dynamic Mechanism check module bit --> FDM */
#define WA_IOT
#define DM_PWDB
#define DM_MONITOR
#define DM_DIG
#define DM_EDCA_TURBO

#define DM_PWDB

enum dbgp_flag_e {};

#ifdef CONFIG_RTLWIFI_DEBUG

struct rtl_priv;

__printf(4, 5)
void _rtl_dbg_print(struct rtl_priv *rtlpriv, u64 comp, int level,
		    const char *fmt, ...);

void _rtl_dbg_print_data(struct rtl_priv *rtlpriv, u64 comp, int level,
			 const char *titlestring,
			 const void *hexdata, int hexdatalen);

#define rtl_dbg(rtlpriv, comp, level, fmt, ...)

#define RTPRINT(rtlpriv, dbgtype, dbgflag, fmt, ...)

#define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata,	\
		      _hexdatalen)

#else

struct rtl_priv;

__printf(4, 5)
static inline void rtl_dbg(struct rtl_priv *rtlpriv,
			   u64 comp, int level,
			   const char *fmt, ...)
{
}

__printf(4, 5)
static inline void RTPRINT(struct rtl_priv *rtlpriv,
			   int dbgtype, int dbgflag,
			   const char *fmt, ...)
{
}

static inline void RT_PRINT_DATA(struct rtl_priv *rtlpriv,
				 u64 comp, int level,
				 const char *titlestring,
				 const void *hexdata, size_t hexdatalen)
{
}

#endif

#ifdef CONFIG_RTLWIFI_DEBUG
void rtl_debug_add_one(struct ieee80211_hw *hw);
void rtl_debug_remove_one(struct ieee80211_hw *hw);
void rtl_debugfs_add_topdir(void);
void rtl_debugfs_remove_topdir(void);
#else
#define rtl_debug_add_one
#define rtl_debug_remove_one
#define rtl_debugfs_add_topdir
#define rtl_debugfs_remove_topdir
#endif
#endif