1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/examples/exdriver/exdriver_sync/inc/exsync.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,109 @@
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 __EXSYNC_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 __EXSYNC_H__
1.28 +#define __EXSYNC_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_exsync");
1.42 +
1.43 +// Loopback modes
1.44 +const TInt KIntLoopbackDisable=0;
1.45 +const TInt KIntLoopbackEnable=1;
1.46 +
1.47 +/**
1.48 + User interface for tutorial driver
1.49 +
1.50 + RExDriverChannel class is derived from the RBusLogicalChannel and provides
1.51 + the interface for user. User application accesses the driver functionality
1.52 + using only these API.
1.53 + */
1.54 +class RExDriverChannel:public RBusLogicalChannel
1.55 + {
1.56 +public:
1.57 + // TVer is an enumeration for the version related information. Driver will
1.58 + // need to set and validate version related information while installing.
1.59 + // Version numbers are validated to check if this version of driver as
1.60 + // expected by the client/user application
1.61 + //
1.62 + enum TVer
1.63 + {
1.64 + EUartMajorVersionNumber=1, // Major number for driver
1.65 + EUartMinorVersionNumber=0, // Minor number for device
1.66 + EUartBuildVersionNumber=KE32BuildVersionNumber // Build version number for driver
1.67 + };
1.68 + // TControl is the enumeration for control and synchronous messages
1.69 + // supported by the driver. User application can request for any of
1.70 + // the following control messages to the driver through DoControl()
1.71 + // API provided by the RBusLogicalChannel class.
1.72 + //
1.73 + enum TControl // Synchronous control messages used with DoControl()
1.74 + {
1.75 + EControlCaps, // Get the channel capabilities on uart
1.76 + EControlSetConfig, // Configure the device (uart)
1.77 + EControlSetIntLoopback, // Configure the device's internal looback mode
1.78 + ERequestTransmitData, // Transmit data over the device (uart)
1.79 + ERequestReceiveData // Receive the data from the device (uart)
1.80 +
1.81 + };
1.82 +
1.83 +public:
1.84 + // VersionRequired() will provide the version of the driver. This is made inline
1.85 + // function to initialize the TVersion object with driver's Major,Minor and Build
1.86 + // version numbers. This is later used to validate the driver version.
1.87 + //
1.88 + inline static TVersion VersionRequired();
1.89 +
1.90 + // This header file is included both in user application and driver (in kernel mode).
1.91 + // The following API are provided only in user space and are not required in kernel mode.
1.92 + // Therefore, they are defined under __KERNEL_MODE__ conditional compilation switch.
1.93 + // These functions are wrappers to the RBusLogicalChannel API and are inline.
1.94 + //
1.95 + inline TInt Open(TInt aUnit); // Open the channel to the driver
1.96 + inline TInt Caps(TDes8& aCaps); // Get the channel capabilities
1.97 + inline TInt SetIntLoopback(const TInt aMode); // Configure the device's internal loopback
1.98 + inline TInt SetConfig(const TDesC8& aConfig); // Configure device (UART)
1.99 + inline TInt TransmitData( const TDesC8& aData); // Send data on device (UART)
1.100 + inline TInt ReceiveData(TDes8& aData); // Receive data on device (UART)
1.101 + };
1.102 +
1.103 +// All inline functions implementation is provided in a seperate inline file. This file
1.104 +// is included here to add the inline implementations. Note:these inline functions
1.105 +// implementaion is also available only in user space.
1.106 +//
1.107 +#include "exsync.inl"
1.108 +
1.109 +#endif // __EXSYNC_H__
1.110 +
1.111 +//
1.112 +// End of exsync.h