xref: /wlan-driver/qcacld-3.0/components/ftm_time_sync/core/inc/ftm_time_sync_priv.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2020, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: Declare private API which shall be used internally only
20  * in ftm_time_sync component. This file shall include prototypes of
21  * ftm_time_sync parsing and send logic.
22  *
23  * Note: This API should be never accessed out of ftm_time_sync component.
24  */
25 
26 #ifndef _FTM_TIME_SYNC_PRIV_STRUCT_H_
27 #define _FTM_TIME_SYNC_PRIV_STRUCT_H_
28 
29 #include <qdf_list.h>
30 #include <qdf_types.h>
31 #include "ftm_time_sync_objmgr.h"
32 #include "wlan_ftm_time_sync_public_struct.h"
33 
34 #define WLAN_FTM_TIME_SYNC_PAIR_MAX 32
35 
36 /**
37  * struct wlan_time_sync_pair - wlan time sync pair
38  * @qtime_initiator: initiator qtime
39  * @qtime_target: target qtime
40  */
41 struct wlan_time_sync_pair {
42 	uint64_t qtime_initiator;
43 	uint64_t qtime_target;
44 };
45 
46 /**
47  * struct ftm_time_sync_priv - Private object to be stored in vdev
48  * @qtime_ref: qtime ref
49  * @mac_ref: mac time ref
50  * @time_pair: array of initiator/target qtime pair
51  */
52 
53 struct ftm_time_sync_priv {
54 	uint64_t qtime_ref;
55 	uint64_t mac_ref;
56 	struct wlan_time_sync_pair time_pair[WLAN_FTM_TIME_SYNC_PAIR_MAX];
57 };
58 
59 /**
60  * struct ftm_time_sync_cfg - Cfg ini param for FTM time sync
61  * @enable: FTM time_sync feature enable/disable
62  * @mode: Aggregated/burst mode applicable iff enable = 1
63  * @role: Target/Initiator Role applicable iff enable = 1
64  */
65 struct ftm_time_sync_cfg {
66 	bool enable;
67 	enum ftm_time_sync_mode mode;
68 	enum ftm_time_sync_role role;
69 };
70 
71 /**
72  * struct ftm_time_sync_psoc_priv - Private object to be stored in psoc
73  * @psoc: pointer to psoc object
74  * @cfg_param: INI config param for ftm time sync
75  */
76 struct ftm_time_sync_psoc_priv {
77 	struct wlan_objmgr_psoc *psoc;
78 	struct ftm_time_sync_cfg cfg_param;
79 };
80 
81 /**
82  * struct ftm_time_sync_vdev_priv - Private object to be stored in vdev
83  * @vdev: pointer to vdev object
84  * @ftm_ts_priv: time sync private struct
85  * @rx_ops: rx operations for ftm time sync
86  * @tx_ops: tx operations for ftm time sync
87  * @ftm_time_sync_mutex: mutex to access ftm time sync priv members
88  * @ftm_time_sync_work: work to capture audio qtime and send it to FW
89  * @time_sync_interval: interval between two qtime capture
90  * @num_qtime_pair: number of qinitiator and qtarget pair derived
91  * @num_reads: number of times the qtime to be captured
92  * @valid: send qtime to FW only if this is true
93  * @bssid: bssid of connected AP
94  */
95 struct ftm_time_sync_vdev_priv {
96 	struct wlan_objmgr_vdev *vdev;
97 	struct ftm_time_sync_priv ftm_ts_priv;
98 	struct wlan_ftm_time_sync_rx_ops rx_ops;
99 	struct wlan_ftm_time_sync_tx_ops tx_ops;
100 	qdf_mutex_t ftm_time_sync_mutex;
101 	struct qdf_delayed_work ftm_time_sync_work;
102 	uint32_t time_sync_interval;
103 	int num_qtime_pair;
104 	int num_reads;
105 	bool valid;
106 	struct qdf_mac_addr bssid;
107 };
108 
109 #endif /* End  of _FTM_TIME_SYNC_PRIV_STRUCT_H_ */
110