Commit | Line | Data |
---|---|---|
4bd43f50 LR |
1 | /* |
2 | * Copyright (c) 2007-2008 Atheros Communications Inc. | |
3 | * | |
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. | |
7 | * | |
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. | |
15 | */ | |
16 | /* */ | |
17 | /* Module Name : hb.c */ | |
18 | /* */ | |
19 | /* Abstract */ | |
20 | /* This module contains house keeping and timer functions. */ | |
21 | /* */ | |
22 | /* NOTES */ | |
23 | /* None */ | |
24 | /* */ | |
25 | /************************************************************************/ | |
26 | #include "cprecomp.h" | |
27 | ||
28 | /* Called by wrapper every 10 msec */ | |
29 | void zfiHeartBeat(zdev_t* dev) | |
30 | { | |
31 | zmw_get_wlan_dev(dev); | |
32 | ||
33 | wd->tick++; | |
34 | ||
35 | #if 0 | |
36 | /* => every 1.28 seconds */ | |
37 | if (wd->cwm.cw_enable && ((wd->tick & 0x7f) == 0x3f)) | |
38 | { | |
39 | zfHpCwmUpdate(dev); | |
40 | } | |
41 | #endif | |
42 | /* => every 2.56 seconds */ | |
43 | if ((wd->tick & 0xff) == 0) | |
44 | { | |
45 | zfAgingDefragList(dev, 1); | |
46 | } | |
47 | ||
48 | /* Watch Dog */ | |
49 | //zfWatchDog(); | |
50 | ||
51 | /* LED Control (per 100ms) */ | |
52 | if ((wd->tick % 10) == 9) | |
53 | { | |
54 | zfLed100msCtrl(dev); | |
55 | #ifdef ZM_ENABLE_BA_RATECTRL | |
56 | if (!wd->modeMDKEnable) | |
57 | { | |
58 | zfiDbgReadTally(dev); | |
59 | } | |
60 | #endif | |
61 | } | |
62 | ||
63 | #ifdef ZM_ENABLE_REWRITE_BEACON_START_ADDRESS | |
64 | if ( wd->wlanMode == ZM_MODE_IBSS ) | |
65 | { | |
66 | if ( zfStaIsConnected(dev) ) | |
67 | { | |
68 | zfReWriteBeaconStartAddress(dev); | |
69 | } | |
70 | } | |
71 | #endif | |
72 | ||
73 | if ( wd->wlanMode == ZM_MODE_IBSS ) | |
74 | { | |
75 | if ( zfStaIsConnected(dev) ) | |
76 | { | |
77 | wd->tickIbssReceiveBeacon++; // add 10ms | |
78 | ||
79 | if ( (wd->sta.ibssSiteSurveyStatus == 2) && | |
80 | (wd->tickIbssReceiveBeacon == 300) && | |
81 | (wd->sta.ibssReceiveBeaconCount < 3) ) | |
82 | { | |
83 | zm_debug_msg0("It is happen!!! No error message"); | |
84 | zfReSetCurrentFrequency(dev); | |
85 | } | |
86 | } | |
87 | } | |
88 | ||
89 | if(wd->sta.ReceivedPacketRateCounter <= 0) | |
90 | { | |
91 | wd->sta.ReceivedPktRatePerSecond = wd->sta.TotalNumberOfReceivePackets; | |
92 | //zm_debug_msg1("Receive Packet Per Second = ", wd->sta.ReceivedPktRatePerSecond); | |
93 | if (wd->sta.TotalNumberOfReceivePackets != 0) | |
94 | { | |
95 | wd->sta.avgSizeOfReceivePackets = wd->sta.TotalNumberOfReceiveBytes/wd->sta.TotalNumberOfReceivePackets; | |
96 | } | |
97 | else | |
98 | { | |
99 | wd->sta.avgSizeOfReceivePackets = 640; | |
100 | } | |
101 | wd->sta.TotalNumberOfReceivePackets = 0; | |
102 | wd->sta.TotalNumberOfReceiveBytes = 0; | |
103 | wd->sta.ReceivedPacketRateCounter = 100; /*for another 1s*/ | |
104 | } | |
105 | else | |
106 | { | |
107 | wd->sta.ReceivedPacketRateCounter--; | |
108 | } | |
109 | ||
110 | /* => every 1.28 seconds */ | |
111 | if((wd->tick & 0x7f) == 0x3f) | |
112 | { | |
113 | if( wd->sta.NonNAPcount > 0) | |
114 | { | |
115 | wd->sta.RTSInAGGMode = TRUE; | |
116 | wd->sta.NonNAPcount = 0; | |
117 | } | |
118 | else | |
119 | { | |
120 | wd->sta.RTSInAGGMode = FALSE; | |
121 | } | |
122 | } | |
123 | ||
124 | ||
125 | ||
126 | /* Maintain management time tick */ | |
127 | zfMmApTimeTick(dev); | |
128 | zfMmStaTimeTick(dev); | |
129 | ||
130 | //zfPhyCrTuning(dev); | |
131 | ||
132 | //zfTxPowerControl(dev); | |
133 | zfHpHeartBeat(dev); | |
134 | ||
135 | } | |
136 | ||
137 | ||
138 | void zfDumpBssList(zdev_t* dev) | |
139 | { | |
140 | struct zsBssInfo* pBssInfo; | |
141 | u8_t str[33]; | |
142 | u8_t i, j; | |
143 | u32_t addr1, addr2; | |
144 | zmw_get_wlan_dev(dev); | |
145 | zmw_declare_for_critical_section(); | |
146 | ||
147 | zm_debug_msg0("***** Bss scan result *****"); | |
148 | zmw_enter_critical_section(dev); | |
149 | ||
150 | pBssInfo = wd->sta.bssList.head; | |
151 | ||
152 | for( i=0; i<wd->sta.bssList.bssCount; i++ ) | |
153 | { | |
154 | if ( i ) | |
155 | { | |
156 | zm_debug_msg0("---------------------------"); | |
157 | } | |
158 | ||
159 | zm_debug_msg1("BSS #", i); | |
160 | for(j=0; j<pBssInfo->ssid[1]; j++) | |
161 | { | |
162 | str[j] = pBssInfo->ssid[2+j]; | |
163 | } | |
164 | str[pBssInfo->ssid[1]] = 0; | |
165 | zm_debug_msg0("SSID = "); | |
166 | zm_debug_msg0(str); | |
167 | ||
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 ) | |
182 | { | |
183 | for( j=0; j<pBssInfo->supportedRates[1]; j++ ) | |
184 | { | |
185 | zm_debug_msg2("supported rates = ", pBssInfo->supportedRates[2+j]); | |
186 | } | |
187 | } | |
188 | ||
189 | for( j=0; j<pBssInfo->extSupportedRates[1]; j++ ) | |
190 | { | |
191 | zm_debug_msg2("ext supported rates = ", pBssInfo->extSupportedRates[2+j]); | |
192 | } | |
193 | ||
194 | pBssInfo = pBssInfo->next; | |
195 | } | |
196 | zmw_leave_critical_section(dev); | |
197 | ||
198 | zm_debug_msg0("***************************"); | |
199 | } | |
200 |