xref: /wlan-driver/qca-wifi-host-cmn/qdf/inc/qdf_debug_domain.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2017 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name 
20*5113495bSYour Name /**
21*5113495bSYour Name  * DOC: qdf_debug_domain
22*5113495bSYour Name  * QCA driver framework (QDF) debug domain APIs. Debug domains are used to track
23*5113495bSYour Name  * resource allocations across different driver states, particularly for runtime
24*5113495bSYour Name  * leak detection.
25*5113495bSYour Name  */
26*5113495bSYour Name 
27*5113495bSYour Name #ifndef __QDF_DEBUG_DOMAIN_H
28*5113495bSYour Name #define __QDF_DEBUG_DOMAIN_H
29*5113495bSYour Name 
30*5113495bSYour Name #include "qdf_types.h"
31*5113495bSYour Name 
32*5113495bSYour Name /**
33*5113495bSYour Name  * enum qdf_debug_domain - debug domains for tracking resource allocations
34*5113495bSYour Name  * @QDF_DEBUG_DOMAIN_INIT: The default debug domain, tied to driver load
35*5113495bSYour Name  * @QDF_DEBUG_DOMAIN_ACTIVE: The active debug domain, tied some "running" state
36*5113495bSYour Name  * @QDF_DEBUG_DOMAIN_COUNT: The number of debug domains for iterating, etc.
37*5113495bSYour Name  */
38*5113495bSYour Name enum qdf_debug_domain {
39*5113495bSYour Name 	QDF_DEBUG_DOMAIN_INIT,
40*5113495bSYour Name 	QDF_DEBUG_DOMAIN_ACTIVE,
41*5113495bSYour Name 
42*5113495bSYour Name 	/* keep last */
43*5113495bSYour Name 	QDF_DEBUG_DOMAIN_COUNT,
44*5113495bSYour Name };
45*5113495bSYour Name 
46*5113495bSYour Name /**
47*5113495bSYour Name  * qdf_debug_domain_get() - Get the current debug domain
48*5113495bSYour Name  *
49*5113495bSYour Name  * Return: the current debug domain
50*5113495bSYour Name  */
51*5113495bSYour Name enum qdf_debug_domain qdf_debug_domain_get(void);
52*5113495bSYour Name 
53*5113495bSYour Name /**
54*5113495bSYour Name  * qdf_debug_domain_set() - Set the current debug domain
55*5113495bSYour Name  * @domain: the domain to change to
56*5113495bSYour Name  *
57*5113495bSYour Name  * Return: None
58*5113495bSYour Name  */
59*5113495bSYour Name void qdf_debug_domain_set(enum qdf_debug_domain domain);
60*5113495bSYour Name 
61*5113495bSYour Name /**
62*5113495bSYour Name  * qdf_debug_domain_name() - Get the human readable name of a debug domain
63*5113495bSYour Name  * @domain: The domain to return the name of
64*5113495bSYour Name  *
65*5113495bSYour Name  * Return: name of the given domain
66*5113495bSYour Name  */
67*5113495bSYour Name const char *qdf_debug_domain_name(enum qdf_debug_domain domain);
68*5113495bSYour Name 
69*5113495bSYour Name /**
70*5113495bSYour Name  * qdf_debug_domain_valid() - bounds checks the given domain
71*5113495bSYour Name  * @domain: the domain to validate
72*5113495bSYour Name  *
73*5113495bSYour Name  * Return: true is the given domain is a valid debug domain
74*5113495bSYour Name  */
75*5113495bSYour Name bool qdf_debug_domain_valid(enum qdf_debug_domain domain);
76*5113495bSYour Name 
77*5113495bSYour Name #endif /* __QDF_DEBUG_DOMAIN_H */
78