xref: /wlan-dirver/qca-wifi-host-cmn/cfg/inc/i_cfg.h (revision 8afde5a83f7f4f62cb83b7e2a10c2f5a3ee63dea)
1 /*
2  * Copyright (c) 2018 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: Internal APIs for the configuration component.
21  */
22 
23 #ifndef __I_CFG_H
24 #define __I_CFG_H
25 
26 #include "cfg_define.h"
27 #include "qdf_trace.h"
28 #include "qdf_types.h"
29 #include "wlan_objmgr_psoc_obj.h"
30 
31 #define __cfg_log(level, fmt, args...) \
32 	QDF_TRACE(QDF_MODULE_ID_CONFIG, level, FL(fmt), ##args)
33 #define cfg_err(fmt, args...) __cfg_log(QDF_TRACE_LEVEL_ERROR, fmt, ##args)
34 #define cfg_info(fmt, args...) __cfg_log(QDF_TRACE_LEVEL_INFO, fmt, ##args)
35 #define cfg_debug(fmt, args...) __cfg_log(QDF_TRACE_LEVEL_DEBUG, fmt, ##args)
36 #define cfg_enter() cfg_debug("enter")
37 #define cfg_exit() cfg_debug("exit")
38 
39 /* define global config values structure */
40 
41 #undef __CFG_INI_STRING
42 #define __CFG_INI_STRING(id, mtype, ctype, name, min, max, fallback, desc, \
43 			 def...) \
44 	const char id##_internal[(max) + 1];
45 #undef __CFG_INI
46 #define __CFG_INI(id, mtype, ctype, name, min, max, fallback, desc, def...) \
47 	const ctype id##_internal;
48 
49 struct cfg_values {
50 	/* e.g. const int32_t __CFG_SCAN_DWELL_TIME_internal; */
51 	CFG_ALL
52 };
53 
54 #undef __CFG_INI_STRING
55 #define __CFG_INI_STRING(args...) __CFG_INI(args)
56 #undef __CFG_INI
57 #define __CFG_INI(args...) (args)
58 
59 struct cfg_values *cfg_psoc_get_values(struct wlan_objmgr_psoc *psoc);
60 
61 #define __cfg_get(psoc, id) (cfg_psoc_get_values(psoc)->id##_internal)
62 
63 #endif /* __I_CFG_H */
64 
65