hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
/** @file */
/******************************************************************************
 *
 * Copyright(c) 2019 Realtek Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of version 2 of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 ******************************************************************************/
 
#ifndef _MAC_AX_MPORT_H_
#define _MAC_AX_MPORT_H_
 
#include "../type.h"
 
/*--------------------Define -------------------------------------------*/
#define BCN_ERLY_DEF 160
#define BCN_SETUP_DEF 4
#define BCN_HOLD_DEF 400
#define BCN_MASK_DEF 0
#define TBTT_ERLY_DEF 5
#define TBTT_AGG_DEF 1
#define BCN_SET_TO_US 32
#define TU_TO_BCN_SET (1024 / BCN_SET_TO_US)
#define BCN_ERLY_SET_DLY 10
 
#define PTCL_DBG_BCNQ_NUM0 8
#define PTCL_DBG_BCNQ_NUM1 9
#define PTCL_DBG_DLY_US 100
 
#define TU_UNIT 1024
#define MS_UNIT 1000
#define PORT_DLY_TU_CNT_LMT 200
#define PORT_DLY_US_CNT_LMT 200
 
#define MAX_BCN_ITVL 0x639C
 
#define CHK_BCNQ_CNT 200
#define BCNQ_EMP_CONT_CNT 3
 
#define LBK_PLCP_DLY_DEF 0x28
#define LBK_PLCP_DLY_FPGA 0x46
 
#define BCN_FAST_DRP_TBTT 1
 
/* 50% hold time , 30% beacon early */
#define BCN_ERLY_RATIO 3
#define BCN_HOLD_RATIO 5
#define BCN_ITVL_RATIO 10
 
#define PORT_H2C_DLY_US 10
#define PORT_H2C_DLY_CNT 20000
 
#define TBTT_SHIFT_OFST_MSB 0x800
 
/*--------------------Define MACRO--------------------------------------*/
/*--------------------Define Enum---------------------------------------*/
enum port_stat {
   PORT_ST_DIS = 0,
   PORT_ST_NOLINK,
   PORT_ST_ADHOC,
   PORT_ST_INFRA,
   PORT_ST_AP,
};
 
enum C2H_MPORT_RET_CODE {
   C2H_MPORT_RET_SUCCESS = 0,
   C2H_MPORT_RET_PENDING,
   C2H_MPORT_RET_BAND_ERR,
   C2H_MPORT_RET_PORT_ERR,
   C2H_MPORT_RET_MBID_ERR,
   C2H_MPORT_RET_NO_CONTENT,
   C2H_MPORT_RET_TSF32TOG_C2H_FAIL,
   C2H_MPORT_RET_CFG_TYPE_ERR,
   C2H_MPORT_RET_SET_CFG_ILEGAL_EN,
   C2H_MPORT_RET_SET_CFG_ARDY_DIS,
   C2H_MPORT_RET_INPUT_ILEGAL,
   C2H_MPORT_RET_CHK_BELW_LMT,
   C2H_MPORT_RET_CHK_OVER_LMT,
   C2H_MPORT_RET_SUB_SPC_ERR,
   C2H_MPORT_RET_POLL_TO,
   C2H_MPORT_RET_TSF_NOT_RUN,
   C2H_MPORT_RET_MALLOC_FAIL,
   C2H_MPORT_RET_DEINIT_FAIL,
   C2H_MPORT_RET_PKT_DROP,
   C2H_MPORT_RET_ADD_PSTIMER,
   C2H_MPORT_RET_CHK_BCNQ_TO,
   C2H_MPORT_RET_CHK_BCNQ_FAIL,
   C2H_MPORT_RET_SEND_C2H_INIT,
   C2H_MPORT_RET_SEND_C2H_CFG,
};
 
/*--------------------Define Struct-------------------------------------*/
 
/**
 * @addtogroup Basic_TRX
 * @{
 * @addtogroup MultiPort
 * @{
 */
/**
 * @brief dly_port_tu
 *
 * @param *adapter
 * @param band
 * @param port
 * @param dly_tu
 * @return Please Place Description here.
 * @retval u32
 */
