hc
2024-05-08 f309769f8af08599af39b6de4f675784ce76530d
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
/******************************************************************************
 *
 * Copyright(c) 2007 - 2017  Realtek Corporation.
 *
 * 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.
 *
 * The full GNU General Public License is included in this distribution in the
 * file called LICENSE.
 *
 * Contact Information:
 * wlanfae <wlanfae@realtek.com>
 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
 * Hsinchu 300, Taiwan.
 *
 * Larry Finger <Larry.Finger@lwfinger.net>
 *
 *****************************************************************************/
#ifndef __ODM_TYPES_H__
#define __ODM_TYPES_H__
 
/*Define Different SW team support*/
#define    ODM_AP            0x01    /*BIT(0)*/
#define    ODM_CE            0x04    /*BIT(2)*/
#define    ODM_WIN        0x08    /*BIT(3)*/
#define    ODM_ADSL        0x10
/*BIT(4)*/        /*already combine with ODM_AP, and is nouse now*/
#define    ODM_IOT        0x20    /*BIT(5)*/
 
/*For FW API*/
#define    __iram_odm_func__
#define    __odm_func__
#define    __odm_func_aon__
 
/*Deifne HW endian support*/
#define    ODM_ENDIAN_BIG    0
#define    ODM_ENDIAN_LITTLE    1
 
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
   #define GET_PDM_ODM(__padapter)    ((struct dm_struct*)(&(GET_HAL_DATA(__padapter))->DM_OutSrc))
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
   #define GET_PDM_ODM(__padapter)    ((struct dm_struct *)(&(GET_HAL_DATA(__padapter))->odmpriv))
#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
   #define GET_PDM_ODM(__padapter)    ((struct dm_struct*)(&__padapter->pshare->_dmODM))
#endif
 
#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
   #if defined(CONFIG_RTL_TRIBAND_SUPPORT) && defined(CONFIG_USB_HCI)
   /* enable PCI & USB HCI at the same time */
      #define RT_PCI_USB_INTERFACE            1
      #define    RT_PCI_INTERFACE            RT_PCI_USB_INTERFACE
   #define RT_USB_INTERFACE            RT_PCI_USB_INTERFACE
   #define    RT_SDIO_INTERFACE            3
      #else
   #define    RT_PCI_INTERFACE            1
   #define    RT_USB_INTERFACE            2
   #define    RT_SDIO_INTERFACE            3
   #endif
#endif
 
enum hal_status {
   HAL_STATUS_SUCCESS,
   HAL_STATUS_FAILURE,
#if 0
   RT_STATUS_PENDING,
   RT_STATUS_RESOURCE,
   RT_STATUS_INVALID_CONTEXT,
   RT_STATUS_INVALID_PARAMETER,
   RT_STATUS_NOT_SUPPORT,
   RT_STATUS_OS_API_FAILED,
#endif
};
 
#if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
 
#define        VISTA_USB_RX_REVISE            0
 
/*
 * Declare for ODM spin lock definition temporarily fro compile pass.
 */
enum rt_spinlock_type {
   RT_TX_SPINLOCK = 1,
   RT_RX_SPINLOCK = 2,
   RT_RM_SPINLOCK = 3,
   RT_CAM_SPINLOCK = 4,
   RT_SCAN_SPINLOCK = 5,
   RT_LOG_SPINLOCK = 7,
   RT_BW_SPINLOCK = 8,
   RT_CHNLOP_SPINLOCK = 9,
   RT_RF_OPERATE_SPINLOCK = 10,
   RT_INITIAL_SPINLOCK = 11,
   RT_RF_STATE_SPINLOCK = 12,
   /* For RF state. Added by Bruce, 2007-10-30. */
#if VISTA_USB_RX_REVISE
   RT_USBRX_CONTEXT_SPINLOCK = 13,
   RT_USBRX_POSTPROC_SPINLOCK = 14,
   /* protect data of adapter->IndicateW/ IndicateR */
#endif
   /* Shall we define Ndis 6.2 SpinLock Here ? */
   RT_PORT_SPINLOCK = 16,
   RT_VNIC_SPINLOCK = 17,
   RT_HVL_SPINLOCK = 18,
   RT_H2C_SPINLOCK = 20,
   /* For H2C cmd. Added by tynli. 2009.11.09. */
 
