kerneltest/e32test/device/t_usblib.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2006-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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32test\device\t_usblib.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __T_USBLIB_H__
       
    19 #define __T_USBLIB_H__
       
    20 
       
    21 
       
    22 // --- Little USB Test Helpers ---
       
    23 
       
    24 //
       
    25 // Returns ETrue if the testing platform is not in the list of platforms which
       
    26 // are known NOT to have any USB support. In other words, assume that licensee
       
    27 // platforms which aren't in this list WILL support USB.
       
    28 //
       
    29 inline TBool SupportsUsb()
       
    30 	{
       
    31 	TInt muid = 0;
       
    32 	const TInt r = HAL::Get(HAL::EMachineUid, muid);
       
    33 	if (r != KErrNone) return EFalse;;
       
    34 	return ((muid != HAL::EMachineUid_Series5mx) &&
       
    35 			(muid != HAL::EMachineUid_Cogent) &&
       
    36 			(muid != HAL::EMachineUid_Win32Emulator) &&
       
    37 			(muid != HAL::EMachineUid_WinC) &&
       
    38 			(muid != HAL::EMachineUid_CL7211_Eval) &&
       
    39 			(muid != HAL::EMachineUid_LinkUp) &&
       
    40 			(muid != HAL::EMachineUid_IQ80310) &&
       
    41 			(muid != HAL::EMachineUid_Integrator) &&
       
    42 			(muid != HAL::EMachineUid_Helen) &&
       
    43 			(muid != HAL::EMachineUid_NE1_TB) &&
       
    44 			(muid != HAL::EMachineUid_X86PC));
       
    45 	}
       
    46 
       
    47 
       
    48 //
       
    49 // Returns ETrue if the testing platform is not in the list of platforms which
       
    50 // are known NOT to support alternate interface settings.
       
    51 //
       
    52 inline TBool SupportsAlternateInterfaces()
       
    53 	{
       
    54 	TInt muid = 0;
       
    55 	const TInt r = HAL::Get(HAL::EMachineUid, muid);
       
    56 	if (r != KErrNone) return EFalse;;
       
    57 	return ((muid != HAL::EMachineUid_Brutus) &&
       
    58 			(muid != HAL::EMachineUid_Assabet) &&
       
    59 			(muid != HAL::EMachineUid_Lubbock));
       
    60 	}
       
    61 
       
    62 
       
    63 //
       
    64 // Returns ETrue if the testing platform is not in the list of platforms which
       
    65 // are known NOT to support stalling of endpoints in an unconfigured state.
       
    66 // (Some UDCs don't permit endpoint stall operations until a SET_CONFIGURATION
       
    67 // request has been received.)
       
    68 //
       
    69 inline TBool SupportsEndpointStall()
       
    70 	{
       
    71 	TInt muid = 0;
       
    72 	const TInt r = HAL::Get(HAL::EMachineUid, muid);
       
    73 	if (r != KErrNone) return EFalse;;
       
    74 	return ((muid != HAL::EMachineUid_OmapH2) &&
       
    75 			(muid != HAL::EMachineUid_OmapH4));
       
    76 	}
       
    77 
       
    78 
       
    79 //
       
    80 // Calculates a 16-bit value out of two single bytes.
       
    81 //
       
    82 inline TUint16 EpSize(TUint8 aLowByte, TUint8 aHighByte)
       
    83 		{
       
    84 		TUint16 size = aLowByte;
       
    85 		size |= (aHighByte << 8);
       
    86 		return size;
       
    87 		}
       
    88 
       
    89 
       
    90 #endif	// __T_USBLIB_H__