66 #define C_SIFS_A 16 // micro sec.
69 #define C_EIFS 80 // micro sec.
72 #define C_SLOT_SHORT 9 // micro sec.
73 #define C_SLOT_LONG 20
75 #define C_CWMIN_A 15 // slot time
78 #define C_CWMAX 1023 // slot time
80 #define WAIT_BEACON_TX_DOWN_TMO 3 // Times
83 static unsigned char abyDefaultSuppRatesG[] = {
WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
87 static unsigned char abyDefaultSuppRatesA[] = {
WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
89 static unsigned char abyDefaultSuppRatesB[] = {
WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
96 {17, 17, 17, 17, 34, 23, 17, 11, 8, 5, 4, 3};
103 s_vCalculateOFDMRParameter(
104 unsigned char byRate,
106 unsigned char *pbyTxRate,
107 unsigned char *pbyRsvTime
129 s_vCalculateOFDMRParameter (
130 unsigned char byRate,
132 unsigned char *pbyTxRate,
133 unsigned char *pbyRsvTime
244 s_vSetRSPINF (
PSDevice pDevice,
CARD_PHY_TYPE ePHYType,
void *pvSupportRateIEs,
void *pvExtSupportRateIEs)
246 unsigned char byServ = 0, bySignal = 0;
247 unsigned short wLen = 0;
248 unsigned char byTxRate = 0, byRsvTime = 0;
298 s_vCalculateOFDMRParameter(
RATE_6M,
304 s_vCalculateOFDMRParameter(
RATE_9M,
310 s_vCalculateOFDMRParameter(
RATE_12M,
316 s_vCalculateOFDMRParameter(
RATE_18M,
322 s_vCalculateOFDMRParameter(
RATE_24M,
328 s_vCalculateOFDMRParameter(
335 s_vCalculateOFDMRParameter(
342 s_vCalculateOFDMRParameter(
443 unsigned char byCWMaxMin = 0;
444 unsigned char bySlot = 0;
445 unsigned char bySIFS = 0;
446 unsigned char byDIFS = 0;
447 unsigned char byData;
455 if (pSupportRates ==
NULL) {
465 if (byData == 0x1C) {
472 if (byData == 0x14) {
485 if (pSupportRates ==
NULL) {
494 if (byData == 0x20) {
500 if (byData == 0x18) {
511 if (pSupportRates ==
NULL) {
521 if (byData == 0x20) {
527 if (byData == 0x18) {
574 if (pDevice->
bySIFS != bySIFS) {
578 if (pDevice->
byDIFS != byDIFS) {
586 if (pDevice->
bySlot != bySlot) {
605 s_vSetRSPINF(pDevice, ePHYType, pSupportRates, pExtSupportRates);
665 unsigned int uBeaconInterval = 0;
666 unsigned int uLowNextTBTT = 0;
667 unsigned int uHighRemain = 0;
668 unsigned int uLowRemain = 0;
674 uBeaconInterval = wBeaconInterval * 1024;
676 uLowNextTBTT = (
LODWORD(qwNextTBTT) >> 10) << 10;
677 uLowRemain = (uLowNextTBTT) % uBeaconInterval;
679 uHighRemain = (((0xffffffff % uBeaconInterval) + 1) *
HIDWORD(qwNextTBTT))
681 uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
682 uLowRemain = uBeaconInterval - uLowRemain;
685 if ((~uLowNextTBTT) < uLowRemain) {
688 LODWORD(qwNextTBTT) = uLowNextTBTT + uLowRemain;
838 if (is_zero_ether_addr(pDevice->
abyBSSID) ==
false) {
886 void *pDeviceHandler,
887 unsigned short wDataRate
928 if (pDevice->
iTDUsed[uIdx] != 0)
980 printk(
"chester power off\n");
1001 bool bResult =
true;
1002 printk(
"chester power on\n");
1010 printk(
"chester pbRadioOff\n");
1035 printk(
"chester power on\n");
1069 void *pDeviceHandler,
1070 unsigned char *pbyBSSID,
1072 unsigned short wRSNCap
1077 unsigned int ii = 0;
1086 for (ii = 0; ii < 6; ii++) {
1096 if ((bRSNCapExist ==
true) && (wRSNCap &
BIT0)) {
1107 if ((bRSNCapExist ==
true) && (wRSNCap &
BIT0)) {
1120 void *pDeviceHandler
1144 void *pDeviceHandler,
1145 void *pvMeasureEIDs,
1146 unsigned int uNumOfMeasureEIDs
1153 bool bExpired =
true;
1156 if ((pEID ==
NULL) ||
1157 (uNumOfMeasureEIDs == 0)) {
1199 if (
LODWORD(qwStartTSF) < 1024) {
1233 if (bExpired ==
false) {
1271 void *pDeviceHandler,
1272 unsigned char byMode,
1273 unsigned char byNewChannel,
1274 unsigned char byCount
1278 bool bResult =
true;
1314 void *pDeviceHandler,
1316 unsigned char byQuietCount,
1317 unsigned char byQuietPeriod,
1318 unsigned short wQuietDuration,
1319 unsigned short wQuietOffset
1323 unsigned int ii = 0;
1325 if (bResetQuiet ==
true) {
1371 void *pDeviceHandler
1375 unsigned int ii = 0;
1376 unsigned long dwStartTime = 0xFFFFFFFF;
1377 unsigned int uCurrentQuietIndex = 0;
1378 unsigned long dwNextTime = 0;
1379 unsigned long dwGap = 0;
1380 unsigned long dwDuration = 0;
1386 uCurrentQuietIndex = ii;
1389 if (dwStartTime == 0xFFFFFFFF) {
1471 void *pDeviceHandler,
1472 unsigned char byChannel,
1506 void *pDeviceHandler,
1507 unsigned char *pbyMinPower,
1508 unsigned char *pbyMaxPower
1512 unsigned char byDec = 0;
1541 void *pDeviceHandler
1552 void *pDeviceHandler
1608 void *pDeviceHandler
1624 pDesc->m_rd0RD0.wResCount = (
unsigned short)(pDevice->
rx_buf_sz);
1626 pDesc->m_rd1RD1.wReqCount = (
unsigned short)(pDevice->
rx_buf_sz);
1632 pDesc->m_rd0RD0.wResCount = (
unsigned short)(pDevice->
rx_buf_sz);
1634 pDesc->m_rd1RD1.wReqCount = (
unsigned short)(pDevice->
rx_buf_sz);
1670 unsigned int ui = (
unsigned int) wRateIdx;
1673 if (pDevice->
wBasicRate & ((
unsigned short)1 << ui)) {
1674 return (
unsigned short)ui;
1678 return (
unsigned short)
RATE_1M;
1697 unsigned int ui = (
unsigned int) wRateIdx;
1708 if (pDevice->
wBasicRate & ((
unsigned short)1 << ui)) {
1710 return (
unsigned short)ui;
1734 unsigned char byServ = 0x00, bySignal = 0x00;
1735 unsigned short wLen = 0x0000;
1736 unsigned char byTxRate, byRsvTime;
1786 s_vCalculateOFDMRParameter(
RATE_6M,
1792 s_vCalculateOFDMRParameter(
RATE_9M,
1798 s_vCalculateOFDMRParameter(
RATE_12M,
1804 s_vCalculateOFDMRParameter(
RATE_18M,
1810 s_vCalculateOFDMRParameter(
RATE_24M,
1861 unsigned char byMaxMin = 0;
1953 unsigned short wRate = (
unsigned short)(1<<wRateIdx);
1980 return (
unsigned char)pDevice->
byBBType;
2005 switch(wLoopbackMode) {
2062 unsigned short wRxBcnTSFOffst= 0;
2067 (qwTSF2).
u.dwLowDword += (
unsigned long)(wRxBcnTSFOffst);
2068 if ((qwTSF2).u.dwLowDword < (
unsigned long)(wRxBcnTSFOffst)) {
2069 (qwTSF2).
u.dwHighDword++;
2079 return (qwTSFOffset);
2099 unsigned char byData;
2107 if (ww == W_MAX_TIMEOUT)
2133 unsigned int uLowNextTBTT;
2134 unsigned int uHighRemain, uLowRemain;
2135 unsigned int uBeaconInterval;
2137 uBeaconInterval = wBeaconInterval * 1024;
2139 uLowNextTBTT = (
LODWORD(qwTSF) >> 10) << 10;
2141 uLowRemain = (uLowNextTBTT) % uBeaconInterval;
2145 uHighRemain = (((0xffffffff % uBeaconInterval) + 1) *
HIDWORD(qwTSF))
2147 uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
2148 uLowRemain = uBeaconInterval - uLowRemain;
2151 if ((~uLowNextTBTT) < uLowRemain)
2154 LODWORD(qwTSF) = uLowNextTBTT + uLowRemain;