   rt_bt_data_spinlock = 25,
 
   RT_WAPI_OPTION_SPINLOCK = 26,
   RT_WAPI_RX_SPINLOCK = 27,
 
   /* add for 92D CCK control issue */
   RT_CCK_PAGEA_SPINLOCK = 28,
   RT_BUFFER_SPINLOCK = 29,
   RT_CHANNEL_AND_BANDWIDTH_SPINLOCK = 30,
   RT_GEN_TEMP_BUF_SPINLOCK = 31,
   RT_AWB_SPINLOCK = 32,
   RT_FW_PS_SPINLOCK = 33,
   RT_HW_TIMER_SPIN_LOCK = 34,
   RT_MPT_WI_SPINLOCK = 35,
   RT_P2P_SPIN_LOCK = 36,    /* Protect P2P context */
   RT_DBG_SPIN_LOCK = 37,
   RT_IQK_SPINLOCK = 38,
   RT_PENDED_OID_SPINLOCK = 39,
   RT_CHNLLIST_SPINLOCK = 40,
   RT_INDIC_SPINLOCK = 41,    /* protect indication */
   RT_RFD_SPINLOCK = 42,
   RT_SYNC_IO_CNT_SPINLOCK = 43,
   RT_LAST_SPINLOCK,
};
 
#endif
 
#if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
   #define sta_info     _RT_WLAN_STA
   #define    __func__        __FUNCTION__
   #define    PHYDM_TESTCHIP_SUPPORT    TESTCHIP_SUPPORT
   #define MASKH3BYTES            0xffffff00
   #define SUCCESS    0
   #define FAIL    (-1)
 
   #define    u8         u1Byte
   #define    s8         s1Byte
 
   #define    u16        u2Byte
   #define    s16        s2Byte
 
   #define    u32     u4Byte
   #define    s32         s4Byte
 
   #define    u64        u8Byte
   #define    s64        s8Byte
 
   #define    phydm_timer_list    _RT_TIMER
 
   // for power limit table
   enum odm_pw_lmt_regulation_type {
       PW_LMT_REGU_FCC = 0,
       PW_LMT_REGU_ETSI = 1,
       PW_LMT_REGU_MKK = 2,
       PW_LMT_REGU_WW13 = 3,
       PW_LMT_REGU_IC = 4,
       PW_LMT_REGU_KCC = 5,
       PW_LMT_REGU_ACMA = 6,
       PW_LMT_REGU_CHILE = 7,
       PW_LMT_REGU_UKRAINE = 8,
       PW_LMT_REGU_MEXICO = 9,
       PW_LMT_REGU_CN = 10
   };
 
   enum odm_pw_lmt_band_type {
       PW_LMT_BAND_2_4G = 0,
       PW_LMT_BAND_5G = 1
   };
 
   enum odm_pw_lmt_bandwidth_type {
       PW_LMT_BW_20M = 0,
       PW_LMT_BW_40M = 1,
       PW_LMT_BW_80M = 2,
       PW_LMT_BW_160M = 3
   };
 
   enum odm_pw_lmt_ratesection_type {
       PW_LMT_RS_CCK = 0,
       PW_LMT_RS_OFDM = 1,
       PW_LMT_RS_HT = 2,
       PW_LMT_RS_VHT = 3
   };
 
   enum odm_pw_lmt_rfpath_type {
       PW_LMT_PH_1T = 0,
       PW_LMT_PH_2T = 1,
       PW_LMT_PH_3T = 2,
       PW_LMT_PH_4T = 3
   };
 
#elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
   #include "../typedef.h"
 
   #ifdef CONFIG_PCI_HCI
   #if defined(CONFIG_RTL_TRIBAND_SUPPORT) && defined(CONFIG_USB_HCI)
       #define DEV_BUS_TYPE        RT_PCI_USB_INTERFACE
   #else
       #define DEV_BUS_TYPE        RT_PCI_INTERFACE
   #endif
   #endif
 
   #if (defined(TESTCHIP_SUPPORT))
       #define    PHYDM_TESTCHIP_SUPPORT 1
   #else
       #define    PHYDM_TESTCHIP_SUPPORT 0
   #endif
 
   #define    sta_info stat_info
   #define    boolean    bool
 
   #define    phydm_timer_list    timer_list
   #if defined(__ECOS)
   #define s64    s8Byte
   #endif 
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) && defined(DM_ODM_CE_MAC80211)
 
   #include <asm/byteorder.h>
 
   #define DEV_BUS_TYPE    RT_PCI_INTERFACE
 
   #if defined(__LITTLE_ENDIAN)
       #define    ODM_ENDIAN_TYPE            ODM_ENDIAN_LITTLE
   #elif defined(__BIG_ENDIAN)
       #define    ODM_ENDIAN_TYPE            ODM_ENDIAN_BIG
   #else
       #error
   #endif
 
   /* define useless flag to avoid compile warning */
   #define    USE_WORKITEM 0
   #define    FOR_BRAZIL_PRETEST 0
   #define    FPGA_TWO_MAC_VERIFICATION    0
   #define    RTL8881A_SUPPORT    0
   #define    PHYDM_TESTCHIP_SUPPORT 0
 
 
   #define RATE_ADAPTIVE_SUPPORT            0
   #define POWER_TRAINING_ACTIVE            0
 
   #define sta_info    rtl_sta_info
   #define    boolean        bool
 
   #define    phydm_timer_list    timer_list
 
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
   #include <drv_types.h>
 
   #ifdef CONFIG_USB_HCI
       #define DEV_BUS_TYPE    RT_USB_INTERFACE
   #elif defined(CONFIG_PCI_HCI)
       #define DEV_BUS_TYPE    RT_PCI_INTERFACE
   #elif defined(CONFIG_SDIO_HCI)
       #define DEV_BUS_TYPE    RT_SDIO_INTERFACE
   #elif defined(CONFIG_GSPI_HCI)
       #define DEV_BUS_TYPE    RT_SDIO_INTERFACE
   #endif
 
 
   #if defined(CONFIG_LITTLE_ENDIAN)
       #define    ODM_ENDIAN_TYPE            ODM_ENDIAN_LITTLE
   #elif defined(CONFIG_BIG_ENDIAN)
       #define    ODM_ENDIAN_TYPE            ODM_ENDIAN_BIG
   #endif
 
   #define    boolean    bool
 
   #define SET_TX_DESC_ANTSEL_A_88E(__ptx_desc, __value) SET_BITS_TO_LE_4BYTE(__ptx_desc + 8, 24, 1, __value)
   #define SET_TX_DESC_ANTSEL_B_88E(__ptx_desc, __value) SET_BITS_TO_LE_4BYTE(__ptx_desc + 8, 25, 1, __value)
   #define SET_TX_DESC_ANTSEL_C_88E(__ptx_desc, __value) SET_BITS_TO_LE_4BYTE(__ptx_desc + 28, 29, 1, __value)
 
   /* define useless flag to avoid compile warning */
   #define    USE_WORKITEM 0
   #define    FOR_BRAZIL_PRETEST 0
   #define    FPGA_TWO_MAC_VERIFICATION    0
   #define    RTL8881A_SUPPORT    0
 
   #if (defined(TESTCHIP_SUPPORT))
       #define    PHYDM_TESTCHIP_SUPPORT 1
   #else
       #define    PHYDM_TESTCHIP_SUPPORT 0
   #endif
 
   #define    phydm_timer_list    rtw_timer_list
 
   // for power limit table
   enum odm_pw_lmt_regulation_type {
       PW_LMT_REGU_FCC = 0,
       PW_LMT_REGU_ETSI = 1,
       PW_LMT_REGU_MKK = 2,
       PW_LMT_REGU_WW13 = 3,
       PW_LMT_REGU_IC = 4,
       PW_LMT_REGU_KCC = 5,
       PW_LMT_REGU_ACMA = 6,
       PW_LMT_REGU_CHILE = 7,
       PW_LMT_REGU_UKRAINE = 8,
       PW_LMT_REGU_MEXICO = 9,
       PW_LMT_REGU_CN = 10
   };
 
   enum odm_pw_lmt_band_type {
       PW_LMT_BAND_2_4G = 0,
       PW_LMT_BAND_5G = 1
   };
 
   enum odm_pw_lmt_bandwidth_type {
       PW_LMT_BW_20M = 0,
       PW_LMT_BW_40M = 1,
       PW_LMT_BW_80M = 2,
       PW_LMT_BW_160M = 3
   };
 
   enum odm_pw_lmt_ratesection_type {
       PW_LMT_RS_CCK = 0,
       PW_LMT_RS_OFDM = 1,
       PW_LMT_RS_HT = 2,
       PW_LMT_RS_VHT = 3
   };
 
   enum odm_pw_lmt_rfpath_type {
       PW_LMT_PH_1T = 0,
       PW_LMT_PH_2T = 1,
       PW_LMT_PH_3T = 2,
       PW_LMT_PH_4T = 3
   };
 
