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