2 * Copyright (c) 2007-2008 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 /* Module Name : hb.c */
20 /* This module contains house keeping and timer functions. */
25 /************************************************************************/
28 /* Called by wrapper every 10 msec */
29 void zfiHeartBeat(zdev_t
* dev
)
31 zmw_get_wlan_dev(dev
);
36 /* => every 1.28 seconds */
37 if (wd
->cwm
.cw_enable
&& ((wd
->tick
& 0x7f) == 0x3f))
42 /* => every 2.56 seconds */
43 if ((wd
->tick
& 0xff) == 0)
45 zfAgingDefragList(dev
, 1);
51 /* LED Control (per 100ms) */
52 if ((wd
->tick
% 10) == 9)
55 #ifdef ZM_ENABLE_BA_RATECTRL
56 if (!wd
->modeMDKEnable
)
63 #ifdef ZM_ENABLE_REWRITE_BEACON_START_ADDRESS
64 if ( wd
->wlanMode
== ZM_MODE_IBSS
)
66 if ( zfStaIsConnected(dev
) )
68 zfReWriteBeaconStartAddress(dev
);
73 if ( wd
->wlanMode
== ZM_MODE_IBSS
)
75 if ( zfStaIsConnected(dev
) )
77 wd
->tickIbssReceiveBeacon
++; // add 10ms
79 if ( (wd
->sta
.ibssSiteSurveyStatus
== 2) &&
80 (wd
->tickIbssReceiveBeacon
== 300) &&
81 (wd
->sta
.ibssReceiveBeaconCount
< 3) )
83 zm_debug_msg0("It is happen!!! No error message");
84 zfReSetCurrentFrequency(dev
);
89 if(wd
->sta
.ReceivedPacketRateCounter
<= 0)
91 wd
->sta
.ReceivedPktRatePerSecond
= wd
->sta
.TotalNumberOfReceivePackets
;
92 //zm_debug_msg1("Receive Packet Per Second = ", wd->sta.ReceivedPktRatePerSecond);
93 if (wd
->sta
.TotalNumberOfReceivePackets
!= 0)
95 wd
->sta
.avgSizeOfReceivePackets
= wd
->sta
.TotalNumberOfReceiveBytes
/wd
->sta
.TotalNumberOfReceivePackets
;
99 wd
->sta
.avgSizeOfReceivePackets
= 640;
101 wd
->sta
.TotalNumberOfReceivePackets
= 0;
102 wd
->sta
.TotalNumberOfReceiveBytes
= 0;
103 wd
->sta
.ReceivedPacketRateCounter
= 100; /*for another 1s*/
107 wd
->sta
.ReceivedPacketRateCounter
--;
110 /* => every 1.28 seconds */
111 if((wd
->tick
& 0x7f) == 0x3f)
113 if( wd
->sta
.NonNAPcount
> 0)
115 wd
->sta
.RTSInAGGMode
= TRUE
;
116 wd
->sta
.NonNAPcount
= 0;
120 wd
->sta
.RTSInAGGMode
= FALSE
;
126 /* Maintain management time tick */
128 zfMmStaTimeTick(dev
);
130 //zfPhyCrTuning(dev);
132 //zfTxPowerControl(dev);
138 void zfDumpBssList(zdev_t
* dev
)
140 struct zsBssInfo
* pBssInfo
;
144 zmw_get_wlan_dev(dev
);
145 zmw_declare_for_critical_section();
147 zm_debug_msg0("***** Bss scan result *****");
148 zmw_enter_critical_section(dev
);
150 pBssInfo
= wd
->sta
.bssList
.head
;
152 for( i
=0; i
<wd
->sta
.bssList
.bssCount
; i
++ )
156 zm_debug_msg0("---------------------------");
159 zm_debug_msg1("BSS #", i
);
160 for(j
=0; j
<pBssInfo
->ssid
[1]; j
++)
162 str
[j
] = pBssInfo
->ssid
[2+j
];
164 str
[pBssInfo
->ssid
[1]] = 0;
165 zm_debug_msg0("SSID = ");
168 addr1
= (pBssInfo
->bssid
[0] << 16) + (pBssInfo
->bssid
[1] << 8 )
169 + pBssInfo
->bssid
[2];
170 addr2
= (pBssInfo
->bssid
[3] << 16) + (pBssInfo
->bssid
[4] << 8 )
171 + pBssInfo
->bssid
[5];
172 zm_debug_msg2("Bssid = ", addr1
);
173 zm_debug_msg2(" ", addr2
);
174 zm_debug_msg1("frequency = ", pBssInfo
->frequency
);
175 zm_debug_msg1("security type = ", pBssInfo
->securityType
);
176 zm_debug_msg1("WME = ", pBssInfo
->wmeSupport
);
177 zm_debug_msg1("beacon interval = ", pBssInfo
->beaconInterval
[0]
178 + (pBssInfo
->beaconInterval
[1] << 8));
179 zm_debug_msg1("capability = ", pBssInfo
->capability
[0]
180 + (pBssInfo
->capability
[1] << 8));
181 if ( pBssInfo
->supportedRates
[1] > 0 )
183 for( j
=0; j
<pBssInfo
->supportedRates
[1]; j
++ )
185 zm_debug_msg2("supported rates = ", pBssInfo
->supportedRates
[2+j
]);
189 for( j
=0; j
<pBssInfo
->extSupportedRates
[1]; j
++ )
191 zm_debug_msg2("ext supported rates = ", pBssInfo
->extSupportedRates
[2+j
]);
194 pBssInfo
= pBssInfo
->next
;
196 zmw_leave_critical_section(dev
);
198 zm_debug_msg0("***************************");