1 /*
2  * Copyright (c) 2020 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 #include <linux/string.h>
20 #include <qdf_func_tracker.h>
21 #include <qdf_mem.h>
22 #include <qdf_module.h>
23 
24 #ifdef FUNC_CALL_MAP
25 char qdf_func_call_map_buf[QDF_FUNCTION_CALL_MAP_BUF_LEN] = {0};
26 
cc_func(unsigned int track)27 void cc_func(unsigned int track)
28 {
29 	unsigned int index = 0;
30 	unsigned int bit = 0;
31 
32 	index = track / 8;
33 	bit = track % 8;
34 	qdf_func_call_map_buf[index] |= (char)(1 << bit);
35 }
36 
37 qdf_export_symbol(cc_func);
38 
qdf_get_func_call_map(char * data)39 void qdf_get_func_call_map(char *data)
40 {
41 	qdf_mem_copy(data, qdf_func_call_map_buf,
42 		     QDF_FUNCTION_CALL_MAP_BUF_LEN);
43 }
44 
45 qdf_export_symbol(qdf_get_func_call_map);
46 
qdf_clear_func_call_map(void)47 void qdf_clear_func_call_map(void)
48 {
49 	qdf_mem_zero(qdf_func_call_map_buf, QDF_FUNCTION_CALL_MAP_BUF_LEN);
50 }
51 
52 qdf_export_symbol(qdf_clear_func_call_map);
53 
54 #endif
55