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