sl@0: // Copyright (c) 2006-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: // e32test\device\t_usblib.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __T_USBLIB_H__ sl@0: #define __T_USBLIB_H__ sl@0: sl@0: sl@0: // --- Little USB Test Helpers --- sl@0: sl@0: // sl@0: // Returns ETrue if the testing platform is not in the list of platforms which sl@0: // are known NOT to have any USB support. In other words, assume that licensee sl@0: // platforms which aren't in this list WILL support USB. sl@0: // sl@0: inline TBool SupportsUsb() sl@0: { sl@0: TInt muid = 0; sl@0: const TInt r = HAL::Get(HAL::EMachineUid, muid); sl@0: if (r != KErrNone) return EFalse;; sl@0: return ((muid != HAL::EMachineUid_Series5mx) && sl@0: (muid != HAL::EMachineUid_Cogent) && sl@0: (muid != HAL::EMachineUid_Win32Emulator) && sl@0: (muid != HAL::EMachineUid_WinC) && sl@0: (muid != HAL::EMachineUid_CL7211_Eval) && sl@0: (muid != HAL::EMachineUid_LinkUp) && sl@0: (muid != HAL::EMachineUid_IQ80310) && sl@0: (muid != HAL::EMachineUid_Integrator) && sl@0: (muid != HAL::EMachineUid_Helen) && sl@0: (muid != HAL::EMachineUid_NE1_TB) && sl@0: (muid != HAL::EMachineUid_X86PC)); sl@0: } sl@0: sl@0: sl@0: // sl@0: // Returns ETrue if the testing platform is not in the list of platforms which sl@0: // are known NOT to support alternate interface settings. sl@0: // sl@0: inline TBool SupportsAlternateInterfaces() sl@0: { sl@0: TInt muid = 0; sl@0: const TInt r = HAL::Get(HAL::EMachineUid, muid); sl@0: if (r != KErrNone) return EFalse;; sl@0: return ((muid != HAL::EMachineUid_Brutus) && sl@0: (muid != HAL::EMachineUid_Assabet) && sl@0: (muid != HAL::EMachineUid_Lubbock)); sl@0: } sl@0: sl@0: sl@0: // sl@0: // Returns ETrue if the testing platform is not in the list of platforms which sl@0: // are known NOT to support stalling of endpoints in an unconfigured state. sl@0: // (Some UDCs don't permit endpoint stall operations until a SET_CONFIGURATION sl@0: // request has been received.) sl@0: // sl@0: inline TBool SupportsEndpointStall() sl@0: { sl@0: TInt muid = 0; sl@0: const TInt r = HAL::Get(HAL::EMachineUid, muid); sl@0: if (r != KErrNone) return EFalse;; sl@0: return ((muid != HAL::EMachineUid_OmapH2) && sl@0: (muid != HAL::EMachineUid_OmapH4)); sl@0: } sl@0: sl@0: sl@0: // sl@0: // Calculates a 16-bit value out of two single bytes. sl@0: // sl@0: inline TUint16 EpSize(TUint8 aLowByte, TUint8 aHighByte) sl@0: { sl@0: TUint16 size = aLowByte; sl@0: size |= (aHighByte << 8); sl@0: return size; sl@0: } sl@0: sl@0: sl@0: #endif // __T_USBLIB_H__