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