def.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2013 Realtek Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * The full GNU General Public License is included in this distribution in the
  15. * file called LICENSE.
  16. *
  17. * Contact Information:
  18. * wlanfae <wlanfae@realtek.com>
  19. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  20. * Hsinchu 300, Taiwan.
  21. *
  22. * Larry Finger <Larry.Finger@lwfinger.net>
  23. *
  24. *****************************************************************************/
  25. #ifndef __RTL92C_DEF_H__
  26. #define __RTL92C_DEF_H__
  27. #define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0
  28. #define HAL_PRIME_CHNL_OFFSET_LOWER 1
  29. #define HAL_PRIME_CHNL_OFFSET_UPPER 2
  30. #define RX_MPDU_QUEUE 0
  31. #define RX_CMD_QUEUE 1
  32. #define C2H_RX_CMD_HDR_LEN 8
  33. #define GET_C2H_CMD_CMD_LEN(__prxhdr) \
  34. LE_BITS_TO_4BYTE((__prxhdr), 0, 16)
  35. #define GET_C2H_CMD_ELEMENT_ID(__prxhdr) \
  36. LE_BITS_TO_4BYTE((__prxhdr), 16, 8)
  37. #define GET_C2H_CMD_CMD_SEQ(__prxhdr) \
  38. LE_BITS_TO_4BYTE((__prxhdr), 24, 7)
  39. #define GET_C2H_CMD_CONTINUE(__prxhdr) \
  40. LE_BITS_TO_4BYTE((__prxhdr), 31, 1)
  41. #define GET_C2H_CMD_CONTENT(__prxhdr) \
  42. ((u8 *)(__prxhdr) + C2H_RX_CMD_HDR_LEN)
  43. #define GET_C2H_CMD_FEEDBACK_ELEMENT_ID(__pcmdfbhdr) \
  44. LE_BITS_TO_4BYTE((__pcmdfbhdr), 0, 8)
  45. #define GET_C2H_CMD_FEEDBACK_CCX_LEN(__pcmdfbhdr) \
  46. LE_BITS_TO_4BYTE((__pcmdfbhdr), 8, 8)
  47. #define GET_C2H_CMD_FEEDBACK_CCX_CMD_CNT(__pcmdfbhdr) \
  48. LE_BITS_TO_4BYTE((__pcmdfbhdr), 16, 16)
  49. #define GET_C2H_CMD_FEEDBACK_CCX_MAC_ID(__pcmdfbhdr) \
  50. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 0, 5)
  51. #define GET_C2H_CMD_FEEDBACK_CCX_VALID(__pcmdfbhdr) \
  52. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 7, 1)
  53. #define GET_C2H_CMD_FEEDBACK_CCX_RETRY_CNT(__pcmdfbhdr) \
  54. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 8, 5)
  55. #define GET_C2H_CMD_FEEDBACK_CCX_TOK(__pcmdfbhdr) \
  56. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 15, 1)
  57. #define GET_C2H_CMD_FEEDBACK_CCX_QSEL(__pcmdfbhdr) \
  58. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4)
  59. #define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \
  60. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12)
  61. #define CHIP_BONDING_IDENTIFIER(_value) (((_value)>>22)&0x3)
  62. /* [15:12] IC version(CUT): A-cut=0, B-cut=1, C-cut=2, D-cut=3
  63. * [7] Manufacturer: TSMC=0, UMC=1
  64. * [6:4] RF type: 1T1R=0, 1T2R=1, 2T2R=2
  65. * [3] Chip type: TEST=0, NORMAL=1
  66. * [2:0] IC type: 81xxC=0, 8723=1, 92D=2
  67. */
  68. #define CHIP_8723 BIT(0)
  69. #define CHIP_92D BIT(1)
  70. #define NORMAL_CHIP BIT(3)
  71. #define RF_TYPE_1T1R (~(BIT(4)|BIT(5)|BIT(6)))
  72. #define RF_TYPE_1T2R BIT(4)
  73. #define RF_TYPE_2T2R BIT(5)
  74. #define CHIP_VENDOR_UMC BIT(7)
  75. #define B_CUT_VERSION BIT(12)
  76. #define C_CUT_VERSION BIT(13)
  77. #define D_CUT_VERSION ((BIT(12)|BIT(13)))
  78. #define E_CUT_VERSION BIT(14)
  79. /* MASK */
  80. #define IC_TYPE_MASK (BIT(0)|BIT(1)|BIT(2))
  81. #define CHIP_TYPE_MASK BIT(3)
  82. #define RF_TYPE_MASK (BIT(4)|BIT(5)|BIT(6))
  83. #define MANUFACTUER_MASK BIT(7)
  84. #define ROM_VERSION_MASK (BIT(11)|BIT(10)|BIT(9)|BIT(8))
  85. #define CUT_VERSION_MASK (BIT(15)|BIT(14)|BIT(13)|BIT(12))
  86. /* Get element */
  87. #define GET_CVID_IC_TYPE(version) ((version) & IC_TYPE_MASK)
  88. #define GET_CVID_CHIP_TYPE(version) ((version) & CHIP_TYPE_MASK)
  89. #define GET_CVID_RF_TYPE(version) ((version) & RF_TYPE_MASK)
  90. #define GET_CVID_MANUFACTUER(version) ((version) & MANUFACTUER_MASK)
  91. #define GET_CVID_ROM_VERSION(version) ((version) & ROM_VERSION_MASK)
  92. #define GET_CVID_CUT_VERSION(version) ((version) & CUT_VERSION_MASK)
  93. #define IS_81XXC(version) \
  94. ((GET_CVID_IC_TYPE(version) == 0) ? true : false)
  95. #define IS_8723_SERIES(version) \
  96. ((GET_CVID_IC_TYPE(version) == CHIP_8723) ? true : false)
  97. #define IS_92D(version) \
  98. ((GET_CVID_IC_TYPE(version) == CHIP_92D) ? true : false)
  99. #define IS_NORMAL_CHIP(version) \
  100. ((GET_CVID_CHIP_TYPE(version)) ? true : false)
  101. #define IS_NORMAL_CHIP92D(version) \
  102. ((GET_CVID_CHIP_TYPE(version)) ? true : false)
  103. #define IS_1T1R(version) \
  104. ((GET_CVID_RF_TYPE(version)) ? false : true)
  105. #define IS_1T2R(version) \
  106. ((GET_CVID_RF_TYPE(version) == RF_TYPE_1T2R) ? true : false)
  107. #define IS_2T2R(version) \
  108. ((GET_CVID_RF_TYPE(version) == RF_TYPE_2T2R) ? true : false)
  109. #define IS_CHIP_VENDOR_UMC(version) \
  110. ((GET_CVID_MANUFACTUER(version)) ? true : false)
  111. #define IS_92C_SERIAL(version) \
  112. ((IS_81XXC(version) && IS_2T2R(version)) ? true : false)
  113. #define IS_81xxC_VENDOR_UMC_A_CUT(version) \
  114. (IS_81XXC(version) ? ((IS_CHIP_VENDOR_UMC(version)) ? \
  115. ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) : false)
  116. #define IS_81XXC_VENDOR_UMC_B_CUT(version) \
  117. (IS_81XXC(version) ? (IS_CHIP_VENDOR_UMC(version) ? \
  118. ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true \
  119. : false) : false) : false)
  120. enum version_8188e {
  121. VERSION_TEST_CHIP_88E = 0x00,
  122. VERSION_NORMAL_CHIP_88E = 0x01,
  123. VERSION_UNKNOWN = 0xFF,
  124. };
  125. enum rx_packet_type {
  126. NORMAL_RX,
  127. TX_REPORT1,
  128. TX_REPORT2,
  129. HIS_REPORT,
  130. };
  131. enum rtl819x_loopback_e {
  132. RTL819X_NO_LOOPBACK = 0,
  133. RTL819X_MAC_LOOPBACK = 1,
  134. RTL819X_DMA_LOOPBACK = 2,
  135. RTL819X_CCK_LOOPBACK = 3,
  136. };
  137. enum rf_optype {
  138. RF_OP_BY_SW_3WIRE = 0,
  139. RF_OP_BY_FW,
  140. RF_OP_MAX
  141. };
  142. enum rf_power_state {
  143. RF_ON,
  144. RF_OFF,
  145. RF_SLEEP,
  146. RF_SHUT_DOWN,
  147. };
  148. enum power_save_mode {
  149. POWER_SAVE_MODE_ACTIVE,
  150. POWER_SAVE_MODE_SAVE,
  151. };
  152. enum power_polocy_config {
  153. POWERCFG_MAX_POWER_SAVINGS,
  154. POWERCFG_GLOBAL_POWER_SAVINGS,
  155. POWERCFG_LOCAL_POWER_SAVINGS,
  156. POWERCFG_LENOVO,
  157. };
  158. enum interface_select_pci {
  159. INTF_SEL1_MINICARD = 0,
  160. INTF_SEL0_PCIE = 1,
  161. INTF_SEL2_RSV = 2,
  162. INTF_SEL3_RSV = 3,
  163. };
  164. enum hal_fw_c2h_cmd_id {
  165. HAL_FW_C2H_CMD_READ_MACREG = 0,
  166. HAL_FW_C2H_CMD_READ_BBREG = 1,
  167. HAL_FW_C2H_CMD_READ_RFREG = 2,
  168. HAL_FW_C2H_CMD_READ_EEPROM = 3,
  169. HAL_FW_C2H_CMD_READ_EFUSE = 4,
  170. HAL_FW_C2H_CMD_READ_CAM = 5,
  171. HAL_FW_C2H_CMD_GET_BASICRATE = 6,
  172. HAL_FW_C2H_CMD_GET_DATARATE = 7,
  173. HAL_FW_C2H_CMD_SURVEY = 8,
  174. HAL_FW_C2H_CMD_SURVEYDONE = 9,
  175. HAL_FW_C2H_CMD_JOINBSS = 10,
  176. HAL_FW_C2H_CMD_ADDSTA = 11,
  177. HAL_FW_C2H_CMD_DELSTA = 12,
  178. HAL_FW_C2H_CMD_ATIMDONE = 13,
  179. HAL_FW_C2H_CMD_TX_REPORT = 14,
  180. HAL_FW_C2H_CMD_CCX_REPORT = 15,
  181. HAL_FW_C2H_CMD_DTM_REPORT = 16,
  182. HAL_FW_C2H_CMD_TX_RATE_STATISTICS = 17,
  183. HAL_FW_C2H_CMD_C2HLBK = 18,
  184. HAL_FW_C2H_CMD_C2HDBG = 19,
  185. HAL_FW_C2H_CMD_C2HFEEDBACK = 20,
  186. HAL_FW_C2H_CMD_MAX
  187. };
  188. enum rtl_desc_qsel {
  189. QSLT_BK = 0x2,
  190. QSLT_BE = 0x0,
  191. QSLT_VI = 0x5,
  192. QSLT_VO = 0x7,
  193. QSLT_BEACON = 0x10,
  194. QSLT_HIGH = 0x11,
  195. QSLT_MGNT = 0x12,
  196. QSLT_CMD = 0x13,
  197. };
  198. enum rtl_desc92c_rate {
  199. DESC92C_RATE1M = 0x00,
  200. DESC92C_RATE2M = 0x01,
  201. DESC92C_RATE5_5M = 0x02,
  202. DESC92C_RATE11M = 0x03,
  203. DESC92C_RATE6M = 0x04,
  204. DESC92C_RATE9M = 0x05,
  205. DESC92C_RATE12M = 0x06,
  206. DESC92C_RATE18M = 0x07,
  207. DESC92C_RATE24M = 0x08,
  208. DESC92C_RATE36M = 0x09,
  209. DESC92C_RATE48M = 0x0a,
  210. DESC92C_RATE54M = 0x0b,
  211. DESC92C_RATEMCS0 = 0x0c,
  212. DESC92C_RATEMCS1 = 0x0d,
  213. DESC92C_RATEMCS2 = 0x0e,
  214. DESC92C_RATEMCS3 = 0x0f,
  215. DESC92C_RATEMCS4 = 0x10,
  216. DESC92C_RATEMCS5 = 0x11,
  217. DESC92C_RATEMCS6 = 0x12,
  218. DESC92C_RATEMCS7 = 0x13,
  219. DESC92C_RATEMCS8 = 0x14,
  220. DESC92C_RATEMCS9 = 0x15,
  221. DESC92C_RATEMCS10 = 0x16,
  222. DESC92C_RATEMCS11 = 0x17,
  223. DESC92C_RATEMCS12 = 0x18,
  224. DESC92C_RATEMCS13 = 0x19,
  225. DESC92C_RATEMCS14 = 0x1a,
  226. DESC92C_RATEMCS15 = 0x1b,
  227. DESC92C_RATEMCS15_SG = 0x1c,
  228. DESC92C_RATEMCS32 = 0x20,
  229. };
  230. struct phy_sts_cck_8192s_t {
  231. u8 adc_pwdb_X[4];
  232. u8 sq_rpt;
  233. u8 cck_agc_rpt;
  234. };
  235. struct h2c_cmd_8192c {
  236. u8 element_id;
  237. u32 cmd_len;
  238. u8 *p_cmdbuffer;
  239. };
  240. #endif