wlan_bearer/wlanldd/wlan_symbian/wlanldd_symbian/inc/EtherCardApi.h
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:   Declaration of the RPcmNetCardIf class.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 12 %
       
    20 */
       
    21 
       
    22 #if !defined(__ETHERAPI_H__)
       
    23 #define __ETHERAPI_H__
       
    24 
       
    25 #include "wlanlddcommon.h"
       
    26 #include "FrameXferBlock.h"
       
    27 
       
    28 #ifndef __KERNEL_MODE__
       
    29 #include <e32std.h> // for RChunk
       
    30 #endif
       
    31 
       
    32 class TCapsPcmNetCd
       
    33 	{
       
    34 public:
       
    35 	TVersion version;
       
    36 	};
       
    37 
       
    38 /**
       
    39 *  User mode interface for ethernet transfer over WLAN
       
    40 *
       
    41 *  @since S60 v3.1
       
    42 */
       
    43 class RPcmNetCardIf : public RBusLogicalChannel
       
    44 	{
       
    45 public:
       
    46     
       
    47     /** The asynchronous call types */
       
    48 	enum TRequest
       
    49 		{
       
    50 		ERequestRead,
       
    51 		EResumeTx,
       
    52 		}; 
       
    53 	
       
    54 	/** The synchronous call types */
       
    55 	enum TControl
       
    56 		{
       
    57 		EControlGetConfig,
       
    58 		EControlReadCancel,
       
    59 		EControlResumeTxCancel,
       
    60         ESvControlInitBuffers,
       
    61         ESvControlFreeBuffers
       
    62 		}; 
       
    63 
       
    64 	/** 
       
    65 	* Calls executed in the context of the client's thread, but in 
       
    66 	* supervisor mode
       
    67 	*/
       
    68 	enum TControlFast
       
    69 	    {
       
    70 	    EControlFastAllocTxBuffer = 0x0F000000,
       
    71 	    EControlFastAddTxFrame,
       
    72 	    };
       
    73 	
       
    74 public:
       
    75     
       
    76     /**
       
    77     * Open a channel
       
    78     *
       
    79     * @since S60 3.1
       
    80     */
       
    81 	inline TInt Open() ;
       
    82 
       
    83     /**
       
    84     * Get version numbering information.
       
    85     *
       
    86     * @since S60 3.1
       
    87     * @return version required
       
    88     */
       
    89 	inline TVersion	VersionRequired() const;
       
    90 
       
    91     /**
       
    92     * Cancel read request.
       
    93     *
       
    94     * @since S60 3.1
       
    95     */
       
    96 	inline void ReadCancel() ;
       
    97 
       
    98     /**
       
    99     * Cancel Resume Tx request.
       
   100     *
       
   101     * @since S60 5.2
       
   102     */
       
   103 	inline void ResumeTxCancel();
       
   104 
       
   105     /**
       
   106     * Retrieve configuration information
       
   107     *
       
   108     * @since S60 3.1
       
   109     * @param aConfig buffer for configuration info
       
   110     * @return KErrNone on success, any other on failure
       
   111     */
       
   112 	inline TInt GetConfig( TDes8& aConfig ) ;
       
   113 
       
   114     /**
       
   115     * Allocate memory for FrameXferBlock to be used in data frame 
       
   116     * Tx- and Rx-operations. 
       
   117     * Does necessary memory allocation and maps the physical memory to 
       
   118     * calling process's address space so that the calling process
       
   119     * is able to access the memory.
       
   120     *
       
   121     * @since S60 3.1
       
   122     * @param aFrameXferBlock FrameXferBlock to be initialized by 
       
   123     *        the device driver
       
   124     * @return KErrNone on success, any other on failure
       
   125     */
       
   126     inline TInt InitialiseBuffers( 
       
   127         RFrameXferBlockProtocolStack*& aFrameXferBlock );
       
   128 
       
   129     /**
       
   130     * Unmap memory mapped by InitiliazeBuffers method from the client 
       
   131     * process's address space and deallocate it.
       
   132     * Every call to InitialiseBuffers must be matched by a call to
       
   133     * ReleaseBuffers.
       
   134     *
       
   135     * @since S60 3.1
       
   136     * @return KErrNone on success, any other on failure
       
   137     */
       
   138     inline TInt ReleaseBuffers();
       
   139 
       
   140     /**
       
   141     * Asynchronous request to get notified once Tx from the client is
       
   142     * once again allowed.
       
   143     *
       
   144     * @since S60 5.2
       
   145     * @param aStatus a TRequestStatus
       
   146     */
       
   147     inline void ResumeTx( TRequestStatus& aStatus );
       
   148 
       
   149     /**
       
   150     * Asynchronous frame read function
       
   151     *
       
   152     * @since S60 3.1
       
   153     * @param aStatus a TRequestStatus
       
   154     */
       
   155     inline void RequestFrame( TRequestStatus& aStatus );
       
   156 
       
   157 	/**
       
   158 	 * Allocate a Tx buffer from the shared memory.
       
   159 	 * 
       
   160      * @since S60 5.2
       
   161      * @param aLength Length of the requested Tx buffer in bytes
       
   162 	 * @return Pointer to the allocated buffer, on success.
       
   163 	 *         NULL, in case the allocation failed. 
       
   164 	 *         Note! If NULL is returned the client is not allowed to call 
       
   165 	 *         AddTxFrame()(i.e. Tx flow is stopped) until the next time when
       
   166 	 *         ResumeTx asynchronous request completes.
       
   167 	 */
       
   168 	inline TDataBuffer* AllocTxBuffer( TUint aLength );
       
   169 	
       
   170 	/**
       
   171 	 * Add the specified Tx frame (contained in the buffer allocated from the 
       
   172 	 * shared memory) to the relevant Tx queue according to the frame's AC 
       
   173 	 * (i.e. priority). 
       
   174 	 * The frame will automatically get transmitted in its turn.
       
   175 	 *  
       
   176      * @since S60 5.2
       
   177      * @param aPacket The frame to add
       
   178      * @return ETrue if the client is allowed to continue calling this method
       
   179      *         (i.e. Tx flow is not stopped).
       
   180      *         EFalse if the client is not allowed to call this method again
       
   181      *         (i.e. Tx flow is stopped) until the next time when 
       
   182      *         ResumeTx asynchronous request completes.
       
   183 	 */
       
   184 	inline TBool AddTxFrame( TDataBuffer* aPacket );
       
   185 	
       
   186 #ifndef __KERNEL_MODE__
       
   187 private:
       
   188     /** handle to kernel side shared memory chunk */
       
   189     RChunk iSharedMemoryChunk;
       
   190 #endif
       
   191 	};
       
   192 
       
   193 #ifndef __KERNEL_MODE__
       
   194 #include "EtherCardApi.inl"
       
   195 #endif
       
   196 
       
   197 #endif  // __ETHERAPI_H__