wlan_plat/wlan_osa_api/inc/wlanosa.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 "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:  osa interface declaration
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 6 %
       
    20 */
       
    21 
       
    22 #ifndef M_WLANOSA_H
       
    23 #define M_WLANOSA_H
       
    24 
       
    25 #include <wlanosaplatform.h>
       
    26 
       
    27 class MWlanDfc;
       
    28 class MWlanTimer;
       
    29 
       
    30 /**
       
    31  *  osa interface declaration
       
    32  *
       
    33  *
       
    34  *  @lib wlanosa.lib
       
    35  *  @since S60 v3.2
       
    36  */
       
    37 class MWlanOsa 
       
    38     {
       
    39 
       
    40 public:
       
    41 
       
    42     /* basic trace levels masks */
       
    43     enum { KFatalLevel      = 0x01 };
       
    44     enum { KErrorLevel      = 0x02 };
       
    45     enum { KWarningLevel    = 0x04 };
       
    46     enum { KInfoLevel       = 0x08 };
       
    47 
       
    48     /* masks for Alloc method */
       
    49     enum { KAllocZeroStampMask = 0x01 };
       
    50 
       
    51     /* memory type identifier */
       
    52     enum TOsaMemoryType
       
    53         {
       
    54         /* for general purpose */
       
    55         ENormalMemory = 0,
       
    56         /* DMA suitable memory to be used for accessing the WLAN device */
       
    57         EInterconnectMemory 
       
    58         };
       
    59 
       
    60     /**
       
    61      * Memory allocation. 
       
    62      * Correct alignment guaranteed
       
    63      *
       
    64      * @since S60 v3.2
       
    65      * @param aOsaMemoryType memory type to be allocated
       
    66      * @param aSize size of the buffer to be allocated in bytes. Must be 
       
    67      *              positive otherwise the allocation fails
       
    68      * @param aFlags bitmask to fine-tune behavior of the allocation
       
    69      *               bit 0 - set: zero stamp allocated memory
       
    70      * @return begin of the allocated memory, NULL upon failure
       
    71      */
       
    72     virtual void* Alloc( TOsaMemoryType aOsaMemoryType, 
       
    73                          TInt aSize, 
       
    74                          TUint aFlags ) = 0;
       
    75 
       
    76     /**
       
    77      * Releases memory allocated by the Alloc method
       
    78      *
       
    79      * @since S60 v3.2
       
    80      * @param aPtr begin of the buffer to be freed
       
    81      */
       
    82     virtual void Free( void* aPtr ) = 0;
       
    83 
       
    84     /**
       
    85      * Creates DFC context object 
       
    86      *
       
    87      * @since S60 v3.2
       
    88      * @return DFC context object, NULL upon failure
       
    89      */
       
    90     virtual MWlanDfc* DfcCreate() = 0;
       
    91 
       
    92     /**
       
    93      * Destroys DFC context object 
       
    94      *
       
    95      * @since S60 v3.2
       
    96      * @param aWlanDfc DFC context object to be destroyed
       
    97      */
       
    98     virtual void DfcDestroy( MWlanDfc* aWlanDfc ) = 0;
       
    99 
       
   100     /**
       
   101      * Creates timer context object
       
   102      *
       
   103      * @since S60 v3.2
       
   104      * @return timer context object, NULL upon failure
       
   105      */
       
   106     virtual MWlanTimer* TimerCreate() = 0;
       
   107 
       
   108     /**
       
   109      * Destroys timer context object
       
   110      *
       
   111      * @since S60 v3.2
       
   112      * @param aWlanTimer timer context object to be destroyed
       
   113      */
       
   114     virtual void TimerDestroy( MWlanTimer* aWlanTimer ) = 0;
       
   115 
       
   116     /**
       
   117      * Prints a formatted string to the debug port
       
   118      * 
       
   119      * @since S60 v3.2
       
   120      * @param aLevelMask bitmask to define level of the trace
       
   121      * @param aFmt a null terminated ANSI 8 bit printf format specifier. 
       
   122      * The format specifier dictates what arguments follow 
       
   123      * @param A list of arguments as defined by the aFmt specifier. 
       
   124      * This must not be longer than 256 characters
       
   125      */
       
   126     static void FormattedPrint( TUint32 aLevelMask, 
       
   127                                 const TInt8* aFmt, 
       
   128                                 ... );
       
   129 
       
   130     /**
       
   131      * Dumps bytestream in hexadecimal format to the debug port
       
   132      * 
       
   133      * @since S60 v3.2
       
   134      * @param aLevelMask bitmask to define level of the trace
       
   135      * @param aData begin of the data
       
   136      * @param aDataSize size of the data
       
   137      */
       
   138     static void Dump( TUint32 aLevelMask, 
       
   139                       const TInt8* aData, 
       
   140                       TInt aDataSize );
       
   141 
       
   142     /**
       
   143      * Evaluates an boolean expression and executes an assertion, 
       
   144      * that stops the execution of the program, 
       
   145      * in case the evaluation yields to false 
       
   146      * 
       
   147      * @since S60 v3.2
       
   148      * @param aFile file name to be traced
       
   149      * @param aLine line number to be traced
       
   150      * @param aExpression expression to be evaluated
       
   151      */
       
   152     static void Assert( const TInt8* aFile, 
       
   153                         TInt aLine, 
       
   154                         TBool aExpression = EFalse );
       
   155 
       
   156     /**
       
   157      * compares two memory buffers for equality 
       
   158      * The two buffers are considered equal only if
       
   159      * the binary content of both buffers is the same.
       
   160      * 
       
   161      * @since S60 v3.2
       
   162      * @param aLhs start address of the first buffer in the comparison
       
   163      * @param aRhs start address of the second buffer in the comparison
       
   164      * @param aNumOfBytes number of bytes to compare
       
   165      * @return zero if both buffers are equal; non-zero, otherwise. 
       
   166      */
       
   167     static TInt MemCmp( const void* aLhs, const void* aRhs, TInt aNumOfBytes );
       
   168 
       
   169     /**
       
   170      * copies bytes in memory, target and source address can overlap
       
   171      * 
       
   172      * @since S60 v3.2
       
   173      * @param aDest target address
       
   174      * @param aSrc source address
       
   175      * @param aLengthinBytes number of bytes to be moved
       
   176      * @return target address
       
   177      */
       
   178     static void* MemCpy( void* aDest, const void* aSrc, TUint aLengthinBytes );
       
   179 
       
   180     /**
       
   181      * copies bytes in memory, target and source address can overlap 
       
   182      * Assumes that the addresses are aligned on TInt boundaries,
       
   183      * and that the aLengthinBytes value is a multiple of sizeof(TInt).
       
   184      * 
       
   185      * @since S60 v3.2
       
   186      * @param aDest target address
       
   187      * @param aSrc source address
       
   188      * @param aLengthinBytes number of bytes to be moved
       
   189      * @return target address
       
   190      */
       
   191     static void* WordCpy( TInt* aDest, 
       
   192                           const TInt* aSrc, 
       
   193                           TUint aLengthinBytes );
       
   194 
       
   195     /**
       
   196      * sets the specified number of bytes to binary zero
       
   197      * 
       
   198      * @since S60 v3.2
       
   199      * @param aDest target address
       
   200      * @param aSrc source address
       
   201      * @param aLengthinBytes number of bytes to be set
       
   202      * @return target address
       
   203      */
       
   204     static void* MemClr( void* aDest, TUint aLengthinBytes );
       
   205 
       
   206     /**
       
   207      * sets all of the specified number of bytes to the specified fill value
       
   208      * 
       
   209      * @since S60 v3.2
       
   210      * @param aDest start address
       
   211      * @param aValue fill value
       
   212      * @param aCount number of bytes to be set
       
   213      * @return start address
       
   214      */
       
   215     static void* MemSet( void* aDest, TInt aValue, TUint aCount );
       
   216 
       
   217     /**
       
   218      * gets the current system time in microseconds
       
   219      * 
       
   220      * @since S60 v3.2
       
   221      * @return current system time in microseconds
       
   222      */
       
   223     static TInt64 Time();
       
   224 
       
   225     /**
       
   226      * busy-wait for a length of time specified by 
       
   227      * the param aWaitTimeInMicroSeconds
       
   228      * 
       
   229      * @since S60 v3.2
       
   230      * @param aWaitTimeInMicroSeconds the 
       
   231      * length of time to wait in microseconds
       
   232      */
       
   233     static void BusyWait( TUint aWaitTimeInMicroSeconds );
       
   234 
       
   235     };
       
   236 
       
   237 #endif // M_WLANOSA_H