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". |
89 cacheOption)); |
89 cacheOption)); |
90 |
90 |
91 TUint32 physicalAddressNotNeeded ( 0 ); |
91 TUint32 physicalAddressNotNeeded ( 0 ); |
92 |
92 |
93 // Map our device's memory into the chunk (at offset 0) |
93 // Map our device's memory into the chunk (at offset 0) |
94 r = Kern::ChunkCommitContiguous( chunk, 0, iChunkSize, physicalAddressNotNeeded ); |
94 r = Kern::ChunkCommitContiguous( |
|
95 chunk, |
|
96 0, |
|
97 iChunkSize, |
|
98 physicalAddressNotNeeded ); |
95 |
99 |
96 if ( r != KErrNone) |
100 if ( r != KErrNone) |
97 { |
101 { |
98 TraceDump( WARNING_LEVEL, |
102 TraceDump( WARNING_LEVEL, |
99 (("WLANLDD: MgmtFrameMemMngr::DoAllocate: chunk commit failed. Status: %d"), |
103 (("WLANLDD: MgmtFrameMemMngr::DoAllocate: chunk commit failed. Status: %d"), |
161 r ) ); |
165 r ) ); |
162 |
166 |
163 // store the handle & the chunk size |
167 // store the handle & the chunk size |
164 aSharedChunkInfo.iChunkHandle = r; |
168 aSharedChunkInfo.iChunkHandle = r; |
165 aSharedChunkInfo.iSize = iChunkSize; |
169 aSharedChunkInfo.iSize = iChunkSize; |
|
170 iClientChunkHandle = r; |
166 |
171 |
167 // store the kernel addresses |
172 // store the kernel addresses |
168 |
173 |
169 TUint8* start_of_mem = reinterpret_cast<TUint8*>(iChunkKernelAddr ); |
174 TUint8* start_of_mem = reinterpret_cast<TUint8*>(iChunkKernelAddr ); |
170 |
175 |
593 |
598 |
594 // --------------------------------------------------------------------------- |
599 // --------------------------------------------------------------------------- |
595 // |
600 // |
596 // --------------------------------------------------------------------------- |
601 // --------------------------------------------------------------------------- |
597 // |
602 // |
598 void MgmtFrameMemMngr::OnReleaseMemory() |
603 void MgmtFrameMemMngr::OnReleaseMemory( DThread& aThread ) |
599 { |
604 { |
600 TraceDump(INIT_LEVEL, ("WLANLDD: MgmtFrameMemMngr::OnReleaseMemory")); |
605 TraceDump(INIT_LEVEL, ("WLANLDD: MgmtFrameMemMngr::OnReleaseMemory")); |
601 |
606 |
602 TraceDump(MEMORY, (("WLANLDD: delete WlanChunk: 0x%08x"), |
607 if ( iRxFrameMemoryPool ) |
603 reinterpret_cast<TUint32>(iRxFrameMemoryPool))); |
608 { |
604 |
609 TraceDump(MEMORY, (("WLANLDD: delete WlanChunk: 0x%08x"), |
605 delete iRxFrameMemoryPool; |
610 reinterpret_cast<TUint32>(iRxFrameMemoryPool))); |
606 iRxFrameMemoryPool = NULL; |
611 |
|
612 delete iRxFrameMemoryPool; |
|
613 iRxFrameMemoryPool = NULL; |
|
614 } |
607 |
615 |
608 if ( iParent.SharedMemoryChunk() ) |
616 if ( iParent.SharedMemoryChunk() ) |
609 { |
617 { |
610 TraceDump(MEMORY, (("WLANLDD: delete DChunk: 0x%08x"), |
618 TraceDump(MEMORY, (("WLANLDD: delete DChunk: 0x%08x"), |
611 reinterpret_cast<TUint32>(iParent.SharedMemoryChunk()))); |
619 reinterpret_cast<TUint32>(iParent.SharedMemoryChunk()))); |
612 |
620 |
|
621 if ( iClientChunkHandle >= 0 ) |
|
622 { |
|
623 TraceDump(INIT_LEVEL, |
|
624 (("WLANLDD: MgmtFrameMemMngr::OnReleaseMemory: close shared " |
|
625 "chunk handle: %d"), |
|
626 iClientChunkHandle)); |
|
627 |
|
628 // We have a valid client handle to the shared chunk, so close it |
|
629 Kern::CloseHandle( &aThread, iClientChunkHandle ); |
|
630 iClientChunkHandle = -1; |
|
631 } |
|
632 |
613 // schedule the shared memory chunk for destruction |
633 // schedule the shared memory chunk for destruction |
614 Kern::ChunkClose( iParent.SharedMemoryChunk() ); |
634 Kern::ChunkClose( iParent.SharedMemoryChunk() ); |
615 iParent.SharedMemoryChunk() = NULL; |
635 iParent.SharedMemoryChunk() = NULL; |
616 MarkMemFree(); // mark as free |
636 MarkMemFree(); |
617 } |
637 } |
618 else |
638 } |
619 { |
|
620 // nothing here |
|
621 } |
|
622 } |
|