card.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. #include <linux/nl80211.h>
  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
  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. struct vnt_private;
  65. void CARDvSetRSPINF(struct vnt_private *, CARD_PHY_TYPE ePHYType);
  66. void vUpdateIFS(struct vnt_private *);
  67. void CARDvUpdateBasicTopRate(struct vnt_private *);
  68. bool CARDbAddBasicRate(struct vnt_private *, unsigned short wRateIdx);
  69. bool CARDbIsOFDMinBasicRate(struct vnt_private *);
  70. void CARDvSetLoopbackMode(void __iomem *dwIoBase, unsigned short wLoopbackMode);
  71. bool CARDbSoftwareReset(struct vnt_private *);
  72. void CARDvSetFirstNextTBTT(void __iomem *dwIoBase, unsigned short wBeaconInterval);
  73. void CARDvUpdateNextTBTT(void __iomem *dwIoBase, u64 qwTSF, unsigned short wBeaconInterval);
  74. bool CARDbGetCurrentTSF(void __iomem *dwIoBase, u64 *pqwCurrTSF);
  75. u64 CARDqGetNextTBTT(u64 qwTSF, unsigned short wBeaconInterval);
  76. u64 CARDqGetTSFOffset(unsigned char byRxRate, u64 qwTSF1, u64 qwTSF2);
  77. bool CARDbSetTxPower(struct vnt_private *, unsigned long ulTxPower);
  78. unsigned char CARDbyGetPktType(struct vnt_private *);
  79. void CARDvSafeResetTx(struct vnt_private *);
  80. void CARDvSafeResetRx(struct vnt_private *);
  81. bool CARDbRadioPowerOff(struct vnt_private *);
  82. bool CARDbRadioPowerOn(struct vnt_private *);
  83. bool CARDbIsShortPreamble(struct vnt_private *);
  84. bool CARDbIsShorSlotTime(struct vnt_private *);
  85. bool CARDbSetPhyParameter(struct vnt_private *, CARD_PHY_TYPE ePHYType,
  86. unsigned short wCapInfo, unsigned char byERPField,
  87. void *pvSupportRateIEs, void *pvExtSupportRateIEs);
  88. bool CARDbUpdateTSF(struct vnt_private *, unsigned char byRxRate,
  89. u64 qwBSSTimestamp, u64 qwLocalTSF);
  90. bool CARDbStopTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
  91. bool CARDbStartTxPacket(struct vnt_private *, CARD_PKT_TYPE ePktType);
  92. bool CARDbSetBeaconPeriod(struct vnt_private *, unsigned short wBeaconInterval);
  93. bool CARDbSetBSSID(struct vnt_private *,
  94. unsigned char *pbyBSSID, enum nl80211_iftype);
  95. bool CARDbPowerDown(struct vnt_private *);
  96. bool CARDbSetTxDataRate(struct vnt_private *, unsigned short wDataRate);
  97. bool CARDbRemoveKey(struct vnt_private *, unsigned char *pbyBSSID);
  98. bool
  99. CARDbAdd_PMKID_Candidate(
  100. struct vnt_private *,
  101. unsigned char *pbyBSSID,
  102. bool bRSNCapExist,
  103. unsigned short wRSNCap
  104. );
  105. void *
  106. CARDpGetCurrentAddress(
  107. struct vnt_private *
  108. );
  109. bool
  110. CARDbStartMeasure(
  111. struct vnt_private *,
  112. void *pvMeasureEIDs,
  113. unsigned int uNumOfMeasureEIDs
  114. );
  115. bool
  116. CARDbChannelSwitch(
  117. struct vnt_private *,
  118. unsigned char byMode,
  119. unsigned char byNewChannel,
  120. unsigned char byCount
  121. );
  122. bool
  123. CARDbSetQuiet(
  124. struct vnt_private *,
  125. bool bResetQuiet,
  126. unsigned char byQuietCount,
  127. unsigned char byQuietPeriod,
  128. unsigned short wQuietDuration,
  129. unsigned short wQuietOffset
  130. );
  131. bool
  132. CARDbStartQuiet(
  133. struct vnt_private *
  134. );
  135. void
  136. CARDvSetPowerConstraint(
  137. struct vnt_private *,
  138. unsigned char byChannel,
  139. char byPower
  140. );
  141. void
  142. CARDvGetPowerCapability(
  143. struct vnt_private *,
  144. unsigned char *pbyMinPower,
  145. unsigned char *pbyMaxPower
  146. );
  147. char
  148. CARDbyGetTransmitPower(
  149. struct vnt_private *
  150. );
  151. #endif // __CARD_H__