os/kernelhwsrv/kerneltest/e32test/device/t_usblib.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32test\device\t_usblib.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __T_USBLIB_H__
sl@0
    19
#define __T_USBLIB_H__
sl@0
    20
sl@0
    21
sl@0
    22
// --- Little USB Test Helpers ---
sl@0
    23
sl@0
    24
//
sl@0
    25
// Returns ETrue if the testing platform is not in the list of platforms which
sl@0
    26
// are known NOT to have any USB support. In other words, assume that licensee
sl@0
    27
// platforms which aren't in this list WILL support USB.
sl@0
    28
//
sl@0
    29
inline TBool SupportsUsb()
sl@0
    30
	{
sl@0
    31
	TInt muid = 0;
sl@0
    32
	const TInt r = HAL::Get(HAL::EMachineUid, muid);
sl@0
    33
	if (r != KErrNone) return EFalse;;
sl@0
    34
	return ((muid != HAL::EMachineUid_Series5mx) &&
sl@0
    35
			(muid != HAL::EMachineUid_Cogent) &&
sl@0
    36
			(muid != HAL::EMachineUid_Win32Emulator) &&
sl@0
    37
			(muid != HAL::EMachineUid_WinC) &&
sl@0
    38
			(muid != HAL::EMachineUid_CL7211_Eval) &&
sl@0
    39
			(muid != HAL::EMachineUid_LinkUp) &&
sl@0
    40
			(muid != HAL::EMachineUid_IQ80310) &&
sl@0
    41
			(muid != HAL::EMachineUid_Integrator) &&
sl@0
    42
			(muid != HAL::EMachineUid_Helen) &&
sl@0
    43
			(muid != HAL::EMachineUid_NE1_TB) &&
sl@0
    44
			(muid != HAL::EMachineUid_X86PC));
sl@0
    45
	}
sl@0
    46
sl@0
    47
sl@0
    48
//
sl@0
    49
// Returns ETrue if the testing platform is not in the list of platforms which
sl@0
    50
// are known NOT to support alternate interface settings.
sl@0
    51
//
sl@0
    52
inline TBool SupportsAlternateInterfaces()
sl@0
    53
	{
sl@0
    54
	TInt muid = 0;
sl@0
    55
	const TInt r = HAL::Get(HAL::EMachineUid, muid);
sl@0
    56
	if (r != KErrNone) return EFalse;;
sl@0
    57
	return ((muid != HAL::EMachineUid_Brutus) &&
sl@0
    58
			(muid != HAL::EMachineUid_Assabet) &&
sl@0
    59
			(muid != HAL::EMachineUid_Lubbock));
sl@0
    60
	}
sl@0
    61
sl@0
    62
sl@0
    63
//
sl@0
    64
// Returns ETrue if the testing platform is not in the list of platforms which
sl@0
    65
// are known NOT to support stalling of endpoints in an unconfigured state.
sl@0
    66
// (Some UDCs don't permit endpoint stall operations until a SET_CONFIGURATION
sl@0
    67
// request has been received.)
sl@0
    68
//
sl@0
    69
inline TBool SupportsEndpointStall()
sl@0
    70
	{
sl@0
    71
	TInt muid = 0;
sl@0
    72
	const TInt r = HAL::Get(HAL::EMachineUid, muid);
sl@0
    73
	if (r != KErrNone) return EFalse;;
sl@0
    74
	return ((muid != HAL::EMachineUid_OmapH2) &&
sl@0
    75
			(muid != HAL::EMachineUid_OmapH4));
sl@0
    76
	}
sl@0
    77
sl@0
    78
sl@0
    79
//
sl@0
    80
// Calculates a 16-bit value out of two single bytes.
sl@0
    81
//
sl@0
    82
inline TUint16 EpSize(TUint8 aLowByte, TUint8 aHighByte)
sl@0
    83
		{
sl@0
    84
		TUint16 size = aLowByte;
sl@0
    85
		size |= (aHighByte << 8);
sl@0
    86
		return size;
sl@0
    87
		}
sl@0
    88
sl@0
    89
sl@0
    90
#endif	// __T_USBLIB_H__