wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/DataFrameMemMngr.h
changeset 0 c40eb8fe8501
child 3 6524e815f76f
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2002-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:   Declaration of the DataFrameMemMngr class.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 11 %
       
    20 */
       
    21 
       
    22 #ifndef DATAFRAMEMMNGR_H
       
    23 #define DATAFRAMEMMNGR_H
       
    24 
       
    25 #include "EthernetFrameMemMngr.h"
       
    26 
       
    27 class WlanChunk;
       
    28 
       
    29 /**
       
    30 *  Memory manager for protocol stack side client frame Rx memory
       
    31 *
       
    32 *  @since S60 v3.1
       
    33 */
       
    34 class DataFrameMemMngr : public DEthernetFrameMemMngr
       
    35     {
       
    36 public: 
       
    37 
       
    38     /** Ctor */
       
    39     DataFrameMemMngr( 
       
    40         DWlanLogicalChannel& aParent,
       
    41         WlanChunk*& aRxFrameMemoryPool,
       
    42         TInt aTxFrameBufAllocationUnit ) : 
       
    43         DEthernetFrameMemMngr( aParent, aRxFrameMemoryPool ),
       
    44         iFrameXferBlockProtoStack( NULL ),
       
    45         iTxDataChunk( NULL ),
       
    46         iTxFrameMemoryPool( NULL ),
       
    47         iTxFrameBufAllocationUnit ( aTxFrameBufAllocationUnit )
       
    48         {};
       
    49 
       
    50     /** Dtor */
       
    51     virtual ~DataFrameMemMngr() 
       
    52         {
       
    53         iFrameXferBlockProtoStack = NULL;
       
    54         iTxDataChunk = NULL;
       
    55         iTxFrameMemoryPool = NULL;
       
    56         };
       
    57 
       
    58 protected: 
       
    59 
       
    60     /**
       
    61     * From DEthernetFrameMemMngr
       
    62     * Opens a handle to the allocated shared memory chunk
       
    63     *
       
    64     * @since S60 5.0
       
    65     * @param aThread
       
    66     * @param aSharedChunkInfo
       
    67     * @param aSharedMemoryChunk The shared memory chunk
       
    68     * @return system wide error code, KErrNone upon success
       
    69     */
       
    70     virtual TInt DoOpenHandle(
       
    71         DThread& aThread,
       
    72         TSharedChunkInfo& aSharedChunkInfo,
       
    73         DChunk* aSharedMemoryChunk );
       
    74 
       
    75     /**
       
    76     * From DEthernetFrameMemMngr
       
    77     * Gets called when rx frame read cycle has ended.
       
    78     *
       
    79     * @since S60 3.1
       
    80     * @param aBufferStart first element of the array that holds pointers to
       
    81     *        Rx frame meta headers
       
    82     * @param aNumOfBuffers number of meta header pointers in the array
       
    83     * @return ETrue if a pending user mode frame read request exists 
       
    84     *         and callee should complete it, 
       
    85     *         EFalse otherwise
       
    86     */
       
    87     virtual TBool DoEthernetFrameRxComplete( 
       
    88         const TDataBuffer*& aBufferStart, 
       
    89         TUint32 aNumOfBuffers );
       
    90 
       
    91     /**
       
    92     * From DEthernetFrameMemMngr
       
    93     * Gets start address of Rx buffers (their offset addresses)
       
    94     * that are waiting for completion to user mode
       
    95     *
       
    96     * @since S60 3.1
       
    97     * @return see above
       
    98     */
       
    99     virtual TUint32* DoGetTobeCompletedBuffersStart();
       
   100 
       
   101     /**
       
   102     * From DEthernetFrameMemMngr
       
   103     * Gets start address of Rx buffers (their offset addresses)
       
   104     * that have been completed to user mode
       
   105     *
       
   106     * @since S60 3.1
       
   107     * @return see above
       
   108     */
       
   109     virtual TUint32* DoGetCompletedBuffersStart();
       
   110 
       
   111     /**
       
   112     * From DEthernetFrameMemMngr
       
   113     * Gets called when user mode client issues a frame receive request 
       
   114     * and Rx buffers have been completed to it. The completed Rx frame 
       
   115     * buffers are freed.
       
   116     *
       
   117     * @since S60 3.1
       
   118     */
       
   119     virtual void DoFreeRxBuffers();
       
   120 
       
   121     /**
       
   122      * From DEthernetFrameMemMngr
       
   123      * Allocates a Tx packet from the shared memory.
       
   124      * 
       
   125      * @param aLength Length of the requested Tx buffer in bytes
       
   126      * @return Pointer to the meta header attached to the allocated packet, on
       
   127      *         success.
       
   128      *         NULL, in case of failure.
       
   129      */
       
   130     virtual TDataBuffer* AllocTxBuffer( TUint aLength );
       
   131 
       
   132     /**
       
   133      * From DEthernetFrameMemMngr
       
   134      * Deallocates a Tx packet.
       
   135      * 
       
   136      * All Tx packets allocated with AllocTxBuffer() must be deallocated using
       
   137      * this method.
       
   138      * 
       
   139      * @param aPacket Meta header of the packet to the deallocated
       
   140      */ 
       
   141     virtual void FreeTxPacket( TDataBuffer*& aPacket );    
       
   142     
       
   143 private:
       
   144 
       
   145     /**
       
   146     * From DEthernetFrameMemMngr
       
   147     * Memory finalization method.
       
   148     */
       
   149     virtual void OnReleaseMemory();
       
   150     
       
   151     // Prohibit copy constructor.
       
   152     DataFrameMemMngr( const DataFrameMemMngr& );
       
   153     // Prohibit assigment operator.
       
   154     DataFrameMemMngr& operator= ( const DataFrameMemMngr& );  
       
   155     
       
   156 private:    // Data
       
   157 
       
   158     /** 
       
   159     * array of TDataBuffer offset addresses, denoting Rx buffers,
       
   160     * which are waiting here in kernel mode to be completed 
       
   161     * to user mode, when the next frame receive request arrives
       
   162     */
       
   163     TUint32 iTobeCompletedBuffers[KMaxToBeCompletedRxBufs];
       
   164 
       
   165     /** 
       
   166     * array of TDataBuffer offset addresses, denoting Rx buffers, that are
       
   167     * currently under processing in user mode
       
   168     */
       
   169     TUint32 iCompletedBuffers[KMaxCompletedRxBufs];
       
   170     
       
   171     RFrameXferBlockProtocolStack* iFrameXferBlockProtoStack;
       
   172     
       
   173     /** 
       
   174     * pointer to protocol stack side Tx area start in the kernel address 
       
   175     * space 
       
   176     */
       
   177     TUint8* iTxDataChunk;
       
   178 
       
   179     /** 
       
   180     * Tx frame memory pool manager
       
   181     * Own.
       
   182     */
       
   183     WlanChunk* iTxFrameMemoryPool;
       
   184     
       
   185     /**
       
   186     * size of the Tx frame buffer allocation unit in bytes
       
   187     */
       
   188     TInt iTxFrameBufAllocationUnit;
       
   189     };
       
   190 
       
   191 #endif // DATAFRAMEMMNGR_H