wlan_bearer/wlanldd/wlan_common/osa_common/inc/osaplatformhwchunk.h
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:   WlanPlatformHwChunk declaration
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 6 %
       
    20 */
       
    21 
       
    22 #ifndef WLANPLATFORMHWCHUNK_H
       
    23 #define WLANPLATFORMHWCHUNK_H
       
    24 
       
    25 #include "wlanobject.h"
       
    26 
       
    27 class MWlanOsaChunkBase;
       
    28 struct WlanPlatformHwChunkImpl;
       
    29 
       
    30 /**
       
    31  *  platform memory chunk for memory suitable for DMA xfer
       
    32  *
       
    33  *
       
    34  *  @lib wlanosa.lib
       
    35  *  @since S60 v3.2
       
    36  */
       
    37 class WlanPlatformHwChunk : public DBase, public WlanObject
       
    38     {
       
    39 
       
    40     friend class WlanPlatformHwChunkImpl;
       
    41 
       
    42 public:
       
    43 
       
    44 
       
    45     /**
       
    46      * ctor
       
    47      * NOTE: call IsValid() member from super class 
       
    48      * to validate object after ctor
       
    49      *
       
    50      * @since S60 v3.2
       
    51      * @param aSizeInBytes size of the chunk to be created
       
    52      * @param aUseCachedMemory ETrue if cached memory shall be used
       
    53      *        EFalse otherwise
       
    54      * @param aAllocationUnit allocation unit size in bytes
       
    55      */
       
    56     explicit WlanPlatformHwChunk( 
       
    57         TInt aSizeInBytes, 
       
    58         TBool aUseCachedMemory, 
       
    59         TInt aAllocationUnit );
       
    60 
       
    61 	/**
       
    62 	 * Destructor.
       
    63 	 *
       
    64 	 * @since S60 v3.2
       
    65 	 */
       
    66     virtual ~WlanPlatformHwChunk();
       
    67 
       
    68     /**
       
    69      * Returns the chunk managed
       
    70      *
       
    71      * @since S60 v3.2
       
    72      * @return the chunk managed
       
    73      */
       
    74     MWlanOsaChunkBase& Chunk();
       
    75 
       
    76     /**
       
    77      * Returns the chunk managed
       
    78      *
       
    79      * @since S60 v3.2
       
    80      * @return the chunk managed
       
    81      */
       
    82     const MWlanOsaChunkBase& Chunk() const;
       
    83 
       
    84 private:
       
    85 
       
    86     /**
       
    87      * Rounds up memory request size to physical page size 
       
    88      *
       
    89      * @since S60 v3.2
       
    90      * @param size rounded up
       
    91      */
       
    92     static inline TInt RoundToPageSize( TInt aSizeInBytes );
       
    93 
       
    94     /**
       
    95      * Allocate physical ram
       
    96      *
       
    97      * @since S60 v3.2
       
    98      * @param aSizeInBytes amount of physical ram to be allocated
       
    99      * @param aPhysAddr (out) physical address of the memory allocated 
       
   100      * @return ETrue upon success, any other for failure
       
   101      */
       
   102     static inline TBool AllocatePhysicalRam( 
       
   103         TInt aSizeInBytes, TPhysAddr& aPhysAddr );
       
   104 
       
   105     /**
       
   106      * Frees the physical ram allocated
       
   107      *
       
   108      * @since S60 v3.2
       
   109      * @param aPhysRamAddr physical address of the memory to be freed 
       
   110      * @param aPhysRamSize size of the physical ram to be freed
       
   111      */
       
   112     static inline void FreePhysicalRam( 
       
   113         TPhysAddr aPhysRamAddr, TInt aPhysRamSize );
       
   114 
       
   115 
       
   116     /**
       
   117      * Allocate a hw chunk
       
   118      *
       
   119      * @since S60 v3.2
       
   120      * @param aPhysRamAddr physical address of the 
       
   121      * memory to be associuated with the chunk 
       
   122      * @param aPhysRamSize size of the memory
       
   123      * @param aAllocationUnit allocation unit size in bytes
       
   124      * @return ETrue upon success, any other for failure
       
   125      */
       
   126     inline TBool AllocateHardwareChunk( 
       
   127         TPhysAddr aPhysRamAddr, 
       
   128         TInt aPhysRamSize,
       
   129         TInt aAllocationUnit );
       
   130 
       
   131     /**
       
   132      * Extract implementation details
       
   133      *
       
   134      * @since S60 v3.2
       
   135      * @return implementation details
       
   136      */
       
   137     inline WlanPlatformHwChunkImpl& Pimpl();
       
   138 
       
   139     /**
       
   140      * Extract implementation details
       
   141      *
       
   142      * @since S60 v3.2
       
   143      * @return implementation details
       
   144      */
       
   145     inline const WlanPlatformHwChunkImpl& Pimpl() const;
       
   146 
       
   147     // deny copying.
       
   148     WlanPlatformHwChunk( const WlanPlatformHwChunk& );
       
   149 
       
   150     // deny assigment.
       
   151     WlanPlatformHwChunk& operator= ( const WlanPlatformHwChunk& );
       
   152 
       
   153 private: // data
       
   154 
       
   155     /**
       
   156      * implementation
       
   157      * Own.  
       
   158      */
       
   159     WlanPlatformHwChunkImpl* iPimpl;    
       
   160     
       
   161     /** 
       
   162     * ETrue if cached memory shall be used,
       
   163     * EFalse otherwise 
       
   164     */
       
   165     TBool iUseCachedMemory;
       
   166     };
       
   167 
       
   168 #endif // WLANPLATFORMHWCHUNK_H