|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of the DWlanLogicalChannel class. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 56 % |
|
20 */ |
|
21 |
|
22 #include "WlLddWlanLddConfig.h" |
|
23 #include "wlanlddcommon.h" |
|
24 #include "WlanLogicalChannel.h" |
|
25 #include "EthernetFrameMemMngr.h" |
|
26 #include "EtherCardIoc.h" |
|
27 #include "RWlanLogicalChannel.h" |
|
28 #include "Umac.h" |
|
29 #include "wllddoidmsgstorage.h" |
|
30 #include "WlanLogicalDevice.h" |
|
31 #include "osachunk.h" |
|
32 |
|
33 #ifdef RD_WLAN_DDK |
|
34 #include "osa.h" |
|
35 #include "wlanpddiface.h" |
|
36 #endif |
|
37 |
|
38 extern TAny* os_alloc( const TUint32 ); |
|
39 extern void os_free( const TAny* ); |
|
40 |
|
41 // Tx memory for frames created by UMAC |
|
42 const TUint32 KDmaTxMemSize = 4096; // equals to 1 MMU page on most systems |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 #ifndef RD_WLAN_DDK |
|
49 DWlanLogicalChannel::DWlanLogicalChannel( |
|
50 DWlanLogicalDevice& aParent, |
|
51 Umac& aUmac, |
|
52 TDynamicDfcQue& aDfcQ, |
|
53 DMutex& aMutex, |
|
54 DChunk*& aSharedMemoryChunk, |
|
55 WlanChunk*& aRxFrameMemoryPool ) |
|
56 #else |
|
57 DWlanLogicalChannel::DWlanLogicalChannel( |
|
58 DWlanLogicalDevice& aParent, |
|
59 Umac& aUmac, |
|
60 TDynamicDfcQue& aDfcQ, |
|
61 WlanOsa*& aOsa, |
|
62 DChunk*& aSharedMemoryChunk, |
|
63 WlanChunk*& aRxFrameMemoryPool ) |
|
64 #endif |
|
65 : |
|
66 iClient( NULL ), |
|
67 iUnit( KUnitMax ), |
|
68 iUmac( aUmac ), |
|
69 iDfcQ ( &aDfcQ ), |
|
70 iParent( aParent ), |
|
71 iWlanGeneralRequestStatus( NULL ), |
|
72 iWlanRequestNotifyStatus( NULL ), |
|
73 iWlanReceiveFrameStatus( NULL ), |
|
74 iWlanSendFrameStatus( NULL ), |
|
75 iIndicationBuffer( NULL ), |
|
76 iIndicationListHead( NULL ), |
|
77 iFreeIndicationListHead( NULL ), |
|
78 iResumeTxStatus( NULL ), |
|
79 iEthernetReceiveFrameStatus( NULL ), |
|
80 iEthernetFrameMemMngr( NULL ), |
|
81 iTimerDfc( TimerDfcDoToggle, this, 0 ), |
|
82 iTimer( OnTimeOut, this ), |
|
83 iVoiceCallEntryTimer( OnVoiceCallEntryTimerTimeOut, this ), |
|
84 iVoiceCallEntryTimerDfc( VoiceCallEntryTimerDfcDoToggle, this, 0 ), |
|
85 iNullTimer( OnNullTimerTimeOut, this ), |
|
86 iNullTimerDfc( NullTimerDfcDoToggle, this, 0 ), |
|
87 iNoVoiceTimer( OnNoVoiceTimerTimeOut, this ), |
|
88 iNoVoiceTimerDfc( NoVoiceTimerDfcDoToggle, this, 0 ), |
|
89 iKeepAliveTimer( OnKeepAliveTimerTimeOut, this ), |
|
90 iKeepAliveTimerDfc( KeepAliveTimerDfcDoToggle, this, 0 ), |
|
91 iActiveToLightPsTimer( OnActiveToLightPsTimerTimeOut, this ), |
|
92 iActiveToLightPsTimerDfc( ActiveToLightPsTimerDfcDoToggle, this, 0 ), |
|
93 iLightPsToActiveTimer( OnLightPsToActiveTimerTimeOut, this ), |
|
94 iLightPsToActiveTimerDfc( LightPsToActiveTimerDfcDoToggle, this, 0 ), |
|
95 iLightPsToDeepPsTimer( OnLightPsToDeepPsTimerTimeOut, this ), |
|
96 iLightPsToDeepPsTimerDfc( LightPsToDeepPsTimerDfcDoToggle, this, 0 ), |
|
97 iDfc( DfcDoToggle, this, 0 ), |
|
98 iTxTriggerDfc( TxTriggerDfcDoToggle, this, 0 ), |
|
99 iFlags( 0 ), |
|
100 iPowerHandler( *this, aDfcQ ), |
|
101 iPoweringDown( EFalse ), |
|
102 iDfcCtx( NULL ), |
|
103 #ifndef RD_WLAN_DDK |
|
104 iMutex( aMutex ), |
|
105 #else |
|
106 iOsa( aOsa ), |
|
107 #endif |
|
108 iSharedMemoryChunk( aSharedMemoryChunk ), |
|
109 iRxFrameMemoryPool( aRxFrameMemoryPool ), |
|
110 iTxActive( EFalse ), |
|
111 iAddTxFrameAllowed( ETrue ) |
|
112 { |
|
113 TraceDump(INIT_LEVEL, (("WLANLDD: DWlanLogicalChannel Ctor: 0x%08x"), this)); |
|
114 |
|
115 iTimerDfc.SetDfcQ( iDfcQ ); |
|
116 iVoiceCallEntryTimerDfc.SetDfcQ( iDfcQ ); |
|
117 iNullTimerDfc.SetDfcQ( iDfcQ ); |
|
118 iNoVoiceTimerDfc.SetDfcQ( iDfcQ ); |
|
119 iKeepAliveTimerDfc.SetDfcQ( iDfcQ ); |
|
120 iActiveToLightPsTimerDfc.SetDfcQ( iDfcQ ); |
|
121 iLightPsToActiveTimerDfc.SetDfcQ( iDfcQ ); |
|
122 iLightPsToDeepPsTimerDfc.SetDfcQ( iDfcQ ); |
|
123 iDfc.SetDfcQ( iDfcQ ); |
|
124 iTxTriggerDfc.SetDfcQ( iDfcQ ); |
|
125 |
|
126 // store client thread ID |
|
127 iClient = &Kern::CurrentThread(); |
|
128 |
|
129 TraceDump(INIT_LEVEL, (("WLANLDD: current thread 0x%08x"), iClient)); |
|
130 |
|
131 // open a refernce to client thread, so we don't get out of scope |
|
132 ((DObject*)iClient)->Open(); |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 DWlanLogicalChannel::~DWlanLogicalChannel() |
|
140 { |
|
141 TraceDump(INIT_LEVEL, (("WLANLDD: DWlanLogicalChannel Dtor: 0x%08x"), this)); |
|
142 |
|
143 if ( iUnit == KUnitWlan ) |
|
144 { |
|
145 iTimerDfc.Cancel(); |
|
146 iVoiceCallEntryTimerDfc.Cancel(); |
|
147 iNullTimerDfc.Cancel(); |
|
148 iNoVoiceTimerDfc.Cancel(); |
|
149 iKeepAliveTimerDfc.Cancel(); |
|
150 iActiveToLightPsTimerDfc.Cancel(); |
|
151 iLightPsToActiveTimerDfc.Cancel(); |
|
152 iLightPsToDeepPsTimerDfc.Cancel(); |
|
153 iDfc.Cancel(); |
|
154 |
|
155 // if there are any indication items currently pending, free them by |
|
156 // moving them to the free list |
|
157 PurgeIndicationList(); |
|
158 // delete all indication items from the free list |
|
159 FreeIndicationList(); |
|
160 // detach management side callback |
|
161 TraceDump(INIT_LEVEL, ("WLANLDD: detach managemement side callback from UMAC")); |
|
162 iUmac.Detach(); |
|
163 |
|
164 if ( iFlags & KPowerHandlerRegistered ) |
|
165 { |
|
166 // we have registered our power handler |
|
167 |
|
168 // if we stopping operations because of a power down request from power |
|
169 // manager, acknowledge back to power manager that we are now done |
|
170 if ( iPoweringDown ) |
|
171 { |
|
172 TraceDump(INIT_LEVEL, |
|
173 (("WLANLDD: DWlanLogicalChannel::~DWlanLogicalChannel(): signalling powerDownDone"))); |
|
174 iPowerHandler.OnPowerDownDone(); |
|
175 } |
|
176 |
|
177 // de-register our power handler from the power manager |
|
178 TraceDump(INIT_LEVEL, |
|
179 (("WLANLDD: DWlanLogicalChannel::~DWlanLogicalChannel(): de-register our powerhandler"))); |
|
180 iPowerHandler.Remove(); |
|
181 |
|
182 // destroy UMAC internal Tx memory buffer |
|
183 iDmaTxMemory.Finit(); |
|
184 } |
|
185 } |
|
186 else if ( iUnit == KUnitEthernet ) |
|
187 { |
|
188 iTxTriggerDfc.Cancel(); |
|
189 |
|
190 // detach protocol stack side callback |
|
191 TraceDump(INIT_LEVEL, |
|
192 ("WLANLDD: detach protocol stack side callback from UMAC")); |
|
193 iUmac.DetachProtocolStackSideUmacCb(); |
|
194 } |
|
195 |
|
196 if ( iEthernetFrameMemMngr ) |
|
197 { |
|
198 TraceDump(INIT_LEVEL, ("WLANLDD: deallocate ethernet frame memory pool")); |
|
199 TraceDump(MEMORY, (("WLANLDD: delete DEthernetFrameMemMngr: 0x%08x"), |
|
200 reinterpret_cast<TUint32>(iEthernetFrameMemMngr))); |
|
201 |
|
202 delete iEthernetFrameMemMngr; |
|
203 iEthernetFrameMemMngr = NULL; |
|
204 } |
|
205 |
|
206 iDfcQ = NULL; // destroyed elsewhere (by the owner) |
|
207 |
|
208 // close our refernce to client thread as the very last thing we do |
|
209 Kern::SafeClose( reinterpret_cast<DObject*&>(iClient), NULL); |
|
210 } |
|
211 |
|
212 // --------------------------------------------------------------------------- |
|
213 // |
|
214 // --------------------------------------------------------------------------- |
|
215 // |
|
216 DChunk*& DWlanLogicalChannel::SharedMemoryChunk() |
|
217 { |
|
218 return iSharedMemoryChunk; |
|
219 } |
|
220 |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 // --------------------------------------------------------------------------- |
|
224 // |
|
225 void DWlanLogicalChannel::SetRxBufAlignmentPadding( |
|
226 TInt aRxBufAlignmentPadding ) |
|
227 { |
|
228 iParent.SetRxBufAlignmentPadding( aRxBufAlignmentPadding ); |
|
229 } |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 // |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 TInt DWlanLogicalChannel::RxBufAlignmentPadding() const |
|
236 { |
|
237 return iParent.RxBufAlignmentPadding(); |
|
238 } |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 // |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 TBool DWlanLogicalChannel::InitIndicationListEntries() |
|
245 { |
|
246 // Initialize indication list entries |
|
247 TBool ret( ETrue ); // true for success |
|
248 |
|
249 for ( TUint32 i = 0 ; i < KMaxIndicationListEntries; ++i ) |
|
250 { |
|
251 TIndicationListEntry* tmp = new TIndicationListEntry; |
|
252 |
|
253 if ( tmp ) |
|
254 { |
|
255 TraceDump(MEMORY, (("WLANLDD: new TIndicationListEntry: 0x%08x"), |
|
256 reinterpret_cast<TUint32>(tmp))); |
|
257 |
|
258 // The ReleaseIndicationListEntry |
|
259 // function can also be used for initialization |
|
260 ReleaseIndicationListEntry( tmp ); |
|
261 } |
|
262 else |
|
263 { |
|
264 // alloc failed no use to continue |
|
265 ret = EFalse; |
|
266 break; |
|
267 } |
|
268 } |
|
269 |
|
270 return ret; |
|
271 } |
|
272 |
|
273 // --------------------------------------------------------------------------- |
|
274 // If an error occurs in this method, we set iPdd to NULL to prevent |
|
275 // PDD object destruction in base class (DLogicalChannelBase) destructor. |
|
276 // DLogicalChannelBase destructor gets called as this logical channel instance |
|
277 // gets destoyed when this method returns with an error. |
|
278 // The PDD object gets destructed elsewhere. |
|
279 // --------------------------------------------------------------------------- |
|
280 // |
|
281 TInt DWlanLogicalChannel::DoCreate( |
|
282 TInt aUnit, |
|
283 const TDesC8* /*aInfo*/, |
|
284 const TVersion& /*aVer*/ ) |
|
285 { |
|
286 TraceDump(INIT_LEVEL, ("WLANLDD: DWlanLogicalChannel::DoCreate")); |
|
287 TraceDump(INIT_LEVEL, |
|
288 (("WLANLDD: current thread 0x%08x"), &Kern::CurrentThread())); |
|
289 TraceDump(INIT_LEVEL, (("WLANLDD: aUnit %d"), aUnit)); |
|
290 |
|
291 if ( !Kern::CurrentThreadHasCapability( |
|
292 ECapabilityCommDD, |
|
293 __PLATSEC_DIAGNOSTIC_STRING( "Checked by wlan.ldd"))) |
|
294 { |
|
295 iPdd = NULL; |
|
296 return KErrPermissionDenied; |
|
297 } |
|
298 |
|
299 // enable reception of requests from user mode |
|
300 SetDfcQ(iDfcQ); |
|
301 iMsgQ.Receive(); |
|
302 |
|
303 // length of the allocation unit to be used for OSA interconnect |
|
304 // (DMA capable) memory and frame Rx/Tx buffers. |
|
305 // If WLAN DDK is used and the WLAN PDD capabilities query below |
|
306 // returns a non-NULL response and the PDD indicates support for |
|
307 // cached memory, we use the length of the processor's cache line |
|
308 // - returned in that response - as the allocation unit length. |
|
309 // Otherwise we use this default value |
|
310 TInt allocationUnit ( 32 ); |
|
311 |
|
312 iUnit = aUnit; // store the unit |
|
313 |
|
314 // PDD has been loaded and created by the framework at this point |
|
315 |
|
316 if ( iUnit == KUnitWlan ) |
|
317 { |
|
318 if ( !InitIndicationListEntries() ) |
|
319 { |
|
320 iPdd = NULL; |
|
321 return KErrNoMemory; |
|
322 } |
|
323 |
|
324 // attach management side callback |
|
325 TraceDump(INIT_LEVEL, ("WLANLDD: attach managemement side callback to UMAC")); |
|
326 iUmac.Attach( *this ); |
|
327 |
|
328 #ifndef RD_WLAN_DDK |
|
329 WHA::Wha* wha( reinterpret_cast<WHA::Wha*>(iPdd) ); |
|
330 // attach the WHA object to UMAC |
|
331 TraceDump(INIT_LEVEL, ("WLANLDD: attach WHA object to UMAC")); |
|
332 iUmac.AttachWsa( wha ); |
|
333 #else |
|
334 |
|
335 MWlanPddIface* pdd( reinterpret_cast<MWlanPddIface*>(iPdd) ); |
|
336 |
|
337 TraceDump(INIT_LEVEL, |
|
338 (("WLANLDD: DWlanLogicalChannel::DoCreate: wlanpdd addr: 0x%08x"), |
|
339 pdd)); |
|
340 |
|
341 // determine PDD capabilities |
|
342 |
|
343 MWlanPddIface::SCapabilities* pddCapabilities ( NULL ); |
|
344 |
|
345 pdd->GetCapabilities( pddCapabilities ); |
|
346 |
|
347 TraceDump(INIT_LEVEL, |
|
348 (("WLANLDD: DWlanLogicalChannel::DoCreate: pddCapabilities ptr: 0x%08x"), |
|
349 reinterpret_cast<TUint32>(pddCapabilities))); |
|
350 |
|
351 if ( pddCapabilities ) |
|
352 { |
|
353 TraceDump(INIT_LEVEL, |
|
354 (("WLANLDD: DWlanLogicalChannel::DoCreate: wlanpdd iCapabilities: 0x%08x"), |
|
355 pddCapabilities->iCapabilities)); |
|
356 |
|
357 if ( pddCapabilities->iCapabilities & |
|
358 MWlanPddIface::SCapabilities::KCachedMemory ) |
|
359 { |
|
360 TraceDump(INIT_LEVEL, |
|
361 ("WLANLDD: DWlanLogicalChannel::DoCreate: use cached memory")); |
|
362 |
|
363 iParent.UseCachedMemory( ETrue ); |
|
364 |
|
365 TraceDump(INIT_LEVEL, |
|
366 (("WLANLDD: DWlanLogicalChannel::DoCreate: wlanpdd iCacheLineLength: %d"), |
|
367 pddCapabilities->iCacheLineLength)); |
|
368 |
|
369 allocationUnit = pddCapabilities->iCacheLineLength; |
|
370 } |
|
371 delete pddCapabilities; |
|
372 pddCapabilities = NULL; |
|
373 } |
|
374 |
|
375 // initialize OSA |
|
376 if ( !iOsa->Initialize( |
|
377 iParent.UseCachedMemory(), |
|
378 allocationUnit, |
|
379 iDfcQ ) ) |
|
380 { |
|
381 // init failed. We cannot continue |
|
382 |
|
383 TraceDump(ERROR_LEVEL, |
|
384 ("WLANLDD: DWlanLogicalChannel::DoCreate: osa init failed, abort")); |
|
385 |
|
386 iPdd = NULL; |
|
387 return KErrGeneral; |
|
388 } |
|
389 |
|
390 TraceDump(INIT_LEVEL, |
|
391 ("WLANLDD: DWlanLogicalChannel::DoCreate: attach osa and osaext to wlanpdd")); |
|
392 TraceDump(INIT_LEVEL, |
|
393 (("WLANLDD: DWlanLogicalChannel::DoCreate: osa and osaext addr: 0x%08x"), |
|
394 reinterpret_cast<TUint32>(iOsa))); |
|
395 |
|
396 // pass interfaces to PDD |
|
397 const TBool ret( pdd->Attach( *iOsa, *iOsa ) ); |
|
398 if ( ret ) |
|
399 { |
|
400 TraceDump(INIT_LEVEL, |
|
401 ("WLANLDD: DWlanLogicalChannel::DoCreate: extract WHA and attach it to UMAC")); |
|
402 // extract wha and attach it to UMAC |
|
403 iUmac.AttachWsa( &(pdd->Extract()) ); |
|
404 } |
|
405 else |
|
406 { |
|
407 // attach failure abort |
|
408 TraceDump(WARNING_LEVEL, ("WLANLDD: PDD attach failure -> abort")); |
|
409 iPdd = NULL; |
|
410 return KErrNoMemory; |
|
411 } |
|
412 #endif |
|
413 |
|
414 #ifndef RD_WLAN_DDK |
|
415 // pass the mutex to WHA |
|
416 wha->Mutex( reinterpret_cast<WHA::TMutexHandle>(&iMutex) ); |
|
417 #endif |
|
418 |
|
419 // register our power handler with the power manager |
|
420 TraceDump(INIT_LEVEL, |
|
421 (("WLANLDD: DWlanLogicalChannel::DoCreate: register our powerhandler"))); |
|
422 iPowerHandler.Add(); |
|
423 iFlags |= KPowerHandlerRegistered; // note that we have registered |
|
424 |
|
425 // create UMAC internal Tx memory buffer |
|
426 if ( iDmaTxMemory.Init( KDmaTxMemSize, iParent.UseCachedMemory() ) |
|
427 == KDmaTxMemSize ) |
|
428 { |
|
429 // success; no further action needed |
|
430 } |
|
431 else |
|
432 { |
|
433 // failure |
|
434 iPdd = NULL; |
|
435 return KErrNoMemory; |
|
436 } |
|
437 } |
|
438 else if ( iUnit == KUnitEthernet ) |
|
439 { |
|
440 // attach protocol stack side callbac |
|
441 iUmac.AttachProtocolStackSideUmacCb( *this ); |
|
442 } |
|
443 else |
|
444 { |
|
445 // unknown unit |
|
446 |
|
447 TraceDump(ERROR_LEVEL, |
|
448 (("WLANLDD: DWlanLogicalChannel::DoCreate: ERROR: unknown unit: %d"), |
|
449 iUnit)); |
|
450 iPdd = NULL; |
|
451 return KErrPermissionDenied; |
|
452 } |
|
453 |
|
454 // init ethernet frame memory pool manager |
|
455 iEthernetFrameMemMngr = DEthernetFrameMemMngr::Init( |
|
456 aUnit, |
|
457 *this, |
|
458 iRxFrameMemoryPool, |
|
459 iParent.UseCachedMemory(), |
|
460 allocationUnit ); |
|
461 |
|
462 if ( iEthernetFrameMemMngr ) |
|
463 { |
|
464 // init success -> continue |
|
465 TraceDump(INIT_LEVEL, (("WLANLDD: ethernet memory pool allocated: 0x%08x"), |
|
466 iEthernetFrameMemMngr)); |
|
467 } |
|
468 else |
|
469 { |
|
470 // init failure no use to continue |
|
471 TraceDump(WARNING_LEVEL, |
|
472 ("WLANLDD: ethernet memory pool allocation failure")); |
|
473 |
|
474 iPdd = NULL; |
|
475 return KErrNoMemory; |
|
476 } |
|
477 |
|
478 return KErrNone; |
|
479 } |
|
480 |
|
481 // --------------------------------------------------------------------------- |
|
482 // |
|
483 // --------------------------------------------------------------------------- |
|
484 // |
|
485 void DWlanLogicalChannel::HandleMsg(TMessageBase* aMsg) |
|
486 { |
|
487 TraceDump(WLM_CMD, ("WLANLDD: DWlanLogicalChannel::HandleMsg")); |
|
488 |
|
489 // we are now executing in a DFC thread context |
|
490 // acquire mutex |
|
491 #ifndef RD_WLAN_DDK |
|
492 Kern::MutexWait( iMutex ); |
|
493 #else |
|
494 iOsa->MutexAcquire(); |
|
495 #endif |
|
496 |
|
497 TraceDump(MUTEX, |
|
498 (("WLANLDD: DWlanLogicalChannel::HandleMsg: mutex acquired"))); |
|
499 |
|
500 TThreadMessage& m = *reinterpret_cast<TThreadMessage*>( aMsg ); |
|
501 |
|
502 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: current thread 0x%08x"), |
|
503 &Kern::CurrentThread())); |
|
504 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: client thread 0x%08x"), m.Client())); |
|
505 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: channel creator thread 0x%08x"), |
|
506 iClient)); |
|
507 |
|
508 // Get message type |
|
509 TInt id = m.iValue; |
|
510 |
|
511 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: message id: %d"), id)); |
|
512 |
|
513 // Decode the message type and dispatch it to the relevent handler function... |
|
514 |
|
515 // A logical channel can be closed either explicitly by its user-side client, |
|
516 // or implicitly if the client thread dies. In the latter case, the channel |
|
517 // is closed in the context of the kernel supervisor thread. |
|
518 if ( id == ECloseMsg ) |
|
519 { |
|
520 TraceDump(WLM_CMD_DETAILS, ("WLANLDD: close message")); |
|
521 |
|
522 if( m.Client() == iClient ) |
|
523 { |
|
524 // channel closed by client |
|
525 |
|
526 // trick to disable PDD object dealloc |
|
527 // as this logical channel gets destoyed after this |
|
528 // and iPdd is deallocated in DLogicalChannelBase |
|
529 iPdd = NULL; |
|
530 } |
|
531 |
|
532 // release mutex |
|
533 // Note that in this case we release the mutex before completing the |
|
534 // client message. Reason: When SMP is used, doing these actions in |
|
535 // the reverse order could, in principle, lead to a situation where |
|
536 // the channel instance has already been destroyed (by another thread) |
|
537 // when the mutex is tried to be released. |
|
538 |
|
539 #ifndef RD_WLAN_DDK |
|
540 Kern::MutexSignal( iMutex ); |
|
541 #else |
|
542 iOsa->MutexRelease(); |
|
543 #endif |
|
544 |
|
545 TraceDump(MUTEX, |
|
546 (("WLANLDD: DWlanLogicalChannel::HandleMsg: mutex released"))); |
|
547 |
|
548 m.Complete( KErrNone, EFalse ); |
|
549 |
|
550 return; |
|
551 } |
|
552 |
|
553 // For all other message types, we check that the message is from the thread |
|
554 // that created us. |
|
555 if ( m.Client() != iClient ) |
|
556 { |
|
557 TraceDump(SERIOUS_LEVEL, (("WLANLDD: ERROR: requesting thread: 0x%08x"), |
|
558 m.Client())); |
|
559 TraceDump(SERIOUS_LEVEL, ("WLANLDD: ERROR: request from wrong thread")); |
|
560 |
|
561 m.Complete( KErrPermissionDenied, ETrue ); |
|
562 } |
|
563 else if ( id == KMaxTInt ) |
|
564 { |
|
565 TraceDump(WLM_CMD_DETAILS, ("WLANLDD: DoCancel")); |
|
566 |
|
567 // DoCancel |
|
568 DoCancel( m.Int0() ); |
|
569 m.Complete( KErrNone,ETrue ); |
|
570 } |
|
571 else if ( id < 0 ) |
|
572 { |
|
573 TraceDump(WLM_CMD_DETAILS, ("WLANLDD: DoRequest")); |
|
574 |
|
575 // DoRequest |
|
576 TRequestStatus* req_status = reinterpret_cast<TRequestStatus*>( m.Ptr0() ); |
|
577 const TInt r = DoRequest( ~id, req_status, m.Ptr1(), m.Ptr2() ); |
|
578 if ( r != KErrNone) |
|
579 { |
|
580 // this branch means that an error of somekind has occurred |
|
581 // we complete the request synchronously |
|
582 Kern::RequestComplete( m.Client(), req_status, r ); |
|
583 } |
|
584 |
|
585 m.Complete( KErrNone, ETrue ); |
|
586 } |
|
587 else |
|
588 { |
|
589 TraceDump(WLM_CMD_DETAILS, ("WLANLDD: DoControl")); |
|
590 |
|
591 // DoControl |
|
592 const TInt r = DoControl( id, m.Ptr0(), m.Ptr1() ); |
|
593 m.Complete( r, ETrue ); |
|
594 } |
|
595 |
|
596 // release mutex |
|
597 |
|
598 #ifndef RD_WLAN_DDK |
|
599 Kern::MutexSignal( iMutex ); |
|
600 #else |
|
601 iOsa->MutexRelease(); |
|
602 #endif |
|
603 |
|
604 TraceDump(MUTEX, |
|
605 (("WLANLDD: DWlanLogicalChannel::HandleMsg: mutex released"))); |
|
606 } |
|
607 |
|
608 |
|
609 // --------------------------------------------------------------------------- |
|
610 // |
|
611 // --------------------------------------------------------------------------- |
|
612 // |
|
613 TAny* DWlanLogicalChannel::DoControlFast( TInt aFunction, TAny* param ) |
|
614 { |
|
615 TAny* ret( NULL ); |
|
616 TBool triggerTx ( EFalse ); |
|
617 |
|
618 TraceDump(WLM_CMD_DETAILS, |
|
619 (("WLANLDD: DWlanLogicalChannel::DoControlFast: current thread 0x%08x"), |
|
620 &Kern::CurrentThread())); |
|
621 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: channel creator thread: 0x%08x"), |
|
622 iClient)); |
|
623 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: function: 0x%x"), aFunction)); |
|
624 |
|
625 // Note! We are executing in the context of the client's thread, but |
|
626 // in supervisor mode |
|
627 |
|
628 // acquire mutex |
|
629 #ifndef RD_WLAN_DDK |
|
630 Kern::MutexWait( iMutex ); |
|
631 #else |
|
632 iOsa->MutexAcquire(); |
|
633 #endif |
|
634 |
|
635 TraceDump(MUTEX, |
|
636 (("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex acquired"))); |
|
637 |
|
638 switch ( aFunction ) |
|
639 { |
|
640 case RPcmNetCardIf::EControlFastAllocTxBuffer: |
|
641 ret = iEthernetFrameMemMngr->AllocTxBuffer( |
|
642 reinterpret_cast<TUint>(param) ); |
|
643 |
|
644 if ( !ret && iAddTxFrameAllowed ) |
|
645 { |
|
646 iAddTxFrameAllowed = EFalse; |
|
647 |
|
648 TraceDump( NWSA_TX, |
|
649 ("WLANLDD: DWlanLogicalChannel::DoControlFast: stop flow from protocol stack") ); |
|
650 } |
|
651 break; |
|
652 |
|
653 case RPcmNetCardIf::EControlFastAddTxFrame: |
|
654 { |
|
655 #ifndef NDEBUG |
|
656 if ( !iAddTxFrameAllowed ) |
|
657 { |
|
658 TraceDump(ERROR_LEVEL, |
|
659 ("WLANLDD: DWlanLogicalChannel::DoControlFast: WARNING: AddTxFrame req. when flow ctrl is on")); |
|
660 } |
|
661 #endif |
|
662 if ( iEthernetFrameMemMngr->AllTxQueuesEmpty() ) |
|
663 { |
|
664 triggerTx = ETrue; |
|
665 } |
|
666 |
|
667 TDataBuffer* discardFrame ( NULL ); |
|
668 |
|
669 ret = reinterpret_cast<TAny*>(iEthernetFrameMemMngr->AddTxFrame( |
|
670 reinterpret_cast<TDataBuffer*>(param), |
|
671 discardFrame, |
|
672 iUmac.UserDataTxEnabled() )); |
|
673 |
|
674 if ( discardFrame ) |
|
675 { |
|
676 TraceDump( NWSA_TX_DETAILS, |
|
677 (("WLANLDD: DWlanLogicalChannel::DoControlFast: have to drop tx frame of UP: %d"), |
|
678 reinterpret_cast<TDataBuffer*>(param)->UserPriority()) ); |
|
679 |
|
680 iEthernetFrameMemMngr->FreeTxPacket( discardFrame ); |
|
681 } |
|
682 |
|
683 if ( !ret ) |
|
684 { |
|
685 iAddTxFrameAllowed = EFalse; |
|
686 |
|
687 TraceDump( NWSA_TX, |
|
688 ("WLANLDD: DWlanLogicalChannel::DoControlFast: stop flow from protocol stack") ); |
|
689 } |
|
690 break; |
|
691 } |
|
692 default: |
|
693 #ifndef NDEBUG |
|
694 TraceDump(ERROR_LEVEL, (("WLANLDD: unknown request: %d"), |
|
695 aFunction)); |
|
696 os_assert( |
|
697 (TUint8*)("WLANLDD: panic"), |
|
698 (TUint8*)(WLAN_FILE), |
|
699 __LINE__ ); |
|
700 #endif |
|
701 break; |
|
702 } |
|
703 |
|
704 // release mutex |
|
705 #ifndef RD_WLAN_DDK |
|
706 Kern::MutexSignal( iMutex ); |
|
707 #else |
|
708 iOsa->MutexRelease(); |
|
709 #endif |
|
710 |
|
711 TraceDump(MUTEX, |
|
712 ("WLANLDD: DWlanLogicalChannel::DoControlFast: mutex released")); |
|
713 |
|
714 if ( triggerTx ) |
|
715 { |
|
716 // Trigger a new Tx - via a DFC. |
|
717 // Note that we do this outside of mutex protection, as this block of |
|
718 // code is executed by a lower priority (user side) thread, and the |
|
719 // DFC by a higher priority (kernel side) thread, and the latter will |
|
720 // also need to acquire the same mutex before it can proceed. So, as |
|
721 // the lower priority thread will get paused and the higher priority |
|
722 // thread will get scheduled (to execute the DFC), we don't want the |
|
723 // higher priority thread to need to wait for the mutex. So we |
|
724 // released the mutex first in this code block and after that enque |
|
725 // the DFC request. |
|
726 if ( !( iFlags & KTxTriggerArmed ) ) |
|
727 { |
|
728 iFlags |= KTxTriggerArmed; |
|
729 iTxTriggerDfc.Enque(); |
|
730 } |
|
731 } |
|
732 |
|
733 return ret; |
|
734 } |
|
735 |
|
736 // --------------------------------------------------------------------------- |
|
737 // |
|
738 // --------------------------------------------------------------------------- |
|
739 // |
|
740 void DWlanLogicalChannel::DoCancel( TInt aMask ) |
|
741 { |
|
742 if ( iUnit == KUnitWlan ) |
|
743 { |
|
744 if ( aMask & ( 1 << EWlanRequestNotify ) ) |
|
745 { |
|
746 TraceDump(INFO_LEVEL, |
|
747 ("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side notify cancel")); |
|
748 |
|
749 CancelIndicationRequest(); |
|
750 Kern::RequestComplete( |
|
751 iClient, iWlanRequestNotifyStatus, KErrServerTerminated ); |
|
752 iWlanRequestNotifyStatus = NULL; |
|
753 } |
|
754 else if ( aMask & ( 1 << EWlanRequestFrame ) ) |
|
755 { |
|
756 TraceDump(INFO_LEVEL, |
|
757 ("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side frame read cancel")); |
|
758 |
|
759 Kern::RequestComplete( |
|
760 iClient, iWlanReceiveFrameStatus, KErrServerTerminated ); |
|
761 iWlanReceiveFrameStatus = NULL; |
|
762 } |
|
763 else |
|
764 { |
|
765 TraceDump(ERROR_LEVEL, |
|
766 (("WLANLDD: DWlanLogicalChannel::DoCancel: mgmt side unhandled mask panic: 0x%08x"), |
|
767 aMask)); |
|
768 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
769 } |
|
770 } |
|
771 else if ( iUnit == KUnitEthernet ) |
|
772 { |
|
773 if ( aMask & ( 1 << RPcmNetCardIf::EControlResumeTxCancel ) ) |
|
774 { |
|
775 TraceDump(INFO_LEVEL, |
|
776 ("WLANLDD: DWlanLogicalChannel::DoCancel: user side resume Tx cancel")); |
|
777 |
|
778 Kern::RequestComplete( |
|
779 iClient, iResumeTxStatus, KErrServerTerminated ); |
|
780 iResumeTxStatus = NULL; |
|
781 } |
|
782 else if ( aMask & ( 1 << RPcmNetCardIf::EControlReadCancel ) ) |
|
783 { |
|
784 TraceDump(INFO_LEVEL, |
|
785 ("WLANLDD: DWlanLogicalChannel::DoCancel: user side frame read cancel")); |
|
786 |
|
787 Kern::RequestComplete( |
|
788 iClient, iEthernetReceiveFrameStatus, KErrServerTerminated ); |
|
789 iEthernetReceiveFrameStatus = NULL; |
|
790 } |
|
791 else |
|
792 { |
|
793 TraceDump(ERROR_LEVEL, |
|
794 (("WLANLDD: DWlanLogicalChannel::DoCancel: user side unhandled mask panic: 0x%08x"), |
|
795 aMask)); |
|
796 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
797 } |
|
798 } |
|
799 else |
|
800 { |
|
801 TraceDump(ERROR_LEVEL, (("WLANLDD: DoCancel unknown unit panic: %d"), |
|
802 iUnit)); |
|
803 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
804 } |
|
805 } |
|
806 |
|
807 // --------------------------------------------------------------------------- |
|
808 // |
|
809 // --------------------------------------------------------------------------- |
|
810 // |
|
811 TBool DWlanLogicalChannel::ProtocolStackDataReceiveComplete( |
|
812 const TDataBuffer*& aBufferStart, |
|
813 TUint32 aNumOfBuffers ) |
|
814 { |
|
815 if ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete( aBufferStart, |
|
816 aNumOfBuffers ) ) |
|
817 { |
|
818 Kern::RequestComplete( iClient, iEthernetReceiveFrameStatus, KErrNone ); |
|
819 iEthernetReceiveFrameStatus = NULL; |
|
820 } |
|
821 |
|
822 return ETrue; // indicate always successful processing |
|
823 } |
|
824 |
|
825 // ----------------------------------------------------------------------------- |
|
826 // |
|
827 // ----------------------------------------------------------------------------- |
|
828 // |
|
829 TBool DWlanLogicalChannel::ProtocolStackSideClientReady() const |
|
830 { |
|
831 TBool status ( EFalse ); |
|
832 |
|
833 if ( iEthernetFrameMemMngr && iEthernetFrameMemMngr->IsMemInUse() ) |
|
834 { |
|
835 status = ETrue; |
|
836 } |
|
837 |
|
838 return status; |
|
839 } |
|
840 |
|
841 // --------------------------------------------------------------------------- |
|
842 // |
|
843 // --------------------------------------------------------------------------- |
|
844 // |
|
845 void DWlanLogicalChannel::UserDataReEnabled() |
|
846 { |
|
847 if ( !( iFlags & KTxTriggerArmed ) ) |
|
848 { |
|
849 iFlags |= KTxTriggerArmed; |
|
850 iTxTriggerDfc.Enque(); |
|
851 } |
|
852 } |
|
853 |
|
854 // --------------------------------------------------------------------------- |
|
855 // |
|
856 // --------------------------------------------------------------------------- |
|
857 // |
|
858 TUint8* DWlanLogicalChannel::DmaPrivateTxMemory() |
|
859 { |
|
860 return reinterpret_cast<TUint8*>(iDmaTxMemory.Addr()); |
|
861 } |
|
862 |
|
863 // --------------------------------------------------------------------------- |
|
864 // |
|
865 // --------------------------------------------------------------------------- |
|
866 // |
|
867 void DWlanLogicalChannel::SetProtocolStackTxOffset( |
|
868 TUint32 aEthernetFrameTxOffset ) |
|
869 { |
|
870 const TUint32 KNotRelevant ( 0 ); |
|
871 |
|
872 if ( iEthernetFrameMemMngr ) |
|
873 { |
|
874 TraceDump(NWSA_TX_DETAILS, |
|
875 (("WLANLDD: DWlanLogicalChannel::SetProtocolStackTxOffset: aEthernetFrameTxOffset: %d"), |
|
876 aEthernetFrameTxOffset )); |
|
877 |
|
878 iEthernetFrameMemMngr->SetTxOffsets( |
|
879 aEthernetFrameTxOffset, |
|
880 KNotRelevant, |
|
881 KNotRelevant ); |
|
882 } |
|
883 } |
|
884 |
|
885 // --------------------------------------------------------------------------- |
|
886 // |
|
887 // --------------------------------------------------------------------------- |
|
888 // |
|
889 void DWlanLogicalChannel::OnTxProtocolStackDataComplete( |
|
890 TInt aCompletionCode, |
|
891 TDataBuffer* aMetaHeader ) |
|
892 { |
|
893 TraceDump(UMAC_PROTO_CALLBACK, |
|
894 ("WLANLDD: DWlanLogicalChannel::OnTxProtocolStackDataComplete")); |
|
895 TraceDump(UMAC_PROTO_CALLBACK, |
|
896 (("WLANLDD: aCompletionCode: %d"), aCompletionCode)); |
|
897 |
|
898 iEthernetFrameMemMngr->FreeTxPacket( aMetaHeader ); |
|
899 |
|
900 TxProtocolStackData(); |
|
901 |
|
902 if ( !iAddTxFrameAllowed ) |
|
903 { |
|
904 if ( iResumeTxStatus && |
|
905 iEthernetFrameMemMngr->ResumeClientTx( |
|
906 iUmac.UserDataTxEnabled() ) ) |
|
907 { |
|
908 // resume Tx flow from protocol stack |
|
909 |
|
910 TraceDump(NWSA_TX_DETAILS, |
|
911 ("WLANLDD: DWlanLogicalChannel::OnTxProtocolStackDataComplete: complete client Tx resume req")); |
|
912 |
|
913 // complete the pending request to user mode |
|
914 Kern::RequestComplete( |
|
915 iClient, iResumeTxStatus, aCompletionCode ); |
|
916 // mark request as non-pending |
|
917 iResumeTxStatus = NULL; |
|
918 |
|
919 iAddTxFrameAllowed = ETrue; |
|
920 } |
|
921 } |
|
922 } |
|
923 |
|
924 // --------------------------------------------------------------------------- |
|
925 // |
|
926 // --------------------------------------------------------------------------- |
|
927 // |
|
928 void DWlanLogicalChannel::OnOtherTxDataComplete() |
|
929 { |
|
930 TraceDump(UMAC_PROTO_CALLBACK, |
|
931 ("WLANLDD: DWlanLogicalChannel::OnOtherTxDataComplete")); |
|
932 |
|
933 // We try to submit Protocol Stack side frames also when this event occurs |
|
934 // a) to speed up new Tx submission in the case that a frame submitted by |
|
935 // someone else than the Protocol Stack Side Client unblocks the WHA Tx |
|
936 // pipeline and |
|
937 // b) to avoid the Tx pipe from getting stuck even temporarily |
|
938 if ( !( iFlags & KTxTriggerArmed ) ) |
|
939 { |
|
940 iFlags |= KTxTriggerArmed; |
|
941 iTxTriggerDfc.Enque(); // we do this via a DFC |
|
942 } |
|
943 } |
|
944 |
|
945 // --------------------------------------------------------------------------- |
|
946 // |
|
947 // --------------------------------------------------------------------------- |
|
948 // |
|
949 void DWlanLogicalChannel::OnTxDataSent() |
|
950 { |
|
951 TraceDump(UMAC_PROTO_CALLBACK, |
|
952 ("WLANLDD: DWlanLogicalChannel::OnTxDataSent")); |
|
953 |
|
954 // We try to submit Protocol Stack side frames also when this event occurs |
|
955 // a) to speed up new Tx submission in the case that a frame, submitted by |
|
956 // someone else than the Protocol Stack Side Client, gets transmitted & |
|
957 // makes a WHA Txqueue - for which there are packets pending in our Tx |
|
958 // queues - non-full |
|
959 // b) to avoid the Tx pipe from getting stuck even temporarily |
|
960 if ( !( iFlags & KTxTriggerArmed ) ) |
|
961 { |
|
962 iFlags |= KTxTriggerArmed; |
|
963 iTxTriggerDfc.Enque(); // we do this via a DFC |
|
964 } |
|
965 } |
|
966 |
|
967 // --------------------------------------------------------------------------- |
|
968 // |
|
969 // --------------------------------------------------------------------------- |
|
970 // |
|
971 void DWlanLogicalChannel::TxManagementData() |
|
972 { |
|
973 TDataBuffer* buffer = iEthernetFrameMemMngr->OnWriteEthernetFrame(); |
|
974 |
|
975 if ( !buffer ) |
|
976 { |
|
977 TraceDump(ERROR_LEVEL, |
|
978 ("WLANLDD: DWlanLogicalChannel::TxManagementData: " |
|
979 "panic, no buffer")); |
|
980 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
981 } |
|
982 else |
|
983 { |
|
984 iUmac.WriteMgmtFrame( *buffer ); |
|
985 } |
|
986 } |
|
987 |
|
988 // --------------------------------------------------------------------------- |
|
989 // |
|
990 // --------------------------------------------------------------------------- |
|
991 // |
|
992 void DWlanLogicalChannel::TxProtocolStackData() |
|
993 { |
|
994 #ifndef NDEBUG |
|
995 TUint packetsSubmitted ( 0 ); |
|
996 #endif |
|
997 |
|
998 if ( !iTxActive ) |
|
999 { |
|
1000 TWhaTxQueueState txQueueState; |
|
1001 TBool morePackets ( EFalse ); |
|
1002 iTxActive = ETrue; |
|
1003 |
|
1004 while ( iUmac.TxPermitted( txQueueState ) ) |
|
1005 { |
|
1006 TDataBuffer* metaHeader = |
|
1007 iEthernetFrameMemMngr->GetTxFrame( txQueueState, morePackets ); |
|
1008 |
|
1009 if ( metaHeader ) |
|
1010 { |
|
1011 TraceDump( NWSA_TX_DETAILS, |
|
1012 (("WLANLDD: DWlanLogicalChannel::TxProtocolStackData: submitting packet %d"), |
|
1013 ++packetsSubmitted) ); |
|
1014 |
|
1015 iUmac.TxProtocolStackData( |
|
1016 *metaHeader, |
|
1017 morePackets ); |
|
1018 } |
|
1019 else |
|
1020 { |
|
1021 TraceDump(NWSA_TX_DETAILS, |
|
1022 ("WLANLDD: DWlanLogicalChannel::TxProtocolStackData: no packet that could be submitted")); |
|
1023 |
|
1024 break; |
|
1025 } |
|
1026 } |
|
1027 |
|
1028 iTxActive = EFalse; |
|
1029 } |
|
1030 |
|
1031 TraceDump( NWSA_TX_DETAILS, |
|
1032 (("WLANLDD: DWlanLogicalChannel::TxProtocolStackData: %d packet(s) submitted"), |
|
1033 packetsSubmitted) ); |
|
1034 } |
|
1035 |
|
1036 // --------------------------------------------------------------------------- |
|
1037 // |
|
1038 // --------------------------------------------------------------------------- |
|
1039 // |
|
1040 TBool DWlanLogicalChannel::OnReadEthernetFrameRequest() |
|
1041 { |
|
1042 const TBool ret = iEthernetFrameMemMngr->OnReadRequest(); |
|
1043 return ret; |
|
1044 } |
|
1045 |
|
1046 // --------------------------------------------------------------------------- |
|
1047 // |
|
1048 // --------------------------------------------------------------------------- |
|
1049 // |
|
1050 TInt DWlanLogicalChannel::OnEthernetSideRequest( |
|
1051 TInt aReqNo, |
|
1052 TRequestStatus* aStatus, |
|
1053 TAny* /*a1*/, |
|
1054 TAny* /*a2*/ ) |
|
1055 { |
|
1056 const TInt ret( KErrNone ); |
|
1057 |
|
1058 switch (aReqNo) |
|
1059 { |
|
1060 case RPcmNetCardIf::ERequestRead: |
|
1061 // Read request |
|
1062 if ( OnReadEthernetFrameRequest() ) |
|
1063 { |
|
1064 // rx data to be completed exists |
|
1065 // complete it directly |
|
1066 Kern::RequestComplete( |
|
1067 iClient, |
|
1068 aStatus, |
|
1069 KErrNone ); |
|
1070 } |
|
1071 else |
|
1072 { |
|
1073 // no rx data for completion exists |
|
1074 // store the pending request |
|
1075 iEthernetReceiveFrameStatus = aStatus; |
|
1076 } |
|
1077 break; |
|
1078 case RPcmNetCardIf::EResumeTx: |
|
1079 // request to get notified once Tx can again be resumed |
|
1080 iResumeTxStatus = aStatus; |
|
1081 break; |
|
1082 default: |
|
1083 // unknown request |
|
1084 |
|
1085 TraceDump(ERROR_LEVEL, |
|
1086 ("WLANLDD: unknown protocol stack request")); |
|
1087 TraceDump(ERROR_LEVEL, (("WLANLDD: request id: %d"), aReqNo)); |
|
1088 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1089 break; |
|
1090 } |
|
1091 |
|
1092 return ret; |
|
1093 } |
|
1094 |
|
1095 // --------------------------------------------------------------------------- |
|
1096 // |
|
1097 // --------------------------------------------------------------------------- |
|
1098 // |
|
1099 void DWlanLogicalChannel::FinitSystem() |
|
1100 { |
|
1101 TraceDump(INIT_LEVEL, ("WLANLDD * finit system")); |
|
1102 iUmac.FinitSystem(); |
|
1103 } |
|
1104 |
|
1105 // --------------------------------------------------------------------------- |
|
1106 // |
|
1107 // --------------------------------------------------------------------------- |
|
1108 // |
|
1109 void DWlanLogicalChannel::InitSystem( |
|
1110 TAny* aInputBuffer, |
|
1111 TUint aInputLength ) |
|
1112 { |
|
1113 // read the USER mode parameters to internal storage |
|
1114 TInt ret = Kern::ThreadRawRead( |
|
1115 iClient, |
|
1116 aInputBuffer, |
|
1117 &iOpenParam, |
|
1118 aInputLength ); |
|
1119 if ( ret != KErrNone ) |
|
1120 { |
|
1121 TraceDump(ERROR_LEVEL, |
|
1122 ("WLANLDD: DWlanLogicalChannel::InitSystem(): ThreadRawRead panic")); |
|
1123 TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); |
|
1124 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1125 } |
|
1126 |
|
1127 // backup pointers |
|
1128 const TAny* pda( iOpenParam.iPda ); |
|
1129 const TAny* fw( iOpenParam.iFirmWare ); |
|
1130 |
|
1131 // allocate kernel memory for the pda and firmware |
|
1132 iOpenParam.iPda = os_alloc( iOpenParam.iPdaLength ); |
|
1133 iOpenParam.iFirmWare = os_alloc( iOpenParam.iFirmWareLength ); |
|
1134 |
|
1135 if ( iOpenParam.iPda && iOpenParam.iFirmWare ) |
|
1136 { |
|
1137 // allocation success |
|
1138 // read the parameters to allocated storage |
|
1139 ret = Kern::ThreadRawRead( |
|
1140 iClient, |
|
1141 pda, |
|
1142 iOpenParam.iPda, |
|
1143 iOpenParam.iPdaLength ); |
|
1144 if ( ret != KErrNone ) |
|
1145 { |
|
1146 TraceDump(ERROR_LEVEL, |
|
1147 ("WLANLDD: DWlanLogicalChannel::InitSystem(): ThreadRawRead panic")); |
|
1148 TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); |
|
1149 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1150 } |
|
1151 ret = Kern::ThreadRawRead( |
|
1152 iClient, |
|
1153 fw, |
|
1154 iOpenParam.iFirmWare, |
|
1155 iOpenParam.iFirmWareLength ); |
|
1156 if ( ret != KErrNone ) |
|
1157 { |
|
1158 TraceDump(ERROR_LEVEL, |
|
1159 ("WLANLDD: DWlanLogicalChannel::InitSystem(): ThreadRawRead panic")); |
|
1160 TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); |
|
1161 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1162 } |
|
1163 |
|
1164 // check this in completion method |
|
1165 iFlags |= KFreeOpenParamsMask; |
|
1166 |
|
1167 iUmac.BootUp( |
|
1168 static_cast<TUint8*>(iOpenParam.iPda), |
|
1169 iOpenParam.iPdaLength, |
|
1170 static_cast<TUint8*>(iOpenParam.iFirmWare), |
|
1171 iOpenParam.iFirmWareLength ); |
|
1172 } |
|
1173 else |
|
1174 { |
|
1175 // allocation failure |
|
1176 // make sure all is released |
|
1177 os_free( iOpenParam.iPda ); |
|
1178 os_free( iOpenParam.iFirmWare ); |
|
1179 |
|
1180 TraceDump(ERROR_LEVEL, |
|
1181 ("WLANLDD: DWlanLogicalChannel::InitSystem: ERROR: PDA and/or firmware memory allocation failure")); |
|
1182 |
|
1183 // complete the pending request with error code to user mode |
|
1184 Kern::RequestComplete( |
|
1185 iClient, |
|
1186 iWlanGeneralRequestStatus, |
|
1187 KErrNoMemory ); |
|
1188 // mark request as non pending |
|
1189 iWlanGeneralRequestStatus = NULL; |
|
1190 } |
|
1191 } |
|
1192 |
|
1193 // --------------------------------------------------------------------------- |
|
1194 // |
|
1195 // --------------------------------------------------------------------------- |
|
1196 // |
|
1197 TBool DWlanLogicalChannel::HandlePointerParameters() |
|
1198 { |
|
1199 TraceDump(WLM_CMD_DETAILS, |
|
1200 (("WLANLDD: DWlanLogicalChannel::HandlePointerParameters"))); |
|
1201 |
|
1202 if ( !HandleScanResponseFrameBodyCase() ) |
|
1203 { |
|
1204 // memory allocation failure |
|
1205 |
|
1206 return EFalse; |
|
1207 } |
|
1208 |
|
1209 if ( !CheckAndHandleIeDataCase() ) |
|
1210 { |
|
1211 // memory allocation failure |
|
1212 |
|
1213 // free memory allocated in the previous step |
|
1214 FreeScanResponseFramebody(); |
|
1215 |
|
1216 return EFalse; |
|
1217 } |
|
1218 |
|
1219 return ETrue; |
|
1220 } |
|
1221 |
|
1222 // --------------------------------------------------------------------------- |
|
1223 // |
|
1224 // --------------------------------------------------------------------------- |
|
1225 // |
|
1226 TBool DWlanLogicalChannel::HandleScanResponseFrameBodyCase() |
|
1227 { |
|
1228 TBool ret( ETrue ); |
|
1229 |
|
1230 // handle scan response frame body case |
|
1231 if ( (reinterpret_cast<const TOIDHeader*> |
|
1232 (&iOidMsgStorage))->oid_id == E802_11_CONNECT ) |
|
1233 { |
|
1234 if ( iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody ) |
|
1235 { |
|
1236 // scan response frame body exists |
|
1237 // we must allocate kernel storage for it here |
|
1238 |
|
1239 TraceDump(WLM_CMD_DETAILS, |
|
1240 (("WLANLDD: DWlanLogicalChannel::HandleScanResponseFrameBodyCase: allocate memory & copy data; length: %d"), |
|
1241 iOidMsgStorage.iOidMsgs |
|
1242 .iConnectMsg.scanResponseFrameBodyLength )); |
|
1243 |
|
1244 const TUint8* user_mode_address( |
|
1245 iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody ); |
|
1246 |
|
1247 iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody |
|
1248 = static_cast<TUint8*>(os_alloc( |
|
1249 iOidMsgStorage.iOidMsgs |
|
1250 .iConnectMsg.scanResponseFrameBodyLength )); |
|
1251 |
|
1252 if ( iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody ) |
|
1253 { |
|
1254 // allocation success |
|
1255 // read the parameters to the allocated storage |
|
1256 const TInt local( Kern::ThreadRawRead( |
|
1257 iClient, |
|
1258 user_mode_address, |
|
1259 const_cast<TUint8*>(iOidMsgStorage.iOidMsgs |
|
1260 .iConnectMsg.scanResponseFrameBody), |
|
1261 iOidMsgStorage.iOidMsgs |
|
1262 .iConnectMsg.scanResponseFrameBodyLength ) ); |
|
1263 |
|
1264 if ( local != KErrNone ) |
|
1265 { |
|
1266 TraceDump(ERROR_LEVEL, |
|
1267 ("WLANLDD: ThreadRawRead panic")); |
|
1268 TraceDump(ERROR_LEVEL, (("WLANLDD: local: %d"), ret)); |
|
1269 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1270 } |
|
1271 |
|
1272 // mark memory deallocation event |
|
1273 iFlags |= KFreeScanResponseFramebodyMask; |
|
1274 } |
|
1275 else |
|
1276 { |
|
1277 // allocation failure |
|
1278 ret = EFalse; |
|
1279 } |
|
1280 } |
|
1281 else // --- scan response frame body does not exist --- |
|
1282 { |
|
1283 // this is a usage error |
|
1284 |
|
1285 TraceDump(ERROR_LEVEL, |
|
1286 ("WLANLDD: scan response frame body is null in connect OID")); |
|
1287 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1288 } |
|
1289 } |
|
1290 else // --- connect not issued --- |
|
1291 { |
|
1292 // do nothing |
|
1293 } |
|
1294 |
|
1295 return ret; |
|
1296 } |
|
1297 |
|
1298 // --------------------------------------------------------------------------- |
|
1299 // |
|
1300 // --------------------------------------------------------------------------- |
|
1301 // |
|
1302 TBool DWlanLogicalChannel::CheckAndHandleIeDataCase() |
|
1303 { |
|
1304 TBool ret( ETrue ); |
|
1305 |
|
1306 // handle Tx IE case |
|
1307 if ( (reinterpret_cast<const TOIDHeader*> |
|
1308 (&iOidMsgStorage))->oid_id == E802_11_CONNECT ) |
|
1309 { |
|
1310 if ( iOidMsgStorage.iOidMsgs.iConnectMsg.ieData ) |
|
1311 { |
|
1312 // Tx IE exists |
|
1313 // we must allocate kernel storage for it here |
|
1314 |
|
1315 TraceDump(WLM_CMD_DETAILS, |
|
1316 (("WLANLDD: DWlanLogicalChannel::CheckAndHandleIeDataCase: allocate memory & copy data; length: %d"), |
|
1317 iOidMsgStorage.iOidMsgs.iConnectMsg.ieDataLength )); |
|
1318 |
|
1319 const TUint8* user_mode_address( |
|
1320 iOidMsgStorage.iOidMsgs.iConnectMsg.ieData ); |
|
1321 |
|
1322 iOidMsgStorage.iOidMsgs.iConnectMsg.ieData |
|
1323 = static_cast<TUint8*>(os_alloc( |
|
1324 iOidMsgStorage.iOidMsgs.iConnectMsg.ieDataLength )); |
|
1325 |
|
1326 if ( iOidMsgStorage.iOidMsgs.iConnectMsg.ieData ) |
|
1327 { |
|
1328 // allocation success |
|
1329 // read the parameters to the allocated storage |
|
1330 const TInt local( Kern::ThreadRawRead( |
|
1331 iClient, |
|
1332 user_mode_address, |
|
1333 const_cast<TUint8*>(iOidMsgStorage.iOidMsgs |
|
1334 .iConnectMsg.ieData), |
|
1335 iOidMsgStorage.iOidMsgs |
|
1336 .iConnectMsg.ieDataLength ) ); |
|
1337 |
|
1338 if ( local != KErrNone ) |
|
1339 { |
|
1340 TraceDump(ERROR_LEVEL, |
|
1341 ("WLANLDD: ThreadRawRead panic")); |
|
1342 TraceDump(ERROR_LEVEL, (("WLANLDD: local: %d"), ret)); |
|
1343 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1344 } |
|
1345 |
|
1346 // mark memory deallocation event |
|
1347 iFlags |= KFreeIeDataMask; |
|
1348 } |
|
1349 else |
|
1350 { |
|
1351 // allocation failure |
|
1352 ret = EFalse; |
|
1353 } |
|
1354 } |
|
1355 else // --- RSN IE does not exists --- |
|
1356 { |
|
1357 // do nothing |
|
1358 } |
|
1359 } |
|
1360 else // --- connect not issued --- |
|
1361 { |
|
1362 // do nothing |
|
1363 } |
|
1364 |
|
1365 return ret; |
|
1366 } |
|
1367 |
|
1368 // --------------------------------------------------------------------------- |
|
1369 // |
|
1370 // --------------------------------------------------------------------------- |
|
1371 // |
|
1372 void DWlanLogicalChannel::FreeScanResponseFramebody() |
|
1373 { |
|
1374 if ( iFlags & KFreeScanResponseFramebodyMask ) |
|
1375 { |
|
1376 // free scan response frame |
|
1377 |
|
1378 TraceDump(WLM_CMD_DETAILS, |
|
1379 (("WLANLDD: DWlanLogicalChannel::FreeScanResponseFramebody: freeing memory"))); |
|
1380 |
|
1381 os_free( iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody ); |
|
1382 iOidMsgStorage.iOidMsgs.iConnectMsg.scanResponseFrameBody = NULL; |
|
1383 iFlags &= ~KFreeScanResponseFramebodyMask; |
|
1384 } |
|
1385 } |
|
1386 |
|
1387 // --------------------------------------------------------------------------- |
|
1388 // |
|
1389 // --------------------------------------------------------------------------- |
|
1390 // |
|
1391 void DWlanLogicalChannel::FreeIeData() |
|
1392 { |
|
1393 if ( iFlags & KFreeIeDataMask ) |
|
1394 { |
|
1395 // free Tx IE |
|
1396 |
|
1397 TraceDump(WLM_CMD_DETAILS, |
|
1398 (("WLANLDD: DWlanLogicalChannel::FreeIeData: freeing memory"))); |
|
1399 |
|
1400 os_free( iOidMsgStorage.iOidMsgs.iConnectMsg.ieData ); |
|
1401 iOidMsgStorage.iOidMsgs.iConnectMsg.ieData = NULL; |
|
1402 iFlags &= ~KFreeIeDataMask; |
|
1403 } |
|
1404 } |
|
1405 |
|
1406 // --------------------------------------------------------------------------- |
|
1407 // |
|
1408 // --------------------------------------------------------------------------- |
|
1409 // |
|
1410 TInt DWlanLogicalChannel::OnMgmtSideDoRequest( |
|
1411 TInt aReqNo, |
|
1412 TRequestStatus* aStatus, |
|
1413 TAny* a1, |
|
1414 TAny* a2 ) |
|
1415 { |
|
1416 TraceDump(WLM_CMD, |
|
1417 (("WLANLDD: DWlanLogicalChannel::OnMgmtSideDoRequest(): request: %d"), |
|
1418 aReqNo)); |
|
1419 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: a1 0x%08x"), a1)); |
|
1420 TraceDump(WLM_CMD_DETAILS, (("WLANLDD: a2 0x%08x"), a2)); |
|
1421 |
|
1422 TInt ret( KErrNone ); |
|
1423 |
|
1424 SOutputBuffer output_buffer = { NULL, 0 }; |
|
1425 if ( a2 ) |
|
1426 { |
|
1427 // read the USER mode output parameters to internal storage |
|
1428 ret = Kern::ThreadRawRead( |
|
1429 iClient, |
|
1430 a2, |
|
1431 &output_buffer, |
|
1432 sizeof(output_buffer) ); |
|
1433 if ( ret != KErrNone ) |
|
1434 { |
|
1435 TraceDump(ERROR_LEVEL, |
|
1436 ("WLANLDD: OnMgmtSideDoRequest(): ThreadRawRead panic")); |
|
1437 TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); |
|
1438 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1439 } |
|
1440 } |
|
1441 |
|
1442 switch ( aReqNo ) |
|
1443 { |
|
1444 case EWlanInitSystem: |
|
1445 // bootup the chip and the system |
|
1446 iWlanGeneralRequestStatus = aStatus; |
|
1447 InitSystem( a1, sizeof(TOpenParam) ); |
|
1448 break; |
|
1449 case EWlanFinitSystem: |
|
1450 // power down the chip and the system |
|
1451 iWlanGeneralRequestStatus = aStatus; |
|
1452 FinitSystem(); |
|
1453 break; |
|
1454 case EWlanCommand: |
|
1455 // management command |
|
1456 iWlanGeneralRequestStatus = aStatus; |
|
1457 |
|
1458 // read the USER mode parameters to internal storage |
|
1459 ret = Kern::ThreadRawRead( |
|
1460 iClient, |
|
1461 a1, |
|
1462 &iOidMsgStorage, |
|
1463 sizeof(iOidMsgStorage) ); |
|
1464 if ( ret != KErrNone ) |
|
1465 { |
|
1466 TraceDump(ERROR_LEVEL, |
|
1467 ("WLANLDD: DWlanLogicalChannel::OnMgmtSideDoRequest(): ThreadRawRead panic")); |
|
1468 TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); |
|
1469 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1470 } |
|
1471 |
|
1472 // read also parameters pointed to by pointers from USER mode to |
|
1473 // internal storage; when such parameters exist |
|
1474 if ( !HandlePointerParameters() ) |
|
1475 { |
|
1476 // memory allocation failure |
|
1477 // complete the pending request with error code to user mode |
|
1478 Kern::RequestComplete( |
|
1479 iClient, |
|
1480 iWlanGeneralRequestStatus, |
|
1481 KErrNoMemory ); |
|
1482 // mark request as non pending |
|
1483 iWlanGeneralRequestStatus = NULL; |
|
1484 break; |
|
1485 } |
|
1486 |
|
1487 iUmac.HandleOid( |
|
1488 reinterpret_cast<const TOIDHeader*>(&iOidMsgStorage), |
|
1489 // we can pass output buffer pointer as is |
|
1490 // because it is not accessed by UMAC and the |
|
1491 // actual user mode writing is done by OnOidCompleted method |
|
1492 output_buffer.iData, |
|
1493 output_buffer.iLen ); |
|
1494 break; |
|
1495 case EWlanRequestNotify: |
|
1496 // store the USER mode indication address; |
|
1497 iIndicationBuffer = static_cast<TIndication*>(a1); |
|
1498 iWlanRequestNotifyStatus = aStatus; |
|
1499 IndicationRequest( static_cast<TIndication*>(a1) ); |
|
1500 break; |
|
1501 case EWlanRequestFrame: |
|
1502 if ( OnReadEthernetFrameRequest() ) |
|
1503 { |
|
1504 // rx data to be completed exists |
|
1505 // complete it directly |
|
1506 Kern::RequestComplete( |
|
1507 iClient, |
|
1508 aStatus, |
|
1509 KErrNone ); |
|
1510 } |
|
1511 else |
|
1512 { |
|
1513 // no rx data for completion exists |
|
1514 // store the pending request |
|
1515 iWlanReceiveFrameStatus = aStatus; |
|
1516 } |
|
1517 break; |
|
1518 case EWlanRequestSend: |
|
1519 iWlanSendFrameStatus = aStatus; |
|
1520 |
|
1521 TxManagementData(); |
|
1522 break; |
|
1523 default: |
|
1524 // unknown request |
|
1525 TraceDump(ERROR_LEVEL, |
|
1526 ("WLANLDD: unhandled management request panic")); |
|
1527 TraceDump(ERROR_LEVEL, (("WLANLDD: request id: %d"), aReqNo)); |
|
1528 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1529 break; |
|
1530 } |
|
1531 |
|
1532 return ret; |
|
1533 } |
|
1534 |
|
1535 // --------------------------------------------------------------------------- |
|
1536 // |
|
1537 // --------------------------------------------------------------------------- |
|
1538 // |
|
1539 TInt DWlanLogicalChannel::DoRequest( |
|
1540 TInt aReqNo, |
|
1541 TRequestStatus* aStatus, |
|
1542 TAny* a1, |
|
1543 TAny* a2 ) |
|
1544 { |
|
1545 TInt ret( KErrNone ); |
|
1546 if ( iUnit == KUnitWlan ) |
|
1547 { |
|
1548 ret = OnMgmtSideDoRequest( aReqNo, aStatus, a1, a2 ); |
|
1549 } |
|
1550 else if ( iUnit == KUnitEthernet ) |
|
1551 { |
|
1552 ret = OnEthernetSideRequest( aReqNo, aStatus, a1, a2 ); |
|
1553 } |
|
1554 else |
|
1555 { |
|
1556 // unknown unit |
|
1557 |
|
1558 TraceDump(ERROR_LEVEL, |
|
1559 ("WLANLDD: DWlanLogicalChannel::DoRequest(): unknown request unit panic")); |
|
1560 TraceDump(ERROR_LEVEL, (("WLANLDD: request id: %d"), aReqNo)); |
|
1561 TraceDump(ERROR_LEVEL, (("WLANLDD: unit: %d"), iUnit)); |
|
1562 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1563 } |
|
1564 |
|
1565 return ret; |
|
1566 } |
|
1567 |
|
1568 // --------------------------------------------------------------------------- |
|
1569 // |
|
1570 // --------------------------------------------------------------------------- |
|
1571 // |
|
1572 TInt DWlanLogicalChannel::OnInitialiseEthernetFrameBuffers( |
|
1573 TSharedChunkInfo* aSharedChunkInfo ) |
|
1574 { |
|
1575 TInt ret( KErrNoMemory ); |
|
1576 |
|
1577 if ( iEthernetFrameMemMngr ) |
|
1578 { |
|
1579 TUint8 notRelevant( 0 ); |
|
1580 TUint8 vendorTxHdrLen ( 0 ); |
|
1581 TUint8 vendorTxTrailerLen ( 0 ); |
|
1582 |
|
1583 iUmac.GetFrameExtraSpaceForVendor( |
|
1584 notRelevant, |
|
1585 vendorTxHdrLen, |
|
1586 vendorTxTrailerLen ); |
|
1587 |
|
1588 ret = iEthernetFrameMemMngr->OnInitialiseMemory( |
|
1589 *iClient, |
|
1590 aSharedChunkInfo, |
|
1591 vendorTxHdrLen, |
|
1592 vendorTxTrailerLen ); |
|
1593 } |
|
1594 |
|
1595 return ret; |
|
1596 } |
|
1597 |
|
1598 // --------------------------------------------------------------------------- |
|
1599 // |
|
1600 // --------------------------------------------------------------------------- |
|
1601 // |
|
1602 void DWlanLogicalChannel::OnReleaseEthernetFrameBuffers() |
|
1603 { |
|
1604 if ( iEthernetFrameMemMngr ) |
|
1605 { |
|
1606 iEthernetFrameMemMngr->OnReleaseMemory(); |
|
1607 } |
|
1608 } |
|
1609 |
|
1610 // --------------------------------------------------------------------------- |
|
1611 // |
|
1612 // --------------------------------------------------------------------------- |
|
1613 // |
|
1614 TInt DWlanLogicalChannel::OnEthernetSideControl( |
|
1615 TInt aFunction, |
|
1616 TAny* a1, |
|
1617 TAny* /*a2*/ ) |
|
1618 { |
|
1619 TInt ret(KErrNone); |
|
1620 |
|
1621 switch (aFunction) |
|
1622 { |
|
1623 case RPcmNetCardIf::EControlGetConfig: |
|
1624 { |
|
1625 const TMacAddress& mac = iUmac.StationId(); |
|
1626 TEtherConfig ethercfg = { NULL }; |
|
1627 |
|
1628 // 0x00 - card is ready, 0xff - card not ready. |
|
1629 ethercfg.iStatus = 0; |
|
1630 // Speed setting (0x00 to 0x03). |
|
1631 ethercfg.iEthSpeed = 0; |
|
1632 // Duplex setting (0x00 to 0x03) |
|
1633 ethercfg.iEthDuplex = 0; |
|
1634 |
|
1635 // set STA MAC |
|
1636 os_memcpy( ethercfg.iEthAddress, &mac, KMacAddressLength ); |
|
1637 |
|
1638 // write config to USER mode |
|
1639 ret = Kern::ThreadRawWrite( |
|
1640 iClient, |
|
1641 a1, |
|
1642 ðercfg, |
|
1643 sizeof(ethercfg) ); |
|
1644 if ( ret != KErrNone ) |
|
1645 { |
|
1646 TraceDump(ERROR_LEVEL, ("WLANLDD: ThreadRawWrite panic")); |
|
1647 TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); |
|
1648 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1649 } |
|
1650 break; |
|
1651 } |
|
1652 case RPcmNetCardIf::ESvControlInitBuffers: |
|
1653 // instruct initiliaze buffers for data xfer |
|
1654 if ( a1 ) |
|
1655 { |
|
1656 // call |
|
1657 TraceDump(INIT_LEVEL, |
|
1658 ("WLANLDD * init protocol shared IO-buffer memory pool")); |
|
1659 |
|
1660 TraceDump(INIT_LEVEL, |
|
1661 (("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl: chunk info addr: 0x%08x"), |
|
1662 a1)); |
|
1663 ret = OnInitialiseEthernetFrameBuffers( |
|
1664 static_cast<TSharedChunkInfo*>(a1) ); |
|
1665 |
|
1666 // set frame Tx offset for protocol stack side |
|
1667 iUmac.SetTxOffset(); |
|
1668 } |
|
1669 else |
|
1670 { |
|
1671 TraceDump(ERROR_LEVEL, |
|
1672 ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl(): init protocol stack buffer pool panic")); |
|
1673 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1674 } |
|
1675 break; |
|
1676 case RPcmNetCardIf::ESvControlFreeBuffers: |
|
1677 { |
|
1678 // instruct free buffers for data xfer |
|
1679 OnReleaseEthernetFrameBuffers(); |
|
1680 break; |
|
1681 } |
|
1682 default: |
|
1683 // unhadled panic |
|
1684 TraceDump(ERROR_LEVEL, |
|
1685 ("WLANLDD: DWlanLogicalChannel::OnEthernetSideControl(): protocol stack side control panic")); |
|
1686 TraceDump(ERROR_LEVEL, (("function id: %d"), aFunction)); |
|
1687 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1688 break; |
|
1689 } |
|
1690 |
|
1691 return ret; |
|
1692 } |
|
1693 |
|
1694 // --------------------------------------------------------------------------- |
|
1695 // |
|
1696 // --------------------------------------------------------------------------- |
|
1697 // |
|
1698 TInt DWlanLogicalChannel::OnMgmtSideControl( |
|
1699 TInt aFunction, |
|
1700 TAny* a1, |
|
1701 TAny* /*a2*/ ) |
|
1702 { |
|
1703 TInt ret( KErrNone ); |
|
1704 if ( aFunction == EWlanSvControlInitBuffers ) |
|
1705 { |
|
1706 // initiliaze buffers for wlan mgmt client data xfer |
|
1707 if ( a1 ) |
|
1708 { |
|
1709 TraceDump(INIT_LEVEL, |
|
1710 ("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl(): init management client shared IO-buffer memory pool")); |
|
1711 |
|
1712 TraceDump(INIT_LEVEL, |
|
1713 (("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl: chunk info addr: 0x%08x"), |
|
1714 a1)); |
|
1715 ret = OnInitialiseEthernetFrameBuffers( |
|
1716 static_cast<TSharedChunkInfo*>(a1) ); |
|
1717 } |
|
1718 else |
|
1719 { |
|
1720 TraceDump(ERROR_LEVEL, |
|
1721 ("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl(): init management client buffer pool panic")); |
|
1722 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1723 } |
|
1724 } |
|
1725 else if ( aFunction == EWlanSvControlFreeBuffers ) |
|
1726 { |
|
1727 // free wlan mgmt client data xfer buffers |
|
1728 OnReleaseEthernetFrameBuffers(); |
|
1729 } |
|
1730 else |
|
1731 { |
|
1732 // unknown request |
|
1733 |
|
1734 TraceDump(ERROR_LEVEL, |
|
1735 ("WLANLDD: DWlanLogicalChannel::OnMgmtSideControl(): management side control panic")); |
|
1736 TraceDump(ERROR_LEVEL, (("WLANLDD: function id: %d"), aFunction)); |
|
1737 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1738 } |
|
1739 |
|
1740 return ret; |
|
1741 } |
|
1742 |
|
1743 // --------------------------------------------------------------------------- |
|
1744 // |
|
1745 // --------------------------------------------------------------------------- |
|
1746 // |
|
1747 TInt DWlanLogicalChannel::DoControl( TInt aFunction, TAny* a1, TAny* a2) |
|
1748 { |
|
1749 TInt ret( KErrNone ); |
|
1750 if ( iUnit == KUnitWlan ) |
|
1751 { |
|
1752 ret = OnMgmtSideControl( aFunction, a1, a2 ); |
|
1753 } |
|
1754 else if ( iUnit == KUnitEthernet ) |
|
1755 { |
|
1756 ret = OnEthernetSideControl( aFunction, a1, a2 ); |
|
1757 } |
|
1758 else |
|
1759 { |
|
1760 // unknown unit |
|
1761 |
|
1762 TraceDump(ERROR_LEVEL, ("WLANLDD: unhandled control unit panic")); |
|
1763 TraceDump(ERROR_LEVEL, (("WLANLDD: function id: %d"), aFunction)); |
|
1764 TraceDump(ERROR_LEVEL, (("WLANLDD: unit: %d"), iUnit)); |
|
1765 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1766 } |
|
1767 |
|
1768 return ret; |
|
1769 } |
|
1770 |
|
1771 // --------------------------------------------------------------------------- |
|
1772 // |
|
1773 // --------------------------------------------------------------------------- |
|
1774 // |
|
1775 void DWlanLogicalChannel::OnOidCompleted( |
|
1776 TInt aReason, |
|
1777 SOidOutputData& OidOutputData ) |
|
1778 { |
|
1779 if ( iFlags & KFreeOpenParamsMask ) |
|
1780 { |
|
1781 // free open params |
|
1782 os_free( iOpenParam.iPda ); |
|
1783 iOpenParam.iPda = NULL; |
|
1784 os_free( iOpenParam.iFirmWare ); |
|
1785 iOpenParam.iFirmWare = NULL; |
|
1786 iFlags &= ~KFreeOpenParamsMask; |
|
1787 } |
|
1788 else |
|
1789 { |
|
1790 // check if there are other command parameter related memory blocks |
|
1791 // to be released |
|
1792 // Note! We check the flags already here to avoid unnecessary |
|
1793 // FreeXXX function calls |
|
1794 |
|
1795 if ( iFlags & KFreeScanResponseFramebodyMask ) |
|
1796 { |
|
1797 // free scan response frame body |
|
1798 FreeScanResponseFramebody(); |
|
1799 |
|
1800 // the following flags can be set only at the same time with |
|
1801 // KFreeScanResponseFramebodyMask |
|
1802 |
|
1803 if ( iFlags & KFreeIeDataMask ) |
|
1804 { |
|
1805 // free IE(s) |
|
1806 FreeIeData(); |
|
1807 } |
|
1808 } |
|
1809 } |
|
1810 |
|
1811 TraceDump(UMAC_MGMT_CALLBACK, |
|
1812 ("WLANLDD: DWlanLogicalChannel::OnOidCompleted()")); |
|
1813 TraceDump(UMAC_MGMT_CALLBACK, (("WLANLDD: OID: 0x%08x"), |
|
1814 OidOutputData.iOidId)); |
|
1815 TraceDump(UMAC_MGMT_CALLBACK, (("WLANLDD: aReason: %d"), aReason)); |
|
1816 |
|
1817 if ( iWlanGeneralRequestStatus ) |
|
1818 { |
|
1819 // write data to user mode if this happened to be a read request |
|
1820 if ( OidOutputData.iOidData ) |
|
1821 { |
|
1822 TraceDump(UMAC_MGMT_CALLBACK, ("WLANLDD: write data to USER mode")); |
|
1823 TraceDump(UMAC_MGMT_CALLBACK, (("WLANLDD: length: %d"), |
|
1824 OidOutputData.iLengthOfDataInBytes)); |
|
1825 |
|
1826 const TInt ret |
|
1827 = Kern::ThreadRawWrite( |
|
1828 iClient, |
|
1829 OidOutputData.iBufferSupplied, |
|
1830 OidOutputData.iOidData, |
|
1831 OidOutputData.iLengthOfDataInBytes ); |
|
1832 |
|
1833 if ( ret != KErrNone ) |
|
1834 { |
|
1835 TraceDump(ERROR_LEVEL, ("WLANLDD: ThreadRawWrite panic")); |
|
1836 TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); |
|
1837 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
1838 } |
|
1839 } |
|
1840 |
|
1841 // complete the pending request to user mode |
|
1842 Kern::RequestComplete( iClient, iWlanGeneralRequestStatus, aReason ); |
|
1843 // mark request as non pending |
|
1844 iWlanGeneralRequestStatus = NULL; |
|
1845 } |
|
1846 else // iReqStatus |
|
1847 { |
|
1848 // no pending request exists, so it must have been cancelled |
|
1849 // Nothing more to do here |
|
1850 TraceDump(UMAC_MGMT_CALLBACK, |
|
1851 ("WLANLDD: DWlanLogicalChannel::OnOidCompleted(): no pending request")); |
|
1852 } |
|
1853 } |
|
1854 |
|
1855 // --------------------------------------------------------------------------- |
|
1856 // |
|
1857 // --------------------------------------------------------------------------- |
|
1858 // |
|
1859 void DWlanLogicalChannel::SetMgmtSideTxOffsets( |
|
1860 TUint32 aEthernetFrameTxOffset, |
|
1861 TUint32 aDot11FrameTxOffset, |
|
1862 TUint32 aSnapFrameTxOffset ) |
|
1863 { |
|
1864 if ( iEthernetFrameMemMngr ) |
|
1865 { |
|
1866 TraceDump(NWSA_TX_DETAILS, |
|
1867 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aEthernetFrameTxOffset: %d"), |
|
1868 aEthernetFrameTxOffset )); |
|
1869 TraceDump(NWSA_TX_DETAILS, |
|
1870 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aDot11FrameTxOffset: %d"), |
|
1871 aDot11FrameTxOffset )); |
|
1872 TraceDump(NWSA_TX_DETAILS, |
|
1873 (("WLANLDD: DWlanLogicalChannel::SetMgmtSideTxOffsets: aSnapFrameTxOffset: %d"), |
|
1874 aSnapFrameTxOffset )); |
|
1875 |
|
1876 iEthernetFrameMemMngr->SetTxOffsets( |
|
1877 aEthernetFrameTxOffset, |
|
1878 aDot11FrameTxOffset, |
|
1879 aSnapFrameTxOffset ); |
|
1880 } |
|
1881 } |
|
1882 |
|
1883 // --------------------------------------------------------------------------- |
|
1884 // |
|
1885 // --------------------------------------------------------------------------- |
|
1886 // |
|
1887 TUint8* DWlanLogicalChannel::GetBufferForRxData( |
|
1888 TUint aLengthinBytes ) |
|
1889 { |
|
1890 TUint8* ret ( NULL ); |
|
1891 if ( iEthernetFrameMemMngr ) |
|
1892 { |
|
1893 ret = iEthernetFrameMemMngr->OnGetEthernetFrameRxBuffer( |
|
1894 aLengthinBytes ); |
|
1895 } |
|
1896 else |
|
1897 { |
|
1898 TraceDump(RX_FRAME | WARNING_LEVEL, |
|
1899 ("WLANLDD: DWlanLogicalChannel::GetBufferForRxData: WARNING: no frame mgr => failed")); |
|
1900 } |
|
1901 |
|
1902 return ret; |
|
1903 } |
|
1904 |
|
1905 // --------------------------------------------------------------------------- |
|
1906 // |
|
1907 // --------------------------------------------------------------------------- |
|
1908 // |
|
1909 void DWlanLogicalChannel::MgmtDataReceiveComplete( |
|
1910 const TDataBuffer*& aBufferStart, |
|
1911 TUint32 aNumOfBuffers ) |
|
1912 { |
|
1913 if ( iEthernetFrameMemMngr->OnEthernetFrameRxComplete( |
|
1914 aBufferStart, |
|
1915 aNumOfBuffers ) ) |
|
1916 { |
|
1917 Kern::RequestComplete( iClient, iWlanReceiveFrameStatus, KErrNone ); |
|
1918 iWlanReceiveFrameStatus = NULL; |
|
1919 } |
|
1920 } |
|
1921 |
|
1922 // --------------------------------------------------------------------------- |
|
1923 // |
|
1924 // --------------------------------------------------------------------------- |
|
1925 // |
|
1926 void DWlanLogicalChannel::MgmtPathWriteComplete( TInt aErr ) |
|
1927 { |
|
1928 TraceDump(UMAC_MGMT_CALLBACK, |
|
1929 ("WLANLDD: DWlanLogicalChannel::MgmtPathWriteComplete()")); |
|
1930 TraceDump(UMAC_MGMT_CALLBACK, |
|
1931 (("WLANLDD: aCompletionCode: %d"), aErr)); |
|
1932 |
|
1933 if ( iWlanSendFrameStatus ) |
|
1934 { |
|
1935 // complete the pending request to user mode |
|
1936 Kern::RequestComplete( |
|
1937 iClient, iWlanSendFrameStatus, aErr ); |
|
1938 // mark request as non pending |
|
1939 iWlanSendFrameStatus = NULL; |
|
1940 } |
|
1941 else // iReqStatus |
|
1942 { |
|
1943 // no pending request exists, so it must have been cancelled |
|
1944 // Nothing to do here |
|
1945 TraceDump(UMAC_MGMT_CALLBACK, |
|
1946 ("WLANLDD: DWlanLogicalChannel::MgmtPathWriteComplete(): no pending request")); |
|
1947 } |
|
1948 } |
|
1949 |
|
1950 // --------------------------------------------------------------------------- |
|
1951 // |
|
1952 // --------------------------------------------------------------------------- |
|
1953 // |
|
1954 DWlanLogicalChannel::TIndicationListEntry* |
|
1955 DWlanLogicalChannel::GetFreeIndicationListEntry() |
|
1956 { |
|
1957 TIndicationListEntry* newEntry = NULL; |
|
1958 |
|
1959 if ( iFreeIndicationListHead ) |
|
1960 { |
|
1961 newEntry = iFreeIndicationListHead; |
|
1962 iFreeIndicationListHead = newEntry->next; |
|
1963 newEntry->next = NULL; |
|
1964 } |
|
1965 |
|
1966 return newEntry; |
|
1967 } |
|
1968 |
|
1969 // --------------------------------------------------------------------------- |
|
1970 // |
|
1971 // --------------------------------------------------------------------------- |
|
1972 // |
|
1973 void DWlanLogicalChannel::StoreIndication( TIndication aIndication ) |
|
1974 { |
|
1975 TIndicationListEntry* newEntry = GetFreeIndicationListEntry(); |
|
1976 |
|
1977 if ( !newEntry ) |
|
1978 { |
|
1979 return; |
|
1980 } |
|
1981 |
|
1982 newEntry->indication = aIndication; |
|
1983 newEntry->next = NULL; |
|
1984 |
|
1985 if ( !iIndicationListHead ) |
|
1986 { |
|
1987 iIndicationListHead = newEntry; |
|
1988 } |
|
1989 else |
|
1990 { |
|
1991 TIndicationListEntry *tmp = iIndicationListHead; |
|
1992 |
|
1993 while ( tmp->next ) |
|
1994 { |
|
1995 tmp = tmp->next; |
|
1996 } |
|
1997 |
|
1998 tmp->next = newEntry; |
|
1999 } |
|
2000 } |
|
2001 |
|
2002 // --------------------------------------------------------------------------- |
|
2003 // |
|
2004 // --------------------------------------------------------------------------- |
|
2005 // |
|
2006 void DWlanLogicalChannel::IndicationComplete() |
|
2007 { |
|
2008 Kern::RequestComplete( |
|
2009 iClient, iWlanRequestNotifyStatus, KErrNone ); |
|
2010 iWlanRequestNotifyStatus = NULL; |
|
2011 } |
|
2012 |
|
2013 // --------------------------------------------------------------------------- |
|
2014 // |
|
2015 // --------------------------------------------------------------------------- |
|
2016 // |
|
2017 TBool DWlanLogicalChannel::GetStoredIndication() |
|
2018 { |
|
2019 TIndicationListEntry *tmp = NULL; |
|
2020 |
|
2021 if ( !iIndicationListHead ) |
|
2022 { |
|
2023 return EFalse; |
|
2024 } |
|
2025 |
|
2026 TraceDump(WLM_INDICATION, |
|
2027 (("WLANLDD: DWlanLogicalChannel::GetStoredIndication(): indication complete: %d"), |
|
2028 iIndicationListHead->indication)); |
|
2029 |
|
2030 const TInt ret = Kern::ThreadRawWrite( iClient, iIndicationBuffer, |
|
2031 &( iIndicationListHead->indication ), |
|
2032 sizeof(iIndicationListHead->indication) ); |
|
2033 |
|
2034 if ( ret != KErrNone ) |
|
2035 { |
|
2036 TraceDump(ERROR_LEVEL, ("WLANLDD: ThreadRawWrite panic")); |
|
2037 TraceDump(ERROR_LEVEL, (("WLANLDD: ret: %d"), ret)); |
|
2038 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
2039 } |
|
2040 |
|
2041 tmp = iIndicationListHead; |
|
2042 iIndicationListHead = tmp->next; |
|
2043 |
|
2044 ReleaseIndicationListEntry( tmp ); |
|
2045 |
|
2046 return ETrue; |
|
2047 } |
|
2048 |
|
2049 // --------------------------------------------------------------------------- |
|
2050 // |
|
2051 // --------------------------------------------------------------------------- |
|
2052 // |
|
2053 void DWlanLogicalChannel::TryToCompleteIndicationRequest() |
|
2054 { |
|
2055 if ( iIndicationBuffer ) |
|
2056 { |
|
2057 if ( GetStoredIndication() ) |
|
2058 { |
|
2059 IndicationComplete(); |
|
2060 iIndicationBuffer = NULL; |
|
2061 } |
|
2062 } |
|
2063 } |
|
2064 |
|
2065 // --------------------------------------------------------------------------- |
|
2066 // |
|
2067 // --------------------------------------------------------------------------- |
|
2068 // |
|
2069 void DWlanLogicalChannel::OnInDicationEvent( TIndication aIndication ) |
|
2070 { |
|
2071 StoreIndication( aIndication ); |
|
2072 TryToCompleteIndicationRequest(); |
|
2073 } |
|
2074 |
|
2075 // --------------------------------------------------------------------------- |
|
2076 // |
|
2077 // --------------------------------------------------------------------------- |
|
2078 // |
|
2079 void DWlanLogicalChannel::FreeIndicationList() |
|
2080 { |
|
2081 // Free the indication list entries |
|
2082 TIndicationListEntry *iter = iFreeIndicationListHead; |
|
2083 TIndicationListEntry *next = NULL; |
|
2084 |
|
2085 while ( iter ) |
|
2086 { |
|
2087 next = iter->next; |
|
2088 |
|
2089 TraceDump(MEMORY, (("WLANLDD: delete TIndicationListEntry: 0x%08x"), |
|
2090 reinterpret_cast<TUint32>(iter))); |
|
2091 |
|
2092 delete iter; |
|
2093 |
|
2094 iter = next; |
|
2095 } |
|
2096 |
|
2097 iFreeIndicationListHead = NULL; |
|
2098 iIndicationListHead = NULL; |
|
2099 iIndicationBuffer = NULL; |
|
2100 } |
|
2101 |
|
2102 // --------------------------------------------------------------------------- |
|
2103 // |
|
2104 // --------------------------------------------------------------------------- |
|
2105 // |
|
2106 void DWlanLogicalChannel::CancelIndicationRequest() |
|
2107 { |
|
2108 iIndicationBuffer = NULL; |
|
2109 PurgeIndicationList(); |
|
2110 } |
|
2111 |
|
2112 // --------------------------------------------------------------------------- |
|
2113 // |
|
2114 // --------------------------------------------------------------------------- |
|
2115 // |
|
2116 void DWlanLogicalChannel::PurgeIndicationList() |
|
2117 { |
|
2118 TIndicationListEntry* iter = iIndicationListHead; |
|
2119 TIndicationListEntry* next = NULL; |
|
2120 |
|
2121 while ( iter ) |
|
2122 { |
|
2123 next = iter->next; |
|
2124 |
|
2125 ReleaseIndicationListEntry( iter ); |
|
2126 |
|
2127 iter = next; |
|
2128 } |
|
2129 |
|
2130 iIndicationListHead = NULL; |
|
2131 } |
|
2132 |
|
2133 // --------------------------------------------------------------------------- |
|
2134 // |
|
2135 // --------------------------------------------------------------------------- |
|
2136 // |
|
2137 void DWlanLogicalChannel::IndicationRequest( TIndication* aBuffer ) |
|
2138 { |
|
2139 iIndicationBuffer = aBuffer; |
|
2140 TryToCompleteIndicationRequest(); |
|
2141 } |
|
2142 |
|
2143 // --------------------------------------------------------------------------- |
|
2144 // |
|
2145 // --------------------------------------------------------------------------- |
|
2146 // |
|
2147 void DWlanLogicalChannel::ReleaseIndicationListEntry( |
|
2148 TIndicationListEntry* aEntry ) |
|
2149 { |
|
2150 aEntry->next = NULL; |
|
2151 |
|
2152 if ( !iFreeIndicationListHead ) |
|
2153 { |
|
2154 iFreeIndicationListHead = aEntry; |
|
2155 } |
|
2156 else |
|
2157 { |
|
2158 TIndicationListEntry* tmp = iFreeIndicationListHead; |
|
2159 |
|
2160 while ( tmp->next ) |
|
2161 { |
|
2162 tmp = tmp->next; |
|
2163 } |
|
2164 |
|
2165 tmp->next = aEntry; |
|
2166 } |
|
2167 } |
|
2168 |
|
2169 // --------------------------------------------------------------------------- |
|
2170 // |
|
2171 // --------------------------------------------------------------------------- |
|
2172 // |
|
2173 void DWlanLogicalChannel::MarkRxBufFree( TUint8* aBufferToFree ) |
|
2174 { |
|
2175 if ( iEthernetFrameMemMngr ) |
|
2176 { |
|
2177 iEthernetFrameMemMngr->DoMarkRxBufFree( aBufferToFree ); |
|
2178 } |
|
2179 } |
|
2180 |
|
2181 // --------------------------------------------------------------------------- |
|
2182 // |
|
2183 // --------------------------------------------------------------------------- |
|
2184 // |
|
2185 void DWlanLogicalChannel::RealTimerDfc() |
|
2186 { |
|
2187 // acquire mutex |
|
2188 |
|
2189 #ifndef RD_WLAN_DDK |
|
2190 Kern::MutexWait( iMutex ); |
|
2191 #else |
|
2192 iOsa->MutexAcquire(); |
|
2193 #endif |
|
2194 |
|
2195 TraceDump(MUTEX, |
|
2196 (("WLANLDD: DWlanLogicalChannel::RealTimerDfc(): mutex acquired"))); |
|
2197 |
|
2198 iUmac.OnTimeout( EWlanDefaultTimer ); |
|
2199 |
|
2200 // release mutex |
|
2201 |
|
2202 #ifndef RD_WLAN_DDK |
|
2203 Kern::MutexSignal( iMutex ); |
|
2204 #else |
|
2205 iOsa->MutexRelease(); |
|
2206 #endif |
|
2207 |
|
2208 TraceDump(MUTEX, |
|
2209 (("WLANLDD: DWlanLogicalChannel::RealTimerDfc(): mutex released"))); |
|
2210 } |
|
2211 |
|
2212 // --------------------------------------------------------------------------- |
|
2213 // |
|
2214 // --------------------------------------------------------------------------- |
|
2215 // |
|
2216 void DWlanLogicalChannel::TimerDfcDoToggle( TAny* aPtr ) |
|
2217 { |
|
2218 DWlanLogicalChannel* ptr = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2219 ptr->RealTimerDfc(); |
|
2220 } |
|
2221 |
|
2222 // --------------------------------------------------------------------------- |
|
2223 // |
|
2224 // --------------------------------------------------------------------------- |
|
2225 // |
|
2226 void DWlanLogicalChannel::RealDfc() |
|
2227 { |
|
2228 // acquire mutex |
|
2229 |
|
2230 #ifndef RD_WLAN_DDK |
|
2231 Kern::MutexWait( iMutex ); |
|
2232 #else |
|
2233 iOsa->MutexAcquire(); |
|
2234 #endif |
|
2235 |
|
2236 TraceDump(MUTEX, |
|
2237 (("WLANLDD: DWlanLogicalChannel::RealDfc: mutex acquired"))); |
|
2238 |
|
2239 if ( !(iFlags & KDfcCancelledMask) ) |
|
2240 { |
|
2241 iUmac.OnDfc( iDfcCtx ); |
|
2242 } |
|
2243 |
|
2244 // release mutex |
|
2245 |
|
2246 #ifndef RD_WLAN_DDK |
|
2247 Kern::MutexSignal( iMutex ); |
|
2248 #else |
|
2249 iOsa->MutexRelease(); |
|
2250 #endif |
|
2251 |
|
2252 TraceDump(MUTEX, |
|
2253 (("WLANLDD: DWlanLogicalChannel::RealDfc: mutex released"))); |
|
2254 } |
|
2255 |
|
2256 // --------------------------------------------------------------------------- |
|
2257 // |
|
2258 // --------------------------------------------------------------------------- |
|
2259 // |
|
2260 void DWlanLogicalChannel::DfcDoToggle( TAny* aPtr ) |
|
2261 { |
|
2262 DWlanLogicalChannel* ptr( static_cast<DWlanLogicalChannel*>(aPtr) ); |
|
2263 ptr->RealDfc(); |
|
2264 } |
|
2265 |
|
2266 // --------------------------------------------------------------------------- |
|
2267 // |
|
2268 // --------------------------------------------------------------------------- |
|
2269 // |
|
2270 void DWlanLogicalChannel::OnTimeOut( TAny *aPtr ) |
|
2271 { |
|
2272 DWlanLogicalChannel* p = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2273 |
|
2274 // queue to a DFC for completion |
|
2275 p->iTimerDfc.Add(); |
|
2276 } |
|
2277 |
|
2278 // --------------------------------------------------------------------------- |
|
2279 // |
|
2280 // --------------------------------------------------------------------------- |
|
2281 // |
|
2282 void DWlanLogicalChannel::RealVoiceCallEntryTimerDfc() |
|
2283 { |
|
2284 // acquire mutex |
|
2285 |
|
2286 #ifndef RD_WLAN_DDK |
|
2287 Kern::MutexWait( iMutex ); |
|
2288 #else |
|
2289 iOsa->MutexAcquire(); |
|
2290 #endif |
|
2291 |
|
2292 TraceDump(MUTEX, |
|
2293 (("WLANLDD: DWlanLogicalChannel::RealVoiceCallEntryTimerDfc(): mutex acquired"))); |
|
2294 |
|
2295 iUmac.OnTimeout( EWlanVoiceCallEntryTimer ); |
|
2296 |
|
2297 // release mutex |
|
2298 |
|
2299 #ifndef RD_WLAN_DDK |
|
2300 Kern::MutexSignal( iMutex ); |
|
2301 #else |
|
2302 iOsa->MutexRelease(); |
|
2303 #endif |
|
2304 |
|
2305 TraceDump(MUTEX, |
|
2306 (("WLANLDD: DWlanLogicalChannel::RealVoiceCallEntryTimerDfc(): mutex released"))); |
|
2307 } |
|
2308 |
|
2309 // --------------------------------------------------------------------------- |
|
2310 // |
|
2311 // --------------------------------------------------------------------------- |
|
2312 // |
|
2313 void DWlanLogicalChannel::VoiceCallEntryTimerDfcDoToggle( TAny* aPtr ) |
|
2314 { |
|
2315 DWlanLogicalChannel* ptr = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2316 ptr->RealVoiceCallEntryTimerDfc(); |
|
2317 } |
|
2318 |
|
2319 // --------------------------------------------------------------------------- |
|
2320 // |
|
2321 // --------------------------------------------------------------------------- |
|
2322 // |
|
2323 void DWlanLogicalChannel::OnVoiceCallEntryTimerTimeOut( TAny *aPtr ) |
|
2324 { |
|
2325 DWlanLogicalChannel* p = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2326 |
|
2327 // queue to a DFC for completion |
|
2328 p->iVoiceCallEntryTimerDfc.Add(); |
|
2329 } |
|
2330 |
|
2331 // --------------------------------------------------------------------------- |
|
2332 // |
|
2333 // --------------------------------------------------------------------------- |
|
2334 // |
|
2335 void DWlanLogicalChannel::RealNullTimerDfc() |
|
2336 { |
|
2337 // acquire mutex |
|
2338 |
|
2339 #ifndef RD_WLAN_DDK |
|
2340 Kern::MutexWait( iMutex ); |
|
2341 #else |
|
2342 iOsa->MutexAcquire(); |
|
2343 #endif |
|
2344 |
|
2345 TraceDump(MUTEX, |
|
2346 (("WLANLDD: DWlanLogicalChannel::RealNullTimerDfc(): mutex acquired"))); |
|
2347 |
|
2348 iUmac.OnTimeout( EWlanNullTimer ); |
|
2349 |
|
2350 // release mutex |
|
2351 |
|
2352 #ifndef RD_WLAN_DDK |
|
2353 Kern::MutexSignal( iMutex ); |
|
2354 #else |
|
2355 iOsa->MutexRelease(); |
|
2356 #endif |
|
2357 |
|
2358 TraceDump(MUTEX, |
|
2359 (("WLANLDD: DWlanLogicalChannel::RealNullTimerDfc(): mutex released"))); |
|
2360 } |
|
2361 |
|
2362 // --------------------------------------------------------------------------- |
|
2363 // |
|
2364 // --------------------------------------------------------------------------- |
|
2365 // |
|
2366 void DWlanLogicalChannel::NullTimerDfcDoToggle( TAny* aPtr ) |
|
2367 { |
|
2368 DWlanLogicalChannel* ptr = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2369 ptr->RealNullTimerDfc(); |
|
2370 } |
|
2371 |
|
2372 // --------------------------------------------------------------------------- |
|
2373 // |
|
2374 // --------------------------------------------------------------------------- |
|
2375 // |
|
2376 void DWlanLogicalChannel::OnNullTimerTimeOut( TAny *aPtr ) |
|
2377 { |
|
2378 DWlanLogicalChannel* p = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2379 |
|
2380 // queue to a DFC for completion |
|
2381 p->iNullTimerDfc.Add(); |
|
2382 } |
|
2383 |
|
2384 // --------------------------------------------------------------------------- |
|
2385 // |
|
2386 // --------------------------------------------------------------------------- |
|
2387 // |
|
2388 void DWlanLogicalChannel::RealNoVoiceTimerDfc() |
|
2389 { |
|
2390 // acquire mutex |
|
2391 |
|
2392 #ifndef RD_WLAN_DDK |
|
2393 Kern::MutexWait( iMutex ); |
|
2394 #else |
|
2395 iOsa->MutexAcquire(); |
|
2396 #endif |
|
2397 |
|
2398 TraceDump(MUTEX, |
|
2399 (("WLANLDD: DWlanLogicalChannel::RealNoVoiceTimerDfc: mutex acquired"))); |
|
2400 |
|
2401 iUmac.OnTimeout( EWlanNoVoiceTimer ); |
|
2402 |
|
2403 // release mutex |
|
2404 |
|
2405 #ifndef RD_WLAN_DDK |
|
2406 Kern::MutexSignal( iMutex ); |
|
2407 #else |
|
2408 iOsa->MutexRelease(); |
|
2409 #endif |
|
2410 |
|
2411 TraceDump(MUTEX, |
|
2412 (("WLANLDD: DWlanLogicalChannel::RealNoVoiceTimerDfc: mutex released"))); |
|
2413 } |
|
2414 |
|
2415 // --------------------------------------------------------------------------- |
|
2416 // |
|
2417 // --------------------------------------------------------------------------- |
|
2418 // |
|
2419 void DWlanLogicalChannel::NoVoiceTimerDfcDoToggle( TAny* aPtr ) |
|
2420 { |
|
2421 DWlanLogicalChannel* ptr = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2422 ptr->RealNoVoiceTimerDfc(); |
|
2423 } |
|
2424 |
|
2425 // --------------------------------------------------------------------------- |
|
2426 // |
|
2427 // --------------------------------------------------------------------------- |
|
2428 // |
|
2429 void DWlanLogicalChannel::OnNoVoiceTimerTimeOut( TAny *aPtr ) |
|
2430 { |
|
2431 DWlanLogicalChannel* p = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2432 |
|
2433 // queue to a DFC for completion |
|
2434 p->iNoVoiceTimerDfc.Add(); |
|
2435 } |
|
2436 |
|
2437 // --------------------------------------------------------------------------- |
|
2438 // |
|
2439 // --------------------------------------------------------------------------- |
|
2440 // |
|
2441 void DWlanLogicalChannel::RealKeepAliveTimerDfc() |
|
2442 { |
|
2443 // acquire mutex |
|
2444 |
|
2445 #ifndef RD_WLAN_DDK |
|
2446 Kern::MutexWait( iMutex ); |
|
2447 #else |
|
2448 iOsa->MutexAcquire(); |
|
2449 #endif |
|
2450 |
|
2451 TraceDump(MUTEX, |
|
2452 (("WLANLDD: DWlanLogicalChannel::RealKeepAliveTimerDfc: mutex acquired"))); |
|
2453 |
|
2454 iUmac.OnTimeout( EWlanKeepAliveTimer ); |
|
2455 |
|
2456 // release mutex |
|
2457 |
|
2458 #ifndef RD_WLAN_DDK |
|
2459 Kern::MutexSignal( iMutex ); |
|
2460 #else |
|
2461 iOsa->MutexRelease(); |
|
2462 #endif |
|
2463 |
|
2464 TraceDump(MUTEX, |
|
2465 (("WLANLDD: DWlanLogicalChannel::RealKeepAliveTimerDfc: mutex released"))); |
|
2466 } |
|
2467 |
|
2468 // --------------------------------------------------------------------------- |
|
2469 // |
|
2470 // --------------------------------------------------------------------------- |
|
2471 // |
|
2472 void DWlanLogicalChannel::KeepAliveTimerDfcDoToggle( TAny* aPtr ) |
|
2473 { |
|
2474 DWlanLogicalChannel* ptr = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2475 ptr->RealKeepAliveTimerDfc(); |
|
2476 } |
|
2477 |
|
2478 // --------------------------------------------------------------------------- |
|
2479 // |
|
2480 // --------------------------------------------------------------------------- |
|
2481 // |
|
2482 void DWlanLogicalChannel::OnKeepAliveTimerTimeOut( TAny *aPtr ) |
|
2483 { |
|
2484 DWlanLogicalChannel* p = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2485 |
|
2486 // queue to a DFC for completion |
|
2487 p->iKeepAliveTimerDfc.Add(); |
|
2488 } |
|
2489 |
|
2490 // --------------------------------------------------------------------------- |
|
2491 // |
|
2492 // --------------------------------------------------------------------------- |
|
2493 // |
|
2494 void DWlanLogicalChannel::RealActiveToLightPsTimerDfc() |
|
2495 { |
|
2496 // acquire mutex |
|
2497 |
|
2498 #ifndef RD_WLAN_DDK |
|
2499 Kern::MutexWait( iMutex ); |
|
2500 #else |
|
2501 iOsa->MutexAcquire(); |
|
2502 #endif |
|
2503 |
|
2504 TraceDump(MUTEX, |
|
2505 (("WLANLDD: DWlanLogicalChannel::RealActiveToLightPsTimerDfc: mutex acquired"))); |
|
2506 |
|
2507 iUmac.OnTimeout( EWlanActiveToLightPsTimer ); |
|
2508 |
|
2509 // release mutex |
|
2510 |
|
2511 #ifndef RD_WLAN_DDK |
|
2512 Kern::MutexSignal( iMutex ); |
|
2513 #else |
|
2514 iOsa->MutexRelease(); |
|
2515 #endif |
|
2516 |
|
2517 TraceDump(MUTEX, |
|
2518 (("WLANLDD: DWlanLogicalChannel::RealActiveToLightPsTimerDfc: mutex released"))); |
|
2519 } |
|
2520 |
|
2521 // --------------------------------------------------------------------------- |
|
2522 // |
|
2523 // --------------------------------------------------------------------------- |
|
2524 // |
|
2525 void DWlanLogicalChannel::ActiveToLightPsTimerDfcDoToggle( TAny* aPtr ) |
|
2526 { |
|
2527 DWlanLogicalChannel* ptr = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2528 ptr->RealActiveToLightPsTimerDfc(); |
|
2529 } |
|
2530 |
|
2531 // --------------------------------------------------------------------------- |
|
2532 // |
|
2533 // --------------------------------------------------------------------------- |
|
2534 // |
|
2535 void DWlanLogicalChannel::OnActiveToLightPsTimerTimeOut( TAny *aPtr ) |
|
2536 { |
|
2537 DWlanLogicalChannel* p = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2538 |
|
2539 // queue to a DFC for completion |
|
2540 p->iActiveToLightPsTimerDfc.Add(); |
|
2541 } |
|
2542 |
|
2543 // --------------------------------------------------------------------------- |
|
2544 // |
|
2545 // --------------------------------------------------------------------------- |
|
2546 // |
|
2547 void DWlanLogicalChannel::RealLightPsToActiveTimerDfc() |
|
2548 { |
|
2549 // acquire mutex |
|
2550 |
|
2551 #ifndef RD_WLAN_DDK |
|
2552 Kern::MutexWait( iMutex ); |
|
2553 #else |
|
2554 iOsa->MutexAcquire(); |
|
2555 #endif |
|
2556 |
|
2557 TraceDump(MUTEX, |
|
2558 (("WLANLDD: DWlanLogicalChannel::RealLightPsToActiveTimerDfc: mutex acquired"))); |
|
2559 |
|
2560 iUmac.OnTimeout( EWlanLightPsToActiveTimer ); |
|
2561 |
|
2562 // release mutex |
|
2563 |
|
2564 #ifndef RD_WLAN_DDK |
|
2565 Kern::MutexSignal( iMutex ); |
|
2566 #else |
|
2567 iOsa->MutexRelease(); |
|
2568 #endif |
|
2569 |
|
2570 TraceDump(MUTEX, |
|
2571 (("WLANLDD: DWlanLogicalChannel::RealLightPsToActiveTimerDfc: mutex released"))); |
|
2572 } |
|
2573 |
|
2574 // --------------------------------------------------------------------------- |
|
2575 // |
|
2576 // --------------------------------------------------------------------------- |
|
2577 // |
|
2578 void DWlanLogicalChannel::LightPsToActiveTimerDfcDoToggle( TAny* aPtr ) |
|
2579 { |
|
2580 DWlanLogicalChannel* ptr = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2581 ptr->RealLightPsToActiveTimerDfc(); |
|
2582 } |
|
2583 |
|
2584 // --------------------------------------------------------------------------- |
|
2585 // |
|
2586 // --------------------------------------------------------------------------- |
|
2587 // |
|
2588 void DWlanLogicalChannel::OnLightPsToActiveTimerTimeOut( TAny *aPtr ) |
|
2589 { |
|
2590 DWlanLogicalChannel* p = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2591 |
|
2592 // queue to a DFC for completion |
|
2593 p->iLightPsToActiveTimerDfc.Add(); |
|
2594 } |
|
2595 |
|
2596 // --------------------------------------------------------------------------- |
|
2597 // |
|
2598 // --------------------------------------------------------------------------- |
|
2599 // |
|
2600 void DWlanLogicalChannel::RealLightPsToDeepPsTimerDfc() |
|
2601 { |
|
2602 // acquire mutex |
|
2603 |
|
2604 #ifndef RD_WLAN_DDK |
|
2605 Kern::MutexWait( iMutex ); |
|
2606 #else |
|
2607 iOsa->MutexAcquire(); |
|
2608 #endif |
|
2609 |
|
2610 TraceDump(MUTEX, |
|
2611 (("WLANLDD: DWlanLogicalChannel::RealLightPsToDeepPsTimerDfc: mutex acquired"))); |
|
2612 |
|
2613 iUmac.OnTimeout( EWlanLightPsToDeepPsTimer ); |
|
2614 |
|
2615 // release mutex |
|
2616 |
|
2617 #ifndef RD_WLAN_DDK |
|
2618 Kern::MutexSignal( iMutex ); |
|
2619 #else |
|
2620 iOsa->MutexRelease(); |
|
2621 #endif |
|
2622 |
|
2623 TraceDump(MUTEX, |
|
2624 (("WLANLDD: DWlanLogicalChannel::RealLightPsToDeepPsTimerDfc: mutex released"))); |
|
2625 } |
|
2626 |
|
2627 // --------------------------------------------------------------------------- |
|
2628 // |
|
2629 // --------------------------------------------------------------------------- |
|
2630 // |
|
2631 void DWlanLogicalChannel::LightPsToDeepPsTimerDfcDoToggle( TAny* aPtr ) |
|
2632 { |
|
2633 DWlanLogicalChannel* ptr = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2634 ptr->RealLightPsToDeepPsTimerDfc(); |
|
2635 } |
|
2636 |
|
2637 // --------------------------------------------------------------------------- |
|
2638 // |
|
2639 // --------------------------------------------------------------------------- |
|
2640 // |
|
2641 void DWlanLogicalChannel::OnLightPsToDeepPsTimerTimeOut( TAny *aPtr ) |
|
2642 { |
|
2643 DWlanLogicalChannel* p = static_cast<DWlanLogicalChannel*>(aPtr); |
|
2644 |
|
2645 // queue to a DFC for completion |
|
2646 p->iLightPsToDeepPsTimerDfc.Add(); |
|
2647 } |
|
2648 |
|
2649 // --------------------------------------------------------------------------- |
|
2650 // |
|
2651 // --------------------------------------------------------------------------- |
|
2652 // |
|
2653 void DWlanLogicalChannel::RegisterTimeout( |
|
2654 TUint32 aTimeoutInMicroSeconds, |
|
2655 TWlanTimer aTimer ) |
|
2656 { |
|
2657 TraceDump(INFO_LEVEL, |
|
2658 (("WLANLDD: DWlanLogicalChannel::RegisterTimeout: timer: %d"), |
|
2659 aTimer)); |
|
2660 TraceDump(INFO_LEVEL, |
|
2661 (("WLANLDD: DWlanLogicalChannel::RegisterTimeout: aTimeoutInMicroSeconds: %d"), |
|
2662 aTimeoutInMicroSeconds)); |
|
2663 |
|
2664 const TInt KThousand = 1000; |
|
2665 |
|
2666 switch ( aTimer ) |
|
2667 { |
|
2668 case EWlanDefaultTimer: |
|
2669 iTimer.OneShot( |
|
2670 // convert timeout 1st to milliseconds & then to NKern ticks |
|
2671 NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), |
|
2672 // request completion in ISR context |
|
2673 EFalse ); |
|
2674 break; |
|
2675 case EWlanVoiceCallEntryTimer: |
|
2676 iVoiceCallEntryTimer.OneShot( |
|
2677 // convert timeout 1st to milliseconds & then to NKern ticks |
|
2678 NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), |
|
2679 // request completion in ISR context |
|
2680 EFalse ); |
|
2681 break; |
|
2682 case EWlanNullTimer: |
|
2683 iNullTimer.OneShot( |
|
2684 // convert timeout 1st to milliseconds & then to NKern ticks |
|
2685 NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), |
|
2686 // request completion in ISR context |
|
2687 EFalse ); |
|
2688 break; |
|
2689 case EWlanNoVoiceTimer: |
|
2690 iNoVoiceTimer.OneShot( |
|
2691 // convert timeout 1st to milliseconds & then to NKern ticks |
|
2692 NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), |
|
2693 // request completion in ISR context |
|
2694 EFalse ); |
|
2695 break; |
|
2696 case EWlanKeepAliveTimer: |
|
2697 iKeepAliveTimer.OneShot( |
|
2698 // convert timeout 1st to milliseconds & then to NKern ticks |
|
2699 NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), |
|
2700 // request completion in ISR context |
|
2701 EFalse ); |
|
2702 break; |
|
2703 case EWlanActiveToLightPsTimer: |
|
2704 iActiveToLightPsTimer.OneShot( |
|
2705 // convert timeout 1st to milliseconds & then to NKern ticks |
|
2706 NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), |
|
2707 // request completion in ISR context |
|
2708 EFalse ); |
|
2709 break; |
|
2710 case EWlanLightPsToActiveTimer: |
|
2711 iLightPsToActiveTimer.OneShot( |
|
2712 // convert timeout 1st to milliseconds & then to NKern ticks |
|
2713 NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), |
|
2714 // request completion in ISR context |
|
2715 EFalse ); |
|
2716 break; |
|
2717 case EWlanLightPsToDeepPsTimer: |
|
2718 iLightPsToDeepPsTimer.OneShot( |
|
2719 // convert timeout 1st to milliseconds & then to NKern ticks |
|
2720 NKern::TimerTicks( aTimeoutInMicroSeconds / KThousand ), |
|
2721 // request completion in ISR context |
|
2722 EFalse ); |
|
2723 break; |
|
2724 default: |
|
2725 TraceDump(ERROR_LEVEL, |
|
2726 (("WLANLDD: DWlanLogicalChannel::RegisterTimeout: panic, unknown timer: %d"), |
|
2727 aTimer)); |
|
2728 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
2729 } |
|
2730 } |
|
2731 |
|
2732 // --------------------------------------------------------------------------- |
|
2733 // |
|
2734 // --------------------------------------------------------------------------- |
|
2735 // |
|
2736 void DWlanLogicalChannel::CancelTimeout( TWlanTimer aTimer ) |
|
2737 { |
|
2738 TraceDump(INFO_LEVEL, |
|
2739 (("WLANLDD: DWlanLogicalChannel::CancelTimeout: timer: %d"), |
|
2740 aTimer)); |
|
2741 |
|
2742 switch ( aTimer ) |
|
2743 { |
|
2744 case EWlanDefaultTimer: |
|
2745 iTimer.Cancel(); |
|
2746 iTimerDfc.Cancel(); |
|
2747 break; |
|
2748 case EWlanVoiceCallEntryTimer: |
|
2749 iVoiceCallEntryTimer.Cancel(); |
|
2750 iVoiceCallEntryTimerDfc.Cancel(); |
|
2751 break; |
|
2752 case EWlanNullTimer: |
|
2753 iNullTimer.Cancel(); |
|
2754 iNullTimerDfc.Cancel(); |
|
2755 break; |
|
2756 case EWlanNoVoiceTimer: |
|
2757 iNoVoiceTimer.Cancel(); |
|
2758 iNoVoiceTimerDfc.Cancel(); |
|
2759 break; |
|
2760 case EWlanKeepAliveTimer: |
|
2761 iKeepAliveTimer.Cancel(); |
|
2762 iKeepAliveTimerDfc.Cancel(); |
|
2763 break; |
|
2764 case EWlanActiveToLightPsTimer: |
|
2765 iActiveToLightPsTimer.Cancel(); |
|
2766 iActiveToLightPsTimerDfc.Cancel(); |
|
2767 break; |
|
2768 case EWlanLightPsToActiveTimer: |
|
2769 iLightPsToActiveTimer.Cancel(); |
|
2770 iLightPsToActiveTimerDfc.Cancel(); |
|
2771 break; |
|
2772 case EWlanLightPsToDeepPsTimer: |
|
2773 iLightPsToDeepPsTimer.Cancel(); |
|
2774 iLightPsToDeepPsTimerDfc.Cancel(); |
|
2775 break; |
|
2776 default: |
|
2777 TraceDump(ERROR_LEVEL, |
|
2778 (("WLANLDD: DWlanLogicalChannel::CancelTimeout: panic, unknown timer: %d"), |
|
2779 aTimer)); |
|
2780 os_assert( (TUint8*)("WLANLDD: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
2781 } |
|
2782 } |
|
2783 |
|
2784 // --------------------------------------------------------------------------- |
|
2785 // |
|
2786 // --------------------------------------------------------------------------- |
|
2787 // |
|
2788 void DWlanLogicalChannel::RegisterDfc( TAny* aCntx ) |
|
2789 { |
|
2790 iFlags &= ~KDfcCancelledMask; |
|
2791 iDfcCtx = aCntx; |
|
2792 iDfc.Enque(); |
|
2793 } |
|
2794 |
|
2795 // --------------------------------------------------------------------------- |
|
2796 // |
|
2797 // --------------------------------------------------------------------------- |
|
2798 // |
|
2799 void DWlanLogicalChannel::CancelDfc() |
|
2800 { |
|
2801 iFlags |= KDfcCancelledMask; |
|
2802 iDfc.Cancel(); |
|
2803 } |
|
2804 |
|
2805 // --------------------------------------------------------------------------- |
|
2806 // |
|
2807 // --------------------------------------------------------------------------- |
|
2808 // |
|
2809 void DWlanLogicalChannel::RealTxTriggerDfc() |
|
2810 { |
|
2811 // acquire mutex |
|
2812 |
|
2813 #ifndef RD_WLAN_DDK |
|
2814 Kern::MutexWait( iMutex ); |
|
2815 #else |
|
2816 iOsa->MutexAcquire(); |
|
2817 #endif |
|
2818 |
|
2819 TraceDump(MUTEX, |
|
2820 ("WLANLDD: DWlanLogicalChannel::RealTxTriggerDfc: mutex acquired")); |
|
2821 |
|
2822 iFlags &= ~KTxTriggerArmed; |
|
2823 TxProtocolStackData(); |
|
2824 |
|
2825 // release mutex |
|
2826 |
|
2827 #ifndef RD_WLAN_DDK |
|
2828 Kern::MutexSignal( iMutex ); |
|
2829 #else |
|
2830 iOsa->MutexRelease(); |
|
2831 #endif |
|
2832 |
|
2833 TraceDump(MUTEX, |
|
2834 ("WLANLDD: DWlanLogicalChannel::RealTxTriggerDfc: mutex released")); |
|
2835 } |
|
2836 |
|
2837 // --------------------------------------------------------------------------- |
|
2838 // |
|
2839 // --------------------------------------------------------------------------- |
|
2840 // |
|
2841 void DWlanLogicalChannel::TxTriggerDfcDoToggle( TAny* aPtr ) |
|
2842 { |
|
2843 DWlanLogicalChannel* ptr( static_cast<DWlanLogicalChannel*>(aPtr) ); |
|
2844 ptr->RealTxTriggerDfc(); |
|
2845 } |
|
2846 |
|
2847 // --------------------------------------------------------------------------- |
|
2848 // |
|
2849 // --------------------------------------------------------------------------- |
|
2850 // |
|
2851 TDataBuffer* DWlanLogicalChannel::GetRxFrameMetaHeader() |
|
2852 { |
|
2853 TDataBuffer* metaHdr ( NULL ); |
|
2854 if ( iEthernetFrameMemMngr ) |
|
2855 { |
|
2856 metaHdr = iEthernetFrameMemMngr->GetRxFrameMetaHeader(); |
|
2857 } |
|
2858 else |
|
2859 { |
|
2860 TraceDump(RX_FRAME | WARNING_LEVEL, |
|
2861 ("WLANLDD: DWlanLogicalChannel::GetRxFrameMetaHeader: WARNING: no frame mgr => failed")); |
|
2862 } |
|
2863 |
|
2864 return metaHdr; |
|
2865 } |
|
2866 |
|
2867 // --------------------------------------------------------------------------- |
|
2868 // |
|
2869 // --------------------------------------------------------------------------- |
|
2870 // |
|
2871 void DWlanLogicalChannel::FreeRxFrameMetaHeader( TDataBuffer* aMetaHeader ) |
|
2872 { |
|
2873 if ( iEthernetFrameMemMngr ) |
|
2874 { |
|
2875 iEthernetFrameMemMngr->FreeRxFrameMetaHeader( aMetaHeader ); |
|
2876 } |
|
2877 } |
|
2878 |
|
2879 // --------------------------------------------------------------------------- |
|
2880 // |
|
2881 // --------------------------------------------------------------------------- |
|
2882 // |
|
2883 void DWlanLogicalChannel::OnPowerUp() |
|
2884 { |
|
2885 // acquire mutex |
|
2886 |
|
2887 #ifndef RD_WLAN_DDK |
|
2888 Kern::MutexWait( iMutex ); |
|
2889 #else |
|
2890 iOsa->MutexAcquire(); |
|
2891 #endif |
|
2892 |
|
2893 TraceDump(MUTEX, |
|
2894 (("WLANLDD: DWlanLogicalChannel::OnPowerUp: mutex acquired"))); |
|
2895 |
|
2896 // No real action in this case; so just inform that we are done |
|
2897 iPowerHandler.OnPowerUpDone(); |
|
2898 |
|
2899 // release mutex |
|
2900 |
|
2901 #ifndef RD_WLAN_DDK |
|
2902 Kern::MutexSignal( iMutex ); |
|
2903 #else |
|
2904 iOsa->MutexRelease(); |
|
2905 #endif |
|
2906 |
|
2907 TraceDump(MUTEX, |
|
2908 (("WLANLDD: DWlanLogicalChannel::OnPowerUp: mutex released"))); |
|
2909 } |
|
2910 |
|
2911 // --------------------------------------------------------------------------- |
|
2912 // |
|
2913 // --------------------------------------------------------------------------- |
|
2914 // |
|
2915 void DWlanLogicalChannel::OnPowerDown() |
|
2916 { |
|
2917 TraceDump(INIT_LEVEL, |
|
2918 (("WLANLDD: DWlanLogicalChannel::OnPowerDown"))); |
|
2919 |
|
2920 iPoweringDown = ETrue; |
|
2921 |
|
2922 // acquire mutex |
|
2923 |
|
2924 #ifndef RD_WLAN_DDK |
|
2925 Kern::MutexWait( iMutex ); |
|
2926 #else |
|
2927 iOsa->MutexAcquire(); |
|
2928 #endif |
|
2929 |
|
2930 TraceDump(MUTEX, |
|
2931 (("WLANLDD: DWlanLogicalChannel::OnPowerDown: mutex acquired"))); |
|
2932 |
|
2933 // Trigger power down indication to wlanengine |
|
2934 iUmac.OnInDicationEvent( EOsPowerStandby ); |
|
2935 |
|
2936 // release mutex |
|
2937 |
|
2938 #ifndef RD_WLAN_DDK |
|
2939 Kern::MutexSignal( iMutex ); |
|
2940 #else |
|
2941 iOsa->MutexRelease(); |
|
2942 #endif |
|
2943 |
|
2944 TraceDump(MUTEX, |
|
2945 (("WLANLDD: DWlanLogicalChannel::OnPowerDown: mutex released"))); |
|
2946 } |