1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#ifndef R8192_HW
21#define R8192_HW
22
23typedef enum _VERSION_819xU {
24 VERSION_819xU_A,
25 VERSION_819xU_B,
26 VERSION_819xU_C,
27} VERSION_819xU, *PVERSION_819xU;
28
29typedef enum _RT_RF_TYPE_DEF {
30 RF_1T2R = 0,
31 RF_2T4R,
32
33 RF_819X_MAX_TYPE
34} RT_RF_TYPE_DEF;
35
36
37typedef enum _BaseBand_Config_Type {
38 BaseBand_Config_PHY_REG = 0,
39 BaseBand_Config_AGC_TAB = 1,
40} BaseBand_Config_Type, *PBaseBand_Config_Type;
41#define RTL8187_REQT_READ 0xc0
42#define RTL8187_REQT_WRITE 0x40
43#define RTL8187_REQ_GET_REGS 0x05
44#define RTL8187_REQ_SET_REGS 0x05
45
46#define MAX_TX_URB 5
47#define MAX_RX_URB 16
48
49#define R8180_MAX_RETRY 255
50
51
52#define RX_URB_SIZE 9100
53
54#define BB_ANTATTEN_CHAN14 0x0c
55#define BB_ANTENNA_B 0x40
56
57#define BB_HOST_BANG BIT(30)
58#define BB_HOST_BANG_EN BIT(2)
59#define BB_HOST_BANG_CLK BIT(1)
60#define BB_HOST_BANG_RW BIT(3)
61#define BB_HOST_BANG_DATA 1
62
63
64#define AFR 0x010
65#define AFR_CardBEn BIT(0)
66#define AFR_CLKRUN_SEL BIT(1)
67#define AFR_FuncRegEn BIT(2)
68#define RTL8190_EEPROM_ID 0x8129
69#define EEPROM_VID 0x02
70#define EEPROM_PID 0x04
71#define EEPROM_NODE_ADDRESS_BYTE_0 0x0C
72
73#define EEPROM_TxPowerDiff 0x1F
74#define EEPROM_ThermalMeter 0x20
75#define EEPROM_PwDiff 0x21
76#define EEPROM_CrystalCap 0x22
77
78#define EEPROM_TxPwIndex_CCK 0x23
79#define EEPROM_TxPwIndex_OFDM_24G 0x24
80#define EEPROM_TxPwIndex_CCK_V1 0x29
81#define EEPROM_TxPwIndex_OFDM_24G_V1 0x2C
82#define EEPROM_TxPwIndex_Ver 0x27
83
84#define EEPROM_Default_TxPowerDiff 0x0
85#define EEPROM_Default_ThermalMeter 0x7
86#define EEPROM_Default_PwDiff 0x4
87#define EEPROM_Default_CrystalCap 0x5
88#define EEPROM_Default_TxPower 0x1010
89#define EEPROM_Customer_ID 0x7B
90#define EEPROM_ChannelPlan 0x16
91#define EEPROM_IC_VER 0x7d
92#define EEPROM_CRC 0x7e
93
94#define EEPROM_CID_DEFAULT 0x0
95#define EEPROM_CID_CAMEO 0x1
96#define EEPROM_CID_RUNTOP 0x2
97#define EEPROM_CID_Senao 0x3
98#define EEPROM_CID_TOSHIBA 0x4
99#define EEPROM_CID_NetCore 0x5
100#define EEPROM_CID_Nettronix 0x6
101#define EEPROM_CID_Pronet 0x7
102#define EEPROM_CID_DLINK 0x8
103
104#define AC_PARAM_TXOP_LIMIT_OFFSET 16
105#define AC_PARAM_ECW_MAX_OFFSET 12
106#define AC_PARAM_ECW_MIN_OFFSET 8
107#define AC_PARAM_AIFS_OFFSET 0
108
109
110enum _RTL8192Usb_HW {
111
112 PCIF = 0x009,
113#define BB_GLOBAL_RESET_BIT 0x1
114 BB_GLOBAL_RESET = 0x020,
115 BSSIDR = 0x02E,
116 CMDR = 0x037,
117#define CR_RST 0x10
118#define CR_RE 0x08
119#define CR_TE 0x04
120#define CR_MulRW 0x01
121 SIFS = 0x03E,
122 TCR = 0x040,
123
124#define TCR_MXDMA_2048 7
125#define TCR_LRL_OFFSET 0
126#define TCR_SRL_OFFSET 8
127#define TCR_MXDMA_OFFSET 21
128#define TCR_SAT BIT(24)
129 RCR = 0x044,
130#define MAC_FILTER_MASK (BIT(0) | BIT(1) | BIT(2) | BIT(3) | BIT(5) | \
131 BIT(12) | BIT(18) | BIT(19) | BIT(20) | BIT(21) | \
132 BIT(22) | BIT(23))
133#define RX_FIFO_THRESHOLD_MASK (BIT(13) | BIT(14) | BIT(15))
134#define RX_FIFO_THRESHOLD_SHIFT 13
135#define RX_FIFO_THRESHOLD_128 3
136#define RX_FIFO_THRESHOLD_256 4
137#define RX_FIFO_THRESHOLD_512 5
138#define RX_FIFO_THRESHOLD_1024 6
139#define RX_FIFO_THRESHOLD_NONE 7
140#define MAX_RX_DMA_MASK (BIT(8) | BIT(9) | BIT(10))
141#define RCR_MXDMA_OFFSET 8
142#define RCR_FIFO_OFFSET 13
143#define RCR_ONLYERLPKT BIT(31)
144#define RCR_ENCS2 BIT(30)
145#define RCR_ENCS1 BIT(29)
146#define RCR_ENMBID BIT(27)
147#define RCR_ACKTXBW (BIT(24) | BIT(25))
148#define RCR_CBSSID BIT(23)
149#define RCR_APWRMGT BIT(22)
150#define RCR_ADD3 BIT(21)
151#define RCR_AMF BIT(20)
152#define RCR_ACF BIT(19)
153#define RCR_ADF BIT(18)
154#define RCR_RXFTH BIT(13)
155#define RCR_AICV BIT(12)
156#define RCR_ACRC32 BIT(5)
157#define RCR_AB BIT(3)
158#define RCR_AM BIT(2)
159#define RCR_APM BIT(1)
160#define RCR_AAP BIT(0)
161 SLOT_TIME = 0x049,
162 ACK_TIMEOUT = 0x04c,
163 PIFS_TIME = 0x04d,
164 USTIME = 0x04e,
165 EDCAPARA_BE = 0x050,
166 EDCAPARA_BK = 0x054,
167 EDCAPARA_VO = 0x058,
168 EDCAPARA_VI = 0x05C,
169 RFPC = 0x05F,
170 CWRR = 0x060,
171 BCN_TCFG = 0x062,
172#define BCN_TCFG_CW_SHIFT 8
173#define BCN_TCFG_IFS 0
174 BCN_INTERVAL = 0x070,
175 ATIMWND = 0x072,
176 BCN_DRV_EARLY_INT = 0x074,
177 BCN_DMATIME = 0x076,
178 BCN_ERR_THRESH = 0x078,
179 RWCAM = 0x0A0,
180 WCAMI = 0x0A4,
181 RCAMO = 0x0A8,
182 SECR = 0x0B0,
183#define SCR_TxUseDK BIT(0)
184#define SCR_RxUseDK BIT(1)
185#define SCR_TxEncEnable BIT(2)
186#define SCR_RxDecEnable BIT(3)
187#define SCR_SKByA2 BIT(4)
188#define SCR_NoSKMC BIT(5)
189#define SCR_UseDK 0x01
190#define SCR_TxSecEnable 0x02
191#define SCR_RxSecEnable 0x04
192 TPPoll = 0x0fd,
193 PSR = 0x0ff,
194#define CPU_CCK_LOOPBACK 0x00030000
195#define CPU_GEN_SYSTEM_RESET 0x00000001
196#define CPU_GEN_FIRMWARE_RESET 0x00000008
197#define CPU_GEN_BOOT_RDY 0x00000010
198#define CPU_GEN_FIRM_RDY 0x00000020
199#define CPU_GEN_PUT_CODE_OK 0x00000080
200#define CPU_GEN_BB_RST 0x00000100
201#define CPU_GEN_PWR_STB_CPU 0x00000004
202#define CPU_GEN_NO_LOOPBACK_MSK 0xFFF8FFFF
203#define CPU_GEN_NO_LOOPBACK_SET 0x00080000
204
205
206
207
208#define CPU_CCK_LOOPBACK 0x00030000
209#define CPU_GEN_SYSTEM_RESET 0x00000001
210#define CPU_GEN_FIRMWARE_RESET 0x00000008
211#define CPU_GEN_BOOT_RDY 0x00000010
212#define CPU_GEN_FIRM_RDY 0x00000020
213#define CPU_GEN_PUT_CODE_OK 0x00000080
214#define CPU_GEN_BB_RST 0x00000100
215#define CPU_GEN_PWR_STB_CPU 0x00000004
216#define CPU_GEN_NO_LOOPBACK_MSK 0xFFF8FFFF
217#define CPU_GEN_NO_LOOPBACK_SET 0x00080000
218 CPU_GEN = 0x100,
219 LED1Cfg = 0x154,
220 LED0Cfg = 0x155,
221
222 AcmAvg = 0x170,
223 AcmHwCtrl = 0x171,
224
225
226
227
228
229#define AcmHw_HwEn BIT(0)
230#define AcmHw_BeqEn BIT(1)
231#define AcmHw_ViqEn BIT(2)
232#define AcmHw_VoqEn BIT(3)
233#define AcmHw_BeqStatus BIT(4)
234#define AcmHw_ViqStatus BIT(5)
235#define AcmHw_VoqStatus BIT(6)
236
237 AcmFwCtrl = 0x172,
238 AES_11N_FIX = 0x173,
239 VOAdmTime = 0x174,
240 VIAdmTime = 0x178,
241 BEAdmTime = 0x17C,
242 RQPN1 = 0x180,
243 RQPN2 = 0x184,
244 RQPN3 = 0x188,
245
246 QPNR = 0x1D0,
247 BQDA = 0x200,
248 HQDA = 0x204,
249 CQDA = 0x208,
250 MQDA = 0x20C,
251 HCCAQDA = 0x210,
252 VOQDA = 0x214,
253 VIQDA = 0x218,
254 BEQDA = 0x21C,
255 BKQDA = 0x220,
256 RCQDA = 0x224,
257 RDQDA = 0x228,
258
259 MAR0 = 0x240,
260 MAR4 = 0x244,
261
262 CCX_PERIOD = 0x250,
263 CLM_RESULT = 0x251,
264 NHM_PERIOD = 0x252,
265
266 NHM_THRESHOLD0 = 0x253,
267 NHM_THRESHOLD1 = 0x254,
268 NHM_THRESHOLD2 = 0x255,
269 NHM_THRESHOLD3 = 0x256,
270 NHM_THRESHOLD4 = 0x257,
271 NHM_THRESHOLD5 = 0x258,
272 NHM_THRESHOLD6 = 0x259,
273
274 MCTRL = 0x25A,
275
276 NHM_RPI_COUNTER0 = 0x264,
277 NHM_RPI_COUNTER1 = 0x265,
278 NHM_RPI_COUNTER2 = 0x266,
279 NHM_RPI_COUNTER3 = 0x267,
280 NHM_RPI_COUNTER4 = 0x268,
281 NHM_RPI_COUNTER5 = 0x269,
282 NHM_RPI_COUNTER6 = 0x26A,
283 NHM_RPI_COUNTER7 = 0x26B,
284#define BW_OPMODE_11J BIT(0)
285#define BW_OPMODE_5G BIT(1)
286#define BW_OPMODE_20MHZ BIT(2)
287 BW_OPMODE = 0x300,
288 MSR = 0x303,
289#define MSR_LINK_MASK (BIT(0)|BIT(1))
290#define MSR_LINK_MANAGED 2
291#define MSR_LINK_NONE 0
292#define MSR_LINK_SHIFT 0
293#define MSR_LINK_ADHOC 1
294#define MSR_LINK_MASTER 3
295#define MSR_LINK_ENEDCA BIT(4)
296 RETRY_LIMIT = 0x304,
297#define RETRY_LIMIT_SHORT_SHIFT 8
298#define RETRY_LIMIT_LONG_SHIFT 0
299 TSFR = 0x308,
300 RRSR = 0x310,
301#define RRSR_RSC_OFFSET 21
302#define RRSR_SHORT_OFFSET 23
303#define RRSR_RSC_DUPLICATE 0x600000
304#define RRSR_RSC_LOWSUBCHNL 0x400000
305#define RRSR_RSC_UPSUBCHANL 0x200000
306#define RRSR_SHORT 0x800000
307#define RRSR_1M BIT(0)
308#define RRSR_2M BIT(1)
309#define RRSR_5_5M BIT(2)
310#define RRSR_11M BIT(3)
311#define RRSR_6M BIT(4)
312#define RRSR_9M BIT(5)
313#define RRSR_12M BIT(6)
314#define RRSR_18M BIT(7)
315#define RRSR_24M BIT(8)
316#define RRSR_36M BIT(9)
317#define RRSR_48M BIT(10)
318#define RRSR_54M BIT(11)
319#define RRSR_MCS0 BIT(12)
320#define RRSR_MCS1 BIT(13)
321#define RRSR_MCS2 BIT(14)
322#define RRSR_MCS3 BIT(15)
323#define RRSR_MCS4 BIT(16)
324#define RRSR_MCS5 BIT(17)
325#define RRSR_MCS6 BIT(18)
326#define RRSR_MCS7 BIT(19)
327#define BRSR_AckShortPmb BIT(23)
328 RATR0 = 0x320,
329 UFWP = 0x318,
330 DRIVER_RSSI = 0x32c,
331
332
333
334
335#define RATR_1M 0x00000001
336#define RATR_2M 0x00000002
337#define RATR_55M 0x00000004
338#define RATR_11M 0x00000008
339
340#define RATR_6M 0x00000010
341#define RATR_9M 0x00000020
342#define RATR_12M 0x00000040
343#define RATR_18M 0x00000080
344#define RATR_24M 0x00000100
345#define RATR_36M 0x00000200
346#define RATR_48M 0x00000400
347#define RATR_54M 0x00000800
348
349#define RATR_MCS0 0x00001000
350#define RATR_MCS1 0x00002000
351#define RATR_MCS2 0x00004000
352#define RATR_MCS3 0x00008000
353#define RATR_MCS4 0x00010000
354#define RATR_MCS5 0x00020000
355#define RATR_MCS6 0x00040000
356#define RATR_MCS7 0x00080000
357
358#define RATR_MCS8 0x00100000
359#define RATR_MCS9 0x00200000
360#define RATR_MCS10 0x00400000
361#define RATR_MCS11 0x00800000
362#define RATR_MCS12 0x01000000
363#define RATR_MCS13 0x02000000
364#define RATR_MCS14 0x04000000
365#define RATR_MCS15 0x08000000
366
367#define RATE_ALL_CCK RATR_1M|RATR_2M|RATR_55M|RATR_11M
368#define RATE_ALL_OFDM_AG RATR_6M|RATR_9M|RATR_12M|RATR_18M|RATR_24M\
369 |RATR_36M|RATR_48M|RATR_54M
370#define RATE_ALL_OFDM_1SS RATR_MCS0|RATR_MCS1|RATR_MCS2|RATR_MCS3 | \
371 RATR_MCS4|RATR_MCS5|RATR_MCS6|RATR_MCS7
372#define RATE_ALL_OFDM_2SS RATR_MCS8|RATR_MCS9 |RATR_MCS10|RATR_MCS11| \
373 RATR_MCS12|RATR_MCS13|RATR_MCS14|RATR_MCS15
374
375 MCS_TXAGC = 0x340,
376 CCK_TXAGC = 0x348,
377
378
379
380 MacBlkCtrl = 0x403,
381
382 EPROM_CMD = 0xfe58,
383#define Cmd9346CR_9356SEL BIT(4)
384#define EPROM_CMD_RESERVED_MASK BIT(5)
385#define EPROM_CMD_OPERATING_MODE_SHIFT 6
386#define EPROM_CMD_OPERATING_MODE_MASK (BIT(7) | BIT(6))
387#define EPROM_CMD_CONFIG 0x3
388#define EPROM_CMD_NORMAL 0
389#define EPROM_CMD_LOAD 1
390#define EPROM_CMD_PROGRAM 2
391#define EPROM_CS_BIT BIT(3)
392#define EPROM_CK_BIT BIT(2)
393#define EPROM_W_BIT BIT(1)
394#define EPROM_R_BIT BIT(0)
395
396 MAC0 = 0x000,
397 MAC1 = 0x001,
398 MAC2 = 0x002,
399 MAC3 = 0x003,
400 MAC4 = 0x004,
401 MAC5 = 0x005,
402
403};
404
405
406
407
408
409#define GPI 0x108
410#define GPO 0x109
411#define GPE 0x10a
412#endif
413