wlan_plat/wlan_busaccess_api/inc/wlansdioa.h
branchRCL_3
changeset 42 a828660c511c
equal deleted inserted replaced
40:5fb7af913dfd 42:a828660c511c
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef WLANSDIOA_H
       
    19 #define WLANSDIOA_H
       
    20 
       
    21 class MWlanSdioaClient;
       
    22 class MWlanOsaExt;
       
    23 
       
    24 #include <wlansdioatypes.h>
       
    25 
       
    26 class WlanSdioa
       
    27     {
       
    28 
       
    29 public:
       
    30 
       
    31     typedef TInt TRequestId;
       
    32 
       
    33     enum { KMaxFunctions = 8 };
       
    34 
       
    35     enum TSdioBusWidth
       
    36         {
       
    37         ESdioBusWidth1 = 1,
       
    38         ESdioBusWidth4 = 4
       
    39         };
       
    40 
       
    41     struct TCapabilities
       
    42         {
       
    43         /* Capability mask (values defined in wlansdioatypes.h) */
       
    44         TUint32 iCapability;
       
    45         
       
    46         /* Maximum number of buffers the SDIOA client is allowed to provide in buffer lists
       
    47            of the TReadRequest and TWriteRequest structures.
       
    48            The value of 1 means that only a single contiguous buffer can be used. */
       
    49         TUint32 iMaxNumberOfBuffers;
       
    50         
       
    51         /* Length of the memory cache line (in bytes) */
       
    52         TUint32 iCacheLineLength;
       
    53         };
       
    54 
       
    55     struct TBufferItem 
       
    56         {
       
    57         /* Buffer length */
       
    58         TUint32 iLength;
       
    59         
       
    60         /* Data buffer */
       
    61         TUint8 *iBuffer;
       
    62         
       
    63         /* Pointer to the next list item (NULL if this is the last item) */
       
    64         struct TBufferItem *iNext;
       
    65         };
       
    66 
       
    67     struct TReadRequest
       
    68         {
       
    69         /* Command number */
       
    70         TUint8 iCmdIndex;
       
    71         
       
    72         /* Function number */
       
    73         TUint8 iFunctionNum;
       
    74         
       
    75         /* Register address */
       
    76         TUint32 iRegAddr;
       
    77         
       
    78         /* Flags (defined in wlansdioatypes.h) */
       
    79         TUint32 iFlags;
       
    80         
       
    81         /* Receive buffer (only valid for CMD52) */
       
    82         TUint8 iRxBuffer;
       
    83         
       
    84         /* Receive buffer list (only valid for CMD53) */
       
    85         TBufferItem *iRxBufferList;
       
    86         
       
    87         /* Transfer size (bytes) */
       
    88         TUint32 iRxCount;
       
    89         
       
    90         /* Completion callback */
       
    91         MWlanSdioaClient* iRequestClient;
       
    92         
       
    93         /* Request identifier (passed back to client with callback) */
       
    94         TRequestId iRequestId;
       
    95         };
       
    96 
       
    97     struct TWriteRequest
       
    98         {
       
    99         /* Command number */
       
   100         TUint8 iCmdIndex;
       
   101         
       
   102         /* Function number */
       
   103         TUint8 iFunctionNum;
       
   104         
       
   105         /* register address */
       
   106         TUint32 iRegAddr;
       
   107         
       
   108         /* Flags (defined in wlansdioatypes.h) */
       
   109         TUint32 iFlags;
       
   110         
       
   111         /* Command argument or CMD52 byte data */
       
   112         TUint8 iTxBuffer;
       
   113         
       
   114         /* Transmit buffer list (only valid for CMD53) */
       
   115         TBufferItem *iTxBufferList;
       
   116         
       
   117         /* Transfer size (bytes) */
       
   118         TUint32 iTxCount;
       
   119         
       
   120         /* Completion callback */
       
   121         MWlanSdioaClient* iRequestClient;
       
   122         
       
   123         /* Request identifier (passed back to client with callback) */
       
   124         TRequestId iRequestId;
       
   125         };
       
   126 
       
   127     /**
       
   128      * Destructor
       
   129      *
       
   130      */
       
   131     virtual ~WlanSdioa() {};
       
   132 
       
   133     /**
       
   134      * Create SDIOA object
       
   135      *
       
   136      */
       
   137     static WlanSdioa* Create();
       
   138 
       
   139     /**
       
   140      * Attach the OSA extension object
       
   141      *
       
   142      * @param aOsaExt OSA extension object
       
   143      */
       
   144     void Attach( MWlanOsaExt& aOsaExt );
       
   145 
       
   146     /**
       
   147      * Destroy the SDIOA object
       
   148      *
       
   149      * @param aWlanSdioa sdioa layer object
       
   150      */
       
   151     static void Destroy( WlanSdioa* aWlanSdioa );
       
   152 
       
   153     /**
       
   154      * Extract module capabilities
       
   155      *
       
   156      * @param aCapabilities capabilities of the module
       
   157      */    
       
   158     virtual void Capability( TCapabilities& aCapabilities ) = 0;        
       
   159 
       
   160     /**
       
   161      * Issue an SDIOA request (separate methods for read and write)
       
   162      *
       
   163      * @param aRequest Request structure
       
   164      * @return Status of the operation
       
   165      *         ESuccess     -   The request was accepted for asynchronous
       
   166      *                          execution and will complete later.
       
   167      *                          Completion is notified by the SDIOA request
       
   168      *                          completion callback.
       
   169      *                          The SDIOA client is allowed to issue additional
       
   170      *                          requests.
       
   171      *
       
   172      *         EFailure     -   The request was not accepted for execution.
       
   173      *                          The request completion callback will not be called.
       
   174      *
       
   175      *         ESuccessXfer -   The request was accepted and completed
       
   176      *                          synchronously.
       
   177      *                          The SDIOA request completion callback will not be called.
       
   178      *                          The SDIOA client is allowed to issue additional requests.
       
   179      *
       
   180      *         EPending     -   The request was accepted for asynchronous
       
   181      *                          excecution and will complete later.
       
   182      *                          Completion is notified by the SDIOA request
       
   183      *                          completion callback.
       
   184      *                          The SDIOA client is not allowed to issue additional
       
   185      *                          requests until the completion callback has been called.
       
   186      */
       
   187     virtual SDIOA::TStatus ReadRequest( TReadRequest& aRequest ) = 0;
       
   188     virtual SDIOA::TStatus WriteRequest( TWriteRequest& aRequest ) = 0;
       
   189 
       
   190     /**
       
   191      * Cancel a pending SDIOA request
       
   192      *
       
   193      * @param aRequestId Request ID
       
   194      * @return Status of the operation
       
   195      *         ESuccess     -   The SDIOA request was cancelled.
       
   196      *                          The completion callback will not be called.
       
   197      *
       
   198      *         EFailure     -   The request could not be cancelled.
       
   199      */
       
   200     virtual SDIOA::TStatus Cancel( TRequestId aRequestId ) = 0;
       
   201 
       
   202     /**
       
   203      * Enable SDIO interrupts (multiplexed on DAT1 line)
       
   204      *
       
   205      * @param aEnable ETrue (enable) or EFalse (disable)
       
   206      * @param aCallbackClient Pointer to the object containing the OnSDIOInterrupt callback method
       
   207      *                        (can be omitted when aEnable == EFalse)
       
   208      * @return Status of the operation
       
   209      *         ESuccess     -   SDIO interrupts were enabled.
       
   210      *                          The MWlanSdioaClient::OnSDIOInterrupt()
       
   211      *                          callback will be called after an
       
   212      *                          interrupt has occurred.
       
   213      *
       
   214      *         EFailure     -   SDIO interrupts could not be enabled.
       
   215      */
       
   216 	virtual SDIOA::TStatus EnableSDIOInterrupt( TBool aEnable, MWlanSdioaClient* aCallbackClient = NULL ) = 0;
       
   217 
       
   218     /**
       
   219      * Initialize the SDIO device
       
   220      * 
       
   221      * This method will perform device initialization so that the device
       
   222      * will be ready for receiving CMD52 and CMD53 requests.
       
   223      * The method must be called after the WLAN device has been powered on.
       
   224      */
       
   225 	virtual SDIOA::TStatus Initialize() = 0;
       
   226 
       
   227     /**
       
   228      * Set the SDIO bus width
       
   229      * 
       
   230      * @param aBusWidth SDIO bus width
       
   231      *
       
   232      * This method sets the SDIO bus width to 1 or 4 bits.
       
   233      */
       
   234     virtual void SetBusWidth( TSdioBusWidth aBusWidth ) = 0;
       
   235 
       
   236     /**
       
   237      * Set the SDIO bus clock speed
       
   238      * 
       
   239      * @param aMHz SDIO bus clock speed in MHz
       
   240      *
       
   241      * This method sets the SDIO bus clock speed to the value
       
   242      * specified by the aMHz parameter or the nearest lower
       
   243      * value supported by the hardware.
       
   244      */
       
   245     virtual void SetClockSpeed( TUint32 aMHz ) = 0;
       
   246 
       
   247 protected:
       
   248 
       
   249     /**
       
   250      * Constructor
       
   251      *
       
   252      * @param aOsaExt OSA extension object
       
   253      */
       
   254     explicit WlanSdioa() {};
       
   255 
       
   256     /**
       
   257      * Extract OSA extension
       
   258      *
       
   259      * @return OSA extension
       
   260      */
       
   261     inline MWlanOsaExt& OsaExtCb();
       
   262 
       
   263 private:
       
   264 
       
   265     /**
       
   266      * OSA extension
       
   267      */
       
   268     MWlanOsaExt*    iOsaExt;
       
   269 
       
   270     };
       
   271 
       
   272 #include <wlansdioa.inl>
       
   273 
       
   274 #endif // WLANSDIOA_H