phydm_types.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2017 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 __ODM_TYPES_H__
  26. #define __ODM_TYPES_H__
  27. /*Define Different SW team support*/
  28. #define ODM_AP 0x01 /*BIT(0)*/
  29. #define ODM_CE 0x04 /*BIT(2)*/
  30. #define ODM_WIN 0x08 /*BIT(3)*/
  31. #define ODM_ADSL 0x10
  32. /*BIT(4)*/ /*already combine with ODM_AP, and is nouse now*/
  33. #define ODM_IOT 0x20 /*BIT(5)*/
  34. /*For FW API*/
  35. #define __iram_odm_func__
  36. /*Deifne HW endian support*/
  37. #define ODM_ENDIAN_BIG 0
  38. #define ODM_ENDIAN_LITTLE 1
  39. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  40. #define GET_PDM_ODM(__padapter) ((struct dm_struct*)(&(GET_HAL_DATA(__padapter))->DM_OutSrc))
  41. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  42. #define GET_PDM_ODM(__padapter) ((struct dm_struct *)(&(GET_HAL_DATA(__padapter))->odmpriv))
  43. #elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
  44. #define GET_PDM_ODM(__padapter) ((struct dm_struct*)(&__padapter->pshare->_dmODM))
  45. #endif
  46. #if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
  47. #define RT_PCI_INTERFACE 1
  48. #define RT_USB_INTERFACE 2
  49. #define RT_SDIO_INTERFACE 3
  50. #endif
  51. enum hal_status {
  52. HAL_STATUS_SUCCESS,
  53. HAL_STATUS_FAILURE,
  54. #if 0
  55. RT_STATUS_PENDING,
  56. RT_STATUS_RESOURCE,
  57. RT_STATUS_INVALID_CONTEXT,
  58. RT_STATUS_INVALID_PARAMETER,
  59. RT_STATUS_NOT_SUPPORT,
  60. RT_STATUS_OS_API_FAILED,
  61. #endif
  62. };
  63. #if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
  64. #define VISTA_USB_RX_REVISE 0
  65. /*
  66. * Declare for ODM spin lock definition temporarily fro compile pass.
  67. */
  68. enum rt_spinlock_type {
  69. RT_TX_SPINLOCK = 1,
  70. RT_RX_SPINLOCK = 2,
  71. RT_RM_SPINLOCK = 3,
  72. RT_CAM_SPINLOCK = 4,
  73. RT_SCAN_SPINLOCK = 5,
  74. RT_LOG_SPINLOCK = 7,
  75. RT_BW_SPINLOCK = 8,
  76. RT_CHNLOP_SPINLOCK = 9,
  77. RT_RF_OPERATE_SPINLOCK = 10,
  78. RT_INITIAL_SPINLOCK = 11,
  79. RT_RF_STATE_SPINLOCK = 12,
  80. /* For RF state. Added by Bruce, 2007-10-30. */
  81. #if VISTA_USB_RX_REVISE
  82. RT_USBRX_CONTEXT_SPINLOCK = 13,
  83. RT_USBRX_POSTPROC_SPINLOCK = 14,
  84. /* protect data of adapter->IndicateW/ IndicateR */
  85. #endif
  86. /* Shall we define Ndis 6.2 SpinLock Here ? */
  87. RT_PORT_SPINLOCK = 16,
  88. RT_VNIC_SPINLOCK = 17,
  89. RT_HVL_SPINLOCK = 18,
  90. RT_H2C_SPINLOCK = 20,
  91. /* For H2C cmd. Added by tynli. 2009.11.09. */
  92. rt_bt_data_spinlock = 25,
  93. RT_WAPI_OPTION_SPINLOCK = 26,
  94. RT_WAPI_RX_SPINLOCK = 27,
  95. /* add for 92D CCK control issue */
  96. RT_CCK_PAGEA_SPINLOCK = 28,
  97. RT_BUFFER_SPINLOCK = 29,
  98. RT_CHANNEL_AND_BANDWIDTH_SPINLOCK = 30,
  99. RT_GEN_TEMP_BUF_SPINLOCK = 31,
  100. RT_AWB_SPINLOCK = 32,
  101. RT_FW_PS_SPINLOCK = 33,
  102. RT_HW_TIMER_SPIN_LOCK = 34,
  103. RT_MPT_WI_SPINLOCK = 35,
  104. RT_P2P_SPIN_LOCK = 36, /* Protect P2P context */
  105. RT_DBG_SPIN_LOCK = 37,
  106. RT_IQK_SPINLOCK = 38,
  107. RT_PENDED_OID_SPINLOCK = 39,
  108. RT_CHNLLIST_SPINLOCK = 40,
  109. RT_INDIC_SPINLOCK = 41, /* protect indication */
  110. RT_RFD_SPINLOCK = 42,
  111. RT_SYNC_IO_CNT_SPINLOCK = 43,
  112. RT_LAST_SPINLOCK,
  113. };
  114. #endif
  115. #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
  116. #define sta_info _RT_WLAN_STA
  117. #define __func__ __FUNCTION__
  118. #define PHYDM_TESTCHIP_SUPPORT TESTCHIP_SUPPORT
  119. #define MASKH3BYTES 0xffffff00
  120. #define SUCCESS 0
  121. #define FAIL (-1)
  122. #define u8 u1Byte
  123. #define s8 s1Byte
  124. #define u16 u2Byte
  125. #define s16 s2Byte
  126. #define u32 u4Byte
  127. #define s32 s4Byte
  128. #define u64 u8Byte
  129. #define s64 s8Byte
  130. #define phydm_timer_list _RT_TIMER
  131. #elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
  132. #include "../typedef.h"
  133. #ifdef CONFIG_PCI_HCI
  134. #define DEV_BUS_TYPE RT_PCI_INTERFACE
  135. #endif
  136. #if (defined(TESTCHIP_SUPPORT))
  137. #define PHYDM_TESTCHIP_SUPPORT 1
  138. #else
  139. #define PHYDM_TESTCHIP_SUPPORT 0
  140. #endif
  141. #define sta_info stat_info
  142. #define boolean bool
  143. #define phydm_timer_list timer_list
  144. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE) && defined(DM_ODM_CE_MAC80211)
  145. #include <asm/byteorder.h>
  146. #define DEV_BUS_TYPE RT_PCI_INTERFACE
  147. #if defined(__LITTLE_ENDIAN)
  148. #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
  149. #elif defined(__BIG_ENDIAN)
  150. #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
  151. #else
  152. #error
  153. #endif
  154. /* define useless flag to avoid compile warning */
  155. #define USE_WORKITEM 0
  156. #define FOR_BRAZIL_PRETEST 0
  157. #define FPGA_TWO_MAC_VERIFICATION 0
  158. #define RTL8881A_SUPPORT 0
  159. #define PHYDM_TESTCHIP_SUPPORT 0
  160. #define RATE_ADAPTIVE_SUPPORT 0
  161. #define POWER_TRAINING_ACTIVE 0
  162. #define sta_info rtl_sta_info
  163. #define boolean bool
  164. #define phydm_timer_list timer_list
  165. #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
  166. #include <drv_types.h>
  167. #ifdef CONFIG_USB_HCI
  168. #define DEV_BUS_TYPE RT_USB_INTERFACE
  169. #elif defined(CONFIG_PCI_HCI)
  170. #define DEV_BUS_TYPE RT_PCI_INTERFACE
  171. #elif defined(CONFIG_SDIO_HCI)
  172. #define DEV_BUS_TYPE RT_SDIO_INTERFACE
  173. #elif defined(CONFIG_GSPI_HCI)
  174. #define DEV_BUS_TYPE RT_SDIO_INTERFACE
  175. #endif
  176. #if defined(CONFIG_LITTLE_ENDIAN)
  177. #define ODM_ENDIAN_TYPE ODM_ENDIAN_LITTLE
  178. #elif defined(CONFIG_BIG_ENDIAN)
  179. #define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
  180. #endif
  181. #define boolean bool
  182. #define SET_TX_DESC_ANTSEL_A_88E(__ptx_desc, __value) SET_BITS_TO_LE_4BYTE(__ptx_desc + 8, 24, 1, __value)
  183. #define SET_TX_DESC_ANTSEL_B_88E(__ptx_desc, __value) SET_BITS_TO_LE_4BYTE(__ptx_desc + 8, 25, 1, __value)
  184. #define SET_TX_DESC_ANTSEL_C_88E(__ptx_desc, __value) SET_BITS_TO_LE_4BYTE(__ptx_desc + 28, 29, 1, __value)
  185. /* define useless flag to avoid compile warning */
  186. #define USE_WORKITEM 0
  187. #define FOR_BRAZIL_PRETEST 0
  188. #define FPGA_TWO_MAC_VERIFICATION 0
  189. #define RTL8881A_SUPPORT 0
  190. #if (defined(TESTCHIP_SUPPORT))
  191. #define PHYDM_TESTCHIP_SUPPORT 1
  192. #else
  193. #define PHYDM_TESTCHIP_SUPPORT 0
  194. #endif
  195. #define phydm_timer_list rtw_timer_list
  196. #elif (DM_ODM_SUPPORT_TYPE == ODM_IOT)
  197. #define boolean bool
  198. #define true _TRUE
  199. #define false _FALSE
  200. // for power limit table
  201. enum odm_pw_lmt_regulation_type {
  202. PW_LMT_REGU_NULL = 0,
  203. PW_LMT_REGU_FCC = 1,
  204. PW_LMT_REGU_ETSI = 2,
  205. PW_LMT_REGU_MKK = 3,
  206. PW_LMT_REGU_WW13 = 4
  207. };
  208. enum odm_pw_lmt_band_type {
  209. PW_LMT_BAND_NULL = 0,
  210. PW_LMT_BAND_2_4G = 1,
  211. PW_LMT_BAND_5G = 2
  212. };
  213. enum odm_pw_lmt_bandwidth_type {
  214. PW_LMT_BW_NULL = 0,
  215. PW_LMT_BW_20M = 1,
  216. PW_LMT_BW_40M = 2,
  217. PW_LMT_BW_80M = 3
  218. };
  219. enum odm_pw_lmt_ratesection_type {
  220. PW_LMT_RS_NULL = 0,
  221. PW_LMT_RS_CCK = 1,
  222. PW_LMT_RS_OFDM = 2,
  223. PW_LMT_RS_HT = 3,
  224. PW_LMT_RS_VHT = 4
  225. };
  226. enum odm_pw_lmt_rfpath_type {
  227. PW_LMT_PH_NULL = 0,
  228. PW_LMT_PH_1T = 1,
  229. PW_LMT_PH_2T = 2,
  230. PW_LMT_PH_3T = 3,
  231. PW_LMT_PH_4T = 4
  232. };
  233. #define phydm_timer_list timer_list
  234. #endif
  235. #define READ_NEXT_PAIR(v1, v2, i) do { if (i + 2 >= array_len) break; i += 2; v1 = array[i]; v2 = array[i + 1]; } while (0)
  236. #define COND_ELSE 2
  237. #define COND_ENDIF 3
  238. #define MASKBYTE0 0xff
  239. #define MASKBYTE1 0xff00
  240. #define MASKBYTE2 0xff0000
  241. #define MASKBYTE3 0xff000000
  242. #define MASKHWORD 0xffff0000
  243. #define MASKLWORD 0x0000ffff
  244. #define MASKDWORD 0xffffffff
  245. #define MASK7BITS 0x7f
  246. #define MASK12BITS 0xfff
  247. #define MASKH4BITS 0xf0000000
  248. #define MASK20BITS 0xfffff
  249. #define MASK24BITS 0xffffff
  250. #define MASKOFDM_D 0xffc00000
  251. #define MASKCCK 0x3f3f3f3f
  252. #define RFREGOFFSETMASK 0xfffff
  253. #define RFREG_MASK 0xfffff
  254. #define MASKH3BYTES 0xffffff00
  255. #define MASKL3BYTES 0x00ffffff
  256. #define MASKBYTE2HIGHNIBBLE 0x00f00000
  257. #define MASKBYTE3LOWNIBBLE 0x0f000000
  258. #define MASKL3BYTES 0x00ffffff
  259. #endif /* __ODM_TYPES_H__ */