xref: /OK3568_Linux_fs/external/rkwifibt/drivers/bcmdhd/dhd_timesync.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Header file describing the common timesync functionality
3  *
4  * Provides type definitions and function prototypes used to handle timesync functionality.
5  *
6  * Copyright (C) 2020, Broadcom.
7  *
8  *      Unless you and Broadcom execute a separate written software license
9  * agreement governing use of this software, this software is licensed to you
10  * under the terms of the GNU General Public License version 2 (the "GPL"),
11  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12  * following added to such license:
13  *
14  *      As a special exception, the copyright holders of this software give you
15  * permission to link this software with independent modules, and to copy and
16  * distribute the resulting executable under terms of your choice, provided that
17  * you also meet, for each linked independent module, the terms and conditions of
18  * the license of that module.  An independent module is a module which is not
19  * derived from this software.  The special exception does not apply to any
20  * modifications of the software.
21  *
22  *
23  * <<Broadcom-WL-IPTag/Open:>>
24  *
25  * $Id$:
26  */
27 
28 #ifndef _dhd_timesync_h_
29 #define _dhd_timesync_h_
30 
31 typedef struct dhd_ts dhd_ts_t;
32 
33 /* Linkage, sets "ts" link and updates hdrlen in pub */
34 extern int dhd_timesync_attach(dhd_pub_t *dhdp);
35 
36 /* Linkage, sets "ts" link and updates hdrlen in pub */
37 extern bool dhd_timesync_watchdog(dhd_pub_t *dhdp);
38 
39 /* Unlink, frees allocated timesync memory (including dhd_ts_t) */
40 extern int dhd_timesync_detach(dhd_pub_t *dhdp);
41 
42 /* Check for and handle local prot-specific iovar commands */
43 extern int dhd_timesync_iovar_op(dhd_ts_t *ts, const char *name, void *params, int plen,
44 	void *arg, int len, bool set);
45 
46 /* handle host time stamp completion */
47 extern void dhd_timesync_handle_host_ts_complete(dhd_ts_t *ts, uint16 xt_id, uint16 status);
48 
49 /* handle fw time stamp event from firmware */
50 extern void dhd_timesync_handle_fw_timestamp(dhd_ts_t *ts, uchar *tlv, uint32 tlv_len,
51 	uint32 seqnum);
52 
53 /* get notified of the ipc rev */
54 extern void dhd_timesync_notify_ipc_rev(dhd_ts_t *ts, uint32 ipc_rev);
55 
56 /* log txs timestamps */
57 extern void dhd_timesync_log_tx_timestamp(dhd_ts_t *ts, uint16 flowid, uint8 intf,
58 	uint32 ts_low, uint32 ts_high, dhd_pkt_parse_t *parse);
59 
60 /* log rx cpl timestamps */
61 extern void dhd_timesync_log_rx_timestamp(dhd_ts_t *ts, uint8 intf,
62 	uint32 ts_low, uint32 ts_high, dhd_pkt_parse_t *parse);
63 
64 /* dynamically disabling it based on the host driver suspend/resume state */
65 extern void dhd_timesync_control(dhd_pub_t *dhdp, bool disabled);
66 
67 extern void dhd_timesync_debug_info_print(dhd_pub_t *dhdp);
68 #endif /* _dhd_timesync_h_ */
69