First public contribution.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\testusbcldd\inc\testusbc.h
15 // Test USB Client API.
17 // WARNING: This file contains some APIs which are internal and are subject
18 // to change without notice. Such APIs should therefore not be used
19 // outside the Kernel and Hardware Services package.
27 #ifndef __TESTUSBC_H__
28 #define __TESTUSBC_H__
35 class RDevTestUsbcClient : public RDevUsbcClient
41 ETestControlReqEndpointStatusNotify = 100,
42 ETestControlClearEndpoint
47 ETestRequestNotifyEndpointStatus = 100
50 inline TInt Open(TInt aUnit)
52 _LIT(KUsbDevName, "Usbc");
53 return (DoCreate(KUsbDevName, TVersion(0, 1, 1), aUnit, NULL, NULL, EOwnerThread));
56 inline void HostRead(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes, TInt aLen)
58 TInt ep = (aEndpoint < 0 || aEndpoint>KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
59 TEndpointTransferInfo info = { &aDes, ETransferTypeReadData, aLen };
60 DoRequest(ep, aStatus, &info, (void*)ETrue);
63 inline void HostWrite(TRequestStatus &aStatus, TEndpointNumber aEndpoint, const TDesC8& aDes,
64 TInt aLen, TBool aZlpRequired = EFalse)
66 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
67 TEndpointTransferInfo info = { const_cast<TDesC8*>(&aDes), ETransferTypeWrite, aLen, aZlpRequired };
68 DoRequest(ep, aStatus, &info, (void*)ETrue);
71 inline void HostEndpointStatusNotify(TRequestStatus &aStatus, TEndpointNumber aEndpoint)
73 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
74 DoRequest(ETestRequestNotifyEndpointStatus, aStatus, (void*)ep, (void*)ETrue);
77 inline void HostClearEndpoint(TEndpointNumber aEndpoint)
79 TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint;
80 DoControl(ETestControlClearEndpoint, (void*)ep, (void*)NULL);
84 #endif //__TESTUSBC_H__