xref: /wlan-dirver/qca-wifi-host-cmn/target_if/cfr/inc/target_if_cfr.h (revision a86b23ee68a2491aede2e03991f3fb37046f4e41)
1 /*
2  * Copyright (c) 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 #ifndef _TARGET_IF_CFR_H_
20 #define _TARGET_IF_CFR_H_
21 
22 #include <wlan_objmgr_cmn.h>
23 #include <wlan_objmgr_psoc_obj.h>
24 #include <wlan_objmgr_pdev_obj.h>
25 #include <wlan_objmgr_vdev_obj.h>
26 #include <wlan_objmgr_peer_obj.h>
27 
28 #include "wmi_unified_cfr_api.h"
29 #include "wmi_unified_param.h"
30 #include "wmi_unified_cfr_param.h"
31 #define PEER_CFR_CAPTURE_ENABLE   1
32 #define PEER_CFR_CAPTURE_DISABLE  0
33 
34 #define PEER_CFR_CAPTURE_EVT_STATUS_MASK 0x80000000
35 #define PEER_CFR_CAPTURE_EVT_PS_STATUS_MASK 0x40000000
36 #define CFR_TX_EVT_STATUS_MASK           0x00000003
37 
38 /* Status codes used by correlate and relay function */
39 #define STATUS_STREAM_AND_RELEASE 0
40 #define STATUS_HOLD               1
41 #define STATUS_ERROR             -1
42 
43 /* Module IDs using corrlation function */
44 #define CORRELATE_DBR_MODULE_ID   0
45 /*
46  * HKV2 - Tx completion event for one-shot capture
47  * Cypress - Tx completion event for one-shot capture (or) RXTLV event for RCC
48  */
49 #define CORRELATE_TX_EV_MODULE_ID 1
50 
51 /**
52  * target_if_cfr_init_pdev() - Inits cfr pdev and registers necessary handlers.
53  * @psoc: pointer to psoc object
54  * @pdev: pointer to pdev object
55  *
56  * Return: Registration status for necessary handlers
57  */
58 int target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc,
59 			    struct wlan_objmgr_pdev *pdev);
60 
61 /**
62  * target_if_cfr_deinit_pdev() - De-inits corresponding pdev and handlers.
63  * @psoc: pointer to psoc object
64  * @pdev: pointer to pdev object
65  *
66  * Return: De-registration status for necessary handlers
67  */
68 int target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc,
69 			      struct wlan_objmgr_pdev *pdev);
70 
71 /**
72  * target_if_cfr_tx_ops_register() - Registers tx ops for cfr module
73  * @tx_ops - pointer to tx_ops structure.
74  */
75 void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops);
76 
77 /**
78  * target_if_cfr_enable_cfr_timer() - Enables cfr timer
79  * @pdev: pointer to pdev object
80  * @cfr_timer: Amount of time this timer has to run
81  *
82  * Return: status of timer
83  */
84 int target_if_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev,
85 				   uint32_t cfr_timer);
86 
87 /**
88  * target_if_cfr_pdev_set_param() - Function to set params for cfr config
89  * @pdev: pointer to pdev object
90  * @param_id: param id which has to be set
91  * @param_value: value of param being set
92  *
93  * Return: success/failure of setting param
94  */
95 int target_if_cfr_pdev_set_param(struct wlan_objmgr_pdev *pdev,
96 				 uint32_t param_id, uint32_t param_value);
97 /**
98  * target_if_cfr_start_capture() - Function to start cfr capture for a peer
99  * @pdev: pointer to pdev object
100  * @peer: pointer to peer object
101  * @cfr_params: capture parameters for this peer
102  *
103  * Return: success/failure status of start capture
104  */
105 int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
106 				struct wlan_objmgr_peer *peer,
107 				struct cfr_capture_params *cfr_params);
108 /**
109  * target_if_cfr_stop_capture() - Function to stop cfr capture for a peer
110  * @pdev: pointer to pdev object
111  * @peer: pointer to peer object
112  *
113  * Return: success/failure status of stop capture
114  */
115 int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
116 			       struct wlan_objmgr_peer *peer);
117 
118 /**
119  * target_if_cfr_get_target_type() - Function to get target type
120  * @psoc: pointer to psoc object
121  *
122  * Return: target type of target
123  */
124 int target_if_cfr_get_target_type(struct wlan_objmgr_psoc *psoc);
125 
126 /**
127  * target_if_cfr_set_cfr_support() - Function to set cfr support
128  * @psoc: pointer to psoc object
129  * @value: value to be set
130  */
131 void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc,
132 				   uint8_t value);
133 
134 /**
135  * target_if_cfr_info_send() - Function to send cfr info to upper layers
136  * @pdev: pointer to pdev object
137  * @head: pointer to cfr info head
138  * @hlen: head len
139  * @data: pointer to cfr info data
140  * @dlen: data len
141  * @tail: pointer to cfr info tail
142  * @tlen: tail len
143  */
144 void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head,
145 			     size_t hlen, void *data, size_t dlen, void *tail,
146 			     size_t tlen);
147 
148 /**
149  * cfr_wifi2_0_init_pdev() - Function to init legacy pdev
150  * @psoc: pointer to psoc object
151  * @pdev: pointer to pdev object
152  *
153  * Return: success/failure status of init
154  */
155 QDF_STATUS cfr_wifi2_0_init_pdev(struct wlan_objmgr_psoc *psoc,
156 				 struct wlan_objmgr_pdev *pdev);
157 
158 /**
159  * cfr_wifi2_0_deinit_pdev() - Function to deinit legacy pdev
160  * @psoc: pointer to psoc object
161  * @pdev: pointer to pdev object
162  *
163  * Return: success/failure status of deinit
164  */
165 QDF_STATUS cfr_wifi2_0_deinit_pdev(struct wlan_objmgr_psoc *psoc,
166 				   struct wlan_objmgr_pdev *pdev);
167 #endif
168