os/kernelhwsrv/kerneltest/e32test/examples/exdriver/exdriver_pio/inc/expio.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 __EXPIO_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 __EXPIO_H__
    25 #define __EXPIO_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_expio");
    39 
    40 /**
    41  User interface for tutorial driver
    42  
    43  RExDriverChannel class is derived from the RBusLogicalChannel and provides 
    44  the interface for user. User application accesses the driver functionality
    45  using only these API.
    46  */
    47 class RExDriverChannel:public RBusLogicalChannel
    48 	{
    49 public:	
    50 	// TVer is an enumeration for the version related information. Driver will 
    51 	// need to set and validate version related information while installing.
    52 	// Version numbers are validated to check if this version of driver as 
    53 	// expected by the client/user application
    54 	//
    55 	enum TVer
    56 		{
    57 		EUartMajorVersionNumber=1,						// Major number for driver
    58 		EUartMinorVersionNumber=0,						// Minor number for device
    59 		EUartBuildVersionNumber=KE32BuildVersionNumber	// Build version number for driver
    60 		};
    61 	// TControl is the enumeration for control and synchronous messages 
    62 	// supported by the driver. User application can request for any of
    63 	// the following control messages to the driver through DoContro() 
    64 	// API provided by the RBusLogicalChannel class.
    65 	//
    66 	enum TControl							// Synchronous control messages used with DoContro()					
    67 		{
    68 		EControlCaps,						// Get the channel capabilities on uart
    69 		EControlSetConfig,					// Configure the device (uart)
    70 		EControlTransmitData,				// Transmit data over the device (uart)	
    71 		EControlReceiveData,				// Receive the data from the device (uart)
    72 		ENumRequests,						// Number of synchronous control requests
    73         EAllRequests = (1<<ENumRequests)-1	// Total number of control synchronous requests
    74 		};
    75 public:
    76 	// VersionRequired() will provide the version of the driver. This is made inline
    77 	// function to initialize the TVersion object with driver's Major,Minor and Build
    78 	// version numbers. This is later used to validate the driver version.
    79 	//
    80 	inline static TVersion VersionRequired();		
    81 	
    82 	// This header file is included both in user application and driver (in kernel mode).
    83 	// The following API are provided only in user space and are not required in kernel mode.
    84 	// Therefore, they are defined under __KERNEL_MODE__ conditional compilation switch.
    85 	// These functions are wrappers to the RBusLogicalChannel API and are inline.
    86 	//
    87 	inline TInt Open();								// Open the channel to the driver
    88 	inline TInt Caps(TDes8& aCaps);					// Get the channel capabilities
    89 	inline TInt SetConfig(const TDesC8& aConfig);	// Configure device (UART)	
    90 	inline TInt TransmitData(const TDesC8& aData);	// Send data on device (UART)	
    91 	inline TInt ReceiveData(TDes8& aData);			// Receive data on device (UART)	
    92 	};
    93 
    94 // All inline functions implementation is provided in a seperate inline file. This file
    95 // is included here to add the inline implementations. Note:these inline functions 
    96 // implementaion is also available only in user space.
    97 // 
    98 #include "expio.inl"
    99 
   100 #endif  // __EXPIO_H__
   101 
   102 //
   103 // End of expio.h