os/kernelhwsrv/kerneltest/e32test/usb/t_usb_device/include/usblib.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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/usb/t_usb_device/include/usblib.h
    15 // 
    16 //
    17 
    18 #ifndef __USBLIB_H__
    19 #define __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_X86PC));
    44 	}
    45 
    46 
    47 //
    48 // Returns ETrue if the testing platform is not in the list of platforms which
    49 // are known NOT to support alternate interface settings.
    50 //
    51 inline TBool SupportsAlternateInterfaces()
    52 	{
    53 	TInt muid = 0;
    54 	const TInt r = HAL::Get(HAL::EMachineUid, muid);
    55 	if (r != KErrNone) return EFalse;;
    56 	return ((muid != HAL::EMachineUid_Brutus) &&
    57 			(muid != HAL::EMachineUid_Assabet) &&
    58 			(muid != HAL::EMachineUid_Lubbock));
    59 	}
    60 
    61 
    62 //
    63 // Returns ETrue if the testing platform is not in the list of platforms which
    64 // are known NOT to support stalling of endpoints in an unconfigured state.
    65 // (Some UDCs don't permit endpoint stall operations until a SET_CONFIGURATION
    66 // request has been received.)
    67 //
    68 inline TBool SupportsEndpointStall()
    69 	{
    70 	TInt muid = 0;
    71 	const TInt r = HAL::Get(HAL::EMachineUid, muid);
    72 	if (r != KErrNone) return EFalse;;
    73 	return ((muid != HAL::EMachineUid_OmapH2) &&
    74 			(muid != HAL::EMachineUid_OmapH4));
    75 	}
    76 
    77 
    78 //
    79 // Calculates a 16-bit value out of two single bytes.
    80 //
    81 inline TUint16 EpSize(TUint8 aLowByte, TUint8 aHighByte)
    82 		{
    83 		TUint16 size = aLowByte;
    84 		size |= (aHighByte << 8);
    85 		return size;
    86 		}
    87 
    88 
    89 #endif	// __USBLIB_H__