u32 dly_port_tu(struct mac_ax_adapter *adapter, u8 band, u8 port, u32 dly_tu);
/**
 * @}
 * @}
 */
 
/**
 * @addtogroup Basic_TRX
 * @{
 * @addtogroup MultiPort
 * @{
 */
 
/**
 * @brief dly_port_us
 *
 * @param *adapter
 * @param band
 * @param port
 * @param dly_us
 * @return Please Place Description here.
 * @retval u32
 */
u32 dly_port_us(struct mac_ax_adapter *adapter, u8 band, u8 port, u32 dly_us);
/**
 * @}
 * @}
 */
 
/**
 * @addtogroup Basic_TRX
 * @{
 * @addtogroup MultiPort
 * @{
 */
 
/**
 * @brief rst_port_info
 *
 * @param *adapter
 * @param band
 * @return Please Place Description here.
 * @retval u32
 */
u32 rst_port_info(struct mac_ax_adapter *adapter, u8 band);
/**
 * @}
 * @}
 */
 
/**
 * @addtogroup Basic_TRX
 * @{
 * @addtogroup MultiPort
 * @{
 */
 
/**
 * @brief mac_port_cfg
 *
 * @param *adapter
 * @param type
 * @param *para
 * @return Please Place Description here.
 * @retval u32
 */
u32 mac_port_cfg(struct mac_ax_adapter *adapter,
        enum mac_ax_port_cfg_type type,
        struct mac_ax_port_cfg_para *para);
/**
 * @}
 * @}
 */
 
/**
 * @addtogroup Basic_TRX
 * @{
 * @addtogroup MultiPort
 * @{
 */
 
/**
 * @brief mac_port_init
 *
 * @param *adapter
 * @param *para
 * @return Please Place Description here.
 * @retval u32
 */
u32 mac_port_init(struct mac_ax_adapter *adapter,
         struct mac_ax_port_init_para *para);
/**
 * @}
 * @}
 */
 
/**
 * @addtogroup Basic_TRX
 * @{
 * @addtogroup MultiPort
 * @{
 */
 
/**
 * @brief mac_tsf_sync
 *
 * @param *adapter
 * @param from_port
 * @param to_port
 * @param sync_offset
 * @param action
 * @return Please Place Description here.
 * @retval u32
 */
u32 mac_tsf_sync(struct mac_ax_adapter *adapter, u8 from_port, u8 to_port,
        s32 sync_offset, enum mac_ax_tsf_sync_act action);
/**
 * @}
 * @}
 */
 
/**
 * @addtogroup Basic_TRX
 * @{
 * @addtogroup MultiPort
 * @{
 */
 
/**
 * @brief mac_parse_bcn_stats_c2h
 *
 * @param *adapter
 * @param *content
 * @param *val
 * @return Please Place Description here.
 * @retval u32
 */
u32 mac_parse_bcn_stats_c2h(struct mac_ax_adapter *adapter,
               u8 *content, struct mac_ax_bcn_cnt *val);
/**
 * @}
 * @}
 */
 
/**
 * @addtogroup Basic_TRX
 * @{
 * @addtogroup MultiPort
 * @{
 */
 
/**
 * @brief get_bcn_stats_event
 *
 * @param *adapter
 * @param *c2h
 * @param *id
 * @param *c2h_info
 * @return Please Place Description here.
 * @retval u32
 */
u32 get_bcn_stats_event(struct mac_ax_adapter *adapter,
           struct rtw_c2h_info *c2h,
           enum phl_msg_evt_id *id, u8 *c2h_info);
/**
 * @}
 * @}
 */
 
u32 mac_tsf32_togl_h2c(struct mac_ax_adapter *adapter,
              struct mac_ax_t32_togl_info *info);
 
u32 mac_get_t32_togl_rpt(struct mac_ax_adapter *adapter,
            struct mac_ax_t32_togl_rpt *ret_rpt);
 
u32 get_bp_idx(u8 band, u8 port);
 
u32 mport_info_init(struct mac_ax_adapter *adapter);
 
u32 mport_info_exit(struct mac_ax_adapter *adapter);
 
#endif