rtlw81.h 67 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. rtlw81.h
  5. Abstract:
  6. This header contains definitions for the wireless RLT81xx family of USB
  7. WIFI Controllers.
  8. Author:
  9. Chris Stevens 7-Oct-2015
  10. --*/
  11. //
  12. // ------------------------------------------------------------------- Includes
  13. //
  14. //
  15. // ---------------------------------------------------------------- Definitions
  16. //
  17. #define RTLW81_ALLOCATION_TAG 0x31387752 // '18wR'
  18. //
  19. // Define the set of RTLW81xx flags.
  20. //
  21. #define RTLW81_FLAG_8188E 0x00000001
  22. #define RTLW81_FLAG_8192C 0x00000002
  23. #define RTLW81_FLAG_8192C_1T2R 0x00000004
  24. #define RTLW81_FLAG_UMC 0x00000008
  25. #define RTLW81_FLAG_UMC_A_CUT 0x00000010
  26. #define RTLW81_FLAG_CCK_HIGH_POWER 0x00000020
  27. //
  28. // Define the firmware files to use for different devices.
  29. //
  30. #define RTLW81_8188E_FIRMWARE_PATH "rtlw8188eufw.bin"
  31. #define RTLW81_8188C_UMC_FIRMWARE_PATH "rtlw8188cufwUMC.bin"
  32. #define RTLW81_DEFAULT_FIRMWARE_PATH "rtlw8192cufw.bin"
  33. //
  34. // Define the maximum size of the control transfer data.
  35. //
  36. #define RTLW81_MAX_CONTROL_TRANSFER_SIZE (sizeof(USB_SETUP_PACKET) + 256)
  37. //
  38. // Define the size of each bulk in transfer.
  39. //
  40. #define RTLW81_BULK_IN_TRANSFER_SIZE (16 * _1KB)
  41. //
  42. // Define the maximum size of single packet, including any headers and footers.
  43. //
  44. #define RTLW81_MAX_PACKET_SIZE 2312
  45. //
  46. // Define the number of bytes needed at the front of every transmit packet.
  47. //
  48. #define RTLW81_TRANSMIT_HEADER_SIZE sizeof(RTLW81_TRANSMIT_HEADER)
  49. //
  50. // Define maximum number of bulk out endpoints.
  51. //
  52. #define RTLW81_MAX_BULK_OUT_ENDPOINT_COUNT 3
  53. //
  54. // Define the number of bulk in transfers.
  55. //
  56. #define RTLW81_BULK_IN_TRANSFER_COUNT 1
  57. //
  58. // Define the bulk in packet alignment.
  59. //
  60. #define RTLW81_BULK_IN_PACKET_ALIGNMENT 0x80
  61. //
  62. // Define the number of times a read from an EFUSE register will be retried
  63. // before the present value is returned.
  64. //
  65. #define RTLW81_EFUSE_RETRY_COUNT 100
  66. //
  67. // Define the default timeout to wait for register state to change.
  68. //
  69. #define RTLW81_DEVICE_TIMEOUT 1
  70. //
  71. // Define the maximum number of chains on an RTL81xx wireless device.
  72. //
  73. #define RTLW81_MAX_CHAIN_COUNT 2
  74. //
  75. // Define the maximum supported channel.
  76. //
  77. #define RTLW81_MAX_CHANNEL 11
  78. //
  79. // Define the default number of transmit and receive chains.
  80. //
  81. #define RTLW81_DEFAULT_TRANSMIT_CHAIN_COUNT 1
  82. #define RTLW81_DEFAULT_RECEIVE_CHAIN_COUNT 1
  83. #define RTLW81_8192C_TRANSMIT_CHAIN_COUNT 2
  84. #define RTLW81_8192C_RECEIVE_CHAIN_COUNT 2
  85. #define RTLW81_8192C_1T2R_TRANSMIT_CHAIN_COUNT 1
  86. //
  87. // Define the number of channel groups.
  88. //
  89. #define RTLW81_DEFAULT_GROUP_COUNT 3
  90. #define RTLW81_8188E_GROUP_COUNT 6
  91. //
  92. // Define the total number of power states needed to program and channel.
  93. //
  94. #define RTLW81_POWER_STATE_COUNT 28
  95. //
  96. // Define the maximum value for a transmit power state.
  97. //
  98. #define RTLW81_MAX_TRANSMIT_POWER 0x3F
  99. //
  100. // Define the ROM sizes for the device versions.
  101. //
  102. #define RTLW81_DEFAULT_ROM_SIZE 128
  103. #define RTLW81_8188E_ROM_SIZE 512
  104. //
  105. // Define offsets within the default ROM.
  106. //
  107. #define RTLW81_DEFAULT_ROM_MAC_ADDRESS_OFFSET 0x16
  108. #define RTLW81_DEFAULT_ROM_CCK_TRANSMIT_POWER_OFFSET 0x5A
  109. #define RTLW81_DEFAULT_ROM_HT_40_TRANSMIT_POWER_OFFSET 0x60
  110. #define RTLW81_DEFAULT_ROM_HT_40_TRANSMIT_POWER_DIFF_OFFSET 0x66
  111. #define RTLW81_DEFAULT_ROM_HT_20_TRANSMIT_POWER_DIFF_OFFSET 0x69
  112. #define RTLW81_DEFAULT_ROM_OFDM_TRANSMIT_POWER_DIFF_OFFSET 0x6C
  113. #define RTLW81_DEFAULT_ROM_HT_40_MAX_POWER_OFFSET 0x6F
  114. #define RTLW81_DEFAULT_ROM_HT_20_MAX_POWER_OFFSET 0x72
  115. #define RTLW81_DEFAULT_ROM_RF_OPT1_OFFSET 0x79
  116. //
  117. // Define the offsets within the RTL8188E ROM.
  118. //
  119. #define RTLW81_8188E_ROM_CCK_TRANSMIT_POWER_OFFSET 0x10
  120. #define RTLW81_8188E_ROM_HT_40_TRANSMIT_POWER_OFFSET 0x16
  121. #define RTLW81_8188E_ROM_POWER_OPTION_OFFSET 0x1B
  122. #define RTLW81_8188E_ROM_CRYSTAL_CAPABILITY_OFFSET 0xB9
  123. #define RTLW81_8188E_ROM_RF_OPT1_OFFSET 0xC1
  124. #define RTLW81_8188E_ROM_MAC_ADDRESS_OFFSET 0xD7
  125. //
  126. // Define values for the RTLW8188E crystal capability byte.
  127. //
  128. #define RTLW81_8188E_ROM_CRYSTAL_CAPABILITY_INVALID 0xFF
  129. #define RTLW81_8188E_ROM_CRYSTAL_CAPABILITY_DEFAULT 0x20
  130. #define RTLW81_8188E_ROM_CRYSTAL_CAPABILITY_MASK 0x3F
  131. //
  132. // Define the bits for the RTLW8188E power option byte.
  133. //
  134. #define RTLW81_8188E_ROM_POWER_OPTION_BW_20_MASK 0xF0
  135. #define RTLW81_8188E_ROM_POWER_OPTION_BW_20_SHIFT 4
  136. #define RTLW81_8188E_ROM_POWER_OPTION_OFDM_MASK 0x0F
  137. #define RTLW81_8188E_ROM_POWER_OPTION_OFDM_SHIFT 0
  138. #define RTLW81_8188E_ROM_POWER_OPTION_HIGH_BITS_SET 0x08
  139. #define RTLW81_8188E_ROM_POWER_OPTION_HIGH_BITS 0xF0
  140. //
  141. // Define the flags for the ROM's RF OPT1 byte.
  142. //
  143. #define RTLW81_ROM_RF_OPT1_REGULATORY_MASK 0x07
  144. #define RTLW81_ROM_RF_OPT1_REGULATORY_SHIFT 0
  145. #define RTLW81_ROM_RF_OPT1_BOARD_TYPE_MASK 0xE0
  146. #define RTLW81_ROM_RF_OPT1_BOARD_TYPE_SHIFT 5
  147. #define RTLW81_ROM_RF_OPT1_BOARD_TYPE_DONGLE 0
  148. #define RTLW81_ROM_RF_OPT1_BOARD_TYPE_HIGHPA 1
  149. #define RTLW81_ROM_RF_OPT1_BOARD_TYPE_MINICARD 2
  150. #define RTLW81_ROM_RF_OPT1_BOARD_TYPE_SOLO 3
  151. #define RTLW81_ROM_RF_OPT1_BOARD_TYPE_COMBO 4
  152. //
  153. // Define the device firmware signature values.
  154. //
  155. #define RTLW81_88E_FIRMWARE_SIGNATURE 0x88E
  156. #define RTLW81_88C_FIRMWARE_SIGNATURE 0x88C
  157. #define RTLW81_92C_FIRMWARE_SIGNATURE 0x92C
  158. //
  159. // Define values related to writing the device firmware to the device.
  160. //
  161. #define RTLW81_FIRMWARE_PAGE_SIZE 4096
  162. #define RTLW81_MAX_FIRMWARE_WRITE_SIZE 196
  163. //
  164. // Define the USB control transfer request value used to read and write
  165. // registers.
  166. //
  167. #define RTLW81_VENDOR_REQUEST_REGISTER 0x05
  168. //
  169. // Define the various queue page counts for the different devices.
  170. //
  171. #define RTLW81_DEFAULT_PUBLIC_QUEUE_PAGE_COUNT 231
  172. #define RTLW81_DEFAULT_TRANSMIT_PAGE_COUNT 248
  173. #define RTLW81_DEFAULT_TRANSMIT_PAGE_BOUNDARY \
  174. (RTLW81_DEFAULT_TRANSMIT_PAGE_COUNT + 1)
  175. #define RTLW81_DEFAULT_TRANSMIT_PACKET_COUNT 256
  176. #define RTLW81_DEFAULT_RECEIVE_BOUNDARY2 0x27FF
  177. #define RTLW81_8188E_PUBLIC_QUEUE_PAGE_COUNT 142
  178. #define RTLW81_8188E_TRANSMIT_PAGE_COUNT 169
  179. #define RTLW81_8188E_TRANSMIT_PAGE_BOUNDARY \
  180. (RTLW81_8188E_TRANSMIT_PAGE_COUNT + 1)
  181. #define RTLW81_8188E_TRANSMIT_PACKET_COUNT 177
  182. #define RTLW81_8188E_HIGH_QUEUE_PAGE_COUNT 13
  183. #define RTLW81_8188E_NORMAL_QUEUE_PAGE_COUNT 13
  184. #define RTLW81_8188E_LOW_QUEUE_PAGE_COUNT 0
  185. #define RTLW81_8188E_RECEIVE_BOUNDARY2 0x23FF
  186. //
  187. // Define the bits for the system ISO control register.
  188. //
  189. #define RTLW81_SYS_ISO_CONTROL_PWC_EV12V 0x8000
  190. #define RTLW81_SYS_ISO_CONTROL_PWC_EV25V 0x4000
  191. #define RTLW81_SYS_ISO_CONTROL_DIOR 0x0200
  192. #define RTLW81_SYS_ISO_CONTROL_EB2CORE 0x0100
  193. #define RTLW81_SYS_ISO_CONTROL_DIOE 0x0080
  194. #define RTLW81_SYS_ISO_CONTROL_DIOP 0x0040
  195. #define RTLW81_SYS_ISO_CONTROL_IP2MAC 0x0020
  196. #define RTLW81_SYS_ISO_CONTROL_PD2CORE 0x0010
  197. #define RTLW81_SYS_ISO_CONTROL_PA2PCIE 0x0008
  198. #define RTLW81_SYS_ISO_CONTROL_UD2CORE 0x0004
  199. #define RTLW81_SYS_ISO_CONTROL_UA2USB 0x0002
  200. #define RTLW81_SYS_ISO_CONTROL_MD2PP 0x0001
  201. //
  202. // Define the bits for the system function enable register.
  203. //
  204. #define RTLW81_SYS_FUNCTION_ENABLE_MREGEN 0x8000
  205. #define RTLW81_SYS_FUNCTION_ENABLE_HWPDN 0x4000
  206. #define RTLW81_SYS_FUNCTION_ENABLE_DIO_RF 0x2000
  207. #define RTLW81_SYS_FUNCTION_ENABLE_ELDR 0x1000
  208. #define RTLW81_SYS_FUNCTION_ENABLE_DCORE 0x0800
  209. #define RTLW81_SYS_FUNCTION_ENABLE_CPUEN 0x0400
  210. #define RTLW81_SYS_FUNCTION_ENABLE_DIOE 0x0200
  211. #define RTLW81_SYS_FUNCTION_ENABLE_PCIED 0x0100
  212. #define RTLW81_SYS_FUNCTION_ENABLE_PPLL 0x0080
  213. #define RTLW81_SYS_FUNCTION_ENABLE_PCIEA 0x0040
  214. #define RTLW81_SYS_FUNCTION_ENABLE_DIO_PCIE 0x0020
  215. #define RTLW81_SYS_FUNCTION_ENABLE_USBD 0x0010
  216. #define RTLW81_SYS_FUNCTION_ENABLE_UPLL 0x0008
  217. #define RTLW81_SYS_FUNCTION_ENABLE_USBA 0x0004
  218. #define RTLW81_SYS_FUNCTION_ENABLE_BB_GLB_RST 0x0002
  219. #define RTLW81_SYS_FUNCTION_ENABLE_BBRSTB 0x0001
  220. //
  221. // Define the bits for the APS FSMCO register.
  222. //
  223. #define RTLW81_APS_FSMCO_XOP_BTCK 0x80000000
  224. #define RTLW81_APS_FSMCO_SOP_A8M 0x40000000
  225. #define RTLW81_APS_FSMCO_SOP_RCK 0x20000000
  226. #define RTLW81_APS_FSMCO_SOP_AMB 0x10000000
  227. #define RTLW81_APS_FSMCO_SOP_ABG 0x08000000
  228. #define RTLW81_APS_FSMCO_SOP_FUSE 0x04000000
  229. #define RTLW81_APS_FSMCO_SOP_MRST 0x02000000
  230. #define RTLW81_APS_FSMCO_ROP_SPS 0x00400000
  231. #define RTLW81_APS_FSMCO_ROP_PWD 0x00200000
  232. #define RTLW81_APS_FSMCO_ROP_ALD 0x00100000
  233. #define RTLW81_APS_FSMCO_SUS_HOST 0x00020000
  234. #define RTLW81_APS_FSMCO_READ_MAC_ON 0x00010000
  235. #define RTLW81_APS_FSMCO_APDM_HPDN 0x00008000
  236. #define RTLW81_APS_FSMCO_APDM_HOST 0x00004000
  237. #define RTLW81_APS_FSMCO_APDM_MAC 0x00002000
  238. #define RTLW81_APS_FSMCO_AFSM_PCIE 0x00001000
  239. #define RTLW81_APS_FSMCO_AFSM_HSUS 0x00000800
  240. #define RTLW81_APS_FSMCO_APFM_RSM 0x00000400
  241. #define RTLW81_APS_FSMCO_APFM_OFF 0x00000200
  242. #define RTLW81_APS_FSMCO_APFM_ONMAC 0x00000100
  243. #define RTLW81_APS_FSMCO_PDN_PL 0x00000020
  244. #define RTLW81_APS_FSMCO_PDN_EN 0x00000010
  245. #define RTLW81_APC_FSMCO_PFM_WOWL 0x00000008
  246. #define RTLW81_APC_FSMCO_PFM_LDKP 0x00000004
  247. #define RTLW81_APS_FSMCO_PFM_AUTOLOAD_DONE 0x00000002
  248. #define RTLW81_APS_FSMCO_PFM_LOAD_ALL 0x00000001
  249. //
  250. // Define the bits for the system clock register.
  251. //
  252. #define RTLW81_SYS_CLOCK_RING_ENABLE 0x00002000
  253. #define RTLW81_SYS_CLOCK_SYS_ENABLE 0x00001000
  254. #define RTLW81_SYS_CLOCK_MAC_ENABLE 0x00000800
  255. #define RTLW81_SYS_CLOCK_SEC_ENABLE 0x00000400
  256. #define RTLW81_SYS_CLOCK_PHY_SSC_RSTB 0x00000200
  257. #define RTLW81_SYS_CLOCK_80M_SSC_EN_HO 0x00000100
  258. #define RTLW81_SYS_CLOCK_80M_SSC_DIS 0x00000080
  259. #define RTLW81_SYS_CLOCK_LOADER_ENABLE 0x00000020
  260. #define RTLW81_SYS_CLOCK_MACSLP 0x00000010
  261. #define RTLW81_SYS_CLOCK_ANA8M 0x00000002
  262. #define RTLW81_SYS_CLOCK_ANAD16V_ENABLE 0x00000001
  263. //
  264. // Define the default value to program the SPS0 control register.
  265. //
  266. #define RTLW81_SPS0_CONTROL_DEFAULT 0x2b
  267. //
  268. // Define the default value to program the temperature control register.
  269. //
  270. #define RTLW81_TEMPERATURE_CONTROL_DEFAULT 0xE9
  271. //
  272. // Define the bits for the PA setting register.
  273. //
  274. #define RTLW81_PA_SETTING_INIT_BIT 0x10
  275. #define RTLW81_PA_SETTING_INIT_MASK 0xF0
  276. #define RTLW81_PA_SETTING_INIT_VALUE 0x90
  277. //
  278. // Define the bits for the RF control register.
  279. //
  280. #define RTLW81_RF_CONTROL_SDMRSTB 0x04
  281. #define RTLW81_RF_CONTROL_RSTB 0x02
  282. #define RTLW81_RF_CONTROL_ENABLE 0x01
  283. //
  284. // Define the bits for the LDOV12D control register.
  285. //
  286. #define RTLW81_LDOV12D_CONTROL_LDV12_ENABLE 0x01
  287. //
  288. // Define the default value to program the LDOHCI12 control register.
  289. //
  290. #define RTLW81_LDOHCI_12_CONTROL_DEFAULT 0x0F
  291. //
  292. // Define the default value to program the LPLDO register.
  293. //
  294. #define RTLW81_LPLDO_CONTROL_DISABLE 0x10
  295. //
  296. // Define the bits for the AFE XTAL control register.
  297. //
  298. #define RTLW81_AFE_XTAL_CONTROL_ENABLE 0x00800000
  299. #define RTLW81_AFE_XTAL_CONTROL_ADDRESS2_MASK 0x007E0000
  300. #define RTLW81_AFE_XTAL_CONTROL_ADDRESS2_SHIFT 17
  301. #define RTLW81_AFE_XTAL_CONTROL_ADDRESS1_MASK 0x0001F800
  302. #define RTLW81_AFE_XTAL_CONTROL_ADDRESS1_SHIFT 11
  303. #define RTLW81_AFE_XTAL_CONTROL1_DEFAULT 0x80
  304. #define RTLW81_AFE_XTAL_CONTROL2_ENABLE 0x80
  305. //
  306. // Define the default value to program the AFE PLL control register.
  307. //
  308. #define RTLW81_AFE_PLL_CONTROL_DEFAULT 0xDB83
  309. //
  310. // Define the bits for the EFUSE control register.
  311. //
  312. #define RTLW81_EFUSE_CONTROL_VALID 0x80000000
  313. #define RTLW81_EFUSE_CONTROL_ADDRESS_MASK 0x0003FF00
  314. #define RTLW81_EFUSE_CONTROL_ADDRESS_SHIFT 8
  315. #define RTLW81_EFUSE_CONTROL_DATA_MASK 0x000000FF
  316. #define RTLW81_EFUSE_CONTROL_DATA_SHIFT 0
  317. //
  318. // Define the bits for the GPIO MUX configuration register.
  319. //
  320. #define RTLW81_GPIO_MUX_CONFIG_ENABLE_BT 0x0020
  321. //
  322. // Define the bits for the LED register.
  323. //
  324. #define RTLW81_LED_SAVE_MASK 0x70
  325. #define RTLW81_LED_DISABLE 0x08
  326. //
  327. // Define the bits for the MCU firmware download register.
  328. //
  329. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_CPRST 0x00800000
  330. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_CLEAR 0x00080000
  331. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_PAGE_MASK 0x00070000
  332. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_PAGE_SHIFT 16
  333. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_RAM_DL_SELECT 0x00000080
  334. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_WINTINI_READY 0x00000040
  335. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_RFINI_READY 0x00000020
  336. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_BBINI_READY 0x00000010
  337. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_MACINI_READY 0x00000008
  338. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_CHECKSUM_REPORT 0x00000004
  339. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_READY 0x00000002
  340. #define RTLW81_MCU_FIRMWARE_DOWNLOAD_ENABLE 0x00000001
  341. //
  342. // Define the bits for RTL8188EU interrupt mask register.
  343. //
  344. #define RTLW81_8188E_INTERRUPT_MASK_PS_TIMEOUT 0x20000000
  345. #define RTLW81_8188E_INTERRUPT_MASK_TBDER 0x04000000
  346. #define RTLW81_8188E_INTERRUPT_MASK_CPWM2 0x00000200
  347. #define RTLW81_8188E_INTERRUPT_MASK_CPWM 0x00000100
  348. //
  349. // Define the bits for RTL8188EU extra interrupt mask register.
  350. //
  351. #define RTLW81_8188E_INTERRUPT_EXTRA_MASK_TRANSMIT_ERROR 0x00000800
  352. #define RTLW81_8188E_INTERRUPT_EXTRA_MASK_RECEIVE_ERROR 0x00000400
  353. #define RTLW81_8188E_INTERRUPT_EXTRA_MASK_TRANSMIT_FOVM 0x00000200
  354. #define RTLW81_8188E_INTERRUPT_EXTRA_MASK_RECEIVE_FOVM 0x00000100
  355. //
  356. // Define the bits for the EFUSE access register.
  357. //
  358. #define RTLW81_EFUSE_ACCESS_OFF 0x00
  359. #define RTLW81_EFUSE_ACCESS_ON 0x69
  360. //
  361. // Define the bits for the HPON FSM chip bonding register.
  362. //
  363. #define RTLW81_HPON_FSM_CHIP_BONDING_ID_MASK 0x00C00000
  364. #define RTLW81_HPON_FSM_CHIP_BONDING_ID_SHIFT 22
  365. #define RTLW81_HPON_FSM_CHIP_BONDING_ID_8192C_1T2R 1
  366. //
  367. // Define the bits for the system configuration register.
  368. //
  369. #define RTLW81_SYS_CONFIGURATION_TYPE_8192C 0x08000000
  370. #define RTLW81_SYS_CONFIGURATION_BD_HCI_SEL 0x04000000
  371. #define RTLW81_SYS_CONFIGURATION_BD_PKG_SEL 0x02000000
  372. #define RTLW81_SYS_CONFIGURATION_TRP_BT_ENABLE 0x01000000
  373. #define RTLW81_SYS_CONFIGURATION_TRP_VAUX_ENABLE 0x00800000
  374. #define RTLW81_SYS_CONFIGURATION_PAD_HWPD_IDN 0x00400000
  375. #define RTLW81_SYS_CONFIGURATION_VENDOR_UMC 0x00080000
  376. #define RTLW81_SYS_CONFIGURATION_BT_FUNC 0x00010000
  377. #define RTLW81_SYS_CONFIGURATION_VERSION_MASK 0x0000F000
  378. #define RTLW81_SYS_CONFIGURATION_VERSION_SHIFT 12
  379. #define RTLW81_SYS_CONFIGURATION_IC_MACPHY_MODE 0x00000800
  380. #define RTLW81_SYS_CONFIGURATION_BD_MAC1 0x00000400
  381. #define RTLW81_SYS_CONFIGURATION_BD_MAC2 0x00000200
  382. #define RTLW81_SYS_CONFIGURATION_SIC_IDLE 0x00000100
  383. #define RTLW81_SYS_CONFIGURATION_TRP_B15V_ENABLE 0x00000080
  384. #define RTLW81_SYS_CONFIGURATION_V15_VALID 0x00000020
  385. #define RTLW81_SYS_CONFIGURATION_PCIRSTB 0x00000010
  386. #define RTLW81_SYS_CONFIGURATION_PCLK_VALID 0x00000008
  387. #define RTLW81_SYS_CONFIGURATION_UCLK_VALID 0x00000004
  388. #define RTLW81_SYS_CONFIGURATION_ACLK_VALID 0x00000002
  389. #define RTLW81_SYS_CONFIGURATION_XCLK_VALID 0x00000001
  390. //
  391. // Define the bits for the configuration register.
  392. //
  393. #define RTLW81_CONFIGURATION_NETWORK_TYPE_MASK 0x00030000
  394. #define RTLW81_CONFIGURATION_NETWORK_TYPE_SHIFT 16
  395. #define RTLW81_CONFIGURATION_NETWORK_TYPE_NO_LINK 0
  396. #define RTLW81_CONFIGURATION_NETWORK_TYPE_AD_HOC 1
  397. #define RTLW81_CONFIGURATION_NETWORK_TYPE_INFRA 2
  398. #define RTLW81_CONFIGURATION_NETWORK_TYPE_AP 3
  399. #define RTLW81_CONFIGURATION_CALTMR_ENABLE 0x00000400
  400. #define RTLW81_CONFIGURATION_SEC_ENABLE 0x00000200
  401. #define RTLW81_CONFIGURATION_MAC_RECEIVE_ENABLE 0x00000080
  402. #define RTLW81_CONFIGURATION_MAC_TRANSMIT_ENABLE 0x00000040
  403. #define RTLW81_CONFIGURATION_SCHEDULE_ENABLE 0x00000020
  404. #define RTLW81_CONFIGURATION_PROTOCOL_ENABLE 0x00000010
  405. #define RTLW81_CONFIGURATION_RECEIVE_DMA_ENABLE 0x00000008
  406. #define RTLW81_CONFIGURATION_TRANSMIT_DMA_ENABLE 0x00000004
  407. #define RTLW81_CONFIGURATION_HCI_RECEIVE_DMA_ENABLE 0x00000002
  408. #define RTLW81_CONFIGURATION_HCI_TRANSMIT_DMA_ENABLE 0x00000001
  409. //
  410. // Define the bits for the page configuration register.
  411. //
  412. #define RTLW81_PAGE_CONFIGURATION_TRANSMIT_PAGE_SIZE_MASK 0xF0
  413. #define RTLW81_PAGE_CONFIGURATION_TRANSMIT_PAGE_SIZE_SHIFT 4
  414. #define RTLW81_PAGE_CONFIGURATION_RECEIVE_PAGE_SIZE_MASK 0x0F
  415. #define RTLW81_PAGE_CONFIGURATION_RECEIVE_PAGE_SIZE_SHIFT 0
  416. #define RTLW81_PAGE_CONFIGURATION_PAGE_SIZE_64 0
  417. #define RTLW81_PAGE_CONFIGURATION_PAGE_SIZE_128 1
  418. #define RTLW81_PAGE_CONFIGURATION_PAGE_SIZE_256 2
  419. #define RTLW81_PAGE_CONFIGURATION_PAGE_SIZE_512 3
  420. #define RTLW81_PAGE_CONFIGURATION_PAGE_SIZE_1024 4
  421. //
  422. // Define the bits for the transmit/receive DMA register.
  423. //
  424. #define RTLW81_TRANSMIT_RECEIVE_DMA_QMAP_MASK 0xFFF0
  425. #define RTLW81_TRANSMIT_RECEIVE_DMA_QMAP_HIGH_NORMAL_LOW 0xF5B0
  426. #define RTLW81_TRANSMIT_RECEIVE_DMA_QMAP_HIGH_LOW 0xF5F0
  427. #define RTLW81_TRANSMIT_RECEIVE_DMA_QMAP_HIGH_NORMAL 0xFAF0
  428. #define RTLW81_TRANSMIT_RECEIVE_DMA_QMAP_LOW 0x5550
  429. #define RTLW81_TRANSMIT_RECEIVE_DMA_QMAP_NORMAL 0xAAA0
  430. #define RTLW81_TRANSMIT_RECEIVE_DMA_QMAP_HIGH 0xFFF0
  431. #define RTLW81_TRANSMIT_RECEIVE_DMA_AGG_ENABLE 0x0004
  432. //
  433. // Define the bits for the LLT initialization register.
  434. //
  435. #define RTLW81_LLT_INIT_OP_MASK 0xC0000000
  436. #define RTLW81_LLT_INIT_OP_SHIFT 30
  437. #define RTLW81_LLT_INIT_OP_WRITE 1
  438. #define RTLW81_LLT_INIT_OP_NO_ACTIVE 0
  439. #define RTLW81_LLT_INIT_ADDRESS_MASK 0x0000FF00
  440. #define RTLW81_LLT_INIT_ADDRESS_SHIFT 8
  441. #define RTLW81_LLT_INIT_DATA_MASK 0x000000FF
  442. #define RTLW81_LLT_INIT_DATA_SHIFT 0
  443. //
  444. // Define the bits for the HMENTFR3 register.
  445. //
  446. #define RTLW81_HMENTFR3_RESET 0x20
  447. //
  448. // Define the bits for the queue page count register.
  449. //
  450. #define RTLW81_QUEUE_PAGE_COUNT_LOAD 0x80000000
  451. #define RTLW81_QUEUE_PAGE_COUNT_PUBLIC_MASK 0x00FF0000
  452. #define RTLW81_QUEUE_PAGE_COUNT_PUBLIC_SHIFT 16
  453. #define RTLW81_QUEUE_PAGE_COUNT_LOW_MASK 0x0000FF00
  454. #define RTLW81_QUEUE_PAGE_COUNT_LOW_SHIFT 8
  455. #define RTLW81_QUEUE_PAGE_COUNT_HIGH_MASK 0x000000FF
  456. #define RTLW81_QUEUE_PAGE_COUNT_HIGH_SHIFT 0
  457. //
  458. // Define the bits for the transmit descriptor control register.
  459. //
  460. #define RTLW81_TRANSMIT_DESCRIPTOR_CONTROL_BLOCK_COUNT_MASK 0x000000F0
  461. #define RTLW81_TRANSMIT_DESCRIPTOR_CONTROL_BLOCK_COUNT_SHIFT 4
  462. #define RTLW81_TRANSMIT_DESCRIPTOR_CONTROL_BLOCK_COUNT_DEFAULT 6
  463. //
  464. // Define the default values for the receive DMA AGG PG TH registers.
  465. //
  466. #define RTLW81_RECEIVE_DMA_AGG_PG_TH0_DEFAULT 48
  467. #define RTLW81_RECEIVE_DMA_AGG_PG_TH1_DEFAULT 4
  468. //
  469. // Define the bits for the firmware/hardware transmit queue control register.
  470. //
  471. #define RTLW81_FIRMWARE_HARDWARE_TRANSMIT_QUEUE_CONTROL_AMPDU_RETRY_NEW 0x80
  472. //
  473. // Define the default value to program the hardware sequencing control register.
  474. //
  475. #define RTW81_HARDWARE_SEQUENCING_CONTROL_DEFAULT 0xFF
  476. //
  477. // Define the bits for the SPEC SIFS register.
  478. //
  479. #define RTLW81_SPEC_SIFS_OFDM_MASK 0xFF00
  480. #define RTLW81_SPEC_SIFS_OFDM_SHIFT 8
  481. #define RTLW81_SPEC_SIFS_CCK_MASK 0x00FF
  482. #define RTLW81_SPEC_SIFS_CCK_SHIFT 0
  483. #define RTLW81_SPEC_SIFS_DEFAULT 0x100A
  484. #define RTLW81_SPEC_SIFS_ASSOCIATED 0x0A0A
  485. //
  486. // Define the bits for the retry limit register.
  487. //
  488. #define RTLW81_RETRY_LIMIT_SHORT_MASK 0x3F00
  489. #define RTLW81_RETRY_LIMIT_SHORT_SHIFT 8
  490. #define RTLW81_RETRY_LIMIT_LONG_MASK 0x003F
  491. #define RTLW81_RETRY_LIMIT_LONG_SHIFT 0
  492. #define RTLW81_RETRY_LIMIT_DEFAULT 0x3030
  493. //
  494. // Define the default values for the DARFRC and RARFRC registers.
  495. //
  496. #define RTLW81_DARFRC0_DEFAULT 0x00000000
  497. #define RTLW81_DARFRC1_DEFAULT 0x10080404
  498. #define RTLW81_RARFRC0_DEFAULT 0x04030201
  499. #define RTLW81_RARFRC1_DEFAULT 0x08070605
  500. //
  501. // Define the bits for the receive response rate register.
  502. //
  503. #define RTLW81_RECEIVE_RESPONSE_RATE_SHORT 0x00800000
  504. #define RTLW81_RECEIVE_RESPONSE_RATE_RSC_UPPER_CHANNEL 0x00400000
  505. #define RTLW81_RECEIVE_RESPONSE_RATE_RSC_LOWER_CHANNEL 0x00200000
  506. #define RTLW81_RECEIVE_RESPONSE_RATE_BITMAP_MASK 0x000FFFFF
  507. #define RTLW81_RECEIVE_RESPONSE_RATE_BITMAP_SHIFT 0
  508. #define RTLW81_RECEIVE_RESPONSE_RATE_CCK_ONLY_1M 0xFFFF1
  509. //
  510. // Define the default value for the aggregate length limit register.
  511. //
  512. #define RTLW81_AGGREGATE_LENGTH_LIMIT_DEFAULT 0x99997631
  513. //
  514. // Define the RTS rate select values for various modes.
  515. //
  516. #define RTLW81_INI_RTS_RATE_SELECT_11B 0
  517. #define RTLW81_INI_RTS_RATE_SELECT_11BG 3
  518. //
  519. // Define the default values for the max aggregation number register.
  520. //
  521. #define RTLW81_MAX_AGGREGATION_NUMBER_DEFAULT 0x0708
  522. #define RTLW81_MAX_AGGREGATION_NUMBER_8188E_DEFAULT 0x07
  523. //
  524. // Define the default value for the beacon TCFG register.
  525. //
  526. #define RTLW81_BEACON_TCFG_DEFAULT 0x660F
  527. //
  528. // Define the default value for the aggregate break time register.
  529. //
  530. #define RTLW81_AGGREGATE_BREAK_TIME_DEFAULT 0x16
  531. //
  532. // Define the bits for the RD control register.
  533. //
  534. #define RTLW81_RD_CONTROL_DISABLE_EDCA_COUNTDOWN 0x0800
  535. //
  536. // Define the default value for the TBTT prohibit register.
  537. //
  538. #define RTLW81_TBTT_PROHIBIT_DEFAULT 0x6404
  539. //
  540. // Define the default value for the beacon control register.
  541. //
  542. #define RTLW81_BEACON_CONTROL_DEFAULT 0x1010
  543. //
  544. // Define the bits for the beacon control register.
  545. //
  546. #define RTLW81_BEACON_CONTROL_DISABLE_TSF_UDT0 0x10
  547. #define RTLW81_BEACON_CONTROL_ENABLE_BEACON 0x08
  548. #define RTLW81_BEACON_CONTROL_TRANSMIT_BEACON_RPT 0x04
  549. #define RTLW81_BEACON_CONTROL_ENABLE_MBSSID 0x02
  550. //
  551. // Define the default value for the driver early init register.
  552. //
  553. #define RTLW81_DRIVER_EARLY_INIT_DEFAULT 0x05
  554. //
  555. // Define the default value for the beacon DMA time register.
  556. //
  557. #define RTLW81_BEACON_DMA_TIME_DEFAULT 0x02
  558. //
  559. // Define the default value for the beacon max error register.
  560. //
  561. #define RTLW81_BEACON_MAX_ERROR_DEFAULT 0xFF
  562. //
  563. // Define the bits for the APSD control register.
  564. //
  565. #define RTLW81_APSD_CONTROL_OFF 0x40
  566. #define RTLW81_APSD_CONTROL_STATUS_OFF 0x80
  567. //
  568. // Define the bits for the bandwidth register.
  569. //
  570. #define RTLW81_BANDWIDTH_MODE_20MHZ 0x04
  571. #define RTLW81_BANDWIDTH_MODE_5G 0x02
  572. #define RTLW81_BANDWIDTH_MODE_11J 0x01
  573. //
  574. // Define the bits for the receive configuration register.
  575. //
  576. #define RTLW81_RECEIVE_CONFIGURATION_APP_FCS 0x80000000
  577. #define RTLW81_RECEIVE_CONFIGURATION_APP_MIC 0x40000000
  578. #define RTLW81_RECEIVE_CONFIGURATION_APP_ICV 0x20000000
  579. #define RTLW81_RECEIVE_CONFIGURATION_APP_PHYSTS 0x10000000
  580. #define RTLW81_RECEIVE_CONFIGURATION_APP_BA_SSN 0x08000000
  581. #define RTLW81_RECEIVE_CONFIGURATION_ENMBID 0x01000000
  582. #define RTLW81_RECEIVE_CONFIGURATION_LSIGEN 0x00800000
  583. #define RTLW81_RECEIVE_CONFIGURATION_MFBEN 0x00400000
  584. #define RTLW81_RECEIVE_CONFIGURATION_HTC_LOC_CTRL 0x00004000
  585. #define RTLW81_RECEIVE_CONFIGURATION_AMF 0x00002000
  586. #define RTLW81_RECEIVE_CONFIGURATION_ACF 0x00001000
  587. #define RTLW81_RECEIVE_CONFIGURATION_ADF 0x00000800
  588. #define RTLW81_RECEIVE_CONFIGURATION_AICV 0x00000200
  589. #define RTLW81_RECEIVE_CONFIGURATION_ACRC32 0x00000100
  590. #define RTLW81_RECEIVE_CONFIGURATION_CBSSID_BCN 0x00000080
  591. #define RTLW81_RECEIVE_CONFIGURATION_CBSSID_DATA 0x00000040
  592. #define RTLW81_RECEIVE_CONFIGURATION_APWRMGT 0x00000020
  593. #define RTLW81_RECEIVE_CONFIGURATION_ADD3 0x00000010
  594. #define RTLW81_RECEIVE_CONFIGURATION_AB 0x00000008
  595. #define RTLW81_RECEIVE_CONFIGURATION_AM 0x00000004
  596. #define RTLW81_RECEIVE_CONFIGURATION_APM 0x00000002
  597. #define RTLW81_RECEIVE_CONFIGURATION_AAP 0x00000001
  598. //
  599. // Define the default values for the EDCA parameter registers.
  600. //
  601. #define RTLW81_EDCA_VO_PARAM_DEFAULT 0x002FA226
  602. #define RTLW81_EDCA_VI_PARAM_DEFAULT 0x005EA324
  603. #define RTLW81_EDCA_BE_PARAM_DEFAULT 0x005EA42B
  604. #define RTLW81_EDCA_BK_PARAM_DEFAULT 0x0000A44f
  605. //
  606. // Define the default and associated values for the SIFS CCK register.
  607. //
  608. #define RTLW81_SIFS_CCK_DEFAULT 0x100A
  609. #define RTLW81_SIFS_CCK_ASSOCIATED 0x0A0A
  610. //
  611. // Define the default and associated values for the SIFS OFDM register.
  612. //
  613. #define RTLW81_SIFS_OFDM_DEFAULT 0x100A
  614. #define RTLW81_SIFS_OFDM_ASSOCIATED 0x0A0A
  615. //
  616. // Define the bits for the MAC SPEC SIFS register.
  617. //
  618. #define RTLW81_MAC_SPEC_SIFS_OFDM_MASK 0xFF00
  619. #define RTLW81_MAC_SPEC_SIFS_OFDM_SHIFT 8
  620. #define RTLW81_MAC_SPEC_SIFS_CCK_MASK 0x00FF
  621. #define RTLW81_MAC_SPEC_SIFS_CCK_SHIFT 0
  622. #define RTLW81_MAC_SPEC_SIFS_DEFAULT 0x100A
  623. #define RTLW81_MAC_SPEC_SIFS_ASSOCIATED 0x0A0A
  624. //
  625. // Define the associated values for the T2T and R2T SIFS.
  626. //
  627. #define RTLW81_T2T_SIFS_ASSOCIATED 0x0A0A
  628. #define RTLW81_R2T_SIFS_ASSOCIATED 0x0A0A
  629. //
  630. // Define the default value for the driver information size register.
  631. //
  632. #define RTLW81_DRIVER_INFORMATION_SIZE_DEFAULT 4
  633. //
  634. // Define the default value for the ACK timeout register.
  635. //
  636. #define RTLW81_ACK_TIMEOUT_DEFAULT 0x40
  637. //
  638. // Define the bits for the CAM command register.
  639. //
  640. #define RTLW81_CAM_COMMAND_POLLING 0x80000000
  641. #define RTLW81_CAM_COMMAND_CLEAR 0x40000000
  642. #define RTLW81_CAM_COMMAND_WRITE 0x00010000
  643. #define RTLW81_CAM_COMMAND_ADDRESS_MASK 0x0000FFFF
  644. #define RTLW81_CAM_COMMAND_ADDRESS_SHIFT 0
  645. //
  646. // Define the bits for the RFMOD register.
  647. //
  648. #define RTLW81_RFMOD_OFDM_ENABLE 0x02000000
  649. #define RTLW81_RFMOD_CCK_ENABLE 0x01000000
  650. #define RTLW81_RFMOD_CCK_TXSC 0x00000030
  651. #define RTLW81_RFMOD_JAPAN 0x00000002
  652. #define RTLW81_RFMOD_40MHZ 0x00000001
  653. //
  654. // Define the default masks and values for the FPGA0 transmit info register.
  655. //
  656. #define RTLW81_FPGA0_TRANSMIT_INFO_INIT1_MASK 0x00000003
  657. #define RTLW81_FPGA0_TRANSMIT_INFO_INIT1_VALUE 0x00000002
  658. #define RTLW81_FPGA0_TRANSMIT_INFO_INIT2_MASK 0x00300033
  659. #define RTLW81_FPGA0_TRANSMIT_INFO_INIT2_VALUE 0x00200022
  660. //
  661. // Define the bits for the HSSI parameter 1 register.
  662. //
  663. #define RTLW81_HSSI_PARAMETER1_PI 0x00000100
  664. //
  665. // Define the bits for the HSSI parameter 2 register.
  666. //
  667. #define RTLW81_HSSI_PARAMETER2_READ_EDGE 0x80000000
  668. #define RTLW81_HSSI_PARAMETER2_READ_ADDRESS_MASK 0x7F800000
  669. #define RTLW81_HSSI_PARAMETER2_READ_ADDRESS_SHIFT 23
  670. #define RTLW81_HSSI_PARAMETER2_DATA_LENGTH 0x00000800
  671. #define RTLW81_HSSI_PARAMETER2_ADDRESS_LENGTH 0x00000400
  672. #define RTLW81_HSSI_PARAMETER2_CCK_HIGH_POWER 0x00000200
  673. //
  674. // Define the bits for the LSSI parameter register.
  675. //
  676. #define RTLW81_LSSI_PARAMETER_8188E_ADDRESS_MASK 0x0FF00000
  677. #define RTLW81_LSSI_PARAMETER_8188E_ADDRESS_SHIFT 20
  678. #define RTLW81_LSSI_PARAMETER_DEFAULT_ADDRESS_MASK 0x03F00000
  679. #define RTLW81_LSSI_PARAMETER_DEFAULT_ADDRESS_SHIFT 20
  680. #define RTLW81_LSSI_PARAMETER_DATA_MASK 0x000FFFFF
  681. #define RTLW81_LSSI_PARAMETER_DATA_SHIFT 0
  682. //
  683. // Define the bits for the FPGA0 ANA parameter 2 register.
  684. //
  685. #define RTLW81_FPGA0_ANA_PARAM2_CBW20 0x00000400
  686. //
  687. // Define the bits for the LSSI readback register.
  688. //
  689. #define RTLW81_LSSI_READBACK_DATA_MASK 0x000FFFFF
  690. #define RTLW81_LSSI_READBACK_DATA_SHIFT 0
  691. //
  692. // Define the bits for the FPGA0 RF OE interface register.
  693. //
  694. #define RTLW81_FPGA0_RF_OE_INTERFACE_ENABLE 0x00100000
  695. #define RTLW81_FPGA0_RF_OE_INTERFACE_HIGH_OUTPUT 0x00000010
  696. //
  697. // Define the bits for the FPGA0 RF software interface register.
  698. //
  699. #define RTLW81_FPGA0_RF_SOFTWARE_INTERFACE_TYPE 0x10
  700. //
  701. // Define the initial mask and value for the CCK 0 AFE settings register.
  702. //
  703. #define RTLW81_CCK0_AFE_SETTING_INIT_MASK 0xFF000000
  704. #define RTLW81_CCK0_AFE_SETTING_INIT_VALUE 0x45000000
  705. //
  706. // Define the initial mask and value for the OFDM 0 transmit path enable
  707. // register.
  708. //
  709. #define RTLW81_OFDM0_TRANSMIT_PATH_ENABLE_INIT_MASK 0x000000FF
  710. #define RTLW81_OFDM0_TRANSMIT_PATH_ENABLE_INIT_VALUE 0x00000023
  711. //
  712. // Define the two initialization values for the OFDM0 AGC core 1 register.
  713. //
  714. #define RTLW81_OFDM0_AGC_CORE1_INIT1 0x69553422
  715. #define RTLW81_OFDM0_AGC_CORE1_INIT2 0x69553420
  716. //
  717. // Define the bits for the OFDM0 AGC core 1 register.
  718. //
  719. #define RTLW81_OFDM0_AGC_CORE1_GAIN_MASK 0x0000007F
  720. #define RTLW81_OFDM0_AGC_CORE1_GAIN_SHIFT 0
  721. #define RTLW81_OFDM0_AGC_CORE1_GAIN_PROBE_VALUE 0x20
  722. #define RTLW81_OFDM0_AGC_CORE1_GAIN_AUTHENTICATE_VALUE 0x32
  723. //
  724. // Define the initial mask and value for the OFDM 0 AGC parameter 1 register.
  725. //
  726. #define RTLW81_OFDM0_AGC_PARAM1_INIT_MASK 0x00000030
  727. #define RTLW81_OFDM0_AGC_PARAM1_INIT_VALUE 0x00000010
  728. //
  729. // Define the bits for the OFDM 1 LSTF 3 register.
  730. //
  731. #define RTLW81_OFDM1_LSTF3_TRANSMIT_ENABLED 0x70
  732. //
  733. // Define the bits for the transmit AGC rate 06-18 register.
  734. //
  735. #define RTLW81_TRANSMIT_AGC_RATE_18_MASK 0xFF000000
  736. #define RTLW81_TRANSMIT_AGC_RATE_18_SHIFT 24
  737. #define RTLW81_TRANSMIT_AGC_RATE_12_MASK 0x00FF0000
  738. #define RTLW81_TRANSMIT_AGC_RATE_12_SHIFT 16
  739. #define RTLW81_TRANSMIT_AGC_RATE_09_MASK 0x0000FF00
  740. #define RTLW81_TRANSMIT_AGC_RATE_09_SHIFT 8
  741. #define RTLW81_TRANSMIT_AGC_RATE_06_MASK 0x000000FF
  742. #define RTLW81_TRANSMIT_AGC_RATE_06_SHIFT 0
  743. //
  744. // Define the bits for the transmit AGC rate 24-54 register.
  745. //
  746. #define RTLW81_TRANSMIT_AGC_RATE_54_MASK 0xFF000000
  747. #define RTLW81_TRANSMIT_AGC_RATE_54_SHIFT 24
  748. #define RTLW81_TRANSMIT_AGC_RATE_48_MASK 0x00FF0000
  749. #define RTLW81_TRANSMIT_AGC_RATE_48_SHIFT 16
  750. #define RTLW81_TRANSMIT_AGC_RATE_36_MASK 0x0000FF00
  751. #define RTLW81_TRANSMIT_AGC_RATE_36_SHIFT 8
  752. #define RTLW81_TRANSMIT_AGC_RATE_24_MASK 0x000000FF
  753. #define RTLW81_TRANSMIT_AGC_RATE_24_SHIFT 0
  754. //
  755. // Define the bits for the transmit AGC MSC 00-03 register.
  756. //
  757. #define RTLW81_TRANSMIT_AGC_MCS03_MASK 0xFF000000
  758. #define RTLW81_TRANSMIT_AGC_MCS03_SHIFT 24
  759. #define RTLW81_TRANSMIT_AGC_MCS02_MASK 0x00FF0000
  760. #define RTLW81_TRANSMIT_AGC_MCS02_SHIFT 16
  761. #define RTLW81_TRANSMIT_AGC_MCS01_MASK 0x0000FF00
  762. #define RTLW81_TRANSMIT_AGC_MCS01_SHIFT 8
  763. #define RTLW81_TRANSMIT_AGC_MCS00_MASK 0x000000FF
  764. #define RTLW81_TRANSMIT_AGC_MCS00_SHIFT 0
  765. //
  766. // Define the bits for the transmit AGC MSC 04-07 register.
  767. //
  768. #define RTLW81_TRANSMIT_AGC_MCS07_MASK 0xFF000000
  769. #define RTLW81_TRANSMIT_AGC_MCS07_SHIFT 24
  770. #define RTLW81_TRANSMIT_AGC_MCS06_MASK 0x00FF0000
  771. #define RTLW81_TRANSMIT_AGC_MCS06_SHIFT 16
  772. #define RTLW81_TRANSMIT_AGC_MCS05_MASK 0x0000FF00
  773. #define RTLW81_TRANSMIT_AGC_MCS05_SHIFT 8
  774. #define RTLW81_TRANSMIT_AGC_MCS04_MASK 0x000000FF
  775. #define RTLW81_TRANSMIT_AGC_MCS04_SHIFT 0
  776. //
  777. // Define the bits for the transmit AGC MSC 08-11 register.
  778. //
  779. #define RTLW81_TRANSMIT_AGC_MCS11_MASK 0xFF000000
  780. #define RTLW81_TRANSMIT_AGC_MCS11_SHIFT 24
  781. #define RTLW81_TRANSMIT_AGC_MCS10_MASK 0x00FF0000
  782. #define RTLW81_TRANSMIT_AGC_MCS10_SHIFT 16
  783. #define RTLW81_TRANSMIT_AGC_MCS09_MASK 0x0000FF00
  784. #define RTLW81_TRANSMIT_AGC_MCS09_SHIFT 8
  785. #define RTLW81_TRANSMIT_AGC_MCS08_MASK 0x000000FF
  786. #define RTLW81_TRANSMIT_AGC_MCS08_SHIFT 0
  787. //
  788. // Define the bits for the transmit AGC MSC 12-15 register.
  789. //
  790. #define RTLW81_TRANSMIT_AGC_MCS15_MASK 0xFF000000
  791. #define RTLW81_TRANSMIT_AGC_MCS15_SHIFT 24
  792. #define RTLW81_TRANSMIT_AGC_MCS14_MASK 0x00FF0000
  793. #define RTLW81_TRANSMIT_AGC_MCS14_SHIFT 16
  794. #define RTLW81_TRANSMIT_AGC_MCS13_MASK 0x0000FF00
  795. #define RTLW81_TRANSMIT_AGC_MCS13_SHIFT 8
  796. #define RTLW81_TRANSMIT_AGC_MCS12_MASK 0x000000FF
  797. #define RTLW81_TRANSMIT_AGC_MCS12_SHIFT 0
  798. //
  799. // Define the bits for the transmit AGC CCK registers.
  800. //
  801. #define RLTW81_TRANSMIT_AGC_A_CCK1_MCS32_MASK 0x0000FF00
  802. #define RLTW81_TRANSMIT_AGC_A_CCK1_MCS32_SHIFT 8
  803. #define RTLW81_TRANSMIT_AGC_A_CCK11_MASK 0xFF000000
  804. #define RTLW81_TRANSMIT_AGC_A_CCK11_SHIFT 24
  805. #define RTLW81_TRANSMIT_AGC_A_CCK55_MASK 0x00FF0000
  806. #define RTLW81_TRANSMIT_AGC_A_CCK55_SHIFT 16
  807. #define RTLW81_TRANSMIT_AGC_A_CCK2_MASK 0x0000FF00
  808. #define RTLW81_TRANSMIT_AGC_A_CCK2_SHIFT 8
  809. #define RTLW81_TRANSMIT_AGC_B_CCK11_MASK 0x000000FF
  810. #define RTLW81_TRANSMIT_AGC_B_CCK11_SHIFT 0
  811. #define RTLW81_TRANSMIT_AGC_B_CCK55_MASK 0xFF000000
  812. #define RTLW81_TRANSMIT_AGC_B_CCK55_SHIFT 24
  813. #define RTLW81_TRANSMIT_AGC_B_CCK2_MASK 0x00FF0000
  814. #define RTLW81_TRANSMIT_AGC_B_CCK2_SHIFT 16
  815. #define RTLW81_TRANSMIT_AGC_B_CCK1_MASK 0x0000FF00
  816. #define RTLW81_TRANSMIT_AGC_B_CCK1_SHIFT 8
  817. //
  818. // Define the bits for the 1 transmit 2 receive chain register.
  819. //
  820. #define RTLW81_8192C_1T2R_INIT_MASK 0x0C000000
  821. #define RTLW81_8192C_1T2R_INIT_VALUE 0x08000000
  822. //
  823. // Define the default value for the USB enable register.
  824. //
  825. #define RTLW81_USB_ENABLE_DEFAULT 0x19
  826. //
  827. // Define the default values for the USB interference registers.
  828. //
  829. #define RTLW81_USB_INTERFERENCE0_DEFAULT 0xE0
  830. #define RLTW81_USB_INTERFERENCE1_DEFAULT 0x8D
  831. #define RTLW81_USB_INTERFERENCE2_DEFAULT 0x80
  832. //
  833. // Define the bits for the USB special option register.
  834. //
  835. #define RTLW81_USB_SPECIAL_OPTION_INT_BULK_SELECT 0x10
  836. #define RTLW81_USB_SPECIAL_OPTION_AGG_ENABLE 0x08
  837. //
  838. // Define the default values for the USB AGG registers.
  839. //
  840. #define RTLW81_USB_DMA_AGG_TO_DEFAULT 4
  841. #define RTLW81_USB_AGG_TO_DEFAULT 6
  842. #define RTLW81_USB_AGG_TH_DEFAULT 8
  843. //
  844. // Define the bits for the USB endpoint register.
  845. //
  846. #define RTLW81_USB_ENDPOINT_LQ_MASK 0x0F00
  847. #define RTLW81_USB_ENDPOINT_LQ_SHIFT 8
  848. #define RTLW81_USB_ENDPOINT_NQ_MASK 0x00F0
  849. #define RTLW81_USB_ENDPOINT_NQ_SHIFT 4
  850. #define RTLW81_USB_ENDPOINT_HQ_MASK 0x000F
  851. #define RTLW81_USB_ENDPOINT_HQ_SHIFT 0
  852. //
  853. // Define the bits for the RF AC register.
  854. //
  855. #define RTLW81_RF_AC_MODE_MASK 0x70000
  856. #define RTLW81_RF_AC_MODE_SHIFT 16
  857. #define RTLW81_RF_AC_MODE_STANDBY 1
  858. //
  859. // Define the initial values to write to the RF IPA register.
  860. //
  861. #define RTLW81_RF_IPA_INIT0 0x0F406
  862. #define RTLW81_RF_IPA_INIT1 0x4F406
  863. #define RTLW81_RF_IPA_INIT2 0x8F406
  864. #define RTLW81_RF_IPA_INIT3 0xCF406
  865. //
  866. // Define the bits for the RF channel bandwidth register.
  867. //
  868. #define RTLW81_RF_CHANNEL_BANDWIDTH_LC_START 0x08000
  869. #define RTLW81_RF_CHANNEL_BANDWIDTH_8188E_20MHZ 0x00C00
  870. #define RTLW81_RF_CHANNEL_BANDWIDTH_DEFAULT_20MHZ 0x00400
  871. #define RTLW81_RF_CHANNEL_BANDWIDTH_CHANNEL_MASK 0x003FF
  872. #define RTLW81_RF_CHANNEL_BANDWIDTH_CHANNEL_SHIFT 0
  873. //
  874. // Define the default values for the RF receive registers.
  875. //
  876. #define RTLW81_RF_RECEIVE_G1_DEFAULT 0x30255
  877. #define RTLW81_RF_RECEIVE_G2_DEFAULT 0x50A00
  878. //
  879. // Define the minimum and maximum RF register values that trigger a delay when
  880. // programming the RF.
  881. //
  882. #define RTLW81_RF_REGISTER_DELAY_VALUE_MIN 0xF9
  883. #define RTLW81_RF_REGISTER_DELAY_VALUE_MAX 0xFE
  884. //
  885. // Define the bits for the receive packet header length and error value.
  886. //
  887. #define RTLW81_RECEIVE_ICV_ERROR 0x8000
  888. #define RTLW81_RECEIVE_CRC_ERROR 0x4000
  889. #define RTLW81_RECEIVE_PACKET_LENGTH_MASK 0x3FFF
  890. #define RTLW81_RECEIVE_PACKET_LENGTH_SHIFT 0
  891. #define RTLW81_RECEIVE_ERROR_MASK \
  892. (RTLW81_RECEIVE_ICV_ERROR | RTLW81_RECEIVE_CRC_ERROR)
  893. //
  894. // Define the bits for the receive packet header status value.
  895. //
  896. #define RTLW81_RECEIVE_STATUS_DECRYPTED 0x0800
  897. #define RTLW81_RECEIVE_STATUS_PHY_STATUS 0x0400
  898. #define RTLW81_RECEIVE_STATUS_SHIFT_MASK 0x0300
  899. #define RTLW81_RECEIVE_STATUS_SHIFT_SHIFT 8
  900. #define RTLW81_RECEIVE_STATUS_QOS 0x0080
  901. #define RTLW81_RECEIVE_STATUS_INFO_SIZE_MASK 0x000F
  902. #define RTLW81_RECEIVE_STATUS_INFO_SIZE_SHIFT 0
  903. //
  904. // Define the bits for the receive packet header rate information.
  905. //
  906. #define RTLW81_RECEIVE_RATE_INFORMATION_RATE_MASK 0x0000003F
  907. #define RTLW81_RECEIVE_RATE_INFORMATION_RATE_SHIFT 0
  908. #define RTWL81_RECEIVE_RATE_INFORMATION_HIGH_THROUGHPUT 0x00000040
  909. #define RTLW81_RECEIVE_RATE_INFORMATION_HIGH_THROUGHPUT_C 0x00000400
  910. //
  911. // Define the transmit packet header type flags.
  912. //
  913. #define RTLW81_TRANSMIT_TYPE_FLAG_MULTICAST_BROADCAST 0x01
  914. #define RTLW81_TRANSMIT_TYPE_FLAG_LAST_SEGMENT 0x04
  915. #define RTLW81_TRANSMIT_TYPE_FLAG_FIRST_SEGMENT 0x08
  916. #define RTLW81_TRANSMIT_TYPE_FLAG_OWN 0x80
  917. //
  918. // Define the transmit packet header identification bits.
  919. //
  920. #define RTLW81_TRANSMIT_IDENTIFICATION_PACKET_OFFSET_MASK 0x7C000000
  921. #define RTLW81_TRANSMIT_IDENTIFICATION_PACKET_OFFSET_SHIFT 26
  922. #define RTLW81_TRANSMIT_IDENTIFICATION_CIPHER_MASK 0x00C00000
  923. #define RTLW81_TRANSMIT_IDENTIFICATION_CIPHER_SHIFT 22
  924. #define RTLW81_TRANSMIT_IDENTIFICATION_CIPHER_NONE 0
  925. #define RTLW81_TRANSMIT_IDENTIFICATION_CIPHER_RC4 1
  926. #define RTLW81_TRANSMIT_IDENTIFICATION_CIPHER_AES 3
  927. #define RTLW81_TRANSMIT_IDENTIFICATION_RAID_MASK 0x000F0000
  928. #define RTLW81_TRANSMIT_IDENTIFICATION_RAID_SHIFT 16
  929. #define RTLW81_TRANSMIT_IDENTIFICATION_RAID_11GN 1
  930. #define RTLW81_TRANSMIT_IDENTIFICATION_RAID_11N 3
  931. #define RTLW81_TRANSMIT_IDENTIFICATION_RAID_11BG 4
  932. #define RTLW81_TRANSMIT_IDENTIFICATION_RAID_11G 5
  933. #define RTLW81_TRANSMIT_IDENTIFICATION_RAID_11B 6
  934. #define RTLW81_TRANSMIT_IDENTIFICATION_QSEL_MASK 0x00001F00
  935. #define RTLW81_TRANSMIT_IDENTIFICATION_QSEL_SHIFT 8
  936. #define RTLW81_TRANSMIT_IDENTIFICATION_QSEL_BE 0x00
  937. #define RTLW81_TRANSMIT_IDENTIFICATION_QSEL_MGMT 0x12
  938. #define RTLW81_TRANSMIT_IDENTIFICATION_AGG_BK 0x00000040
  939. #define RTLW81_TRANSMIT_IDENTIFICATION_AGG_EN 0x00000020
  940. #define RTLW81_TRANSMIT_IDENTIFICATION_MAC_ID_MASK 0x0000001F
  941. #define RTLW81_TRANSMIT_IDENTIFICATION_MAC_ID_SHIFT 0
  942. #define RTLW81_TRANSMIT_IDENTIFICATION_MAC_ID_BSS 0
  943. #define RTLW81_TRANSMIT_IDENTIFICATION_MAC_ID_BROADCAST 4
  944. //
  945. // Define the one bit for the transmit packet header AGG BK value.
  946. //
  947. #define RTLW81_TRANSMIT_AGG_BK_FLAG 0x00010000
  948. #define RTLW81_TRANSMIT_CCX_RPT 0x00080000
  949. //
  950. // Define the rate information bits for the transmit packet header.
  951. //
  952. #define RTLW81_TRANSMIT_RATE_INFORMATION_40MHZ 0x02000000
  953. #define RTLW81_TRANSMIT_RATE_INFORMATION_SCO_MASK 0x00300000
  954. #define RTLW81_TRANSMIT_RATE_INFORMATION_SCO_SHIFT 20
  955. #define RTLW81_TRANSMIT_RATE_INFORMATION_SCO_SCA 1
  956. #define RTLW81_TRANSMIT_RATE_INFORMATION_SCO_SCB 2
  957. #define RTLW81_TRANSMIT_RATE_INFORMATION_HWRTSEN 0x00002000
  958. #define RTLW81_TRANSMIT_RATE_INFORMATION_RTSEN 0x00001000
  959. #define RTLW81_TRANSMIT_RATE_INFORMATION_CTS2SELF 0x00000800
  960. #define RTLW81_TRANSMIT_RATE_INFORMATION_DRVRATE 0x00000100
  961. #define RTLW81_TRANSMIT_RATE_INFORMATION_HWSEQ 0x00000080
  962. #define RTLW81_TRANSMIT_RATE_INFORMATION_QOS 0x00000040
  963. #define RTLW81_TRANSMIT_RATE_INFORMATION_RTSRATE_MASK 0x0000003F
  964. #define RTLW81_TRANSMIT_RATE_INFORMATION_RTSRATE_SHIFT 0
  965. #define RTLW81_TRANSMIT_RATE_INFORMATION_RTSRATE_OFDM24 8
  966. //
  967. // Define the data rate information bits for the transmit packet header.
  968. //
  969. #define RTLW81_TRANSMIT_DATA_RATE_INFORMATION_AGG_NUMBER_MASK 0xFF000000
  970. #define RLTW81_TRANSMIT_DATA_RATE_INFORMATION_AGG_NUMBER_SHIFT 24
  971. #define RTLW81_TRANSMIT_DATA_RATE_INFORMATION_OFDM24 0x0001FF00
  972. #define RTLW81_TRANSMIT_DATA_RATE_INFORMATION_SGI 0x00000040
  973. #define RTLW81_TRANSMIT_DATA_RATE_INFORMATION_DATA_RATE_MASK 0x0000003F
  974. #define RTLW81_TRANSMIT_DATA_RATE_INFORMATION_DATA_RATE_SHIFT 0
  975. #define RTLW81_TRANSMIT_DATA_RATE_INFORMATION_DATA_RATE_OFDM54 11
  976. #define RTLW81_TRANSMIT_DATA_RATE_INFORMATION_DATA_RATE_CCK1 0
  977. //
  978. // Define the sequence bits for the transmit packet header.
  979. //
  980. #define RTLW81_TRANSMIT_SEQUENCE_HARDWARE 0x8000
  981. #define RTLW81_TRANSMIT_SEQUENCE_MASK 0x0FFF
  982. //
  983. // Define the bits for programming the EFUSE registers in order to read the ROM.
  984. //
  985. #define RTLW81_EFUSE_MAX_ADDRESS 512
  986. #define RTLW81_EFUSE_INVALID 0xFF
  987. #define RTLW81_EFUSE_ENCODING_MASK 0x1F
  988. #define RTLW81_EFUSE_ENCODING_EXTENDED 0x0F
  989. #define RTLW81_EFUSE_DEFAULT_OFFSET_MASK 0xF0
  990. #define RTLW81_EFUSE_DEFAULT_OFFSET_SHIFT 4
  991. #define RTLW81_EFUSE_EXTENDED_FIRST_OFFSET_MASK 0xE0
  992. #define RTLW81_EFUSE_EXTENDED_FIRST_OFFSET_SHIFT 5
  993. #define RTLW81_EFUSE_EXTENDED_ENCODING_MASK 0x0F
  994. #define RTLW81_EFUSE_EXTENDED_ENCODING_NO_OFFSET 0x0F
  995. #define RTLW81_EFUSE_EXTENDED_SECOND_OFFSET_MASK 0xF0
  996. #define RTLW81_EFUSE_EXTENDED_SECOND_OFFSET_SHIFT 1
  997. #define RTLW81_EFUSE_VALID_MASK 0x0F
  998. //
  999. // Define the number of firmware boxes available.
  1000. //
  1001. #define RTLW81_FIRMWARE_BOX_COUNT 4
  1002. //
  1003. // Define the size of a firmware command message.
  1004. //
  1005. #define RTLW81_FIRMWARE_COMMAND_MAX_MESSAGE_LENGTH 5
  1006. //
  1007. // Define the maximum length of a firmware command that does not need to set
  1008. // the extension flag.
  1009. //
  1010. #define RTLW81_FIRMWARE_COMMAND_MAX_NO_EXTENSION_LENGTH 3
  1011. //
  1012. // Define the values for the RTL81xx firmware commands.
  1013. //
  1014. #define RTLW81_FIRMWARE_COMMAND_FLAG_EXTENSION 0x80
  1015. #define RTLW81_FIRMWARE_COMMAND_AP_OFFLOAD 0x00
  1016. #define RTLW81_FIRMWARE_COMMAND_SET_POWER_MODE 0x01
  1017. #define RTLW81_FIRMWARE_COMMAND_JOIN_BSS_RPT 0x02
  1018. #define RTLW81_FIRMWARE_COMMAND_RSVD_PAGE 0x03
  1019. #define RTLW81_FIRMWARE_COMMAND_RSSI 0x04
  1020. #define RTLW81_FIRMWARE_COMMAND_RSSI_SETTING 0x05
  1021. #define RTLW81_FIRMWARE_COMMAND_MAC_ID_CONFIG 0x06
  1022. #define RTLW81_FIRMWARE_COMMAND_MAC_ID_PS_MODE 0x07
  1023. #define RTLW81_FIRMWARE_COMMAND_P2P_PS_OFFLOAD 0x08
  1024. #define RTLW81_FIRMWARE_COMMAND_SELECTIVE_SUSPEND 0x09
  1025. //
  1026. // Define the MAC ID bits for the MAC ID config firmware command.
  1027. //
  1028. #define RTLW81_MAC_ID_CONFIG_COMMAND_ID_VALID 0x80
  1029. #define RTLW81_MAC_ID_CONFIG_COMMAND_ID_BROADCAST 0x04
  1030. #define RTLW81_MAC_ID_CONFIG_COMMAND_ID_BSS 0x00
  1031. //
  1032. // Define the MAC ID mask bit for the MAC ID config firmware command.
  1033. //
  1034. #define RTLW81_MAC_ID_CONFIG_COMMAND_MASK_MODE_MASK 0xF0000000
  1035. #define RTLW81_MAC_ID_CONFIG_COMMAND_MASK_MODE_SHIFT 28
  1036. #define RTLW81_MAC_ID_CONFIG_COMMAND_MASK_RATE_MASK 0x0FFFFFFF
  1037. #define RTLW81_MAC_ID_CONFIG_COMMAND_MASK_RATE_SHIFT 0
  1038. //
  1039. // Define the maximum received packet rate that stores CCK PHY status.
  1040. //
  1041. #define RTLW81_PHY_STATUS_MAX_CCK_RATE 3
  1042. //
  1043. // Define the AGC report bits for the RTL8188E CCK PHY status.
  1044. //
  1045. #define RTLW81_8188E_PHY_CCK_AGC_REPORT_LNA_MASK 0xE0
  1046. #define RTLW81_8188E_PHY_CCK_AGC_REPORT_LNA_SHIFT 5
  1047. #define RTLW81_8188E_PHY_CCK_AGC_REPORT_VGA_MASK 0x1F
  1048. #define RTLW81_8188E_PHY_CCK_AGC_REPORT_VGA_SHIFT 0
  1049. //
  1050. // Define the AGC report bits for the high powered CCK PHY status.
  1051. //
  1052. #define RTLW81_DEFAULT_PHY_CCK_HP_AGC_REPORT_INDEX_MASK 0x60
  1053. #define RTLW81_DEFAULT_PHY_CCK_HP_AGC_REPORT_INDEX_SHIFT 5
  1054. #define RTLW81_DEFAULT_PHY_CCK_HP_AGC_REPORT_VALUE_MASK 0x1F
  1055. #define RTLW81_DEFAULT_PHY_CCK_HP_AGC_REPORT_VALUE_SHIFT 0
  1056. //
  1057. // Define the AGC report bits for the default CCK PHY status.
  1058. //
  1059. #define RTLW81_DEFAULT_PHY_CCK_AGC_REPORT_INDEX_MASK 0xC0
  1060. #define RTLW81_DEFAULT_PHY_CCK_AGC_REPORT_INDEX_SHIFT 6
  1061. #define RTLW81_DEFAULT_PHY_CCK_AGC_REPORT_VALUE_MASK 0x3E
  1062. #define RTLW81_DEFAULT_PHY_CCK_AGC_REPORT_VALUE_SHIFT 1
  1063. //
  1064. // Define the AGC report bits for the high throughput OFDM PHY status.
  1065. //
  1066. #define RTLW81_PHY_OFDM_AGC_REPORT_INDEX 1
  1067. #define RTLW81_PHY_OFDM_AGC_REPORT_MASK 0xFE
  1068. #define RTLW81_PHY_OFDM_AGC_REPORT_SHIFT 1
  1069. //
  1070. // Default the value to subtract from the AGC report to get an RSSI value in
  1071. // decibels.
  1072. //
  1073. #define RTLW81_PHY_OFDM_AGC_REPORT_OFFSET 110
  1074. //
  1075. // ------------------------------------------------------ Data Type Definitions
  1076. //
  1077. typedef enum _RTLW81_REGISTER {
  1078. Rtlw81RegisterSysIsoControl = 0x000,
  1079. Rtlw81RegisterSysFunctionEnable = 0x002,
  1080. Rtlw81RegisterApsFsmco = 0x004,
  1081. Rtlw81RegisterSysClock = 0x008,
  1082. Rtlw81RegisterAfeMisc = 0x010,
  1083. Rtlw81RegisterSps0Control = 0x011,
  1084. Rtlw81RegisterTemperatureControl = 0x015,
  1085. Rtlw81RegisterPaSetting = 0x016,
  1086. Rtlw81RegisterRsvControl = 0x01C,
  1087. Rtlw81RegisterRfControl = 0x01F,
  1088. Rtlw81RegisterLdov12dControl = 0x021,
  1089. Rtlw81RegisterLdohci12Control = 0x022,
  1090. Rtlw81RegisterLpldoControl = 0x023,
  1091. Rtlw81RegisterAfeXtalControl0 = 0x024,
  1092. Rtlw81RegisterAfeXtalControl1 = 0x025,
  1093. Rtlw81RegisterAfeXtalControl2 = 0x026,
  1094. Rtlw81RegisterAfeXtalControl3 = 0x027,
  1095. Rtlw81RegisterAfePllControl = 0x028,
  1096. Rtlw81RegisterEfuseControl = 0x030,
  1097. Rtlw81RegisterGpioMuxConfig = 0x040,
  1098. Rtlw81RegisterLedConfig0 = 0x04C,
  1099. Rtlw81RegisterLedConfig1 = 0x04D,
  1100. Rtlw81RegisterLedConfig2 = 0x04E,
  1101. Rtlw81RegisterLedConfig3 = 0x04F,
  1102. Rtlw81RegisterMcuFirmwareDownload0 = 0x080,
  1103. Rtlw81RegisterMcuFirmwareDownload1 = 0x081,
  1104. Rtlw81RegisterMcuFirmwareDownload2 = 0x082,
  1105. Rtlw81RegisterMcuFirmwareDownload3 = 0x083,
  1106. Rtlw81RegisterHmeBoxExtension = 0x088,
  1107. Rtlw81Register8188eInterruptMask = 0x0B0,
  1108. Rtlw81Register8188eInterruptStatus = 0x0B4,
  1109. Rtlw81Register8188eInterruptExtraMask = 0x0B8,
  1110. Rtlw81Register8188eInterruptExtraStatus = 0x0BC,
  1111. Rtlw81RegisterEfuseAccess = 0x0CF,
  1112. Rtlw81RegisterHponFsm = 0x0EC,
  1113. Rtlw81RegisterSysConfiguration = 0x0F0,
  1114. Rtlw81RegisterConfiguration = 0x100,
  1115. Rtlw81RegisterPageConfiguration = 0x104,
  1116. Rtlw81RegisterTransmitReceiveDma = 0x10C,
  1117. Rtlw81RegisterTransmitReceiveBoundary0 = 0x114,
  1118. Rtlw81RegisterTransmitReceiveBoundary1 = 0x115,
  1119. Rtlw81RegisterTransmitReceiveBoundary2 = 0x116,
  1120. Rtlw81RegisterTransmitReceiveBoundary3 = 0x117,
  1121. Rtlw81RegisterDefaultInterruptMask = 0x120,
  1122. Rtlw81RegisterDefaultInterruptStatus = 0x124,
  1123. Rtlw81RegisterHmetfr0 = 0x1CC,
  1124. Rtlw81RegisterHmetfr1 = 0x1CD,
  1125. Rtlw81RegisterHmetfr2 = 0x1CE,
  1126. Rtlw81RegisterHmetfr3 = 0x1CF,
  1127. Rtlw81RegisterHmeBox = 0x1D0,
  1128. Rtlw81RegisterLltInit = 0x1E0,
  1129. Rtlw81RegisterQueuePageCount = 0x200,
  1130. Rtlw81RegisterTransmitDescriptorControl0 = 0x208,
  1131. Rtlw81RegisterTransmitDescriptorControl1 = 0x209,
  1132. Rtlw81RegisterTransmitDescriptorControl2 = 0x20A,
  1133. Rtlw81RegisterTransmitDescriptorControl3 = 0x20B,
  1134. Rtlw81RegisterNormalQueuePageCount = 0x214,
  1135. Rtlw81RegisterReceiveDmaAggPgTh0 = 0x280,
  1136. Rtlw81RegisterReceiveDmaAggPgTh1 = 0x281,
  1137. Rtlw81RegisterFirmwareHardwareTransmitQueueControl = 0x420,
  1138. Rtlw81RegisterHardwareSequencingControl = 0x423,
  1139. Rtlw81RegisterTransmitPacketNormalQueueBoundary = 0x424,
  1140. Rtlw81RegisterTransmitPacketQueueBoundary = 0x425,
  1141. Rtlw81RegisterSpecSifs = 0x428,
  1142. Rtlw81RegisterRetryLimit = 0x42A,
  1143. Rtlw81RegisterDarfrc0 = 0x430,
  1144. Rtlw81RegisterDarfrc1 = 0x434,
  1145. Rtlw81RegisterRarfrc0 = 0x438,
  1146. Rtlw81RegisterRarfrc1 = 0x43C,
  1147. Rtlw81RegisterReceiveResponseRate = 0x440,
  1148. Rtlw81RegisterAggregateLengthLimit = 0x458,
  1149. Rtlw81RegisterTransmitPacketWmacLbkBfHd = 0x45d,
  1150. Rtlw81RegisterIniRtsRateSelect = 0x480,
  1151. Rtlw81RegisterIniDataRateSelectBss = 0x484,
  1152. Rtlw81RegisterIniDataRateSelectBroadcast = 0x488,
  1153. Rtlw81RegisterProtModeControl = 0x4C8,
  1154. Rtlw81RegisterMaxAggregationNumber = 0x4CA,
  1155. Rtlw81RegisterBarModeControl = 0x4CC,
  1156. Rtlw81RegisterEdcaVoParam = 0x500,
  1157. Rtlw81RegisterEdcaViParam = 0x504,
  1158. Rtlw81RegisterEdcaBeParam = 0x508,
  1159. Rtlw81RegisterEdcaBkParam = 0x50C,
  1160. Rtlw81RegisterBeaconTcfg = 0x510,
  1161. Rtlw81RegisterPifs = 0x512,
  1162. Rtlw81RegisterSifsCck = 0x514,
  1163. Rtlw81RegisterSifsOfdm = 0x516,
  1164. Rtlw81RegisterAggregateBreakTime = 0x51A,
  1165. Rtlw81RegisterTransmitPause = 0x522,
  1166. Rtlw81RegisterRdControl = 0x524,
  1167. Rtlw81RegisterTbttProhibit = 0x540,
  1168. Rtlw81RegisterNavProtLength = 0x546,
  1169. Rtlw81RegisterBeaconControl = 0x550,
  1170. Rtlw81RegisterTsfReset = 0x553,
  1171. Rtlw81RegisterBeaconInterval = 0x554,
  1172. Rtlw81RegisterDriverEarlyInt = 0x558,
  1173. Rtlw81RegisterBeaconDmaTime = 0x559,
  1174. Rtlw81RegisterTsftr0 = 0x560,
  1175. Rtlw81RegisterTsftr1 = 0x564,
  1176. Rtlw81RegisterAtiwnd = 0x55A,
  1177. Rtlw81RegisterBeaconMaxError = 0x55D,
  1178. Rtlw81RegisterApsdControl = 0x600,
  1179. Rtlw81RegisterBandwidthMode = 0x603,
  1180. Rtlw81RegisterReceiveConfiguration = 0x608,
  1181. Rtlw81RegisterReceiveDriverInformationSize = 0x60F,
  1182. Rtlw81RegisterMacAddress = 0x610,
  1183. Rtlw81RegisterBssid0 = 0x618,
  1184. Rtlw81RegisterBssid1 = 0x61C,
  1185. Rtlw81RegisterMulticast1 = 0x620,
  1186. Rtlw81RegisterMulticast2 = 0x624,
  1187. Rtlw81RegisterMacSpecSifs = 0x63A,
  1188. Rtlw81RegisterR2tSifs = 0x63C,
  1189. Rtlw81RegisterT2tSifs = 0x63E,
  1190. Rtlw81RegisterAckTimeout = 0x640,
  1191. Rtlw81RegisterCamCommand = 0x670,
  1192. Rtlw81RegisterReceiveManagementFilter = 0x6A0,
  1193. Rtlw81RegisterReceiveControlFilter = 0x6A2,
  1194. Rtlw81RegisterReceiveDataFilter = 0x6A4,
  1195. Rtlw81RegisterFpga0Rfmod = 0x800,
  1196. Rtlw81RegisterFpga0TransmitInfo = 0x804,
  1197. Rtlw81RegisterHssiParameter1 = 0x820,
  1198. Rtlw81RegisterHssiParameter2 = 0x824,
  1199. Rtlw81RegisterTransmitAgcRate1806Chain1 = 0x830,
  1200. Rtlw81RegisterTransmitAgcRate5424Chain1 = 0x834,
  1201. Rtlw81RegisterTransmitAgcBCck155Mcs32 = 0x838,
  1202. Rtlw81RegisterTransmitAgcMcs03Mcs00Chain1 = 0x83C,
  1203. Rtlw81RegisterLssiParameter = 0x840,
  1204. Rtlw81RegisterTransmitAgcMcs07Mcs04Chain1 = 0x848,
  1205. Rtlw81RegisterTransmitAgcMcs11Mcs08Chain1 = 0x84C,
  1206. Rtlw81RegisterFpga0RfOeInterface = 0x860,
  1207. Rtlw81RegisterTransmitAgcMcs15Mcs12Chain1 = 0x868,
  1208. Rtlw81RegisterTransmitAgcBCck11ACck211 = 0x86C,
  1209. Rtlw81RegisterFpga0RfSoftwareInterface = 0x870,
  1210. Rtlw81RegisterFpga0AnaParam2 = 0x884,
  1211. Rtlw81RegisterLssiReadback = 0x8A0,
  1212. Rtlw81RegisterHspiReadback = 0x8B8,
  1213. Rtlw81RegisterFpga1Rfmod = 0x900,
  1214. Rtlw81RegisterFpga1TransmitInfo = 0x90C,
  1215. Rtlw81RegisterCck0AfeSetting = 0xA04,
  1216. Rtlw81RegisterOfdm0TransmitPathEnable = 0xC04,
  1217. Rtlw81RegisterOfdm0AgcCore1 = 0xC50,
  1218. Rtlw81RegisterOfdm0AgcParam1 = 0xC70,
  1219. Rtlw81RegisterOfdm0AgcrsstiTable = 0xC78,
  1220. Rtlw81RegisterOfdm1Lstf0 = 0xD00,
  1221. Rtlw81RegisterOfdm1Lstf1 = 0xD01,
  1222. Rtlw81RegisterOfdm1Lstf2 = 0xD02,
  1223. Rtlw81RegisterOfdm1Lstf3 = 0xD03,
  1224. Rtlw81RegisterTransmitAgcRate1806Chain0 = 0xE00,
  1225. Rtlw81RegisterTransmitAgcRate5424Chain0 = 0xE04,
  1226. Rtlw81RegisterTransmitAgcACck1Mcs32 = 0xE08,
  1227. Rtlw81RegisterTransmitAgcMcs03Mcs00Chain0 = 0xE10,
  1228. Rtlw81RegisterTransmitAgcMcs07Mcs04Chain0 = 0xE14,
  1229. Rtlw81RegisterTransmitAgcMcs11Mcs08Chain0 = 0xE18,
  1230. Rtlw81RegisterTransmitAgcMcs15Mcs12Chain0 = 0xE1C,
  1231. Rtlw81Register8192c1T2RInit0 = 0xE74,
  1232. Rtlw81Register8192c1T2RInit1 = 0xE78,
  1233. Rtlw81Register8192c1T2RInit2 = 0xE7C,
  1234. Rtlw81Register8192c1T2RInit3 = 0xE80,
  1235. Rtlw81Register8192c1T2RInit4 = 0xE84,
  1236. Rtlw81Register8192c1T2RInit5 = 0xE88,
  1237. Rtlw81RegisterFirmwareDownload = 0x1000,
  1238. Rtlw81RegisterUsbEnable = 0xFE10,
  1239. Rtlw81RegisterUsbInterference0 = 0xFE40,
  1240. Rtlw81RegisterUsbInterference1 = 0xFE41,
  1241. Rtlw81RegisterUsbInterference2 = 0xFE42,
  1242. Rtlw81RegisterUsbSpecialOption = 0xFE55,
  1243. Rtlw81RegisterUsbDmaAggTo = 0xFE5B,
  1244. Rtlw81RegisterUsbAggTo = 0xFE5C,
  1245. Rtlw81RegisterUsbAggTh = 0xFE5D,
  1246. Rtlw81RegisterUsbEndpoint = 0xFE66,
  1247. } RTLW81_REGISTER, *PRTLW81_REGISTER;
  1248. typedef enum _RTLW81_RF_REGISTER {
  1249. Rtlw81RfRegisterAc = 0x00,
  1250. Rtlw81RfRegisterIpa = 0x15,
  1251. Rtlw81RfRegisterChannelBandwidth = 0x18,
  1252. Rtlw81RfRegisterReceiveG1 = 0x1A,
  1253. Rtlw81RfRegisterReceiveG2 = 0x1B,
  1254. } RTLW81_RF_REGISTER, *PRTLW81_RF_REGISTER;
  1255. typedef enum _RTLW81_EFUSE_REGISTER {
  1256. Rtlw81EfuseRegisterPaSetting = 0x1FA,
  1257. } RTLW81_EFUSE_REGISTER, *PRTLW81_EFUSE_REGISTER;
  1258. /*++
  1259. Structure Description:
  1260. This structure defines the wireless RTL81xx firwmare header.
  1261. Members:
  1262. Signature - Stores the firmware's signature.
  1263. Category - Stores the firmware's category.
  1264. Function - Stores the firmware's function.
  1265. Version - Stores the firmware's version.
  1266. Subversion - Stores the firmware's subversion.
  1267. Month - Stores the month in which the firmware was created.
  1268. MonthDay - Stores the day of the month on which the firmware was created.
  1269. Hour - Stores the hour in which the firmware was created.
  1270. Minute - Stores the minute in which the firmware was created.
  1271. RamcodeSize - Stores the size of the code.
  1272. Reserved1 - Stores 2 reserved byte.
  1273. SvnIndex - Stores the SVN index of the firwmare.
  1274. Reserved2 - Stores 4 reserved bytes.
  1275. Reserved3 - Stores 4 reserved bytes.
  1276. Reserved4 - Stores 4 reserved bytes.
  1277. --*/
  1278. typedef struct _RTLW81_FIRMWARE_HEADER {
  1279. USHORT Signature;
  1280. UCHAR Category;
  1281. UCHAR Function;
  1282. USHORT Version;
  1283. USHORT Subversion;
  1284. UCHAR Month;
  1285. UCHAR MonthDay;
  1286. UCHAR Hour;
  1287. UCHAR Minute;
  1288. USHORT RamcodeSize;
  1289. USHORT Reserved1;
  1290. ULONG SvnIndex;
  1291. ULONG Reserved2;
  1292. ULONG Reserved3;
  1293. ULONG Reserved4;
  1294. } PACKED RTLW81_FIRMWARE_HEADER, *PRTLW81_FIRMWARE_HEADER;
  1295. /*++
  1296. Structure Description:
  1297. This structure defines the header of bulk IN receive packets.
  1298. Members:
  1299. LengthAndErrorFlags - Stores the length of the packet and the error flags.
  1300. See RTLW81_RECEIVE_* for definitions.
  1301. Status - Stores status information for the received packet. See
  1302. RTLW81_RECEIVE_STATUS_* for definitions.
  1303. Reserved1 - Stores 4 reserved bytes.
  1304. Reserved2 - Stores 2 reserved bytes.
  1305. PacketCount - Stores the total number of packets received by the bulk IN
  1306. transfer that contains this packet.
  1307. Reserved3 - Stores 1 reserved byte.
  1308. RateInformation - Stores rate and high throughput status information. See
  1309. RTLW81_RECEIVE_RATE_INFORMATION_* for definitions.
  1310. Reserved4 - Stores 4 reserved bytes.
  1311. Reserved5 - Stores 4 resreved bytes.
  1312. --*/
  1313. typedef struct _RTLW81_RECEIVE_HEADER {
  1314. USHORT LengthAndErrorFlags;
  1315. USHORT Status;
  1316. ULONG Reserved1;
  1317. USHORT Reserved2;
  1318. UCHAR PacketCount;
  1319. UCHAR Reserved3;
  1320. ULONG RateInformation;
  1321. ULONG Reserved4;
  1322. ULONG Reserved5;
  1323. } PACKED RTLW81_RECEIVE_HEADER, *PRTLW81_RECEIVE_HEADER;
  1324. /*++
  1325. Structure Description:
  1326. This structure defines the RTL8188E devices CCK PHY status.
  1327. Members:
  1328. PathAgc - Stores the path automatic gain control.
  1329. SignalQuality - Stores the signal quality information.
  1330. AgcReport - Stores the automatic gain control report.
  1331. Reserved0 - Stores 1 reserved byte.
  1332. Reserved1 - Stores 1 reserved byte.
  1333. NoisePower - Stores the noise power information.
  1334. PathCfoTail - Stores the path's CFO tail.
  1335. PacketsMask - Stores packet mask information.
  1336. StreamReceiveEvm - Stores EVM status for the receive stream.
  1337. PathReceiveSnr - Stores the SNR status for the receive path.
  1338. NoisePowerDbLsb - Stores the noise power level information.
  1339. Reserved2 - Stores 2 reserved bytes.
  1340. StreamCsi - Stores stream CSI status.
  1341. StreamTargetCsi - Stores the stream's target CSI value.
  1342. SignalEvm - Stores the signal EVM status.
  1343. Reserved3 - Stores 3 reserved bytes.
  1344. --*/
  1345. typedef struct _RTLW81_8188E_PHY_STATUS_CCK {
  1346. UCHAR PathAgc[2];
  1347. UCHAR SignalQuality;
  1348. UCHAR AgcReport;
  1349. UCHAR Reserved0;
  1350. UCHAR Reserved1;
  1351. UCHAR NoisePower;
  1352. UCHAR PathCfoTail[2];
  1353. UCHAR PacketsMask[2];
  1354. UCHAR StreamReceiveEvm[2];
  1355. UCHAR PathReceiveSnr[2];
  1356. UCHAR NoisePowerDbLsb;
  1357. UCHAR Reserved2[3];
  1358. UCHAR StreamCsi[2];
  1359. UCHAR StreamTargetCsi[2];
  1360. UCHAR SignalEvm;
  1361. UCHAR Reserved3[2];
  1362. } PACKED RTLW81_8188E_PHY_STATUS_CCK, *PRTLW81_8188E_PHY_STATUS_CCK;
  1363. /*++
  1364. Structure Description:
  1365. This structure defines the default RTL81xx wireless CCK PHY status.
  1366. Members:
  1367. AdcPowerDb - Stores the ADC power decibel readings.
  1368. SignalQualityReport - Stores the signal quality report.
  1369. AgcReport - Stores the automatic gain control report.
  1370. --*/
  1371. typedef struct _RTLW81_DEFAULT_PHY_STATUS_CCK {
  1372. UCHAR AdcPowerDb[4];
  1373. UCHAR SignalQualityReport;
  1374. UCHAR AgcReport;
  1375. } PACKED RTLW81_DEFAULT_PHY_STATUS_CCK, *PRTLW81_DEFAULT_PHY_STATUS_CCK;
  1376. /*++
  1377. Structure Description:
  1378. This structure defines the RTL81xx high throughput PHY status.
  1379. Members:
  1380. PhyStatus - Stores an array of PHY status information.
  1381. --*/
  1382. typedef struct _RTLW81_PHY_STATUS_OFDM {
  1383. ULONG PhyStatus[8];
  1384. } PACKED RTLW81_PHY_STATUS_OFDM, *PRTLW81_PHY_STATUS_OFDM;
  1385. /*++
  1386. Structure Description:
  1387. This structure defines the header of bulk OUT transmit packets.
  1388. Members:
  1389. PacketLength - Stores the length of the packet to transmit.
  1390. Offset - Stores the offset within the packet to the start of the data.
  1391. TypeFlags - Stores a bitmask of flags describing the type of packet being
  1392. sent. See RTLW81_TRANSMIT_TYPE_FLAGS_* for definitions.
  1393. Identification - Stores identification information as well as other flags.
  1394. See RTLW81_TRANSMIT_IDENTIFICATION_* for details.
  1395. AggBkFlag - Stores a single flag for the aggregation background state. See
  1396. RTLW81_TRANSMIT_AGG_BK_FLAG.
  1397. Reserved1 - Stores 2 reserved bytes.
  1398. Sequence - Stores the sequence number for the 802.11 WLAN.
  1399. RateInformation - Stores rate information and other flags. See
  1400. RTLW81_TRANSMIT_RATE_FLAG_* for definitions.
  1401. DataRateInformation - Stores data rate information and other flags. See
  1402. RTLW81_TRANSMIT_DATA_RATE_FLAG_* for definitions.
  1403. Reserved2 - Stores 4 reserved bytes.
  1404. HeaderChecksum - Stores the 16-bit XOR checksum of the transmit header.
  1405. Reserved3 - Stores 2 reserved bytes.
  1406. --*/
  1407. typedef struct _RTLW81_TRANSMIT_HEADER {
  1408. USHORT PacketLength;
  1409. UCHAR Offset;
  1410. UCHAR TypeFlags;
  1411. ULONG Identification;
  1412. ULONG AggBkFlag;
  1413. USHORT Reserved1;
  1414. USHORT Sequence;
  1415. ULONG RateInformation;
  1416. ULONG DataRateInformation;
  1417. ULONG Reserved2;
  1418. USHORT HeaderChecksum;
  1419. USHORT Reserved3;
  1420. } PACKED RTLW81_TRANSMIT_HEADER, *PRTLW81_TRANSMIT_HEADER;
  1421. /*++
  1422. Structure Description:
  1423. This structure defines an RTL81xx wireless firmware command.
  1424. Members:
  1425. Id - Stores the ID of the firmware command.
  1426. Message - Stores the data contents of the firmware command.
  1427. --*/
  1428. typedef struct RTLW81_FIRMWARE_COMMAND {
  1429. UCHAR Id;
  1430. UCHAR Message[RTLW81_FIRMWARE_COMMAND_MAX_MESSAGE_LENGTH];
  1431. } PACKED RTLW81_FIRMWARE_COMMAND, *PRTLW81_FIRMWARE_COMMAND;
  1432. /*++
  1433. Structure Description:
  1434. This structure defines a MAC ID firmware command for the RTL81xx wireless
  1435. devices.
  1436. Members:
  1437. Mask - Stores the data mask to send to the firmware.
  1438. MacId - Stores the MAC ID the firmware command targets.
  1439. --*/
  1440. typedef struct _RTLW81_MAC_ID_CONFIG_COMMAND {
  1441. ULONG Mask;
  1442. UCHAR MacId;
  1443. } PACKED RTLW81_MAC_ID_CONFIG_COMMAND, *PRTLW81_MAC_ID_CONFIG_COMMAND;
  1444. /*++
  1445. Structure Description:
  1446. This structure defines the power information captured from the ROM for
  1447. default devices. This information is used to program the power for new
  1448. channels.
  1449. Members:
  1450. CckTransmitPower - Stores the CCK transmit power settings for each group in
  1451. each chain.
  1452. Ht40TransmitPower - Stores the high throughput 40MHz transmit power
  1453. settings for each group in each chain.
  1454. Ht40TransmitPowerDiff - Stores the high throughput 40MHz transmit power
  1455. differences for each group.
  1456. Ht40MaxPower - Stores the maximum power setting for each group at 40MHz.
  1457. Ht20TransmitPowerDiff - Store the high throughput 20MHz transmit power
  1458. differences for each group.
  1459. Ht20MaxPower - Stores the maximum power setting for each group at 20MHz.
  1460. OfdmTransmitPowerDiff - Stores the OFDM transmit power differences for each
  1461. group.
  1462. --*/
  1463. typedef struct _RTLW81_POWER_DEFAULT {
  1464. UCHAR CckTransmitPower[RTLW81_MAX_CHAIN_COUNT][RTLW81_DEFAULT_GROUP_COUNT];
  1465. UCHAR Ht40TransmitPower[RTLW81_MAX_CHAIN_COUNT][RTLW81_DEFAULT_GROUP_COUNT];
  1466. UCHAR Ht40TransmitPowerDiff[RTLW81_DEFAULT_GROUP_COUNT];
  1467. UCHAR Ht40MaxPower[RTLW81_DEFAULT_GROUP_COUNT];
  1468. UCHAR Ht20TransmitPowerDiff[RTLW81_DEFAULT_GROUP_COUNT];
  1469. UCHAR Ht20MaxPower[RTLW81_DEFAULT_GROUP_COUNT];
  1470. UCHAR OfdmTransmitPowerDiff[RTLW81_DEFAULT_GROUP_COUNT];
  1471. } RTLW81_POWER_DEFAULT, *PRTLW81_POWER_DEFAULT;
  1472. /*++
  1473. Structure Description:
  1474. This structure defines the power information captured from the ROM for
  1475. RTL8188E devices. This information is used to program the power for new
  1476. channels.
  1477. Members:
  1478. CckTransmitPower - Stores the CCK transmit power settings for each group.
  1479. Ht40TransmitPower - Stores the high throughput 40MHz transmit power
  1480. settings for each group.
  1481. Bw20TransmitPowerDiff - Stores the bandwidth 20MHz power difference.
  1482. OfdmTransmitPowerDiff - Stores the OFDM transmit power difference.
  1483. --*/
  1484. typedef struct _RTLW81_POWER_8188E {
  1485. UCHAR CckTransmitPower[RTLW81_8188E_GROUP_COUNT];
  1486. UCHAR Ht40TransmitPower[RTLW81_8188E_GROUP_COUNT];
  1487. UCHAR Bw20TransmitPowerDiff;
  1488. UCHAR OfdmTransmitPowerDiff;
  1489. } RTLW81_POWER_8188E, *PRTLW81_POWER_8188E;
  1490. typedef enum _RTLW81_BULK_OUT_TYPE {
  1491. Rtlw81BulkOutBe,
  1492. Rtlw81BulkOutBk,
  1493. Rtlw81BulkOutVi,
  1494. Rtlw81BulkOutVo,
  1495. Rtlw81BulkOutTypeCount
  1496. } RTLW81_BULK_OUT_TYPE, *PRTLW81_BULK_OUT_TYPE;
  1497. /*++
  1498. Structure Description:
  1499. This structure defines an RTL81xx WIFI device.
  1500. Members:
  1501. OsDevice - Stores a pointer to the system device object.
  1502. Net80211Link - Stores a pointer to the 802.11 core networking link.
  1503. UsbCoreHandle - Stores the handle returned by the USB core.
  1504. ReferenceCount - Stores the number of references on the structure.
  1505. Flags - Stores a bitmask of flags that hold device state or type
  1506. information. See RTLW81_FLAG_* for definitions.
  1507. TransmitChainCount - Stores the number of transmit chains on the device.
  1508. ReceiveChainCount - Stores the number of receive chains on the device.
  1509. CurrentChannel - Stores the current channel the device is set to use.
  1510. IoBuffer - Stores a pointer to the I/O buffer used for both the bulk
  1511. receive and the control transfers.
  1512. ControlTransfer - Stores a pointer to the control transfer used for
  1513. register reads and writes.
  1514. BulkInTransfer - Stores an array of pointers to transfers used to receive
  1515. packets.
  1516. BulkOutFreeTransferList - Stores an array of lists of free transfers to
  1517. use to send data.
  1518. BulkOutTransferCount - Stores the number of currently submitted bulk out
  1519. transfers.
  1520. BulkOutListLock - Stores a pointer to a lock that protects the list of free
  1521. bulk OUT transfers.
  1522. InitializationStatus - Stores the accumulated initialization status from
  1523. the register reads and writes.
  1524. InitializationPhase - Stores the current initialization phase. Phase 0 goes
  1525. up to kicking off the firmware load and phase 1 completes the
  1526. initialization process after the firmware is loaded.
  1527. InitializationIrp - Stores a pointer to the IRP that is driving device
  1528. initialization.
  1529. Firmware - Stores a pointer to the loaded firmware binary file.
  1530. FirmwareBox - Store the formware box where the next firmware command should
  1531. be sent.
  1532. InterfaceClaimed - Stores a boolean indicating if the interface has
  1533. already been claimed.
  1534. InterfaceNumber - Stores the number of the interface this device interacts
  1535. on.
  1536. BulkInEndpoint - Stores the endpoint number for the bulk in endpoint.
  1537. BulkOutEndpoint - Stores an array of endpoint numbers for the bulk out
  1538. endpoints.
  1539. BulkOutEndpointCount - Stores the number of bulk out endpoints found during
  1540. initialization.
  1541. BulkOutTypeEndpointIndex - Stores an array of endpoint indices for each of
  1542. the bulk out transfer types.
  1543. MacAddress - Stores the default MAC address of the device.
  1544. BoardType - Stores the board type of the RTL81xx device.
  1545. Regulatory - Stores regulatory information for the RTL81xx device.
  1546. CrystalCapbility - Stores the capability of the crystal for the RTL8188E
  1547. device.
  1548. PaSetting - Stores the PA setting for the RTL81xx device.
  1549. Power - Stores channel power information captured from the ROM.
  1550. --*/
  1551. typedef struct _RTLW81_DEVICE {
  1552. PDEVICE OsDevice;
  1553. PNET80211_LINK Net80211Link;
  1554. HANDLE UsbCoreHandle;
  1555. volatile ULONG ReferenceCount;
  1556. ULONG Flags;
  1557. ULONG TransmitChainCount;
  1558. ULONG ReceiveChainCount;
  1559. ULONG CurrentChannel;
  1560. PIO_BUFFER IoBuffer;
  1561. PUSB_TRANSFER ControlTransfer;
  1562. PUSB_TRANSFER BulkInTransfer[RTLW81_BULK_IN_TRANSFER_COUNT];
  1563. LIST_ENTRY BulkOutFreeTransferList[RTLW81_MAX_BULK_OUT_ENDPOINT_COUNT];
  1564. volatile ULONG BulkOutTransferCount;
  1565. PQUEUED_LOCK BulkOutListLock;
  1566. KSTATUS InitializationStatus;
  1567. ULONG InitializationPhase;
  1568. PIRP InitializationIrp;
  1569. PLOADED_FILE Firmware;
  1570. UCHAR FirmwareBox;
  1571. BOOL InterfaceClaimed;
  1572. UCHAR InterfaceNumber;
  1573. UCHAR BulkInEndpoint;
  1574. UCHAR BulkOutEndpoint[RTLW81_MAX_BULK_OUT_ENDPOINT_COUNT];
  1575. UCHAR BulkOutEndpointCount;
  1576. UCHAR BulkOutTypeEndpointIndex[Rtlw81BulkOutTypeCount];
  1577. UCHAR MacAddress[NET80211_ADDRESS_SIZE];
  1578. UCHAR BoardType;
  1579. UCHAR Regulatory;
  1580. UCHAR CrystalCapability;
  1581. UCHAR PaSetting;
  1582. union {
  1583. RTLW81_POWER_DEFAULT Default;
  1584. RTLW81_POWER_8188E Rtlw8188e;
  1585. } Power;
  1586. } RTLW81_DEVICE, *PRTLW81_DEVICE;
  1587. //
  1588. // -------------------------------------------------------------------- Globals
  1589. //
  1590. extern PDRIVER Rtlw81Driver;
  1591. extern NET80211_RATE_INFORMATION RtlwDefaultRateInformation;
  1592. //
  1593. // -------------------------------------------------------- Function Prototypes
  1594. //
  1595. KSTATUS
  1596. Rtlw81Send (
  1597. PVOID DeviceContext,
  1598. PNET_PACKET_LIST PacketList
  1599. );
  1600. /*++
  1601. Routine Description:
  1602. This routine sends data through the network.
  1603. Arguments:
  1604. DeviceContext - Supplies a pointer to the device context associated with
  1605. the link down which this data is to be sent.
  1606. PacketList - Supplies a pointer to a list of network packets to send. Data
  1607. in these packets may be modified by this routine, but must not be used
  1608. once this routine returns.
  1609. Return Value:
  1610. STATUS_SUCCESS if all packets were sent.
  1611. STATUS_RESOURCE_IN_USE if some or all of the packets were dropped due to
  1612. the hardware being backed up with too many packets to send.
  1613. Other failure codes indicate that none of the packets were sent.
  1614. --*/
  1615. KSTATUS
  1616. Rtlw81GetSetInformation (
  1617. PVOID DeviceContext,
  1618. NET_LINK_INFORMATION_TYPE InformationType,
  1619. PVOID Data,
  1620. PUINTN DataSize,
  1621. BOOL Set
  1622. );
  1623. /*++
  1624. Routine Description:
  1625. This routine gets or sets the network device layer's link information.
  1626. Arguments:
  1627. DeviceContext - Supplies a pointer to the device context associated with
  1628. the link for which information is being set or queried.
  1629. InformationType - Supplies the type of information being queried or set.
  1630. Data - Supplies a pointer to the data buffer where the data is either
  1631. returned for a get operation or given for a set operation.
  1632. DataSize - Supplies a pointer that on input contains the size of the data
  1633. buffer. On output, contains the required size of the data buffer.
  1634. Set - Supplies a boolean indicating if this is a get operation (FALSE) or a
  1635. set operation (TRUE).
  1636. Return Value:
  1637. Status code.
  1638. --*/
  1639. KSTATUS
  1640. Rtlw81SetChannel (
  1641. PVOID DeviceContext,
  1642. ULONG Channel
  1643. );
  1644. /*++
  1645. Routine Description:
  1646. This routine sets the 802.11 link's channel to the given value.
  1647. Arguments:
  1648. DeviceContext - Supplies a pointer to the device context associated with
  1649. the 802.11 link whose channel is to be set.
  1650. Channel - Supplies the channel to which the device should be set.
  1651. Return Value:
  1652. Status code.
  1653. --*/
  1654. KSTATUS
  1655. Rtlw81SetState (
  1656. PVOID DeviceContext,
  1657. NET80211_STATE State,
  1658. PNET80211_BSS BssInformation
  1659. );
  1660. /*++
  1661. Routine Description:
  1662. This routine sets the 802.11 link to the given state. State information is
  1663. provided to communicate the details of the 802.11 core's current state.
  1664. Arguments:
  1665. DeviceContext - Supplies a pointer to the device context associated with
  1666. the 802.11 link whose state is to be set.
  1667. State - Supplies the state to which the link is being set.
  1668. BssInformation - Supplies a pointer to the BSS information collected by the
  1669. 802.11 core.
  1670. Return Value:
  1671. Status code.
  1672. --*/
  1673. VOID
  1674. Rtlw81BulkInTransferCompletion (
  1675. PUSB_TRANSFER Transfer
  1676. );
  1677. /*++
  1678. Routine Description:
  1679. This routine is called when the bulk in transfer returns. It processes
  1680. the notification from the device.
  1681. Arguments:
  1682. Transfer - Supplies a pointer to the transfer that completed.
  1683. Return Value:
  1684. None.
  1685. --*/
  1686. KSTATUS
  1687. Rtlw81pInitialize (
  1688. PRTLW81_DEVICE Device,
  1689. PIRP Irp
  1690. );
  1691. /*++
  1692. Routine Description:
  1693. This routine initializes and enables the RTL81xx wireless device.
  1694. Arguments:
  1695. Device - Supplies a pointer to the device.
  1696. Irp - Supplies a pointer to the IRP that is driving the initialization.
  1697. Return Value:
  1698. Status code.
  1699. --*/
  1700. VOID
  1701. Rtlw81pDestroyBulkOutTransfers (
  1702. PRTLW81_DEVICE Device
  1703. );
  1704. /*++
  1705. Routine Description:
  1706. This routine destroys the RTLW815xx device's bulk out tranfers.
  1707. Arguments:
  1708. Device - Supplies a pointer to the device.
  1709. Return Value:
  1710. None.
  1711. --*/
  1712. KSTATUS
  1713. Rtlw81pAddNetworkDevice (
  1714. PRTLW81_DEVICE Device
  1715. );
  1716. /*++
  1717. Routine Description:
  1718. This routine adds the device to 802.11 core networking's available links.
  1719. Arguments:
  1720. Device - Supplies a pointer to the device to add.
  1721. Return Value:
  1722. Status code.
  1723. --*/