r8192U.h 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. /*
  2. * This is part of rtl8187 OpenSource driver.
  3. * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com>
  4. * Released under the terms of GPL (General Public Licence)
  5. *
  6. * Parts of this driver are based on the GPL part of the
  7. * official realtek driver
  8. *
  9. * Parts of this driver are based on the rtl8192 driver skeleton
  10. * from Patric Schenke & Andres Salomon
  11. *
  12. * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
  13. *
  14. * We want to thank the Authors of those projects and the Ndiswrapper
  15. * project Authors.
  16. */
  17. #ifndef R819xU_H
  18. #define R819xU_H
  19. #include <linux/module.h>
  20. #include <linux/kernel.h>
  21. #include <linux/ioport.h>
  22. #include <linux/sched.h>
  23. #include <linux/types.h>
  24. #include <linux/slab.h>
  25. #include <linux/netdevice.h>
  26. #include <linux/usb.h>
  27. #include <linux/etherdevice.h>
  28. #include <linux/delay.h>
  29. #include <linux/rtnetlink.h>
  30. #include <linux/wireless.h>
  31. #include <linux/timer.h>
  32. #include <linux/proc_fs.h>
  33. #include <linux/if_arp.h>
  34. #include <linux/random.h>
  35. #include <asm/io.h>
  36. #include "ieee80211/ieee80211.h"
  37. #define RTL8192U
  38. #define RTL819xU_MODULE_NAME "rtl819xU"
  39. /* HW security */
  40. #define MAX_KEY_LEN 61
  41. #define KEY_BUF_SIZE 5
  42. #define Rx_Smooth_Factor 20
  43. #define DMESG(x, a...)
  44. #define DMESGW(x, a...)
  45. #define DMESGE(x, a...)
  46. extern u32 rt_global_debug_component;
  47. #define RT_TRACE(component, x, args...) \
  48. do { \
  49. if (rt_global_debug_component & component) \
  50. pr_debug("RTL8192U: " x "\n", ##args); \
  51. } while (0)
  52. #define COMP_TRACE BIT(0) /* Function call tracing. */
  53. #define COMP_DBG BIT(1)
  54. #define COMP_INIT BIT(2) /* Driver initialization/halt/reset. */
  55. #define COMP_RECV BIT(3) /* Receive data path. */
  56. #define COMP_SEND BIT(4) /* Send data path. */
  57. #define COMP_IO BIT(5)
  58. /* 802.11 Power Save mode or System/Device Power state. */
  59. #define COMP_POWER BIT(6)
  60. /* 802.11 link related: join/start BSS, leave BSS. */
  61. #define COMP_EPROM BIT(7)
  62. #define COMP_SWBW BIT(8) /* Bandwidth switch. */
  63. #define COMP_POWER_TRACKING BIT(9) /* 8190 TX Power Tracking */
  64. #define COMP_TURBO BIT(10) /* Turbo Mode */
  65. #define COMP_QOS BIT(11)
  66. #define COMP_RATE BIT(12) /* Rate Adaptive mechanism */
  67. #define COMP_RM BIT(13) /* Radio Measurement */
  68. #define COMP_DIG BIT(14)
  69. #define COMP_PHY BIT(15)
  70. #define COMP_CH BIT(16) /* Channel setting debug */
  71. #define COMP_TXAGC BIT(17) /* Tx power */
  72. #define COMP_HIPWR BIT(18) /* High Power Mechanism */
  73. #define COMP_HALDM BIT(19) /* HW Dynamic Mechanism */
  74. #define COMP_SEC BIT(20) /* Event handling */
  75. #define COMP_LED BIT(21)
  76. #define COMP_RF BIT(22)
  77. #define COMP_RXDESC BIT(23) /* Rx desc information for SD3 debug */
  78. /* 11n or 8190 specific code */
  79. #define COMP_FIRMWARE BIT(24) /* Firmware downloading */
  80. #define COMP_HT BIT(25) /* 802.11n HT related information */
  81. #define COMP_AMSDU BIT(26) /* A-MSDU Debugging */
  82. #define COMP_SCAN BIT(27)
  83. #define COMP_DOWN BIT(29) /* rm driver module */
  84. #define COMP_RESET BIT(30) /* Silent reset */
  85. #define COMP_ERR BIT(31) /* Error out, always on */
  86. #define RTL819x_DEBUG
  87. #ifdef RTL819x_DEBUG
  88. #define RTL8192U_ASSERT(expr) \
  89. do { \
  90. if (!(expr)) { \
  91. pr_debug("Assertion failed! %s, %s, %s, line = %d\n", \
  92. #expr, __FILE__, __func__, __LINE__); \
  93. } \
  94. } while (0)
  95. /*
  96. * Debug out data buf.
  97. * If you want to print DATA buffer related BA,
  98. * please set ieee80211_debug_level to DATA|BA
  99. */
  100. #define RT_DEBUG_DATA(level, data, datalen) \
  101. do { \
  102. if ((rt_global_debug_component & (level)) == (level)) { \
  103. int i; \
  104. u8 *pdata = (u8 *) data; \
  105. pr_debug("RTL8192U: %s()\n", __func__); \
  106. for (i = 0; i < (int)(datalen); i++) { \
  107. printk("%2x ", pdata[i]); \
  108. if ((i+1)%16 == 0) \
  109. printk("\n"); \
  110. } \
  111. printk("\n"); \
  112. } \
  113. } while (0)
  114. #else
  115. #define RTL8192U_ASSERT(expr) do {} while (0)
  116. #define RT_DEBUG_DATA(level, data, datalen) do {} while (0)
  117. #endif /* RTL8169_DEBUG */
  118. /* Queue Select Value in TxDesc */
  119. #define QSLT_BK 0x1
  120. #define QSLT_BE 0x0
  121. #define QSLT_VI 0x4
  122. #define QSLT_VO 0x6
  123. #define QSLT_BEACON 0x10
  124. #define QSLT_HIGH 0x11
  125. #define QSLT_MGNT 0x12
  126. #define QSLT_CMD 0x13
  127. #define DESC90_RATE1M 0x00
  128. #define DESC90_RATE2M 0x01
  129. #define DESC90_RATE5_5M 0x02
  130. #define DESC90_RATE11M 0x03
  131. #define DESC90_RATE6M 0x04
  132. #define DESC90_RATE9M 0x05
  133. #define DESC90_RATE12M 0x06
  134. #define DESC90_RATE18M 0x07
  135. #define DESC90_RATE24M 0x08
  136. #define DESC90_RATE36M 0x09
  137. #define DESC90_RATE48M 0x0a
  138. #define DESC90_RATE54M 0x0b
  139. #define DESC90_RATEMCS0 0x00
  140. #define DESC90_RATEMCS1 0x01
  141. #define DESC90_RATEMCS2 0x02
  142. #define DESC90_RATEMCS3 0x03
  143. #define DESC90_RATEMCS4 0x04
  144. #define DESC90_RATEMCS5 0x05
  145. #define DESC90_RATEMCS6 0x06
  146. #define DESC90_RATEMCS7 0x07
  147. #define DESC90_RATEMCS8 0x08
  148. #define DESC90_RATEMCS9 0x09
  149. #define DESC90_RATEMCS10 0x0a
  150. #define DESC90_RATEMCS11 0x0b
  151. #define DESC90_RATEMCS12 0x0c
  152. #define DESC90_RATEMCS13 0x0d
  153. #define DESC90_RATEMCS14 0x0e
  154. #define DESC90_RATEMCS15 0x0f
  155. #define DESC90_RATEMCS32 0x20
  156. #define RTL819X_DEFAULT_RF_TYPE RF_1T2R
  157. #define IEEE80211_WATCH_DOG_TIME 2000
  158. #define PHY_Beacon_RSSI_SLID_WIN_MAX 10
  159. /* For Tx Power Tracking */
  160. #define OFDM_Table_Length 19
  161. #define CCK_Table_length 12
  162. /* For rtl819x */
  163. typedef struct _tx_desc_819x_usb {
  164. /* DWORD 0 */
  165. u16 PktSize;
  166. u8 Offset;
  167. u8 Reserved0:3;
  168. u8 CmdInit:1;
  169. u8 LastSeg:1;
  170. u8 FirstSeg:1;
  171. u8 LINIP:1;
  172. u8 OWN:1;
  173. /* DWORD 1 */
  174. u8 TxFWInfoSize;
  175. u8 RATid:3;
  176. u8 DISFB:1;
  177. u8 USERATE:1;
  178. u8 MOREFRAG:1;
  179. u8 NoEnc:1;
  180. u8 PIFS:1;
  181. u8 QueueSelect:5;
  182. u8 NoACM:1;
  183. u8 Reserved1:2;
  184. u8 SecCAMID:5;
  185. u8 SecDescAssign:1;
  186. u8 SecType:2;
  187. /* DWORD 2 */
  188. u16 TxBufferSize;
  189. u8 ResvForPaddingLen:7;
  190. u8 Reserved3:1;
  191. u8 Reserved4;
  192. /* DWORD 3, 4, 5 */
  193. u32 Reserved5;
  194. u32 Reserved6;
  195. u32 Reserved7;
  196. } tx_desc_819x_usb, *ptx_desc_819x_usb;
  197. #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
  198. typedef struct _tx_desc_819x_usb_aggr_subframe {
  199. /* DWORD 0 */
  200. u16 PktSize;
  201. u8 Offset;
  202. u8 TxFWInfoSize;
  203. /* DWORD 1 */
  204. u8 RATid:3;
  205. u8 DISFB:1;
  206. u8 USERATE:1;
  207. u8 MOREFRAG:1;
  208. u8 NoEnc:1;
  209. u8 PIFS:1;
  210. u8 QueueSelect:5;
  211. u8 NoACM:1;
  212. u8 Reserved1:2;
  213. u8 SecCAMID:5;
  214. u8 SecDescAssign:1;
  215. u8 SecType:2;
  216. u8 PacketID:7;
  217. u8 OWN:1;
  218. } tx_desc_819x_usb_aggr_subframe, *ptx_desc_819x_usb_aggr_subframe;
  219. #endif
  220. typedef struct _tx_desc_cmd_819x_usb {
  221. /* DWORD 0 */
  222. u16 Reserved0;
  223. u8 Reserved1;
  224. u8 Reserved2:3;
  225. u8 CmdInit:1;
  226. u8 LastSeg:1;
  227. u8 FirstSeg:1;
  228. u8 LINIP:1;
  229. u8 OWN:1;
  230. /* DOWRD 1 */
  231. u8 TxFWInfoSize;
  232. u8 Reserved3;
  233. u8 QueueSelect;
  234. u8 Reserved4;
  235. /* DOWRD 2 */
  236. u16 TxBufferSize;
  237. u16 Reserved5;
  238. /* DWORD 3, 4, 5 */
  239. u32 Reserved6;
  240. u32 Reserved7;
  241. u32 Reserved8;
  242. } tx_desc_cmd_819x_usb, *ptx_desc_cmd_819x_usb;
  243. typedef struct _tx_fwinfo_819x_usb {
  244. /* DOWRD 0 */
  245. u8 TxRate:7;
  246. u8 CtsEnable:1;
  247. u8 RtsRate:7;
  248. u8 RtsEnable:1;
  249. u8 TxHT:1;
  250. u8 Short:1; /* Error out, always on */
  251. u8 TxBandwidth:1; /* Used for HT MCS rate only */
  252. u8 TxSubCarrier:2; /* Used for legacy OFDM rate only */
  253. u8 STBC:2;
  254. u8 AllowAggregation:1;
  255. /* Interpret RtsRate field as high throughput data rate */
  256. u8 RtsHT:1;
  257. u8 RtsShort:1; /* Short PLCP for CCK or short GI for 11n MCS */
  258. u8 RtsBandwidth:1; /* Used for HT MCS rate only */
  259. u8 RtsSubcarrier:2;/* Used for legacy OFDM rate only */
  260. u8 RtsSTBC:2;
  261. /* Enable firmware to recalculate and assign packet duration */
  262. u8 EnableCPUDur:1;
  263. /* DWORD 1 */
  264. u32 RxMF:2;
  265. u32 RxAMD:3;
  266. /* 1 indicate Tx info gathered by firmware and returned by Rx Cmd */
  267. u32 TxPerPktInfoFeedback:1;
  268. u32 Reserved1:2;
  269. u32 TxAGCOffSet:4;
  270. u32 TxAGCSign:1;
  271. u32 Tx_INFO_RSVD:6;
  272. u32 PacketID:13;
  273. } tx_fwinfo_819x_usb, *ptx_fwinfo_819x_usb;
  274. struct rtl8192_rx_info {
  275. struct urb *urb;
  276. struct net_device *dev;
  277. u8 out_pipe;
  278. };
  279. typedef struct rx_desc_819x_usb {
  280. /* DOWRD 0 */
  281. u16 Length:14;
  282. u16 CRC32:1;
  283. u16 ICV:1;
  284. u8 RxDrvInfoSize;
  285. u8 Shift:2;
  286. u8 PHYStatus:1;
  287. u8 SWDec:1;
  288. u8 Reserved1:4;
  289. /* DWORD 1 */
  290. u32 Reserved2;
  291. } rx_desc_819x_usb, *prx_desc_819x_usb;
  292. #ifdef USB_RX_AGGREGATION_SUPPORT
  293. typedef struct _rx_desc_819x_usb_aggr_subframe {
  294. /* DOWRD 0 */
  295. u16 Length:14;
  296. u16 CRC32:1;
  297. u16 ICV:1;
  298. u8 Offset;
  299. u8 RxDrvInfoSize;
  300. /* DOWRD 1 */
  301. u8 Shift:2;
  302. u8 PHYStatus:1;
  303. u8 SWDec:1;
  304. u8 Reserved1:4;
  305. u8 Reserved2;
  306. u16 Reserved3;
  307. } rx_desc_819x_usb_aggr_subframe, *prx_desc_819x_usb_aggr_subframe;
  308. #endif
  309. typedef struct rx_drvinfo_819x_usb {
  310. /* DWORD 0 */
  311. u16 Reserved1:12;
  312. u16 PartAggr:1;
  313. u16 FirstAGGR:1;
  314. u16 Reserved2:2;
  315. u8 RxRate:7;
  316. u8 RxHT:1;
  317. u8 BW:1;
  318. u8 SPLCP:1;
  319. u8 Reserved3:2;
  320. u8 PAM:1;
  321. u8 Mcast:1;
  322. u8 Bcast:1;
  323. u8 Reserved4:1;
  324. /* DWORD 1 */
  325. u32 TSFL;
  326. } rx_drvinfo_819x_usb, *prx_drvinfo_819x_usb;
  327. /* Support till 64 bit bus width OS */
  328. #define MAX_DEV_ADDR_SIZE 8
  329. /* For RTL8190 */
  330. #define MAX_FIRMWARE_INFORMATION_SIZE 32
  331. #define MAX_802_11_HEADER_LENGTH (40 + MAX_FIRMWARE_INFORMATION_SIZE)
  332. #define ENCRYPTION_MAX_OVERHEAD 128
  333. #define USB_HWDESC_HEADER_LEN sizeof(tx_desc_819x_usb)
  334. #define TX_PACKET_SHIFT_BYTES (USB_HWDESC_HEADER_LEN + sizeof(tx_fwinfo_819x_usb))
  335. #define MAX_FRAGMENT_COUNT 8
  336. #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
  337. #define MAX_TRANSMIT_BUFFER_SIZE 32000
  338. #else
  339. #define MAX_TRANSMIT_BUFFER_SIZE 8000
  340. #endif
  341. #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
  342. #define TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES (sizeof(tx_desc_819x_usb_aggr_subframe) + sizeof(tx_fwinfo_819x_usb))
  343. #endif
  344. /* Octets for crc32 (FCS, ICV) */
  345. #define scrclng 4
  346. typedef enum rf_optype {
  347. RF_OP_By_SW_3wire = 0,
  348. RF_OP_By_FW,
  349. RF_OP_MAX
  350. } rf_op_type;
  351. /* 8190 Loopback Mode definition */
  352. typedef enum _rtl819xUsb_loopback {
  353. RTL819xU_NO_LOOPBACK = 0,
  354. RTL819xU_MAC_LOOPBACK = 1,
  355. RTL819xU_DMA_LOOPBACK = 2,
  356. RTL819xU_CCK_LOOPBACK = 3,
  357. } rtl819xUsb_loopback_e;
  358. /* due to rtl8192 firmware */
  359. typedef enum _desc_packet_type_e {
  360. DESC_PACKET_TYPE_INIT = 0,
  361. DESC_PACKET_TYPE_NORMAL = 1,
  362. } desc_packet_type_e;
  363. typedef enum _firmware_status {
  364. FW_STATUS_0_INIT = 0,
  365. FW_STATUS_1_MOVE_BOOT_CODE = 1,
  366. FW_STATUS_2_MOVE_MAIN_CODE = 2,
  367. FW_STATUS_3_TURNON_CPU = 3,
  368. FW_STATUS_4_MOVE_DATA_CODE = 4,
  369. FW_STATUS_5_READY = 5,
  370. } firmware_status_e;
  371. typedef struct _rt_firmare_seg_container {
  372. u16 seg_size;
  373. u8 *seg_ptr;
  374. } fw_seg_container, *pfw_seg_container;
  375. typedef struct _rt_firmware {
  376. firmware_status_e firmware_status;
  377. u16 cmdpacket_frag_thresold;
  378. #define RTL8190_MAX_FIRMWARE_CODE_SIZE 64000
  379. u8 firmware_buf[RTL8190_MAX_FIRMWARE_CODE_SIZE];
  380. u16 firmware_buf_size;
  381. } rt_firmware, *prt_firmware;
  382. /* Add this to 9100 bytes to receive A-MSDU from RT-AP */
  383. #define MAX_RECEIVE_BUFFER_SIZE 9100
  384. typedef struct _rt_firmware_info_819xUsb {
  385. u8 sz_info[16];
  386. } rt_firmware_info_819xUsb, *prt_firmware_info_819xUsb;
  387. /* Firmware Queue Layout */
  388. #define NUM_OF_FIRMWARE_QUEUE 10
  389. #define NUM_OF_PAGES_IN_FW 0x100
  390. #ifdef USE_ONE_PIPE
  391. #define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x000
  392. #define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x000
  393. #define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x0ff
  394. #define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x000
  395. #define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0
  396. #define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x0
  397. #define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x00
  398. #define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0
  399. #define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x0
  400. #define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0x00
  401. #else
  402. #define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x020
  403. #define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x020
  404. #define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x040
  405. #define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x040
  406. #define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0
  407. #define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x4
  408. #define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x20
  409. #define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0
  410. #define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x4
  411. #define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0x18
  412. #endif
  413. #define APPLIED_RESERVED_QUEUE_IN_FW 0x80000000
  414. #define RSVD_FW_QUEUE_PAGE_BK_SHIFT 0x00
  415. #define RSVD_FW_QUEUE_PAGE_BE_SHIFT 0x08
  416. #define RSVD_FW_QUEUE_PAGE_VI_SHIFT 0x10
  417. #define RSVD_FW_QUEUE_PAGE_VO_SHIFT 0x18
  418. #define RSVD_FW_QUEUE_PAGE_MGNT_SHIFT 0x10
  419. #define RSVD_FW_QUEUE_PAGE_CMD_SHIFT 0x08
  420. #define RSVD_FW_QUEUE_PAGE_BCN_SHIFT 0x00
  421. #define RSVD_FW_QUEUE_PAGE_PUB_SHIFT 0x08
  422. /*
  423. * =================================================================
  424. * =================================================================
  425. */
  426. #define EPROM_93c46 0
  427. #define EPROM_93c56 1
  428. #define DEFAULT_FRAG_THRESHOLD 2342U
  429. #define MIN_FRAG_THRESHOLD 256U
  430. #define DEFAULT_BEACONINTERVAL 0x64U
  431. #define DEFAULT_BEACON_ESSID "Rtl819xU"
  432. #define DEFAULT_SSID ""
  433. #define DEFAULT_RETRY_RTS 7
  434. #define DEFAULT_RETRY_DATA 7
  435. #define PRISM_HDR_SIZE 64
  436. #define PHY_RSSI_SLID_WIN_MAX 100
  437. typedef enum _WIRELESS_MODE {
  438. WIRELESS_MODE_UNKNOWN = 0x00,
  439. WIRELESS_MODE_A = 0x01,
  440. WIRELESS_MODE_B = 0x02,
  441. WIRELESS_MODE_G = 0x04,
  442. WIRELESS_MODE_AUTO = 0x08,
  443. WIRELESS_MODE_N_24G = 0x10,
  444. WIRELESS_MODE_N_5G = 0x20
  445. } WIRELESS_MODE;
  446. #define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30)
  447. typedef struct buffer {
  448. struct buffer *next;
  449. u32 *buf;
  450. } buffer;
  451. typedef struct rtl_reg_debug {
  452. unsigned int cmd;
  453. struct {
  454. unsigned char type;
  455. unsigned char addr;
  456. unsigned char page;
  457. unsigned char length;
  458. } head;
  459. unsigned char buf[0xff];
  460. } rtl_reg_debug;
  461. typedef struct _rt_9x_tx_rate_history {
  462. u32 cck[4];
  463. u32 ofdm[8];
  464. u32 ht_mcs[4][16];
  465. } rt_tx_rahis_t, *prt_tx_rahis_t;
  466. typedef struct _RT_SMOOTH_DATA_4RF {
  467. char elements[4][100]; /* array to store values */
  468. u32 index; /* index to current array to store */
  469. u32 TotalNum; /* num of valid elements */
  470. u32 TotalVal[4]; /* sum of valid elements */
  471. } RT_SMOOTH_DATA_4RF, *PRT_SMOOTH_DATA_4RF;
  472. /* This maybe changed for D-cut larger aggregation size */
  473. #define MAX_8192U_RX_SIZE 8192
  474. /* Stats seems messed up, clean it ASAP */
  475. typedef struct Stats {
  476. unsigned long txrdu;
  477. unsigned long rxok;
  478. unsigned long rxframgment;
  479. unsigned long rxurberr;
  480. unsigned long rxstaterr;
  481. /* 0: Total, 1: OK, 2: CRC, 3: ICV */
  482. unsigned long received_rate_histogram[4][32];
  483. /* 0: Long preamble/GI, 1: Short preamble/GI */
  484. unsigned long received_preamble_GI[2][32];
  485. /* level: (<4K), (4K~8K), (8K~16K), (16K~32K), (32K~64K) */
  486. unsigned long rx_AMPDUsize_histogram[5];
  487. /* level: (<5), (5~10), (10~20), (20~40), (>40) */
  488. unsigned long rx_AMPDUnum_histogram[5];
  489. unsigned long numpacket_matchbssid;
  490. unsigned long numpacket_toself;
  491. unsigned long num_process_phyinfo;
  492. unsigned long numqry_phystatus;
  493. unsigned long numqry_phystatusCCK;
  494. unsigned long numqry_phystatusHT;
  495. /* 0: 20M, 1: funn40M, 2: upper20M, 3: lower20M, 4: duplicate */
  496. unsigned long received_bwtype[5];
  497. unsigned long txnperr;
  498. unsigned long txnpdrop;
  499. unsigned long txresumed;
  500. unsigned long txnpokint;
  501. unsigned long txoverflow;
  502. unsigned long txlpokint;
  503. unsigned long txlpdrop;
  504. unsigned long txlperr;
  505. unsigned long txbeokint;
  506. unsigned long txbedrop;
  507. unsigned long txbeerr;
  508. unsigned long txbkokint;
  509. unsigned long txbkdrop;
  510. unsigned long txbkerr;
  511. unsigned long txviokint;
  512. unsigned long txvidrop;
  513. unsigned long txvierr;
  514. unsigned long txvookint;
  515. unsigned long txvodrop;
  516. unsigned long txvoerr;
  517. unsigned long txbeaconokint;
  518. unsigned long txbeacondrop;
  519. unsigned long txbeaconerr;
  520. unsigned long txmanageokint;
  521. unsigned long txmanagedrop;
  522. unsigned long txmanageerr;
  523. unsigned long txdatapkt;
  524. unsigned long txfeedback;
  525. unsigned long txfeedbackok;
  526. unsigned long txoktotal;
  527. unsigned long txokbytestotal;
  528. unsigned long txokinperiod;
  529. unsigned long txmulticast;
  530. unsigned long txbytesmulticast;
  531. unsigned long txbroadcast;
  532. unsigned long txbytesbroadcast;
  533. unsigned long txunicast;
  534. unsigned long txbytesunicast;
  535. unsigned long rxoktotal;
  536. unsigned long rxbytesunicast;
  537. unsigned long txfeedbackfail;
  538. unsigned long txerrtotal;
  539. unsigned long txerrbytestotal;
  540. unsigned long txerrmulticast;
  541. unsigned long txerrbroadcast;
  542. unsigned long txerrunicast;
  543. unsigned long txretrycount;
  544. unsigned long txfeedbackretry;
  545. u8 last_packet_rate;
  546. unsigned long slide_signal_strength[100];
  547. unsigned long slide_evm[100];
  548. /* For recording sliding window's RSSI value */
  549. unsigned long slide_rssi_total;
  550. /* For recording sliding window's EVM value */
  551. unsigned long slide_evm_total;
  552. /* Transformed in dbm. Beautified signal strength for UI, not correct */
  553. long signal_strength;
  554. long signal_quality;
  555. long last_signal_strength_inpercent;
  556. /* Correct smoothed ss in dbm, only used in driver
  557. * to report real power now */
  558. long recv_signal_power;
  559. u8 rx_rssi_percentage[4];
  560. u8 rx_evm_percentage[2];
  561. long rxSNRdB[4];
  562. rt_tx_rahis_t txrate;
  563. /* For beacon RSSI */
  564. u32 Slide_Beacon_pwdb[100];
  565. u32 Slide_Beacon_Total;
  566. RT_SMOOTH_DATA_4RF cck_adc_pwdb;
  567. u32 CurrentShowTxate;
  568. } Stats;
  569. /* Bandwidth Offset */
  570. #define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0
  571. #define HAL_PRIME_CHNL_OFFSET_LOWER 1
  572. #define HAL_PRIME_CHNL_OFFSET_UPPER 2
  573. typedef struct ChnlAccessSetting {
  574. u16 SIFS_Timer;
  575. u16 DIFS_Timer;
  576. u16 SlotTimeTimer;
  577. u16 EIFS_Timer;
  578. u16 CWminIndex;
  579. u16 CWmaxIndex;
  580. } *PCHANNEL_ACCESS_SETTING, CHANNEL_ACCESS_SETTING;
  581. typedef struct _BB_REGISTER_DEFINITION {
  582. /* set software control: 0x870~0x877 [8 bytes] */
  583. u32 rfintfs;
  584. /* readback data: 0x8e0~0x8e7 [8 bytes] */
  585. u32 rfintfi;
  586. /* output data: 0x860~0x86f [16 bytes] */
  587. u32 rfintfo;
  588. /* output enable: 0x860~0x86f [16 bytes] */
  589. u32 rfintfe;
  590. /* LSSI data: 0x840~0x84f [16 bytes] */
  591. u32 rf3wireOffset;
  592. /* BB Band Select: 0x878~0x87f [8 bytes] */
  593. u32 rfLSSI_Select;
  594. /* Tx gain stage: 0x80c~0x80f [4 bytes] */
  595. u32 rfTxGainStage;
  596. /* wire parameter control1: 0x820~0x823, 0x828~0x82b,
  597. * 0x830~0x833, 0x838~0x83b [16 bytes] */
  598. u32 rfHSSIPara1;
  599. /* wire parameter control2: 0x824~0x827, 0x82c~0x82f,
  600. * 0x834~0x837, 0x83c~0x83f [16 bytes] */
  601. u32 rfHSSIPara2;
  602. /* Tx Rx antenna control: 0x858~0x85f [16 bytes] */
  603. u32 rfSwitchControl;
  604. /* AGC parameter control1: 0xc50~0xc53, 0xc58~0xc5b,
  605. * 0xc60~0xc63, 0xc68~0xc6b [16 bytes] */
  606. u32 rfAGCControl1;
  607. /* AGC parameter control2: 0xc54~0xc57, 0xc5c~0xc5f,
  608. * 0xc64~0xc67, 0xc6c~0xc6f [16 bytes] */
  609. u32 rfAGCControl2;
  610. /* OFDM Rx IQ imbalance matrix: 0xc14~0xc17, 0xc1c~0xc1f,
  611. * 0xc24~0xc27, 0xc2c~0xc2f [16 bytes] */
  612. u32 rfRxIQImbalance;
  613. /* Rx IQ DC offset and Rx digital filter, Rx DC notch filter:
  614. * 0xc10~0xc13, 0xc18~0xc1b,
  615. * 0xc20~0xc23, 0xc28~0xc2b [16 bytes] */
  616. u32 rfRxAFE;
  617. /* OFDM Tx IQ imbalance matrix: 0xc80~0xc83, 0xc88~0xc8b,
  618. * 0xc90~0xc93, 0xc98~0xc9b [16 bytes] */
  619. u32 rfTxIQImbalance;
  620. /* Tx IQ DC Offset and Tx DFIR type:
  621. * 0xc84~0xc87, 0xc8c~0xc8f,
  622. * 0xc94~0xc97, 0xc9c~0xc9f [16 bytes] */
  623. u32 rfTxAFE;
  624. /* LSSI RF readback data: 0x8a0~0x8af [16 bytes] */
  625. u32 rfLSSIReadBack;
  626. } BB_REGISTER_DEFINITION_T, *PBB_REGISTER_DEFINITION_T;
  627. typedef enum _RT_RF_TYPE_819xU {
  628. RF_TYPE_MIN = 0,
  629. RF_8225,
  630. RF_8256,
  631. RF_8258,
  632. RF_PSEUDO_11N = 4,
  633. } RT_RF_TYPE_819xU, *PRT_RF_TYPE_819xU;
  634. typedef struct _rate_adaptive {
  635. u8 rate_adaptive_disabled;
  636. u8 ratr_state;
  637. u16 reserve;
  638. u32 high_rssi_thresh_for_ra;
  639. u32 high2low_rssi_thresh_for_ra;
  640. u8 low2high_rssi_thresh_for_ra40M;
  641. u32 low_rssi_thresh_for_ra40M;
  642. u8 low2high_rssi_thresh_for_ra20M;
  643. u32 low_rssi_thresh_for_ra20M;
  644. u32 upper_rssi_threshold_ratr;
  645. u32 middle_rssi_threshold_ratr;
  646. u32 low_rssi_threshold_ratr;
  647. u32 low_rssi_threshold_ratr_40M;
  648. u32 low_rssi_threshold_ratr_20M;
  649. u8 ping_rssi_enable;
  650. u32 ping_rssi_ratr;
  651. u32 ping_rssi_thresh_for_ra;
  652. u32 last_ratr;
  653. } rate_adaptive, *prate_adaptive;
  654. #define TxBBGainTableLength 37
  655. #define CCKTxBBGainTableLength 23
  656. typedef struct _txbbgain_struct {
  657. long txbb_iq_amplifygain;
  658. u32 txbbgain_value;
  659. } txbbgain_struct, *ptxbbgain_struct;
  660. typedef struct _ccktxbbgain_struct {
  661. /* The value is from a22 to a29, one byte one time is much safer */
  662. u8 ccktxbb_valuearray[8];
  663. } ccktxbbgain_struct, *pccktxbbgain_struct;
  664. typedef struct _init_gain {
  665. u8 xaagccore1;
  666. u8 xbagccore1;
  667. u8 xcagccore1;
  668. u8 xdagccore1;
  669. u8 cca;
  670. } init_gain, *pinit_gain;
  671. typedef struct _phy_ofdm_rx_status_report_819xusb {
  672. u8 trsw_gain_X[4];
  673. u8 pwdb_all;
  674. u8 cfosho_X[4];
  675. u8 cfotail_X[4];
  676. u8 rxevm_X[2];
  677. u8 rxsnr_X[4];
  678. u8 pdsnr_X[2];
  679. u8 csi_current_X[2];
  680. u8 csi_target_X[2];
  681. u8 sigevm;
  682. u8 max_ex_pwr;
  683. u8 sgi_en;
  684. u8 rxsc_sgien_exflg;
  685. } phy_sts_ofdm_819xusb_t;
  686. typedef struct _phy_cck_rx_status_report_819xusb {
  687. /* For CCK rate descriptor. This is an unsigned 8:1 variable.
  688. * LSB bit presend 0.5. And MSB 7 bts presend a signed value.
  689. * Range from -64~+63.5. */
  690. u8 adc_pwdb_X[4];
  691. u8 sq_rpt;
  692. u8 cck_agc_rpt;
  693. } phy_sts_cck_819xusb_t;
  694. typedef struct _phy_ofdm_rx_status_rxsc_sgien_exintfflag {
  695. u8 reserved:4;
  696. u8 rxsc:2;
  697. u8 sgi_en:1;
  698. u8 ex_intf_flag:1;
  699. } phy_ofdm_rx_status_rxsc_sgien_exintfflag;
  700. typedef enum _RT_CUSTOMER_ID {
  701. RT_CID_DEFAULT = 0,
  702. RT_CID_8187_ALPHA0 = 1,
  703. RT_CID_8187_SERCOMM_PS = 2,
  704. RT_CID_8187_HW_LED = 3,
  705. RT_CID_8187_NETGEAR = 4,
  706. RT_CID_WHQL = 5,
  707. RT_CID_819x_CAMEO = 6,
  708. RT_CID_819x_RUNTOP = 7,
  709. RT_CID_819x_Senao = 8,
  710. RT_CID_TOSHIBA = 9,
  711. RT_CID_819x_Netcore = 10,
  712. RT_CID_Nettronix = 11,
  713. RT_CID_DLINK = 12,
  714. RT_CID_PRONET = 13,
  715. } RT_CUSTOMER_ID, *PRT_CUSTOMER_ID;
  716. /*
  717. * ==========================================================================
  718. * LED customization.
  719. * ==========================================================================
  720. */
  721. typedef enum _LED_STRATEGY_8190 {
  722. SW_LED_MODE0, /* SW control 1 LED via GPIO0. It is default option. */
  723. SW_LED_MODE1, /* SW control for PCI Express */
  724. SW_LED_MODE2, /* SW control for Cameo. */
  725. SW_LED_MODE3, /* SW control for RunTop. */
  726. SW_LED_MODE4, /* SW control for Netcore. */
  727. /* HW control 2 LEDs, LED0 and LED1 (4 different control modes) */
  728. HW_LED,
  729. } LED_STRATEGY_8190, *PLED_STRATEGY_8190;
  730. typedef enum _RESET_TYPE {
  731. RESET_TYPE_NORESET = 0x00,
  732. RESET_TYPE_NORMAL = 0x01,
  733. RESET_TYPE_SILENT = 0x02
  734. } RESET_TYPE;
  735. /* The simple tx command OP code. */
  736. typedef enum _tag_TxCmd_Config_Index {
  737. TXCMD_TXRA_HISTORY_CTRL = 0xFF900000,
  738. TXCMD_RESET_TX_PKT_BUFF = 0xFF900001,
  739. TXCMD_RESET_RX_PKT_BUFF = 0xFF900002,
  740. TXCMD_SET_TX_DURATION = 0xFF900003,
  741. TXCMD_SET_RX_RSSI = 0xFF900004,
  742. TXCMD_SET_TX_PWR_TRACKING = 0xFF900005,
  743. TXCMD_XXXX_CTRL,
  744. } DCMD_TXCMD_OP;
  745. typedef struct r8192_priv {
  746. struct usb_device *udev;
  747. /* For maintain info from eeprom */
  748. short epromtype;
  749. u16 eeprom_vid;
  750. u16 eeprom_pid;
  751. u8 eeprom_CustomerID;
  752. u8 eeprom_ChannelPlan;
  753. RT_CUSTOMER_ID CustomerID;
  754. LED_STRATEGY_8190 LedStrategy;
  755. u8 txqueue_to_outpipemap[9];
  756. int irq;
  757. struct ieee80211_device *ieee80211;
  758. /* O: rtl8192, 1: rtl8185 V B/C, 2: rtl8185 V D */
  759. short card_8192;
  760. /* If TCR reports card V B/C, this discriminates */
  761. u8 card_8192_version;
  762. short enable_gpio0;
  763. enum card_type {
  764. PCI, MINIPCI, CARDBUS, USB
  765. } card_type;
  766. short hw_plcp_len;
  767. short plcp_preamble_mode;
  768. spinlock_t irq_lock;
  769. spinlock_t tx_lock;
  770. struct mutex mutex;
  771. u16 irq_mask;
  772. short chan;
  773. short sens;
  774. short max_sens;
  775. short up;
  776. /* If 1, allow bad crc frame, reception in monitor mode */
  777. short crcmon;
  778. struct semaphore wx_sem;
  779. struct semaphore rf_sem; /* Used to lock rf write operation */
  780. u8 rf_type; /* 0: 1T2R, 1: 2T4R */
  781. RT_RF_TYPE_819xU rf_chip;
  782. short (*rf_set_sens)(struct net_device *dev, short sens);
  783. u8 (*rf_set_chan)(struct net_device *dev, u8 ch);
  784. void (*rf_close)(struct net_device *dev);
  785. void (*rf_init)(struct net_device *dev);
  786. short promisc;
  787. /* Stats */
  788. struct Stats stats;
  789. struct iw_statistics wstats;
  790. /* RX stuff */
  791. struct urb **rx_urb;
  792. struct urb **rx_cmd_urb;
  793. #ifdef THOMAS_BEACON
  794. u32 *oldaddr;
  795. #endif
  796. #ifdef THOMAS_TASKLET
  797. atomic_t irt_counter; /* count for irq_rx_tasklet */
  798. #endif
  799. #ifdef JACKSON_NEW_RX
  800. struct sk_buff **pp_rxskb;
  801. int rx_inx;
  802. #endif
  803. struct sk_buff_head rx_queue;
  804. struct sk_buff_head skb_queue;
  805. struct work_struct qos_activate;
  806. short tx_urb_index;
  807. atomic_t tx_pending[0x10]; /* UART_PRIORITY + 1 */
  808. struct tasklet_struct irq_rx_tasklet;
  809. struct urb *rxurb_task;
  810. /* Tx Related variables */
  811. u16 ShortRetryLimit;
  812. u16 LongRetryLimit;
  813. u32 TransmitConfig;
  814. u8 RegCWinMin; /* For turbo mode CW adaptive */
  815. u32 LastRxDescTSFHigh;
  816. u32 LastRxDescTSFLow;
  817. /* Rx Related variables */
  818. u16 EarlyRxThreshold;
  819. u32 ReceiveConfig;
  820. u8 AcmControl;
  821. u8 RFProgType;
  822. u8 retry_data;
  823. u8 retry_rts;
  824. u16 rts;
  825. struct ChnlAccessSetting ChannelAccessSetting;
  826. struct work_struct reset_wq;
  827. /**********************************************************/
  828. /* For rtl819xUsb */
  829. u16 basic_rate;
  830. u8 short_preamble;
  831. u8 slot_time;
  832. bool bDcut;
  833. bool bCurrentRxAggrEnable;
  834. u8 Rf_Mode; /* For Firmware RF -R/W switch */
  835. prt_firmware pFirmware;
  836. rtl819xUsb_loopback_e LoopbackMode;
  837. u16 EEPROMTxPowerDiff;
  838. u8 EEPROMThermalMeter;
  839. u8 EEPROMPwDiff;
  840. u8 EEPROMCrystalCap;
  841. u8 EEPROM_Def_Ver;
  842. u8 EEPROMTxPowerLevelCCK; /* CCK channel 1~14 */
  843. u8 EEPROMTxPowerLevelCCK_V1[3];
  844. u8 EEPROMTxPowerLevelOFDM24G[3]; /* OFDM 2.4G channel 1~14 */
  845. u8 EEPROMTxPowerLevelOFDM5G[24]; /* OFDM 5G */
  846. /* PHY related */
  847. BB_REGISTER_DEFINITION_T PHYRegDef[4]; /* Radio A/B/C/D */
  848. /* Read/write are allow for following hardware information variables */
  849. u32 MCSTxPowerLevelOriginalOffset[6];
  850. u32 CCKTxPowerLevelOriginalOffset;
  851. u8 TxPowerLevelCCK[14]; /* CCK channel 1~14 */
  852. u8 TxPowerLevelOFDM24G[14]; /* OFDM 2.4G channel 1~14 */
  853. u8 TxPowerLevelOFDM5G[14]; /* OFDM 5G */
  854. u32 Pwr_Track;
  855. u8 TxPowerDiff;
  856. u8 AntennaTxPwDiff[2]; /* Antenna gain offset, 0: B, 1: C, 2: D */
  857. u8 CrystalCap;
  858. u8 ThermalMeter[2]; /* index 0: RFIC0, index 1: RFIC1 */
  859. u8 CckPwEnl;
  860. /* Use to calculate PWBD */
  861. u8 bCckHighPower;
  862. long undecorated_smoothed_pwdb;
  863. /* For set channel */
  864. u8 SwChnlInProgress;
  865. u8 SwChnlStage;
  866. u8 SwChnlStep;
  867. u8 SetBWModeInProgress;
  868. HT_CHANNEL_WIDTH CurrentChannelBW;
  869. u8 ChannelPlan;
  870. /* 8190 40MHz mode */
  871. /* Control channel sub-carrier */
  872. u8 nCur40MhzPrimeSC;
  873. /* Test for shorten RF configuration time.
  874. * We save RF reg0 in this variable to reduce RF reading. */
  875. u32 RfReg0Value[4];
  876. u8 NumTotalRFPath;
  877. bool brfpath_rxenable[4];
  878. /* RF set related */
  879. bool SetRFPowerStateInProgress;
  880. struct timer_list watch_dog_timer;
  881. /* For dynamic mechanism */
  882. /* Tx Power Control for Near/Far Range */
  883. bool bdynamic_txpower;
  884. bool bDynamicTxHighPower;
  885. bool bDynamicTxLowPower;
  886. bool bLastDTPFlag_High;
  887. bool bLastDTPFlag_Low;
  888. bool bstore_last_dtpflag;
  889. /* Define to discriminate on High power State or
  890. * on sitesurvey to change Tx gain index */
  891. bool bstart_txctrl_bydtp;
  892. rate_adaptive rate_adaptive;
  893. /* TX power tracking
  894. * OPEN/CLOSE TX POWER TRACKING */
  895. txbbgain_struct txbbgain_table[TxBBGainTableLength];
  896. u8 txpower_count; /* For 6 sec do tracking again */
  897. bool btxpower_trackingInit;
  898. u8 OFDM_index;
  899. u8 CCK_index;
  900. /* CCK TX Power Tracking */
  901. ccktxbbgain_struct cck_txbbgain_table[CCKTxBBGainTableLength];
  902. ccktxbbgain_struct cck_txbbgain_ch14_table[CCKTxBBGainTableLength];
  903. u8 rfa_txpowertrackingindex;
  904. u8 rfa_txpowertrackingindex_real;
  905. u8 rfa_txpowertracking_default;
  906. u8 rfc_txpowertrackingindex;
  907. u8 rfc_txpowertrackingindex_real;
  908. s8 cck_present_attentuation;
  909. u8 cck_present_attentuation_20Mdefault;
  910. u8 cck_present_attentuation_40Mdefault;
  911. char cck_present_attentuation_difference;
  912. bool btxpower_tracking;
  913. bool bcck_in_ch14;
  914. bool btxpowerdata_readfromEEPORM;
  915. u16 TSSI_13dBm;
  916. init_gain initgain_backup;
  917. u8 DefaultInitialGain[4];
  918. /* For EDCA Turbo mode */
  919. bool bis_any_nonbepkts;
  920. bool bcurrent_turbo_EDCA;
  921. bool bis_cur_rdlstate;
  922. struct timer_list fsync_timer;
  923. bool bfsync_processing; /* 500ms Fsync timer is active or not */
  924. u32 rate_record;
  925. u32 rateCountDiffRecord;
  926. u32 ContinueDiffCount;
  927. bool bswitch_fsync;
  928. u8 framesync;
  929. u32 framesyncC34;
  930. u8 framesyncMonitor;
  931. u16 nrxAMPDU_size;
  932. u8 nrxAMPDU_aggr_num;
  933. /* For gpio */
  934. bool bHwRadioOff;
  935. u32 reset_count;
  936. bool bpbc_pressed;
  937. u32 txpower_checkcnt;
  938. u32 txpower_tracking_callback_cnt;
  939. u8 thermal_read_val[40];
  940. u8 thermal_readback_index;
  941. u32 ccktxpower_adjustcnt_not_ch14;
  942. u32 ccktxpower_adjustcnt_ch14;
  943. u8 tx_fwinfo_force_subcarriermode;
  944. u8 tx_fwinfo_force_subcarrierval;
  945. /* For silent reset */
  946. RESET_TYPE ResetProgress;
  947. bool bForcedSilentReset;
  948. bool bDisableNormalResetCheck;
  949. u16 TxCounter;
  950. u16 RxCounter;
  951. int IrpPendingCount;
  952. bool bResetInProgress;
  953. bool force_reset;
  954. u8 InitialGainOperateType;
  955. u16 SifsTime;
  956. /* Define work item */
  957. struct delayed_work update_beacon_wq;
  958. struct delayed_work watch_dog_wq;
  959. struct delayed_work txpower_tracking_wq;
  960. struct delayed_work rfpath_check_wq;
  961. struct delayed_work gpio_change_rf_wq;
  962. struct delayed_work initialgain_operate_wq;
  963. struct workqueue_struct *priv_wq;
  964. } r8192_priv;
  965. /* For rtl8187B */
  966. typedef enum{
  967. BULK_PRIORITY = 0x01,
  968. LOW_PRIORITY,
  969. NORM_PRIORITY,
  970. VO_PRIORITY,
  971. VI_PRIORITY,
  972. BE_PRIORITY,
  973. BK_PRIORITY,
  974. RSVD2,
  975. RSVD3,
  976. BEACON_PRIORITY,
  977. HIGH_PRIORITY,
  978. MANAGE_PRIORITY,
  979. RSVD4,
  980. RSVD5,
  981. UART_PRIORITY
  982. } priority_t;
  983. typedef enum {
  984. NIC_8192U = 1,
  985. NIC_8190P = 2,
  986. NIC_8192E = 3,
  987. } nic_t;
  988. bool init_firmware(struct net_device *dev);
  989. short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb);
  990. short rtl8192_tx(struct net_device *dev, struct sk_buff *skb);
  991. u32 read_cam(struct net_device *dev, u8 addr);
  992. void write_cam(struct net_device *dev, u8 addr, u32 data);
  993. int read_nic_byte(struct net_device *dev, int x, u8 *data);
  994. int read_nic_byte_E(struct net_device *dev, int x, u8 *data);
  995. int read_nic_dword(struct net_device *dev, int x, u32 *data);
  996. int read_nic_word(struct net_device *dev, int x, u16 *data);
  997. void write_nic_byte(struct net_device *dev, int x, u8 y);
  998. void write_nic_byte_E(struct net_device *dev, int x, u8 y);
  999. void write_nic_word(struct net_device *dev, int x, u16 y);
  1000. void write_nic_dword(struct net_device *dev, int x, u32 y);
  1001. void force_pci_posting(struct net_device *dev);
  1002. void rtl8192_rtx_disable(struct net_device *);
  1003. void rtl8192_rx_enable(struct net_device *);
  1004. void rtl8192_tx_enable(struct net_device *);
  1005. void rtl8192_disassociate(struct net_device *dev);
  1006. void rtl8185_set_rf_pins_enable(struct net_device *dev, u32 a);
  1007. void rtl8192_set_anaparam(struct net_device *dev, u32 a);
  1008. void rtl8185_set_anaparam2(struct net_device *dev, u32 a);
  1009. void rtl8192_update_msr(struct net_device *dev);
  1010. int rtl8192_down(struct net_device *dev);
  1011. int rtl8192_up(struct net_device *dev);
  1012. void rtl8192_commit(struct net_device *dev);
  1013. void rtl8192_set_chan(struct net_device *dev, short ch);
  1014. void write_phy(struct net_device *dev, u8 adr, u8 data);
  1015. void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
  1016. void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
  1017. void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
  1018. void rtl8192_set_rxconf(struct net_device *dev);
  1019. void rtl819xusb_beacon_tx(struct net_device *dev, u16 tx_rate);
  1020. void EnableHWSecurityConfig8192(struct net_device *dev);
  1021. void setKey(struct net_device *dev, u8 EntryNo, u8 KeyIndex, u16 KeyType, u8 *MacAddr, u8 DefaultKey, u32 *KeyContent);
  1022. #endif