sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32test\testusbcldd\inc\testusbc.h sl@0: // Test USB Client API. sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without notice. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef __TESTUSBC_H__ sl@0: #define __TESTUSBC_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: sl@0: sl@0: class RDevTestUsbcClient : public RDevUsbcClient sl@0: { sl@0: public: sl@0: sl@0: enum TControl sl@0: { sl@0: ETestControlReqEndpointStatusNotify = 100, sl@0: ETestControlClearEndpoint sl@0: }; sl@0: sl@0: enum TRequest sl@0: { sl@0: ETestRequestNotifyEndpointStatus = 100 sl@0: }; sl@0: sl@0: inline TInt Open(TInt aUnit) sl@0: { sl@0: _LIT(KUsbDevName, "Usbc"); sl@0: return (DoCreate(KUsbDevName, TVersion(0, 1, 1), aUnit, NULL, NULL, EOwnerThread)); sl@0: } sl@0: sl@0: inline void HostRead(TRequestStatus &aStatus, TEndpointNumber aEndpoint, TDes8 &aDes, TInt aLen) sl@0: { sl@0: TInt ep = (aEndpoint < 0 || aEndpoint>KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; sl@0: TEndpointTransferInfo info = { &aDes, ETransferTypeReadData, aLen }; sl@0: DoRequest(ep, aStatus, &info, (void*)ETrue); sl@0: } sl@0: sl@0: inline void HostWrite(TRequestStatus &aStatus, TEndpointNumber aEndpoint, const TDesC8& aDes, sl@0: TInt aLen, TBool aZlpRequired = EFalse) sl@0: { sl@0: TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; sl@0: TEndpointTransferInfo info = { const_cast(&aDes), ETransferTypeWrite, aLen, aZlpRequired }; sl@0: DoRequest(ep, aStatus, &info, (void*)ETrue); sl@0: } sl@0: sl@0: inline void HostEndpointStatusNotify(TRequestStatus &aStatus, TEndpointNumber aEndpoint) sl@0: { sl@0: TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; sl@0: DoRequest(ETestRequestNotifyEndpointStatus, aStatus, (void*)ep, (void*)ETrue); sl@0: } sl@0: sl@0: inline void HostClearEndpoint(TEndpointNumber aEndpoint) sl@0: { sl@0: TInt ep = (aEndpoint < 0 || aEndpoint > KMaxEndpointsPerClient) ? KInvalidEndpointNumber : aEndpoint; sl@0: DoControl(ETestControlClearEndpoint, (void*)ep, (void*)NULL); sl@0: } sl@0: }; sl@0: sl@0: #endif //__TESTUSBC_H__