os/kernelhwsrv/kerneltest/e32test/personality/example/ifcldd.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * e32test\personality\example\ifcldd.h
    16 * Test code for example RTOS personality.
    17 * 
    18 *
    19 */
    20 
    21 
    22 
    23 #if !defined(__IFCLDD_H__)
    24 #define __IFCLDD_H__
    25 #include <e32cmn.h>
    26 #ifndef __KERNEL_MODE__
    27 #include <e32std.h>
    28 #endif
    29 
    30 _LIT(KRtosIfcLddName,"RtosIfc");
    31 
    32 class TCapsRtosIfcV01
    33 	{
    34 public:
    35 	TVersion	iVersion;
    36 	};
    37 
    38 struct SRxData
    39 	{
    40 	TInt iLength;
    41 	TUint8 iChecksum;
    42 	TUint8 iData[1];
    43 	};
    44 
    45 struct SReport
    46 	{
    47 	enum TType {ESem=8, ERcv=9, ETm=10};
    48 	TInt iType;
    49 	TUint iCount;
    50 	TUint iOkCount;
    51 	TUint iBadCount;
    52 	};
    53 
    54 class RRtosIfc : public RBusLogicalChannel
    55 	{
    56 public:
    57 	enum TRequest
    58 		{
    59 		ERequestWaitInitialTests,
    60 		ERequestReceive,
    61 		ERequestReport,
    62 		};
    63 
    64 	enum TRequestCancel
    65 		{
    66 		ECancelWaitInitialTests=1,
    67 		ECancelReceive=2,
    68 		ECancelReport=4,
    69 		};
    70 
    71 	enum TControl
    72 		{
    73 		EControlInit,
    74 		EControlSend,
    75 		EControlFlush,
    76 		EControlFinish,
    77 		};
    78 public:
    79 #ifndef __KERNEL_MODE__
    80 	inline TInt Open()
    81 		{ return DoCreate(KRtosIfcLddName(),TVersion(0,1,1),KNullUnit,NULL,NULL); }
    82 	inline void Init()
    83 		{ DoControl(EControlInit); }
    84 	inline void WaitInitialTests(TRequestStatus& aStatus)
    85 		{ DoRequest(ERequestWaitInitialTests, aStatus); }
    86 	inline void Receive(TRequestStatus& aStatus, SRxData& aData)
    87 		{ DoRequest(ERequestReceive, aStatus, &aData); }
    88 	inline void Report(TRequestStatus& aStatus, SReport& aData)
    89 		{ DoRequest(ERequestReport, aStatus, &aData); }
    90 	inline TInt SendData(const TDesC8& aData)
    91 		{ return DoControl(EControlSend, (TAny*)&aData); }
    92 	inline void FlushData()
    93 		{ DoControl(EControlFlush); }
    94 	inline void Finish()
    95 		{ DoControl(EControlFinish); }
    96 	inline void Cancel(TUint aMask)
    97 		{ DoCancel(aMask); }
    98 #endif
    99 	};
   100 
   101 #endif