xref: /wlan-driver/qca-wifi-host-cmn/cfg/inc/i_cfg.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2018-2019 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_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_CONFIG, params)
32 #define cfg_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_CONFIG, params)
33 #define cfg_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_CONFIG, params)
34 #define cfg_enter() QDF_TRACE_ENTER(QDF_MODULE_ID_CONFIG, "enter")
35 #define cfg_exit() QDF_TRACE_EXIT(QDF_MODULE_ID_CONFIG, "exit")
36 
37 #define cfg_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_CONFIG, params)
38 #define cfg_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_CONFIG, params)
39 #define cfg_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_CONFIG, params)
40 #define cfg_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_CONFIG, params)
41 
42 #define cfg_nofl_err(params...) \
43 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_CONFIG, params)
44 #define cfg_nofl_warn(params...) \
45 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_CONFIG, params)
46 #define cfg_nofl_info(params...) \
47 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_CONFIG, params)
48 #define cfg_nofl_debug(params...) \
49 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_CONFIG, params)
50 
51 /* define global config values structure */
52 
53 #undef __CFG_INI_STRING
54 #define __CFG_INI_STRING(id, mtype, ctype, name, min, max, fallback, desc, \
55 			 def...) \
56 	const char id##_internal[(max) + 1];
57 #undef __CFG_INI
58 #define __CFG_INI(id, mtype, ctype, name, min, max, fallback, desc, def...) \
59 	const ctype id##_internal;
60 
61 struct cfg_values {
62 	/* e.g. const int32_t __CFG_SCAN_DWELL_TIME_internal; */
63 	CFG_ALL
64 };
65 
66 #undef __CFG_INI_STRING
67 #define __CFG_INI_STRING(args...) __CFG_INI(args)
68 #undef __CFG_INI
69 #define __CFG_INI(args...) (args)
70 
71 struct cfg_values *cfg_psoc_get_values(struct wlan_objmgr_psoc *psoc);
72 
73 #define __cfg_get(psoc, id) (cfg_psoc_get_values( \
74 			(struct wlan_objmgr_psoc *)psoc)->id##_internal)
75 
76 #endif /* __I_CFG_H */
77 
78