xref: /wlan-dirver/qca-wifi-host-cmn/target_if/wifi_pos/inc/target_if_wifi_pos.h (revision 45a38684b07295822dc8eba39e293408f203eec8)
1 /*
2  * Copyright (c) 2017, 2019-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 /**
20  * DOC: target_if_wifi_pos.h
21  * This file declares the functions pertinent to wifi positioning component's
22  * target if layer.
23  */
24 #ifndef _WIFI_POS_TGT_IF_H_
25 #define _WIFI_POS_TGT_IF_H_
26 
27 #include "qdf_types.h"
28 #include "qdf_status.h"
29 struct oem_data_req;
30 struct oem_data_rsp;
31 struct wlan_objmgr_psoc;
32 struct wlan_soc_southbound_cb;
33 struct wlan_lmac_if_tx_ops;
34 struct wlan_lmac_if_rx_ops;
35 
36 #ifdef WIFI_POS_CONVERGED
37 
38 /**
39  * target_if_wifi_pos_get_rxops: api to get rx ops
40  * @psoc: pointer to psoc object
41  *
42  * Return: rx ops
43  */
44 struct wlan_lmac_if_wifi_pos_rx_ops *target_if_wifi_pos_get_rxops(
45 						struct wlan_objmgr_psoc *psoc);
46 
47 /**
48  * target_if_wifi_pos_register_events: function to register with wmi event
49  * @psoc: pointer to psoc object
50  *
51  * Return: status of operation
52  */
53 QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc);
54 
55 /**
56  * target_if_wifi_pos_deregister_events: function to deregister wmi event
57  * @psoc: pointer to psoc object
58  *
59  * Return: status of operation
60  */
61 QDF_STATUS target_if_wifi_pos_deregister_events(struct wlan_objmgr_psoc *psoc);
62 
63 
64 /**
65  * target_if_wifi_pos_register_tx_ops: function to register with lmac tx ops
66  * @tx_ops: lmac tx ops struct object
67  *
68  * Return: none
69  */
70 void target_if_wifi_pos_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
71 
72 #else
73 static inline struct wlan_lmac_if_wifi_pos_rx_ops *target_if_wifi_pos_get_rxops(
74 						struct wlan_objmgr_psoc *psoc)
75 {
76 	return NULL;
77 }
78 
79 static inline void target_if_wifi_pos_register_tx_ops(
80 					struct wlan_lmac_if_tx_ops *tx_ops)
81 {
82 }
83 
84 #endif
85 
86 #if defined(WLAN_FEATURE_CIF_CFR) && defined(WIFI_POS_CONVERGED)
87 /**
88  * target_if_wifi_pos_init_cir_cfr_rings: set DMA ring cap in psoc private
89  * object
90  * @psoc: pointer to psoc object
91  * @hal_soc: pointer to hal soc
92  * @num_mac: number of mac
93  * @buf: buffer containing DMA ring cap
94  *
95  * Return: status of operation
96  */
97 QDF_STATUS target_if_wifi_pos_init_cir_cfr_rings(struct wlan_objmgr_psoc *psoc,
98 					     void *hal_soc, uint8_t num_mac,
99 					     void *buf);
100 /**
101  * target_if_wifi_pos_deinit_dma_rings: frees up DMA rings
102  * @psoc: pointer to psoc
103  *
104  * Return: status of operation
105  */
106 QDF_STATUS target_if_wifi_pos_deinit_dma_rings(struct wlan_objmgr_psoc *psoc);
107 #else
108 static inline QDF_STATUS target_if_wifi_pos_init_cir_cfr_rings(
109 				struct wlan_objmgr_psoc *psoc, void *hal_soc,
110 				uint8_t num_mac, void *buf)
111 {
112 	return QDF_STATUS_SUCCESS;
113 }
114 
115 static inline QDF_STATUS target_if_wifi_pos_deinit_dma_rings(
116 				struct wlan_objmgr_psoc *psoc)
117 {
118 	return QDF_STATUS_SUCCESS;
119 }
120 #endif
121 
122 #ifndef CNSS_GENL
123 /**
124  * target_if_wifi_pos_convert_pdev_id_host_to_target: function to get target
125  * pdev_id from host pdev_id
126  * @psoc: pointer to psoc object
127  * @host_pdev_id: host pdev id
128  * @target_pdev_id: target pdev id
129  *
130  * Return: QDF_STATUS_SUCCESS in case of success, error codes in
131  * case of failure
132  */
133 QDF_STATUS target_if_wifi_pos_convert_pdev_id_host_to_target(
134 		struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id,
135 		uint32_t *target_pdev_id);
136 
137 /**
138  * target_if_wifi_pos_convert_pdev_id_target_to_host: function to get host
139  * pdev_id from target pdev_id
140  * @psoc: pointer to psoc object
141  * @target_pdev_id: target pdev id
142  * @host_pdev_id: host pdev id
143  *
144  * Return: QDF_STATUS_SUCCESS in case of success, error codes in
145  * case of failure
146  */
147 QDF_STATUS target_if_wifi_pos_convert_pdev_id_target_to_host(
148 		struct wlan_objmgr_psoc *psoc, uint32_t target_pdev_id,
149 		uint32_t *host_pdev_id);
150 
151 #else
152 
153 static inline QDF_STATUS target_if_wifi_pos_convert_pdev_id_host_to_target(
154 		struct wlan_objmgr_psoc *psoc, uint32_t host_pdev_id,
155 		uint32_t *target_pdev_id)
156 {
157 	return QDF_STATUS_SUCCESS;
158 }
159 
160 static inline QDF_STATUS target_if_wifi_pos_convert_pdev_id_target_to_host(
161 		struct wlan_objmgr_psoc *psoc, uint32_t target_pdev_id,
162 		uint32_t *host_pdev_id)
163 {
164 	return QDF_STATUS_SUCCESS;
165 }
166 #endif /* CNSS_GENL */
167 
168 #endif /* _WIFI_POS_TGT_IF_H_ */
169