wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/DataFrameMemMngr.h
branchRCL_3
changeset 42 a828660c511c
parent 3 6524e815f76f
child 43 d3d7683d16f5
equal deleted inserted replaced
40:5fb7af913dfd 42:a828660c511c
    14 * Description:   Declaration of the DataFrameMemMngr class.
    14 * Description:   Declaration of the DataFrameMemMngr class.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 12 %
    19 * %version: 13 %
    20 */
    20 */
    21 
    21 
    22 #ifndef DATAFRAMEMMNGR_H
    22 #ifndef DATAFRAMEMMNGR_H
    23 #define DATAFRAMEMMNGR_H
    23 #define DATAFRAMEMMNGR_H
    24 
    24 
    40         DWlanLogicalChannel& aParent,
    40         DWlanLogicalChannel& aParent,
    41         WlanChunk*& aRxFrameMemoryPool,
    41         WlanChunk*& aRxFrameMemoryPool,
    42         TInt aTxFrameBufAllocationUnit ) : 
    42         TInt aTxFrameBufAllocationUnit ) : 
    43         DEthernetFrameMemMngr( aParent, aRxFrameMemoryPool ),
    43         DEthernetFrameMemMngr( aParent, aRxFrameMemoryPool ),
    44         iFrameXferBlockProtoStack( NULL ),
    44         iFrameXferBlockProtoStack( NULL ),
       
    45         iUserToKernAddrOffset( 0 ),
    45         iTxDataChunk( NULL ),
    46         iTxDataChunk( NULL ),
    46         iTxFrameMemoryPool( NULL ),
    47         iTxFrameMemoryPool( NULL ),
    47         iTxFrameBufAllocationUnit ( aTxFrameBufAllocationUnit )
    48         iTxFrameBufAllocationUnit ( aTxFrameBufAllocationUnit )
    48         {};
    49         {};
    49 
    50 
    83     * @return ETrue if a pending user mode frame read request exists 
    84     * @return ETrue if a pending user mode frame read request exists 
    84     *         and callee should complete it, 
    85     *         and callee should complete it, 
    85     *         EFalse otherwise
    86     *         EFalse otherwise
    86     */
    87     */
    87     virtual TBool DoEthernetFrameRxComplete( 
    88     virtual TBool DoEthernetFrameRxComplete( 
    88         const TDataBuffer*& aBufferStart, 
    89         TDataBuffer*& aBufferStart, 
    89         TUint32 aNumOfBuffers );
    90         TUint32 aNumOfBuffers );
    90 
    91 
    91     /**
    92     /**
    92     * From DEthernetFrameMemMngr
    93     * From DEthernetFrameMemMngr
    93     * Gets start address of Rx buffers (their offset addresses)
    94     * To be called when user mode client issues a frame Rx request
    94     * that are waiting for completion to user mode
       
    95     *
    95     *
    96     * @since S60 3.1
    96     * @return ETrue if callee should complete the request immediately 
    97     * @return see above
    97     *         as there exists Rx frame(s) which can be retrieved by the user
    98     */
    98     *         mode client.
    99     virtual TUint32* DoGetTobeCompletedBuffersStart();
    99     *         EFalse otherwise
   100 
   100     */
   101     /**
   101     virtual TBool OnReadRequest();
   102     * From DEthernetFrameMemMngr
   102     
   103     * Gets start address of Rx buffers (their offset addresses)
   103     /**
   104     * that have been completed to user mode
   104      * From DEthernetFrameMemMngr
   105     *
   105      * Gets the highest priority frame (contained in a buffer allocated from
   106     * @since S60 3.1
   106      * the shared memory) from the Rx queues.
   107     * @return see above
   107      * Optionally frees the memory associated to a previously received frame. 
   108     */
   108      * 
   109     virtual TUint32* DoGetCompletedBuffersStart();
   109      * @param aFrameToFreeInUserSpace User space pointer to previously 
   110 
   110      *        received frame which can now be freed.
   111     /**
   111      *        NULL if nothing to free.
   112     * From DEthernetFrameMemMngr
   112      * @return User space pointer to the Rx frame to be handled next.
   113     * Gets called when user mode client issues a frame receive request 
   113      *         NULL, if there are no frames available.
   114     * and Rx buffers have been completed to it. The completed Rx frame 
   114      */ 
   115     * buffers are freed.
   115     virtual TDataBuffer* GetRxFrame( TDataBuffer* aFrameToFreeInUserSpace );
   116     *
   116     
   117     * @since S60 3.1
       
   118     */
       
   119     virtual void DoFreeRxBuffers();
       
   120 
       
   121     /**
   117     /**
   122      * From DEthernetFrameMemMngr
   118      * From DEthernetFrameMemMngr
   123      * Allocates a Tx packet from the shared memory.
   119      * Allocates a Tx packet from the shared memory.
   124      * 
   120      * 
   125      * @param aLength Length of the requested Tx buffer in bytes
   121      * @param aLength Length of the requested Tx buffer in bytes
   126      * @return Pointer to the meta header attached to the allocated packet, on
   122      * @return User space pointer to the meta header attached to the 
   127      *         success.
   123      *         allocated packet, on success.
   128      *         NULL, in case of failure.
   124      *         NULL, in case of failure.
   129      */
   125      */
   130     virtual TDataBuffer* AllocTxBuffer( TUint aLength );
   126     virtual TDataBuffer* AllocTxBuffer( TUint aLength );
   131 
   127 
       
   128     /**
       
   129      * From DEthernetFrameMemMngr
       
   130      * Adds the specified Tx frame (contained in the buffer allocated from the 
       
   131      * shared memory) to the relevant Tx queue according to its AC (i.e.
       
   132      * priority).
       
   133      *  
       
   134      * @param aPacketInUserSpace Meta header attached to the frame; as a user
       
   135      *        space pointer.
       
   136      * @param aPacketInKernSpace If not NULL on return, the frame needs to be 
       
   137      *        discarded and this is the kernel space pointer to its meta header.
       
   138      *        If NULL on return, the frame must not be discarded. 
       
   139      * @param aUserDataTxEnabled ETrue if user data Tx is enabled
       
   140      *        EFalse otherwise
       
   141      * @return ETrue if the client is allowed to continue calling this method
       
   142      *         (i.e. Tx flow is not stopped).
       
   143      *         EFalse if the client is not allowed to call this method again
       
   144      *         (i.e. Tx flow is stopped) until it is re-allowed.
       
   145      */
       
   146     virtual TBool AddTxFrame( 
       
   147         TDataBuffer* aPacketInUserSpace, 
       
   148         TDataBuffer*& aPacketInKernSpace,
       
   149         TBool aUserDataTxEnabled );
       
   150     
       
   151     /**
       
   152      * From DEthernetFrameMemMngr
       
   153      * Gets the frame to be transmitted next from the Tx queues.
       
   154      * 
       
   155      * @param aWhaTxQueueState State (full / not full) of every WHA transmit 
       
   156      *        queue
       
   157      * @param aMore On return is ETrue if another frame is also ready to be 
       
   158      *        transmitted, EFalse otherwise
       
   159      * @return Pointer to the meta header of the frame to be transmitted, on
       
   160      *         success
       
   161      *         NULL, if there's no frame that could be transmitted, given the
       
   162      *         current status of the WHA Tx queues
       
   163      */ 
       
   164     virtual TDataBuffer* GetTxFrame( 
       
   165         const TWhaTxQueueState& aTxQueueState,
       
   166         TBool& aMore );
       
   167     
   132     /**
   168     /**
   133      * From DEthernetFrameMemMngr
   169      * From DEthernetFrameMemMngr
   134      * Deallocates a Tx packet.
   170      * Deallocates a Tx packet.
   135      * 
   171      * 
   136      * All Tx packets allocated with AllocTxBuffer() must be deallocated using
   172      * All Tx packets allocated with AllocTxBuffer() must be deallocated using
   137      * this method.
   173      * this method.
   138      * 
   174      * 
   139      * @param aPacket Meta header of the packet to the deallocated
   175      * @param aPacket Meta header of the packet to the deallocated
   140      */ 
   176      */ 
   141     virtual void FreeTxPacket( TDataBuffer*& aPacket );    
   177     virtual void FreeTxPacket( TDataBuffer*& aPacket );
       
   178 
       
   179     /** 
       
   180      * From DEthernetFrameMemMngr
       
   181      * Determines if Tx from protocol stack side client should be resumed
       
   182      *  
       
   183      * @param aUserDataTxEnabled ETrue if user data Tx is enabled
       
   184      *        EFalse otherwise
       
   185      * @return ETrue if Tx should be resumed
       
   186      *         EFalse otherwise
       
   187      */
       
   188     virtual TBool ResumeClientTx( TBool aUserDataTxEnabled ) const;
       
   189     
       
   190     /** 
       
   191      * From DEthernetFrameMemMngr
       
   192      * Determines if all protocol stack side client's Tx queues are empty
       
   193      * 
       
   194      * @return ETrue if all Tx queues are empty
       
   195      *         EFalse otherwise
       
   196      */
       
   197     virtual TBool AllTxQueuesEmpty() const;
   142     
   198     
   143 private:
   199 private:
   144 
   200 
   145     /**
   201     /**
   146     * From DEthernetFrameMemMngr
   202     * From DEthernetFrameMemMngr
   155     // Prohibit assigment operator.
   211     // Prohibit assigment operator.
   156     DataFrameMemMngr& operator= ( const DataFrameMemMngr& );  
   212     DataFrameMemMngr& operator= ( const DataFrameMemMngr& );  
   157     
   213     
   158 private:    // Data
   214 private:    // Data
   159 
   215 
   160     /** 
   216     /** kernel address of frame xfer block */
   161     * array of TDataBuffer offset addresses, denoting Rx buffers,
       
   162     * which are waiting here in kernel mode to be completed 
       
   163     * to user mode, when the next frame receive request arrives
       
   164     */
       
   165     TUint32 iTobeCompletedBuffers[KMaxToBeCompletedRxBufs];
       
   166 
       
   167     /** 
       
   168     * array of TDataBuffer offset addresses, denoting Rx buffers, that are
       
   169     * currently under processing in user mode
       
   170     */
       
   171     TUint32 iCompletedBuffers[KMaxCompletedRxBufs];
       
   172     
       
   173     RFrameXferBlockProtocolStack* iFrameXferBlockProtoStack;
   217     RFrameXferBlockProtocolStack* iFrameXferBlockProtoStack;
       
   218     
       
   219     /** 
       
   220     * the offset from a User space address to the corresponding address
       
   221     * in the Kernel space in the shared memory chunk. May also be negative 
       
   222     */
       
   223     TInt32 iUserToKernAddrOffset;
   174     
   224     
   175     /** 
   225     /** 
   176     * pointer to protocol stack side Tx area start in the kernel address 
   226     * pointer to protocol stack side Tx area start in the kernel address 
   177     * space 
   227     * space 
   178     */
   228     */