wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EtherCardApi.inl
changeset 0 c40eb8fe8501
child 22 c6a1762761b8
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:   Implementation of RPcmNetCardIf inline methods.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 9 %
       
    20 */
       
    21 
       
    22 // ---------------------------------------------------------------------------
       
    23 // 
       
    24 // ---------------------------------------------------------------------------
       
    25 //
       
    26 inline TInt RPcmNetCardIf::Open()
       
    27 	{
       
    28 	return DoCreate( 
       
    29              LDD_NAME, 
       
    30              VersionRequired(), 
       
    31              KUnitEthernet, 
       
    32              NULL, 
       
    33              NULL );
       
    34 	}
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // 
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 inline TVersion RPcmNetCardIf::VersionRequired() const
       
    41     {
       
    42 	return TVersion( 
       
    43 	            KWlanDriverMajorVersion, 
       
    44 	            KWlanDriverMinorVersion, 
       
    45 	            KWlanDriverBuildVersion );
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // 
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 inline void RPcmNetCardIf::ReadCancel()
       
    53     { 
       
    54     DoCancel( 1 << EControlReadCancel );
       
    55     }
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // 
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 inline void RPcmNetCardIf::ResumeTxCancel()
       
    62     { 
       
    63     DoCancel( 1 << EControlResumeTxCancel );
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // 
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 inline TInt RPcmNetCardIf::GetConfig( TDes8& aConfig )
       
    71     {
       
    72     return DoControl( 
       
    73                 EControlGetConfig, 
       
    74                 const_cast<TUint8*>(aConfig.Ptr()) );
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // 
       
    79 // ---------------------------------------------------------------------------
       
    80 //
       
    81 inline TInt RPcmNetCardIf::InitialiseBuffers( 
       
    82     RFrameXferBlockProtocolStack*& aFrameXferBlock )
       
    83     {
       
    84     TInt status ( KErrNone );
       
    85     
       
    86     TSharedChunkInfo info;
       
    87     
       
    88     status = DoSvControl( 
       
    89         ESvControlInitBuffers, 
       
    90         static_cast<TAny*>(&info) );
       
    91 
       
    92     if ( status == KErrNone )
       
    93         {
       
    94         // shared memory chunk initialization success
       
    95 
       
    96         // Set the handle for the shared memory chunk
       
    97         iSharedMemoryChunk.SetHandle( info.iChunkHandle );
       
    98         
       
    99         // Set the relevant user mode 
       
   100         // addresses as offsets from the chunk base address
       
   101 
       
   102         TUint8* baseAddress ( iSharedMemoryChunk.Base() );
       
   103         
       
   104         const TUint KRxDataChunkSize( 
       
   105             info.iSize
       
   106             - ( sizeof( TDataBuffer )
       
   107                 + KMgmtSideTxBufferLength
       
   108                 + KProtocolStackSideTxDataChunkSize
       
   109                 + sizeof( RFrameXferBlock ) 
       
   110                 + sizeof( RFrameXferBlockProtocolStack ) ) );
       
   111 
       
   112         aFrameXferBlock = reinterpret_cast<RFrameXferBlockProtocolStack*>(
       
   113             baseAddress
       
   114             + KRxDataChunkSize
       
   115             + sizeof( TDataBuffer )
       
   116             + KMgmtSideTxBufferLength
       
   117             + KProtocolStackSideTxDataChunkSize
       
   118             + sizeof( RFrameXferBlock ) );
       
   119 
       
   120         aFrameXferBlock->SetRxDataChunkField( reinterpret_cast<TLinAddr>(
       
   121             baseAddress) );
       
   122 
       
   123         aFrameXferBlock->SetTxDataBufferField( reinterpret_cast<TLinAddr>(
       
   124             baseAddress
       
   125             + KRxDataChunkSize
       
   126             + sizeof( TDataBuffer )
       
   127             + KMgmtSideTxBufferLength) );
       
   128         
       
   129         aFrameXferBlock->UserInitialize( 
       
   130             reinterpret_cast<TUint32>(aFrameXferBlock) );
       
   131         }
       
   132     
       
   133     return status;
       
   134     }
       
   135 
       
   136 // ---------------------------------------------------------------------------
       
   137 // 
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 inline TInt RPcmNetCardIf::ReleaseBuffers()
       
   141     {
       
   142     // close the handle to the shared memory chunk
       
   143     iSharedMemoryChunk.Close();
       
   144     
       
   145     return DoSvControl( ESvControlFreeBuffers );
       
   146     }
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // 
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 inline void RPcmNetCardIf::ResumeTx( TRequestStatus& aStatus )
       
   153     {
       
   154     DoRequest( EResumeTx, aStatus );
       
   155     }
       
   156 
       
   157 // ---------------------------------------------------------------------------
       
   158 // 
       
   159 // ---------------------------------------------------------------------------
       
   160 //
       
   161 inline void RPcmNetCardIf::RequestFrame( TRequestStatus& aStatus )
       
   162     {
       
   163     DoRequest( ERequestRead, aStatus );
       
   164     }
       
   165 
       
   166 // ---------------------------------------------------------------------------
       
   167 // 
       
   168 // ---------------------------------------------------------------------------
       
   169 //
       
   170 inline TDataBuffer* RPcmNetCardIf::AllocTxBuffer( TUint aLength )
       
   171     {
       
   172     return reinterpret_cast<TDataBuffer*>(DoControl( 
       
   173         EControlFastAllocTxBuffer,
       
   174         reinterpret_cast<TAny*>(aLength) ));
       
   175     }
       
   176 
       
   177 // ---------------------------------------------------------------------------
       
   178 // 
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 inline TBool RPcmNetCardIf::AddTxFrame( TDataBuffer* aPacket )
       
   182     {
       
   183     return static_cast<TBool>(DoControl( 
       
   184         EControlFastAddTxFrame, 
       
   185         reinterpret_cast<TAny*>(aPacket) ));
       
   186     }