os/kernelhwsrv/kerneltest/e32test/examples/exdriver/exdriver_dma/inc/exdma.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // This file defines the interface provided by the driver to the user. 
    15 // It will be included both in the application (user) and the driver (kernel). 
    16 // This file typically defines the RBusLogicalChannel derived class that will 
    17 // inturn provide the driver API to the user application.
    18 // ifndef __EXDMA_H__ will resolve the multiple inclusion of this header 
    19 // file in different source files. If the file is already included, then the 
    20 // following switch will not re-include the file.
    21 // 
    22 //
    23 
    24 #ifndef __EXDMA_H__
    25 #define __EXDMA_H__
    26 
    27 // include files
    28 // 
    29 // e32ver.h (for KE32BuildVersionNumber), e32cmn.h and e32std.h are already
    30 // included in d32comm.h and hence not repeating here.
    31 //
    32 #include <d32comm.h>
    33 
    34 // Literal string descriptor constants for driver name. These descriptors 
    35 // are used by the driver to associate a name for registering to the 
    36 // Symbian OS. LDD will have a name to associate with.
    37 //
    38 _LIT(KDriverName, "d_exdma");
    39 
    40 // Internal loopback modes
    41 const TInt KIntLoopbackDisable=0;
    42 const TInt KIntLoopbackEnable=1;
    43 
    44 /**
    45  User interface for tutorial driver
    46  
    47  RExDriverChannel class is derived from the RBusLogicalChannel and provides 
    48  the interface for user. User application accesses the driver functionality
    49  using only these API.
    50  */
    51 class RExDriverChannel:public RBusLogicalChannel
    52 	{
    53 public:
    54 	// TVer is an enumeration for the version related information. Driver will 
    55 	// need to set and validate version related information while installing.
    56 	// Version numbers are validated to check if this version of driver as 
    57 	// expected by the client/user application
    58 	//
    59 	enum TVer
    60 		{
    61 		EUartMajorVersionNumber=1,						// Major number for driver
    62 		EUartMinorVersionNumber=0,						// Minor number for device
    63 		EUartBuildVersionNumber=KE32BuildVersionNumber	// Build version number for driver
    64 		};
    65 	// TControl is the enumeration for control and synchronous messages 
    66 	// supported by the driver. User application can request for any of
    67 	// the following control messages to the driver through DoControl() 
    68 	// API provided by the RBusLogicalChannel class.
    69 	//
    70 	enum TControl							// Synchronous control messages used with DoControl()					
    71 		{
    72 		EControlCaps,						// Get the channel capabilities on uart
    73 		EControlSetConfig,					// Configure the device (uart)
    74 		EControlSetIntLoopback				// Configure the device's internal looback mode
    75 		};
    76 	// TRequest is the enumeration for asynchronous requests supported
    77 	// by the driver. User application can request for any of the 
    78 	// following messages to the driver through DoRequest() API provided
    79 	// by the RBusLogicalChannel class.
    80 	//
    81 	enum TRequest							// Asynchronous request messages used with DoRequest()	
    82 		{
    83 		ERequestTransmitData,				// Transmit data over the device (uart)	
    84 		ERequestReceiveData,				// Receive the data from the device (uart)
    85 		ENumRequests,						// Total number of supported asynchrnous requests
    86 		EAllRequests = (1<<ENumRequests)-1
    87 		};	
    88 public:
    89 	// VersionRequired() will provide the version of the driver. This is made inline
    90 	// function to initialize the TVersion object with driver's Major,Minor and Build
    91 	// version numbers. This is later used to validate the driver version.
    92 	//
    93 	inline static TVersion VersionRequired();		
    94 	
    95 	// These functions are wrappers to the RBusLogicalChannel API and are inline.
    96 	//
    97 	inline TInt Open(TInt aUnit);					// Open the channel to the driver
    98 	inline TInt Caps(TDes8& aCaps);					// Get the channel capabilities
    99 	inline TInt SetIntLoopback(const TInt aMode);	// Configure the device's internal loopback
   100 	inline TInt SetConfig(const TDesC8& aConfig);	// Configure device (UART)	
   101 	inline TInt TransmitData(TRequestStatus& aStatus, const TDesC8& aData);		// Send data on device (UART)	
   102 	inline TInt ReceiveData(TRequestStatus& aStatus, TDes8& aData);				// Receive data on device (UART)	
   103 	inline void CancelTransmit();			// Cancel pending asynchronous Tx requests
   104 	inline void CancelReceive();			// Cancel pending asynchronous Rx requests
   105 	};
   106 
   107 // All inline functions implementation is provided in a seperate inline file. This file
   108 // is included here to add the inline implementations. Note:these inline functions 
   109 // implementaion is also available only in user space.
   110 // 
   111 #include "exdma.inl"
   112 
   113 #endif  // __EXDMA_H__
   114 
   115 //
   116 // End of exdma.h