card.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /*
  2. * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. * File: card.h
  20. *
  21. * Purpose: Provide functions to setup NIC operation mode
  22. *
  23. * Author: Tevin Chen
  24. *
  25. * Date: May 21, 1996
  26. *
  27. */
  28. #ifndef __CARD_H__
  29. #define __CARD_H__
  30. #include "ttype.h"
  31. #include <linux/types.h>
  32. /*--------------------- Export Definitions -------------------------*/
  33. //
  34. // Loopback mode
  35. //
  36. // LOBYTE is MAC LB mode, HIBYTE is MII LB mode
  37. #define CARD_LB_NONE MAKEWORD(MAC_LB_NONE, 0)
  38. #define CARD_LB_MAC MAKEWORD(MAC_LB_INTERNAL, 0) // PHY must ISO, avoid MAC loopback packet go out
  39. #define CARD_LB_PHY MAKEWORD(MAC_LB_EXT, 0)
  40. #define DEFAULT_MSDU_LIFETIME 512 // ms
  41. #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
  42. #define DEFAULT_MGN_LIFETIME 8 // ms
  43. #define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
  44. #define CB_MAX_CHANNEL_24G 14
  45. #define CB_MAX_CHANNEL_5G 42 //[20050104] add channel9(5045MHz), 41==>42
  46. #define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
  47. typedef enum _CARD_PHY_TYPE {
  48. PHY_TYPE_AUTO,
  49. PHY_TYPE_11B,
  50. PHY_TYPE_11G,
  51. PHY_TYPE_11A
  52. } CARD_PHY_TYPE, *PCARD_PHY_TYPE;
  53. typedef enum _CARD_PKT_TYPE {
  54. PKT_TYPE_802_11_BCN,
  55. PKT_TYPE_802_11_MNG,
  56. PKT_TYPE_802_11_DATA,
  57. PKT_TYPE_802_11_ALL
  58. } CARD_PKT_TYPE, *PCARD_PKT_TYPE;
  59. typedef enum _CARD_STATUS_TYPE {
  60. CARD_STATUS_MEDIA_CONNECT,
  61. CARD_STATUS_MEDIA_DISCONNECT,
  62. CARD_STATUS_PMKID
  63. } CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;
  64. typedef enum _CARD_OP_MODE {
  65. OP_MODE_INFRASTRUCTURE,
  66. OP_MODE_ADHOC,
  67. OP_MODE_AP,
  68. OP_MODE_UNKNOWN
  69. } CARD_OP_MODE, *PCARD_OP_MODE;
  70. /*--------------------- Export Classes ----------------------------*/
  71. /*--------------------- Export Variables --------------------------*/
  72. /*--------------------- Export Functions --------------------------*/
  73. void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType);
  74. void vUpdateIFS(void *pDeviceHandler);
  75. void CARDvUpdateBasicTopRate(void *pDeviceHandler);
  76. bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx);
  77. bool CARDbIsOFDMinBasicRate(void *pDeviceHandler);
  78. void CARDvSetLoopbackMode(unsigned long dwIoBase, unsigned short wLoopbackMode);
  79. bool CARDbSoftwareReset(void *pDeviceHandler);
  80. void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterval);
  81. void CARDvUpdateNextTBTT(unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval);
  82. bool CARDbGetCurrentTSF(unsigned long dwIoBase, PQWORD pqwCurrTSF);
  83. QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval);
  84. QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2);
  85. bool CARDbSetTxPower(void *pDeviceHandler, unsigned long ulTxPower);
  86. unsigned char CARDbyGetPktType(void *pDeviceHandler);
  87. void CARDvSafeResetTx(void *pDeviceHandler);
  88. void CARDvSafeResetRx(void *pDeviceHandler);
  89. //xxx
  90. bool CARDbRadioPowerOff(void *pDeviceHandler);
  91. bool CARDbRadioPowerOn(void *pDeviceHandler);
  92. //bool CARDbSendPacket(void *pDeviceHandler, void *pPacket, CARD_PKT_TYPE ePktType, unsigned int uLength);
  93. bool CARDbIsShortPreamble(void *pDeviceHandler);
  94. bool CARDbIsShorSlotTime(void *pDeviceHandler);
  95. bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs);
  96. bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF);
  97. bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
  98. bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType);
  99. bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval);
  100. bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode);
  101. bool
  102. CARDbPowerDown(
  103. void *pDeviceHandler
  104. );
  105. bool CARDbSetTxDataRate(
  106. void *pDeviceHandler,
  107. unsigned short wDataRate
  108. );
  109. bool CARDbRemoveKey (void *pDeviceHandler, unsigned char *pbyBSSID);
  110. bool
  111. CARDbAdd_PMKID_Candidate (
  112. void *pDeviceHandler,
  113. unsigned char *pbyBSSID,
  114. bool bRSNCapExist,
  115. unsigned short wRSNCap
  116. );
  117. void *
  118. CARDpGetCurrentAddress (
  119. void *pDeviceHandler
  120. );
  121. bool
  122. CARDbStartMeasure (
  123. void *pDeviceHandler,
  124. void *pvMeasureEIDs,
  125. unsigned int uNumOfMeasureEIDs
  126. );
  127. bool
  128. CARDbChannelSwitch (
  129. void *pDeviceHandler,
  130. unsigned char byMode,
  131. unsigned char byNewChannel,
  132. unsigned char byCount
  133. );
  134. bool
  135. CARDbSetQuiet (
  136. void *pDeviceHandler,
  137. bool bResetQuiet,
  138. unsigned char byQuietCount,
  139. unsigned char byQuietPeriod,
  140. unsigned short wQuietDuration,
  141. unsigned short wQuietOffset
  142. );
  143. bool
  144. CARDbStartQuiet (
  145. void *pDeviceHandler
  146. );
  147. void
  148. CARDvSetPowerConstraint (
  149. void *pDeviceHandler,
  150. unsigned char byChannel,
  151. char byPower
  152. );
  153. void
  154. CARDvGetPowerCapability (
  155. void *pDeviceHandler,
  156. unsigned char *pbyMinPower,
  157. unsigned char *pbyMaxPower
  158. );
  159. char
  160. CARDbyGetTransmitPower (
  161. void *pDeviceHandler
  162. );
  163. #endif // __CARD_H__