equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
14 * Description: Implementation of the DataFrameMemMngr class. |
14 * Description: Implementation of the DataFrameMemMngr class. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 /* |
18 /* |
19 * %version: 17 % |
19 * %version: 18 % |
20 */ |
20 */ |
21 |
21 |
22 #include "WlLddWlanLddConfig.h" |
22 #include "WlLddWlanLddConfig.h" |
23 #include "DataFrameMemMngr.h" |
23 #include "DataFrameMemMngr.h" |
24 #include "osachunk.h" |
24 #include "osachunk.h" |
58 r ) ); |
58 r ) ); |
59 |
59 |
60 // store the handle & chunk size |
60 // store the handle & chunk size |
61 aSharedChunkInfo.iChunkHandle = r; |
61 aSharedChunkInfo.iChunkHandle = r; |
62 aSharedChunkInfo.iSize = aSharedMemoryChunk->Size(); |
62 aSharedChunkInfo.iSize = aSharedMemoryChunk->Size(); |
|
63 iClientChunkHandle = r; |
63 |
64 |
64 // store the kernel addresses |
65 // store the kernel addresses |
65 |
66 |
66 TLinAddr start_of_mem_linear( 0 ); |
67 TLinAddr start_of_mem_linear( 0 ); |
67 aSharedMemoryChunk->Address( 0, aSharedChunkInfo.iSize, start_of_mem_linear ); |
68 aSharedMemoryChunk->Address( 0, aSharedChunkInfo.iSize, start_of_mem_linear ); |
373 (("WLANLDD: DataFrameMemMngr::AllocTxBuffer: aLength: %d"), |
374 (("WLANLDD: DataFrameMemMngr::AllocTxBuffer: aLength: %d"), |
374 aLength) ); |
375 aLength) ); |
375 |
376 |
376 TDataBuffer* metaHdr ( NULL ); |
377 TDataBuffer* metaHdr ( NULL ); |
377 |
378 |
378 if ( aLength > KMaxEthernetFrameLength ) |
379 if ( ( !IsMemInUse() ) || ( aLength > KMaxEthernetFrameLength ) ) |
379 { |
380 { |
380 #ifndef NDEBUG |
381 #ifndef NDEBUG |
381 TraceDump( NWSA_TX_DETAILS, |
382 TraceDump( NWSA_TX_DETAILS, |
382 ("WLANLDD: DataFrameMemMngr::AllocTxBuffer: WARNING: max size exceeded; req. denied") ); |
383 ("WLANLDD: DataFrameMemMngr::AllocTxBuffer: WARNING: either " |
|
384 "memory not in use OR max size exceeded. Req. denied") ); |
383 os_assert( |
385 os_assert( |
384 (TUint8*)("WLANLDD: panic"), |
386 (TUint8*)("WLANLDD: panic"), |
385 (TUint8*)(WLAN_FILE), |
387 (TUint8*)(WLAN_FILE), |
386 __LINE__ ); |
388 __LINE__ ); |
387 #endif |
389 #endif |
388 |
390 |
389 return metaHdr; |
391 return metaHdr; |
390 } |
392 } |
391 |
393 |
437 |
439 |
438 // --------------------------------------------------------------------------- |
440 // --------------------------------------------------------------------------- |
439 // |
441 // |
440 // --------------------------------------------------------------------------- |
442 // --------------------------------------------------------------------------- |
441 // |
443 // |
442 void DataFrameMemMngr::OnReleaseMemory() |
444 void DataFrameMemMngr::OnReleaseMemory( DThread& aThread ) |
443 { |
445 { |
444 TraceDump(INIT_LEVEL, ("WLANLDD: DataFrameMemMngr::OnReleaseMemory")); |
446 TraceDump(INIT_LEVEL, ("WLANLDD: DataFrameMemMngr::OnReleaseMemory")); |
445 |
447 |
446 if ( iTxFrameMemoryPool ) |
448 if ( iTxFrameMemoryPool ) |
447 { |
449 { |
450 |
452 |
451 delete iTxFrameMemoryPool; |
453 delete iTxFrameMemoryPool; |
452 iTxFrameMemoryPool = NULL; |
454 iTxFrameMemoryPool = NULL; |
453 iTxDataChunk = NULL; |
455 iTxDataChunk = NULL; |
454 |
456 |
455 MarkMemFree(); |
457 MarkMemFree(); |
456 } |
458 } |
457 } |
459 |
|
460 if ( iClientChunkHandle >= 0 ) |
|
461 { |
|
462 TraceDump(INIT_LEVEL, |
|
463 (("WLANLDD: DataFrameMemMngr::OnReleaseMemory: close shared chunk " |
|
464 "handle: %d"), |
|
465 iClientChunkHandle)); |
|
466 |
|
467 // We have a valid client handle to the shared chunk, so close it |
|
468 Kern::CloseHandle( &aThread, iClientChunkHandle ); |
|
469 iClientChunkHandle = -1; |
|
470 } |
|
471 } |