xref: /OK3568_Linux_fs/external/rkwifibt/drivers/bcmdhd/dhd_csi.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Broadcom Dongle Host Driver (DHD), CSI
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (C) 1999-2018, Broadcom.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  *      Unless you and Broadcom execute a separate written software license
7*4882a593Smuzhiyun  * agreement governing use of this software, this software is licensed to you
8*4882a593Smuzhiyun  * under the terms of the GNU General Public License version 2 (the "GPL"),
9*4882a593Smuzhiyun  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10*4882a593Smuzhiyun  * following added to such license:
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  *      As a special exception, the copyright holders of this software give you
13*4882a593Smuzhiyun  * permission to link this software with independent modules, and to copy and
14*4882a593Smuzhiyun  * distribute the resulting executable under terms of your choice, provided that
15*4882a593Smuzhiyun  * you also meet, for each linked independent module, the terms and conditions of
16*4882a593Smuzhiyun  * the license of that module.  An independent module is a module which is not
17*4882a593Smuzhiyun  * derived from this software.  The special exception does not apply to any
18*4882a593Smuzhiyun  * modifications of the software.
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  *      Notwithstanding the above, under no circumstances may you combine this
21*4882a593Smuzhiyun  * software in any way with any other Broadcom software provided under a license
22*4882a593Smuzhiyun  * other than the GPL, without Broadcom's express prior written consent.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * $Id: dhd_csi.h 558438 2015-05-22 06:05:11Z $
25*4882a593Smuzhiyun  */
26*4882a593Smuzhiyun #ifndef __DHD_CSI_H__
27*4882a593Smuzhiyun #define __DHD_CSI_H__
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun /* Maxinum csi file dump size */
30*4882a593Smuzhiyun #define MAX_CSI_FILESZ		(32 * 1024)
31*4882a593Smuzhiyun /* Maxinum subcarrier number */
32*4882a593Smuzhiyun #define MAXINUM_CFR_DATA	256 * 4
33*4882a593Smuzhiyun #define CSI_DUMP_PATH		"/sys/bcm-dhd/csi"
34*4882a593Smuzhiyun #define MAX_EVENT_SIZE		1400
35*4882a593Smuzhiyun /* maximun csi number stored at dhd */
36*4882a593Smuzhiyun #define MAX_CSI_NUM		8
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun typedef struct cfr_dump_header {
39*4882a593Smuzhiyun 	/* 0 - successful; 1 - Failed */
40*4882a593Smuzhiyun 	uint8 status;
41*4882a593Smuzhiyun 	/* Peer MAC address */
42*4882a593Smuzhiyun 	uint8 peer_macaddr[6];
43*4882a593Smuzhiyun 	/* Number of Space Time Streams */
44*4882a593Smuzhiyun 	uint8 sts;
45*4882a593Smuzhiyun 	/* Number of RX chain */
46*4882a593Smuzhiyun 	uint8 num_rx;
47*4882a593Smuzhiyun 	/* Number of subcarrier */
48*4882a593Smuzhiyun 	uint16 num_carrier;
49*4882a593Smuzhiyun 	/* Length of the CSI dump */
50*4882a593Smuzhiyun 	uint32 cfr_dump_length;
51*4882a593Smuzhiyun 	/* remain unsend CSI data length */
52*4882a593Smuzhiyun 	uint32 remain_length;
53*4882a593Smuzhiyun 	/* RSSI */
54*4882a593Smuzhiyun 	int8 rssi;
55*4882a593Smuzhiyun } __attribute__((packed)) cfr_dump_header_t;
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun typedef struct cfr_dump_data {
58*4882a593Smuzhiyun 	cfr_dump_header_t header;
59*4882a593Smuzhiyun 	uint32 data[MAXINUM_CFR_DATA];
60*4882a593Smuzhiyun } cfr_dump_data_t;
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun typedef struct {
63*4882a593Smuzhiyun 	struct list_head list;
64*4882a593Smuzhiyun 	cfr_dump_data_t entry;
65*4882a593Smuzhiyun } cfr_dump_list_t;
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun int dhd_csi_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data);
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun int dhd_csi_init(dhd_pub_t *dhd);
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun int dhd_csi_deinit(dhd_pub_t *dhd);
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun void dhd_csi_clean_list(dhd_pub_t *dhd);
74*4882a593Smuzhiyun 
75*4882a593Smuzhiyun int dhd_csi_dump_list(dhd_pub_t *dhd, char *buf);
76*4882a593Smuzhiyun #endif /* __DHD_CSI_H__ */
77