def.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009-2010 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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * wlanfae <wlanfae@realtek.com>
  23. * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
  24. * Hsinchu 300, Taiwan.
  25. *
  26. * Larry Finger <Larry.Finger@lwfinger.net>
  27. *
  28. *****************************************************************************/
  29. #ifndef __RTL92C_DEF_H__
  30. #define __RTL92C_DEF_H__
  31. #define HAL_RETRY_LIMIT_INFRA 48
  32. #define HAL_RETRY_LIMIT_AP_ADHOC 7
  33. #define PHY_RSSI_SLID_WIN_MAX 100
  34. #define PHY_LINKQUALITY_SLID_WIN_MAX 20
  35. #define PHY_BEACON_RSSI_SLID_WIN_MAX 10
  36. #define RESET_DELAY_8185 20
  37. #define RT_IBSS_INT_MASKS (IMR_BCNINT | IMR_TBDOK | IMR_TBDER)
  38. #define RT_AC_INT_MASKS (IMR_VIDOK | IMR_VODOK | IMR_BEDOK|IMR_BKDOK)
  39. #define NUM_OF_FIRMWARE_QUEUE 10
  40. #define NUM_OF_PAGES_IN_FW 0x100
  41. #define NUM_OF_PAGE_IN_FW_QUEUE_BK 0x07
  42. #define NUM_OF_PAGE_IN_FW_QUEUE_BE 0x07
  43. #define NUM_OF_PAGE_IN_FW_QUEUE_VI 0x07
  44. #define NUM_OF_PAGE_IN_FW_QUEUE_VO 0x07
  45. #define NUM_OF_PAGE_IN_FW_QUEUE_HCCA 0x0
  46. #define NUM_OF_PAGE_IN_FW_QUEUE_CMD 0x0
  47. #define NUM_OF_PAGE_IN_FW_QUEUE_MGNT 0x02
  48. #define NUM_OF_PAGE_IN_FW_QUEUE_HIGH 0x02
  49. #define NUM_OF_PAGE_IN_FW_QUEUE_BCN 0x2
  50. #define NUM_OF_PAGE_IN_FW_QUEUE_PUB 0xA1
  51. #define NUM_OF_PAGE_IN_FW_QUEUE_BK_DTM 0x026
  52. #define NUM_OF_PAGE_IN_FW_QUEUE_BE_DTM 0x048
  53. #define NUM_OF_PAGE_IN_FW_QUEUE_VI_DTM 0x048
  54. #define NUM_OF_PAGE_IN_FW_QUEUE_VO_DTM 0x026
  55. #define NUM_OF_PAGE_IN_FW_QUEUE_PUB_DTM 0x00
  56. #define MAX_LINES_HWCONFIG_TXT 1000
  57. #define MAX_BYTES_LINE_HWCONFIG_TXT 256
  58. #define SW_THREE_WIRE 0
  59. #define HW_THREE_WIRE 2
  60. #define BT_DEMO_BOARD 0
  61. #define BT_QA_BOARD 1
  62. #define BT_FPGA 2
  63. #define RX_SMOOTH_FACTOR 20
  64. #define HAL_PRIME_CHNL_OFFSET_DONT_CARE 0
  65. #define HAL_PRIME_CHNL_OFFSET_LOWER 1
  66. #define HAL_PRIME_CHNL_OFFSET_UPPER 2
  67. #define MAX_H2C_QUEUE_NUM 10
  68. #define RX_MPDU_QUEUE 0
  69. #define RX_CMD_QUEUE 1
  70. #define RX_MAX_QUEUE 2
  71. #define AC2QUEUEID(_AC) (_AC)
  72. #define C2H_RX_CMD_HDR_LEN 8
  73. #define GET_C2H_CMD_CMD_LEN(__prxhdr) \
  74. LE_BITS_TO_4BYTE((__prxhdr), 0, 16)
  75. #define GET_C2H_CMD_ELEMENT_ID(__prxhdr) \
  76. LE_BITS_TO_4BYTE((__prxhdr), 16, 8)
  77. #define GET_C2H_CMD_CMD_SEQ(__prxhdr) \
  78. LE_BITS_TO_4BYTE((__prxhdr), 24, 7)
  79. #define GET_C2H_CMD_CONTINUE(__prxhdr) \
  80. LE_BITS_TO_4BYTE((__prxhdr), 31, 1)
  81. #define GET_C2H_CMD_CONTENT(__prxhdr) \
  82. ((u8 *)(__prxhdr) + C2H_RX_CMD_HDR_LEN)
  83. #define GET_C2H_CMD_FEEDBACK_ELEMENT_ID(__pcmdfbhdr) \
  84. LE_BITS_TO_4BYTE((__pcmdfbhdr), 0, 8)
  85. #define GET_C2H_CMD_FEEDBACK_CCX_LEN(__pcmdfbhdr) \
  86. LE_BITS_TO_4BYTE((__pcmdfbhdr), 8, 8)
  87. #define GET_C2H_CMD_FEEDBACK_CCX_CMD_CNT(__pcmdfbhdr) \
  88. LE_BITS_TO_4BYTE((__pcmdfbhdr), 16, 16)
  89. #define GET_C2H_CMD_FEEDBACK_CCX_MAC_ID(__pcmdfbhdr) \
  90. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 0, 5)
  91. #define GET_C2H_CMD_FEEDBACK_CCX_VALID(__pcmdfbhdr) \
  92. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 7, 1)
  93. #define GET_C2H_CMD_FEEDBACK_CCX_RETRY_CNT(__pcmdfbhdr) \
  94. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 8, 5)
  95. #define GET_C2H_CMD_FEEDBACK_CCX_TOK(__pcmdfbhdr) \
  96. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 15, 1)
  97. #define GET_C2H_CMD_FEEDBACK_CCX_QSEL(__pcmdfbhdr) \
  98. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4)
  99. #define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \
  100. LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12)
  101. #define CHIP_VER_B BIT(4)
  102. #define CHIP_92C_BITMASK BIT(0)
  103. #define CHIP_92C_1T2R 0x03
  104. #define CHIP_92C 0x01
  105. #define CHIP_88C 0x00
  106. enum version_8192c {
  107. VERSION_A_CHIP_92C = 0x01,
  108. VERSION_A_CHIP_88C = 0x00,
  109. VERSION_B_CHIP_92C = 0x11,
  110. VERSION_B_CHIP_88C = 0x10,
  111. VERSION_UNKNOWN = 0x88,
  112. };
  113. #define IS_CHIP_VER_B(version) ((version & CHIP_VER_B) ? true : false)
  114. #define IS_92C_SERIAL(version) ((version & CHIP_92C_BITMASK) ? true : false)
  115. enum rtl819x_loopback_e {
  116. RTL819X_NO_LOOPBACK = 0,
  117. RTL819X_MAC_LOOPBACK = 1,
  118. RTL819X_DMA_LOOPBACK = 2,
  119. RTL819X_CCK_LOOPBACK = 3,
  120. };
  121. enum rf_optype {
  122. RF_OP_BY_SW_3WIRE = 0,
  123. RF_OP_BY_FW,
  124. RF_OP_MAX
  125. };
  126. enum rf_power_state {
  127. RF_ON,
  128. RF_OFF,
  129. RF_SLEEP,
  130. RF_SHUT_DOWN,
  131. };
  132. enum power_save_mode {
  133. POWER_SAVE_MODE_ACTIVE,
  134. POWER_SAVE_MODE_SAVE,
  135. };
  136. enum power_polocy_config {
  137. POWERCFG_MAX_POWER_SAVINGS,
  138. POWERCFG_GLOBAL_POWER_SAVINGS,
  139. POWERCFG_LOCAL_POWER_SAVINGS,
  140. POWERCFG_LENOVO,
  141. };
  142. enum interface_select_pci {
  143. INTF_SEL1_MINICARD = 0,
  144. INTF_SEL0_PCIE = 1,
  145. INTF_SEL2_RSV = 2,
  146. INTF_SEL3_RSV = 3,
  147. };
  148. enum hal_fw_c2h_cmd_id {
  149. HAL_FW_C2H_CMD_Read_MACREG = 0,
  150. HAL_FW_C2H_CMD_Read_BBREG = 1,
  151. HAL_FW_C2H_CMD_Read_RFREG = 2,
  152. HAL_FW_C2H_CMD_Read_EEPROM = 3,
  153. HAL_FW_C2H_CMD_Read_EFUSE = 4,
  154. HAL_FW_C2H_CMD_Read_CAM = 5,
  155. HAL_FW_C2H_CMD_Get_BasicRate = 6,
  156. HAL_FW_C2H_CMD_Get_DataRate = 7,
  157. HAL_FW_C2H_CMD_Survey = 8,
  158. HAL_FW_C2H_CMD_SurveyDone = 9,
  159. HAL_FW_C2H_CMD_JoinBss = 10,
  160. HAL_FW_C2H_CMD_AddSTA = 11,
  161. HAL_FW_C2H_CMD_DelSTA = 12,
  162. HAL_FW_C2H_CMD_AtimDone = 13,
  163. HAL_FW_C2H_CMD_TX_Report = 14,
  164. HAL_FW_C2H_CMD_CCX_Report = 15,
  165. HAL_FW_C2H_CMD_DTM_Report = 16,
  166. HAL_FW_C2H_CMD_TX_Rate_Statistics = 17,
  167. HAL_FW_C2H_CMD_C2HLBK = 18,
  168. HAL_FW_C2H_CMD_C2HDBG = 19,
  169. HAL_FW_C2H_CMD_C2HFEEDBACK = 20,
  170. HAL_FW_C2H_CMD_MAX
  171. };
  172. enum rtl_desc_qsel {
  173. QSLT_BK = 0x2,
  174. QSLT_BE = 0x0,
  175. QSLT_VI = 0x5,
  176. QSLT_VO = 0x7,
  177. QSLT_BEACON = 0x10,
  178. QSLT_HIGH = 0x11,
  179. QSLT_MGNT = 0x12,
  180. QSLT_CMD = 0x13,
  181. };
  182. enum rtl_desc92c_rate {
  183. DESC92C_RATE1M = 0x00,
  184. DESC92C_RATE2M = 0x01,
  185. DESC92C_RATE5_5M = 0x02,
  186. DESC92C_RATE11M = 0x03,
  187. DESC92C_RATE6M = 0x04,
  188. DESC92C_RATE9M = 0x05,
  189. DESC92C_RATE12M = 0x06,
  190. DESC92C_RATE18M = 0x07,
  191. DESC92C_RATE24M = 0x08,
  192. DESC92C_RATE36M = 0x09,
  193. DESC92C_RATE48M = 0x0a,
  194. DESC92C_RATE54M = 0x0b,
  195. DESC92C_RATEMCS0 = 0x0c,
  196. DESC92C_RATEMCS1 = 0x0d,
  197. DESC92C_RATEMCS2 = 0x0e,
  198. DESC92C_RATEMCS3 = 0x0f,
  199. DESC92C_RATEMCS4 = 0x10,
  200. DESC92C_RATEMCS5 = 0x11,
  201. DESC92C_RATEMCS6 = 0x12,
  202. DESC92C_RATEMCS7 = 0x13,
  203. DESC92C_RATEMCS8 = 0x14,
  204. DESC92C_RATEMCS9 = 0x15,
  205. DESC92C_RATEMCS10 = 0x16,
  206. DESC92C_RATEMCS11 = 0x17,
  207. DESC92C_RATEMCS12 = 0x18,
  208. DESC92C_RATEMCS13 = 0x19,
  209. DESC92C_RATEMCS14 = 0x1a,
  210. DESC92C_RATEMCS15 = 0x1b,
  211. DESC92C_RATEMCS15_SG = 0x1c,
  212. DESC92C_RATEMCS32 = 0x20,
  213. };
  214. struct phy_sts_cck_8192s_t {
  215. u8 adc_pwdb_X[4];
  216. u8 sq_rpt;
  217. u8 cck_agc_rpt;
  218. };
  219. struct h2c_cmd_8192c {
  220. u8 element_id;
  221. u32 cmd_len;
  222. u8 *p_cmdbuffer;
  223. };
  224. #endif