1 /*
2  * Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: Public API declarations of pre cac called from SAP module
19  */
20 
21 #ifndef _WLAN_PRE_CAC_API_H_
22 #define _WLAN_PRE_CAC_API_H_
23 
24 #ifdef PRE_CAC_SUPPORT
25 /**
26  * wlan_pre_cac_get_status(): status of pre_cac
27  * @psoc: psoc object manager
28  *
29  * Return: status of pre_cac
30  */
31 bool wlan_pre_cac_get_status(struct wlan_objmgr_psoc *psoc);
32 
33 /**
34  * wlan_pre_cac_set_status() - Set pre cac status
35  * @vdev: vdev object manager
36  * @status: status of pre_cac
37  *
38  * Sets pre_cac status
39  *
40  * Return: QDF_STATUS
41  */
42 QDF_STATUS wlan_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status);
43 
44 /**
45  * wlan_pre_cac_handle_cac_end() - Handle pre cac end
46  * @vdev: vdev object manager
47  *
48  * Return: None
49  */
50 void wlan_pre_cac_handle_cac_end(struct wlan_objmgr_vdev *vdev);
51 
52 /**
53  * wlan_pre_cac_complete_set() - Set pre cac complete status
54  * @vdev: vdev object manager
55  * @status: status
56  *
57  * Return: None
58  */
59 void wlan_pre_cac_complete_set(struct wlan_objmgr_vdev *vdev,
60 			       bool status);
61 
62 /**
63  * wlan_pre_cac_complete_get() - Get pre cac complete status
64  * @vdev: vdev object manager
65  *
66  * Return: pre cac complete status
67  */
68 bool wlan_pre_cac_complete_get(struct wlan_objmgr_vdev *vdev);
69 
70 /**
71  * wlan_pre_cac_set_freq_before_pre_cac() - Set frequency before pre cac
72  * @vdev: vdev object manager
73  * @freq: frequency
74  *
75  * Return: None
76  */
77 void wlan_pre_cac_set_freq_before_pre_cac(struct wlan_objmgr_vdev *vdev,
78 					  qdf_freq_t freq);
79 
80 /**
81  * wlan_pre_cac_get_freq_before_pre_cac() - Get frequency before pre cac
82  * @vdev: vdev object manager
83  *
84  * Return: Frequency before pre cac
85  */
86 qdf_freq_t
87 wlan_pre_cac_get_freq_before_pre_cac(struct wlan_objmgr_vdev *vdev);
88 
89 /**
90  * wlan_pre_cac_handle_radar_ind() - Handle pre cac radar indication
91  * @vdev: vdev object manager
92  *
93  * Return: None
94  */
95 void wlan_pre_cac_handle_radar_ind(struct wlan_objmgr_vdev *vdev);
96 #else
97 static inline void
wlansap_pre_cac_end_notify(struct sap_context * sap_context,struct mac_context * mac,uint8_t intf)98 wlansap_pre_cac_end_notify(struct sap_context *sap_context,
99 			   struct mac_context *mac,
100 			   uint8_t intf)
101 {
102 }
103 
wlan_pre_cac_get_status(struct wlan_objmgr_psoc * psoc)104 static inline bool wlan_pre_cac_get_status(struct wlan_objmgr_psoc *psoc)
105 {
106 	return false;
107 }
108 
109 static inline QDF_STATUS
wlan_pre_cac_set_status(struct wlan_objmgr_vdev * vdev,bool status)110 wlan_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status)
111 {
112 	return false;
113 }
114 
115 static inline void
wlan_pre_cac_handle_cac_end(struct wlan_objmgr_vdev * vdev)116 wlan_pre_cac_handle_cac_end(struct wlan_objmgr_vdev *vdev)
117 {
118 }
119 
120 static inline void
wlan_pre_cac_complete_set(struct wlan_objmgr_vdev * vdev,bool status)121 wlan_pre_cac_complete_set(struct wlan_objmgr_vdev *vdev,
122 			  bool status)
123 {
124 }
125 
126 static inline bool
wlan_pre_cac_complete_get(struct wlan_objmgr_vdev * vdev)127 wlan_pre_cac_complete_get(struct wlan_objmgr_vdev *vdev)
128 {
129 	return false;
130 }
131 
132 static inline void
wlan_pre_cac_set_freq_before_pre_cac(struct wlan_objmgr_vdev * vdev,qdf_freq_t freq)133 wlan_pre_cac_set_freq_before_pre_cac(struct wlan_objmgr_vdev *vdev,
134 				     qdf_freq_t freq)
135 {
136 }
137 
138 static inline qdf_freq_t
wlan_pre_cac_get_freq_before_pre_cac(struct wlan_objmgr_vdev * vdev)139 wlan_pre_cac_get_freq_before_pre_cac(struct wlan_objmgr_vdev *vdev)
140 {
141 	return 0;
142 }
143 #endif /* PRE_CAC_SUPPORT */
144 #endif /* _WLAN_PRE_CAC_API_H_ */
145