os/kernelhwsrv/kerneltest/e32test/examples/exdriver/exdriver_pio/inc/expio.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/examples/exdriver/exdriver_pio/inc/expio.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,103 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// This file defines the interface provided by the driver to the user. 
    1.18 +// It will be included both in the application (user) and the driver (kernel). 
    1.19 +// This file typically defines the RBusLogicalChannel derived class that will 
    1.20 +// inturn provide the driver API to the user application. 
    1.21 +// ifndef __EXPIO_H__ will resolve the multiple inclusion of this header 
    1.22 +// file in different source files. If the file is already included, then the 
    1.23 +// following switch will not re-include the file.
    1.24 +// 
    1.25 +//
    1.26 +
    1.27 +#ifndef __EXPIO_H__
    1.28 +#define __EXPIO_H__
    1.29 +
    1.30 +// include files
    1.31 +// 
    1.32 +// e32ver.h (for KE32BuildVersionNumber), e32cmn.h and e32std.h are already
    1.33 +// included in d32comm.h and hence not repeating here.
    1.34 +//
    1.35 +#include <d32comm.h> 
    1.36 +
    1.37 +// Literal string descriptor constants for driver name. These descriptors 
    1.38 +// are used by the driver to associate a name for registering to the 
    1.39 +// Symbian OS. LDD will have a name to associate with.
    1.40 +//
    1.41 +_LIT(KDriverName, "d_expio");
    1.42 +
    1.43 +/**
    1.44 + User interface for tutorial driver
    1.45 + 
    1.46 + RExDriverChannel class is derived from the RBusLogicalChannel and provides 
    1.47 + the interface for user. User application accesses the driver functionality
    1.48 + using only these API.
    1.49 + */
    1.50 +class RExDriverChannel:public RBusLogicalChannel
    1.51 +	{
    1.52 +public:	
    1.53 +	// TVer is an enumeration for the version related information. Driver will 
    1.54 +	// need to set and validate version related information while installing.
    1.55 +	// Version numbers are validated to check if this version of driver as 
    1.56 +	// expected by the client/user application
    1.57 +	//
    1.58 +	enum TVer
    1.59 +		{
    1.60 +		EUartMajorVersionNumber=1,						// Major number for driver
    1.61 +		EUartMinorVersionNumber=0,						// Minor number for device
    1.62 +		EUartBuildVersionNumber=KE32BuildVersionNumber	// Build version number for driver
    1.63 +		};
    1.64 +	// TControl is the enumeration for control and synchronous messages 
    1.65 +	// supported by the driver. User application can request for any of
    1.66 +	// the following control messages to the driver through DoContro() 
    1.67 +	// API provided by the RBusLogicalChannel class.
    1.68 +	//
    1.69 +	enum TControl							// Synchronous control messages used with DoContro()					
    1.70 +		{
    1.71 +		EControlCaps,						// Get the channel capabilities on uart
    1.72 +		EControlSetConfig,					// Configure the device (uart)
    1.73 +		EControlTransmitData,				// Transmit data over the device (uart)	
    1.74 +		EControlReceiveData,				// Receive the data from the device (uart)
    1.75 +		ENumRequests,						// Number of synchronous control requests
    1.76 +        EAllRequests = (1<<ENumRequests)-1	// Total number of control synchronous requests
    1.77 +		};
    1.78 +public:
    1.79 +	// VersionRequired() will provide the version of the driver. This is made inline
    1.80 +	// function to initialize the TVersion object with driver's Major,Minor and Build
    1.81 +	// version numbers. This is later used to validate the driver version.
    1.82 +	//
    1.83 +	inline static TVersion VersionRequired();		
    1.84 +	
    1.85 +	// This header file is included both in user application and driver (in kernel mode).
    1.86 +	// The following API are provided only in user space and are not required in kernel mode.
    1.87 +	// Therefore, they are defined under __KERNEL_MODE__ conditional compilation switch.
    1.88 +	// These functions are wrappers to the RBusLogicalChannel API and are inline.
    1.89 +	//
    1.90 +	inline TInt Open();								// Open the channel to the driver
    1.91 +	inline TInt Caps(TDes8& aCaps);					// Get the channel capabilities
    1.92 +	inline TInt SetConfig(const TDesC8& aConfig);	// Configure device (UART)	
    1.93 +	inline TInt TransmitData(const TDesC8& aData);	// Send data on device (UART)	
    1.94 +	inline TInt ReceiveData(TDes8& aData);			// Receive data on device (UART)	
    1.95 +	};
    1.96 +
    1.97 +// All inline functions implementation is provided in a seperate inline file. This file
    1.98 +// is included here to add the inline implementations. Note:these inline functions 
    1.99 +// implementaion is also available only in user space.
   1.100 +// 
   1.101 +#include "expio.inl"
   1.102 +
   1.103 +#endif  // __EXPIO_H__
   1.104 +
   1.105 +//
   1.106 +// End of expio.h