xref: /wlan-dirver/qca-wifi-host-cmn/qdf/inc/qdf_platform.h (revision 87a8e4458319c60b618522e263ed900e36aab528)
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: qdf_platform.h
21  * This file defines platform API abstractions.
22  */
23 
24 #ifndef _QDF_PLATFORM_H
25 #define _QDF_PLATFORM_H
26 
27 /**
28  * qdf_self_recovery_callback() - callback for self recovery
29  * @reason: the reason for the recovery request
30  * @func: the caller's function name
31  * @line: the line number of the callsite
32  *
33  * Return: none
34  */
35 typedef void (*qdf_self_recovery_callback)(enum qdf_hang_reason reason,
36 					   const char *func,
37 					   const uint32_t line);
38 
39 /**
40  * qdf_ssr_callback() - callback for ssr
41  *
42  * Return: true if fw is down and false if fw is not down
43  */
44 typedef void (*qdf_ssr_callback)(const char *);
45 
46 /**
47  * qdf_is_module_state_transitioning_cb() - callback to check module state
48  *
49  * Return: true if module is in transition, else false
50  */
51 typedef int (*qdf_is_module_state_transitioning_cb)(void);
52 
53 /**
54  * qdf_is_fw_down_callback() - callback to query if fw is down
55  *
56  * Return: true if fw is down and false if fw is not down
57  */
58 typedef bool (*qdf_is_fw_down_callback)(void);
59 
60 /**
61  * qdf_register_fw_down_callback() - API to register fw down callback
62  * @is_fw_down: callback to query if fw is down or not
63  *
64  * Return: none
65  */
66 void qdf_register_fw_down_callback(qdf_is_fw_down_callback is_fw_down);
67 
68 /**
69  * qdf_is_fw_down() - API to check if fw is down or not
70  *
71  * Return: true: if fw is down
72  *	   false: if fw is not down
73  */
74 bool qdf_is_fw_down(void);
75 
76 /**
77  * qdf_register_self_recovery_callback() - register self recovery callback
78  * @callback:  self recovery callback
79  *
80  * Return: None
81  */
82 void qdf_register_self_recovery_callback(qdf_self_recovery_callback callback);
83 
84 /**
85  * qdf_trigger_self_recovery () - tirgger self recovery
86  *
87  * Return: None
88  */
89 #define qdf_trigger_self_recovery() \
90 	__qdf_trigger_self_recovery(__func__, __LINE__)
91 void __qdf_trigger_self_recovery(const char *func, const uint32_t line);
92 
93 /**
94  * qdf_register_ssr_protect_callbacks() - register [un]protect callbacks
95  *
96  * Return: None
97  */
98 void qdf_register_ssr_protect_callbacks(qdf_ssr_callback protect,
99 					qdf_ssr_callback unprotect);
100 
101 /**
102  * qdf_ssr_protect() - start SSR protection
103  *
104  * Return: None
105  */
106 void qdf_ssr_protect(const char *caller);
107 
108 /**
109  * qdf_ssr_unprotect() - remove SSR protection
110  *
111  * Return: None
112  */
113 void qdf_ssr_unprotect(const char *caller);
114 
115 /**
116  * qdf_register_module_state_query_callback() - register module state query
117  *
118  * Return: None
119  */
120 void qdf_register_module_state_query_callback(
121 			qdf_is_module_state_transitioning_cb query);
122 
123 /**
124  * qdf_is_module_state_transitioning() - query module state transition
125  *
126  * Return: true if in transition else false
127  */
128 bool qdf_is_module_state_transitioning(void);
129 #endif /*_QDF_PLATFORM_H*/
130