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