os/kernelhwsrv/kernel/eka/include/d32usbcshared.inl
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-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
// e32/include/d32usbcshared.inl
sl@0
    15
// User side class definitions for USB Device support.
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file d32usbcshared.inl
sl@0
    21
 @publishedPartner
sl@0
    22
 @released
sl@0
    23
*/
sl@0
    24
sl@0
    25
#ifndef __D32USBCSHARED_INL__
sl@0
    26
#define __D32USBCSHARED_INL__
sl@0
    27
sl@0
    28
inline TInt TUsbcEndpointCaps::MaxPacketSize() const
sl@0
    29
	{
sl@0
    30
	return (iSizes & KUsbEpSize1024) ? 1024 :
sl@0
    31
		((iSizes & KUsbEpSize1023) ? 1023 :
sl@0
    32
		 ((iSizes & KUsbEpSize512) ? 512 :
sl@0
    33
		  ((iSizes & KUsbEpSize256) ? 256 :
sl@0
    34
		   ((iSizes & KUsbEpSize128) ? 128 :
sl@0
    35
			((iSizes & KUsbEpSize64) ? 64 :
sl@0
    36
			 ((iSizes & KUsbEpSize32) ? 32 :
sl@0
    37
			  ((iSizes & KUsbEpSize16) ? 16 :
sl@0
    38
			   ((iSizes & KUsbEpSize8) ? 8 : 0))))))));
sl@0
    39
	}
sl@0
    40
sl@0
    41
sl@0
    42
inline TInt TUsbcEndpointCaps::MinPacketSize() const
sl@0
    43
	{
sl@0
    44
	return (iSizes & KUsbEpSize8) ? 8 :
sl@0
    45
		((iSizes & KUsbEpSize16) ? 16 :
sl@0
    46
		 ((iSizes & KUsbEpSize32) ? 32 :
sl@0
    47
		  ((iSizes & KUsbEpSize64) ? 64 :
sl@0
    48
		   ((iSizes & KUsbEpSize128) ? 128 :
sl@0
    49
			((iSizes & KUsbEpSize256) ? 256 :
sl@0
    50
			 ((iSizes & KUsbEpSize512) ? 512 :
sl@0
    51
			  ((iSizes & KUsbEpSize1023) ? 1023 :
sl@0
    52
			   ((iSizes & KUsbEpSize1024) ? 1024 : 0))))))));
sl@0
    53
	}
sl@0
    54
sl@0
    55
sl@0
    56
static inline TUint PacketSize2Mask(TInt aSize)
sl@0
    57
	{
sl@0
    58
	return (aSize == 8) ? KUsbEpSize8 :
sl@0
    59
		((aSize == 16) ? KUsbEpSize16 :
sl@0
    60
		 ((aSize == 32) ? KUsbEpSize32 :
sl@0
    61
		  ((aSize == 64) ? KUsbEpSize64 :
sl@0
    62
		   ((aSize == 128) ? KUsbEpSize128 :
sl@0
    63
			((aSize == 256) ? KUsbEpSize256 :
sl@0
    64
			 ((aSize == 512) ? KUsbEpSize512 :
sl@0
    65
			  ((aSize == 1023) ? KUsbEpSize1023 :
sl@0
    66
			   ((aSize == 1024) ? KUsbEpSize1024 : 0))))))));
sl@0
    67
	}
sl@0
    68
sl@0
    69
sl@0
    70
static inline TUint EpTypeMask2Value(TInt aType)
sl@0
    71
	{
sl@0
    72
	return (aType & KUsbEpTypeControl) ? KUsbEpAttr_TransferTypeControl :
sl@0
    73
		((aType & KUsbEpTypeIsochronous) ? KUsbEpAttr_TransferTypeIsochronous :
sl@0
    74
		 ((aType & KUsbEpTypeBulk) ? KUsbEpAttr_TransferTypeBulk :
sl@0
    75
		  ((aType & KUsbEpTypeInterrupt) ? KUsbEpAttr_TransferTypeInterrupt : -1)));
sl@0
    76
	}
sl@0
    77
sl@0
    78
sl@0
    79
/** @internalTechnology
sl@0
    80
*/
sl@0
    81
struct TEndpointDescriptorInfo
sl@0
    82
	{
sl@0
    83
	TInt iSetting;											// alternate setting
sl@0
    84
	TInt iEndpoint;											// excludes ep0
sl@0
    85
	TAny* iArg;												// address of data
sl@0
    86
	};
sl@0
    87
sl@0
    88
sl@0
    89
/** @internalTechnology
sl@0
    90
*/
sl@0
    91
struct TCSDescriptorInfo
sl@0
    92
	{
sl@0
    93
	TInt iSetting;											// alternate setting
sl@0
    94
	TInt iEndpoint;											// excludes ep0, not used for CS ifc desc
sl@0
    95
	TAny* iArg;												// address of data
sl@0
    96
	TInt iSize;												// size of data (descriptor block)
sl@0
    97
	};
sl@0
    98
sl@0
    99
inline TUsbcEndpointInfo::TUsbcEndpointInfo(TUint aType, TUint aDir, TInt aSize,
sl@0
   100
											TInt aInterval, TInt aExtra)
sl@0
   101
	: iType(aType), iDir(aDir), iSize(aSize), iInterval(aInterval),
sl@0
   102
	  iInterval_Hs(-1), iTransactions(0), iExtra(aExtra), iFeatureWord1(0),
sl@0
   103
	  iReserved(0)
sl@0
   104
	{}
sl@0
   105
sl@0
   106
inline TUsbcClassInfo::TUsbcClassInfo(TInt aClass, TInt aSubClass, TInt aProtocol)
sl@0
   107
	: iClassNum(aClass), iSubClassNum(aSubClass), iProtocolNum(aProtocol), iReserved(0)
sl@0
   108
	{}
sl@0
   109
sl@0
   110
sl@0
   111
#endif
sl@0
   112
sl@0
   113