Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nu11secur1ty
GitHub Repository: nu11secur1ty/Kali-Linux
Path: blob/master/ALFA-W1F1/RTL8814AU/hal/hal_com_c2h.h
1307 views
1
/******************************************************************************
2
*
3
* Copyright(c) 2007 - 2017 Realtek Corporation.
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms of version 2 of the GNU General Public License as
7
* published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
*****************************************************************************/
15
#ifndef __COMMON_C2H_H__
16
#define __COMMON_C2H_H__
17
18
#define C2H_TYPE_REG 0
19
#define C2H_TYPE_PKT 1
20
21
/*
22
* C2H event format:
23
* Fields TRIGGER PAYLOAD SEQ PLEN ID
24
* BITS [127:120] [119:16] [15:8] [7:4] [3:0]
25
*/
26
#define C2H_ID(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 4)
27
#define C2H_PLEN(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 4, 4)
28
#define C2H_SEQ(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
29
#define C2H_PAYLOAD(_c2h) (((u8*)(_c2h)) + 2)
30
31
#define SET_C2H_ID(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 4, _val)
32
#define SET_C2H_PLEN(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 4, 4, _val)
33
#define SET_C2H_SEQ(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1 , 0, 8, _val)
34
35
/*
36
* C2H event format:
37
* Fields TRIGGER PLEN PAYLOAD SEQ ID
38
* BITS [127:120] [119:112] [111:16] [15:8] [7:0]
39
*/
40
#define C2H_ID_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)), 0, 8)
41
#define C2H_SEQ_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 1, 0, 8)
42
#define C2H_PAYLOAD_88XX(_c2h) (((u8*)(_c2h)) + 2)
43
#define C2H_PLEN_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 14, 0, 8)
44
#define C2H_TRIGGER_88XX(_c2h) LE_BITS_TO_1BYTE(((u8*)(_c2h)) + 15, 0, 8)
45
46
#define SET_C2H_ID_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)), 0, 8, _val)
47
#define SET_C2H_SEQ_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 1, 0, 8, _val)
48
#define SET_C2H_PLEN_88XX(_c2h, _val) SET_BITS_TO_LE_1BYTE(((u8*)(_c2h)) + 14, 0, 8, _val)
49
50
typedef enum _C2H_EVT {
51
C2H_DBG = 0x00,
52
C2H_LB = 0x01,
53
C2H_TXBF = 0x02,
54
C2H_CCX_TX_RPT = 0x03,
55
C2H_AP_REQ_TXRPT = 0x04,
56
C2H_FW_SCAN_COMPLETE = 0x7,
57
C2H_BT_INFO = 0x09,
58
C2H_BT_MP_INFO = 0x0B,
59
C2H_RA_RPT = 0x0C,
60
C2H_SPC_STAT = 0x0D,
61
C2H_RA_PARA_RPT = 0x0E,
62
C2H_FW_CHNL_SWITCH_COMPLETE = 0x10,
63
C2H_IQK_FINISH = 0x11,
64
C2H_MAILBOX_STATUS = 0x15,
65
C2H_P2P_RPORT = 0x16,
66
C2H_MCC = 0x17,
67
C2H_MAC_HIDDEN_RPT = 0x19,
68
C2H_MAC_HIDDEN_RPT_2 = 0x1A,
69
C2H_BCN_EARLY_RPT = 0x1E,
70
C2H_DEFEATURE_DBG = 0x22,
71
C2H_CUSTOMER_STR_RPT = 0x24,
72
C2H_CUSTOMER_STR_RPT_2 = 0x25,
73
C2H_WLAN_INFO = 0x27,
74
#ifdef RTW_PER_CMD_SUPPORT_FW
75
C2H_PER_RATE_RPT = 0x2c,
76
#endif
77
C2H_LPS_STATUS_RPT = 0x32,
78
C2H_DEFEATURE_RSVD = 0xFD,
79
C2H_EXTEND = 0xff,
80
} C2H_EVT;
81
82
typedef enum _EXTEND_C2H_EVT {
83
EXTEND_C2H_DBG_PRINT = 0
84
} EXTEND_C2H_EVT;
85
86
#define C2H_REG_LEN 16
87
88
/* C2H_IQK_FINISH, 0x11 */
89
#define IQK_OFFLOAD_LEN 1
90
void c2h_iqk_offload(_adapter *adapter, u8 *data, u8 len);
91
int c2h_iqk_offload_wait(_adapter *adapter, u32 timeout_ms);
92
#define rtl8812_iqk_wait c2h_iqk_offload_wait /* TODO: remove this after phydm call c2h_iqk_offload_wait instead */
93
94
#ifdef CONFIG_RTW_MAC_HIDDEN_RPT
95
/* C2H_MAC_HIDDEN_RPT, 0x19 */
96
#define MAC_HIDDEN_RPT_LEN 8
97
int c2h_mac_hidden_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
98
99
/* C2H_MAC_HIDDEN_RPT_2, 0x1A */
100
#define MAC_HIDDEN_RPT_2_LEN 5
101
int c2h_mac_hidden_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
102
int hal_read_mac_hidden_rpt(_adapter *adapter);
103
#else
104
#define hal_read_mac_hidden_rpt(adapter) _SUCCESS
105
#endif /* CONFIG_RTW_MAC_HIDDEN_RPT */
106
107
/* C2H_DEFEATURE_DBG, 0x22 */
108
#define DEFEATURE_DBG_LEN 1
109
int c2h_defeature_dbg_hdl(_adapter *adapter, u8 *data, u8 len);
110
111
#ifdef CONFIG_RTW_CUSTOMER_STR
112
/* C2H_CUSTOMER_STR_RPT, 0x24 */
113
#define CUSTOMER_STR_RPT_LEN 8
114
int c2h_customer_str_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
115
116
/* C2H_CUSTOMER_STR_RPT_2, 0x25 */
117
#define CUSTOMER_STR_RPT_2_LEN 8
118
int c2h_customer_str_rpt_2_hdl(_adapter *adapter, u8 *data, u8 len);
119
#endif /* CONFIG_RTW_CUSTOMER_STR */
120
121
#ifdef RTW_PER_CMD_SUPPORT_FW
122
/* C2H_PER_RATE_RPT, 0x2c */
123
int c2h_per_rate_rpt_hdl(_adapter *adapter, u8 *data, u8 len);
124
#endif
125
126
#ifdef CONFIG_LPS_ACK
127
/* C2H_LPS_STATUS_RPT, 0x32 */
128
#define LPS_STATUS_RPT_LEN 2
129
int c2h_lps_status_rpt(PADAPTER adapter, u8 *data, u8 len);
130
#endif /* CONFIG_LPS_ACK */
131
#endif /* __COMMON_C2H_H__ */
132
133