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