1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/examples/exdriver/exdriver_dma/inc/exdma.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,116 @@
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 __EXDMA_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 __EXDMA_H__
1.28 +#define __EXDMA_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_exdma");
1.42 +
1.43 +// Internal 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 + };
1.79 + // TRequest is the enumeration for asynchronous requests supported
1.80 + // by the driver. User application can request for any of the
1.81 + // following messages to the driver through DoRequest() API provided
1.82 + // by the RBusLogicalChannel class.
1.83 + //
1.84 + enum TRequest // Asynchronous request messages used with DoRequest()
1.85 + {
1.86 + ERequestTransmitData, // Transmit data over the device (uart)
1.87 + ERequestReceiveData, // Receive the data from the device (uart)
1.88 + ENumRequests, // Total number of supported asynchrnous requests
1.89 + EAllRequests = (1<<ENumRequests)-1
1.90 + };
1.91 +public:
1.92 + // VersionRequired() will provide the version of the driver. This is made inline
1.93 + // function to initialize the TVersion object with driver's Major,Minor and Build
1.94 + // version numbers. This is later used to validate the driver version.
1.95 + //
1.96 + inline static TVersion VersionRequired();
1.97 +
1.98 + // These functions are wrappers to the RBusLogicalChannel API and are inline.
1.99 + //
1.100 + inline TInt Open(TInt aUnit); // Open the channel to the driver
1.101 + inline TInt Caps(TDes8& aCaps); // Get the channel capabilities
1.102 + inline TInt SetIntLoopback(const TInt aMode); // Configure the device's internal loopback
1.103 + inline TInt SetConfig(const TDesC8& aConfig); // Configure device (UART)
1.104 + inline TInt TransmitData(TRequestStatus& aStatus, const TDesC8& aData); // Send data on device (UART)
1.105 + inline TInt ReceiveData(TRequestStatus& aStatus, TDes8& aData); // Receive data on device (UART)
1.106 + inline void CancelTransmit(); // Cancel pending asynchronous Tx requests
1.107 + inline void CancelReceive(); // Cancel pending asynchronous Rx requests
1.108 + };
1.109 +
1.110 +// All inline functions implementation is provided in a seperate inline file. This file
1.111 +// is included here to add the inline implementations. Note:these inline functions
1.112 +// implementaion is also available only in user space.
1.113 +//
1.114 +#include "exdma.inl"
1.115 +
1.116 +#endif // __EXDMA_H__
1.117 +
1.118 +//
1.119 +// End of exdma.h