#elif (DM_ODM_SUPPORT_TYPE == ODM_IOT)
   #define    boolean    bool
   #define true    _TRUE
   #define false    _FALSE
 
   // for power limit table
   enum odm_pw_lmt_regulation_type {
       PW_LMT_REGU_NULL = 0,
       PW_LMT_REGU_FCC = 1,
       PW_LMT_REGU_ETSI = 2,
       PW_LMT_REGU_MKK = 3,
       PW_LMT_REGU_WW13 = 4,
       PW_LMT_REGU_IC = 5,
       PW_LMT_REGU_KCC = 6,
       PW_LMT_REGU_ACMA = 7,
       PW_LMT_REGU_CHILE = 8,
       PW_LMT_REGU_UKRAINE = 9,
       PW_LMT_REGU_MEXICO = 10,
       PW_LMT_REGU_CN = 11,
       PW_LMT_REGU_MAX_NUM = 12
   };
 
   enum odm_pw_lmt_band_type {
       PW_LMT_BAND_NULL = 0,
       PW_LMT_BAND_2_4G = 1,
       PW_LMT_BAND_5G = 2
   };
 
   enum odm_pw_lmt_bandwidth_type {
       PW_LMT_BW_NULL = 0,
       PW_LMT_BW_20M = 1,
       PW_LMT_BW_40M = 2,
       PW_LMT_BW_80M = 3
   };
 
   enum odm_pw_lmt_ratesection_type {
       PW_LMT_RS_NULL = 0,
       PW_LMT_RS_CCK = 1,
       PW_LMT_RS_OFDM = 2,
       PW_LMT_RS_HT = 3,
       PW_LMT_RS_VHT = 4
   };
 
   enum odm_pw_lmt_rfpath_type {
       PW_LMT_PH_NULL = 0,
       PW_LMT_PH_1T = 1,
       PW_LMT_PH_2T = 2,
       PW_LMT_PH_3T = 3,
       PW_LMT_PH_4T = 4
   };
 
   #define    phydm_timer_list    timer_list
 
#endif
 
#define READ_NEXT_PAIR(v1, v2, i) do { if (i + 2 >= array_len) break; i += 2; v1 = array[i]; v2 = array[i + 1]; } while (0)
#define COND_ELSE  2
#define COND_ENDIF 3
 
#define    MASKBYTE0        0xff
#define    MASKBYTE1        0xff00
#define    MASKBYTE2        0xff0000
#define    MASKBYTE3        0xff000000
#define    MASKHWORD        0xffff0000
#define    MASKLWORD        0x0000ffff
#define    MASKDWORD        0xffffffff
 
#define    MASK7BITS        0x7f
#define    MASK12BITS        0xfff
#define    MASKH4BITS        0xf0000000
#define    MASK20BITS        0xfffff
#define    MASK24BITS        0xffffff
#define    MASKOFDM_D        0xffc00000
#define    MASKCCK            0x3f3f3f3f
 
#define RFREGOFFSETMASK        0xfffff
#define RFREG_MASK        0xfffff
 
#define MASKH3BYTES        0xffffff00
#define MASKL3BYTES        0x00ffffff
#define MASKBYTE2HIGHNIBBLE    0x00f00000
#define MASKBYTE3LOWNIBBLE    0x0f000000
#define    MASKL3BYTES        0x00ffffff
 
#endif /* __ODM_TYPES_H__ */