hal_com.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  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. *
  19. ******************************************************************************/
  20. #ifndef __HAL_COMMON_H__
  21. #define __HAL_COMMON_H__
  22. #include "HalVerDef.h"
  23. #include "hal_pg.h"
  24. #include "hal_phy.h"
  25. #include "hal_phy_reg.h"
  26. #include "hal_com_reg.h"
  27. #include "hal_com_phycfg.h"
  28. /*------------------------------ Tx Desc definition Macro ------------------------*/
  29. //#pragma mark -- Tx Desc related definition. --
  30. //----------------------------------------------------------------------------
  31. //-----------------------------------------------------------
  32. // Rate
  33. //-----------------------------------------------------------
  34. // CCK Rates, TxHT = 0
  35. #define DESC_RATE1M 0x00
  36. #define DESC_RATE2M 0x01
  37. #define DESC_RATE5_5M 0x02
  38. #define DESC_RATE11M 0x03
  39. // OFDM Rates, TxHT = 0
  40. #define DESC_RATE6M 0x04
  41. #define DESC_RATE9M 0x05
  42. #define DESC_RATE12M 0x06
  43. #define DESC_RATE18M 0x07
  44. #define DESC_RATE24M 0x08
  45. #define DESC_RATE36M 0x09
  46. #define DESC_RATE48M 0x0a
  47. #define DESC_RATE54M 0x0b
  48. // MCS Rates, TxHT = 1
  49. #define DESC_RATEMCS0 0x0c
  50. #define DESC_RATEMCS1 0x0d
  51. #define DESC_RATEMCS2 0x0e
  52. #define DESC_RATEMCS3 0x0f
  53. #define DESC_RATEMCS4 0x10
  54. #define DESC_RATEMCS5 0x11
  55. #define DESC_RATEMCS6 0x12
  56. #define DESC_RATEMCS7 0x13
  57. #define DESC_RATEMCS8 0x14
  58. #define DESC_RATEMCS9 0x15
  59. #define DESC_RATEMCS10 0x16
  60. #define DESC_RATEMCS11 0x17
  61. #define DESC_RATEMCS12 0x18
  62. #define DESC_RATEMCS13 0x19
  63. #define DESC_RATEMCS14 0x1a
  64. #define DESC_RATEMCS15 0x1b
  65. #define DESC_RATEMCS15_SG 0x1c
  66. #define DESC_RATEMCS32 0x20
  67. #define DESC_RATEVHTSS1MCS0 0x2c
  68. #define DESC_RATEVHTSS1MCS1 0x2d
  69. #define DESC_RATEVHTSS1MCS2 0x2e
  70. #define DESC_RATEVHTSS1MCS3 0x2f
  71. #define DESC_RATEVHTSS1MCS4 0x30
  72. #define DESC_RATEVHTSS1MCS5 0x31
  73. #define DESC_RATEVHTSS1MCS6 0x32
  74. #define DESC_RATEVHTSS1MCS7 0x33
  75. #define DESC_RATEVHTSS1MCS8 0x34
  76. #define DESC_RATEVHTSS1MCS9 0x35
  77. #define DESC_RATEVHTSS2MCS0 0x36
  78. #define DESC_RATEVHTSS2MCS1 0x37
  79. #define DESC_RATEVHTSS2MCS2 0x38
  80. #define DESC_RATEVHTSS2MCS3 0x39
  81. #define DESC_RATEVHTSS2MCS4 0x3a
  82. #define DESC_RATEVHTSS2MCS5 0x3b
  83. #define DESC_RATEVHTSS2MCS6 0x3c
  84. #define DESC_RATEVHTSS2MCS7 0x3d
  85. #define DESC_RATEVHTSS2MCS8 0x3e
  86. #define DESC_RATEVHTSS2MCS9 0x3f
  87. enum{
  88. UP_LINK,
  89. DOWN_LINK,
  90. };
  91. typedef enum _RT_MEDIA_STATUS {
  92. RT_MEDIA_DISCONNECT = 0,
  93. RT_MEDIA_CONNECT = 1
  94. } RT_MEDIA_STATUS;
  95. #define MAX_DLFW_PAGE_SIZE 4096 // @ page : 4k bytes
  96. typedef enum _FIRMWARE_SOURCE {
  97. FW_SOURCE_IMG_FILE = 0,
  98. FW_SOURCE_HEADER_FILE = 1, //from header file
  99. } FIRMWARE_SOURCE, *PFIRMWARE_SOURCE;
  100. // BK, BE, VI, VO, HCCA, MANAGEMENT, COMMAND, HIGH, BEACON.
  101. //#define MAX_TX_QUEUE 9
  102. #define TX_SELE_HQ BIT(0) // High Queue
  103. #define TX_SELE_LQ BIT(1) // Low Queue
  104. #define TX_SELE_NQ BIT(2) // Normal Queue
  105. #define TX_SELE_EQ BIT(3) // Extern Queue
  106. #define PageNum_128(_Len) (u32)(((_Len)>>7) + ((_Len)&0x7F ? 1:0))
  107. #define PageNum_256(_Len) (u32)(((_Len)>>8) + ((_Len)&0xFF ? 1:0))
  108. #define PageNum_512(_Len) (u32)(((_Len)>>9) + ((_Len)&0x1FF ? 1:0))
  109. #define PageNum(_Len, _Size) (u32)(((_Len)/(_Size)) + ((_Len)&((_Size) - 1) ? 1:0))
  110. void dump_chip_info(HAL_VERSION ChipVersion);
  111. u8 //return the final channel plan decision
  112. hal_com_get_channel_plan(
  113. IN PADAPTER padapter,
  114. IN u8 hw_channel_plan, //channel plan from HW (efuse/eeprom)
  115. IN u8 sw_channel_plan, //channel plan from SW (registry/module param)
  116. IN u8 def_channel_plan, //channel plan used when the former two is invalid
  117. IN BOOLEAN AutoLoadFail
  118. );
  119. BOOLEAN
  120. HAL_IsLegalChannel(
  121. IN PADAPTER Adapter,
  122. IN u32 Channel
  123. );
  124. u8 MRateToHwRate(u8 rate);
  125. void HalSetBrateCfg(
  126. IN PADAPTER Adapter,
  127. IN u8 *mBratesOS,
  128. OUT u16 *pBrateCfg);
  129. BOOLEAN
  130. Hal_MappingOutPipe(
  131. IN PADAPTER pAdapter,
  132. IN u8 NumOutPipe
  133. );
  134. void hal_init_macaddr(_adapter *adapter);
  135. void c2h_evt_clear(_adapter *adapter);
  136. s32 c2h_evt_read(_adapter *adapter, u8 *buf);
  137. u8 rtw_hal_networktype_to_raid(_adapter *adapter,unsigned char network_type);
  138. u8 rtw_get_mgntframe_raid(_adapter *adapter,unsigned char network_type);
  139. #endif //__HAL_COMMON_H__