kernel/eka/include/d32usbcshared.inl
author Tom Cosgrove <tom.cosgrove@nokia.com>
Fri, 28 May 2010 16:29:07 +0100
changeset 30 8aab599e3476
parent 0 a41df078684a
permissions -rw-r--r--
Fix for bug 2283 (RVCT 4.0 support is missing from PDK 3.0.h) Have multiple extension sections in the bld.inf, one for each version of the compiler. The RVCT version building the tools will build the runtime libraries for its version, but make sure we extract all the other versions from zip archives. Also add the archive for RVCT4.

// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// e32/include/d32usbcshared.inl
// User side class definitions for USB Device support.
// 
//

/**
 @file d32usbcshared.inl
 @publishedPartner
 @released
*/

#ifndef __D32USBCSHARED_INL__
#define __D32USBCSHARED_INL__

inline TInt TUsbcEndpointCaps::MaxPacketSize() const
	{
	return (iSizes & KUsbEpSize1024) ? 1024 :
		((iSizes & KUsbEpSize1023) ? 1023 :
		 ((iSizes & KUsbEpSize512) ? 512 :
		  ((iSizes & KUsbEpSize256) ? 256 :
		   ((iSizes & KUsbEpSize128) ? 128 :
			((iSizes & KUsbEpSize64) ? 64 :
			 ((iSizes & KUsbEpSize32) ? 32 :
			  ((iSizes & KUsbEpSize16) ? 16 :
			   ((iSizes & KUsbEpSize8) ? 8 : 0))))))));
	}


inline TInt TUsbcEndpointCaps::MinPacketSize() const
	{
	return (iSizes & KUsbEpSize8) ? 8 :
		((iSizes & KUsbEpSize16) ? 16 :
		 ((iSizes & KUsbEpSize32) ? 32 :
		  ((iSizes & KUsbEpSize64) ? 64 :
		   ((iSizes & KUsbEpSize128) ? 128 :
			((iSizes & KUsbEpSize256) ? 256 :
			 ((iSizes & KUsbEpSize512) ? 512 :
			  ((iSizes & KUsbEpSize1023) ? 1023 :
			   ((iSizes & KUsbEpSize1024) ? 1024 : 0))))))));
	}


static inline TUint PacketSize2Mask(TInt aSize)
	{
	return (aSize == 8) ? KUsbEpSize8 :
		((aSize == 16) ? KUsbEpSize16 :
		 ((aSize == 32) ? KUsbEpSize32 :
		  ((aSize == 64) ? KUsbEpSize64 :
		   ((aSize == 128) ? KUsbEpSize128 :
			((aSize == 256) ? KUsbEpSize256 :
			 ((aSize == 512) ? KUsbEpSize512 :
			  ((aSize == 1023) ? KUsbEpSize1023 :
			   ((aSize == 1024) ? KUsbEpSize1024 : 0))))))));
	}


static inline TUint EpTypeMask2Value(TInt aType)
	{
	return (aType & KUsbEpTypeControl) ? KUsbEpAttr_TransferTypeControl :
		((aType & KUsbEpTypeIsochronous) ? KUsbEpAttr_TransferTypeIsochronous :
		 ((aType & KUsbEpTypeBulk) ? KUsbEpAttr_TransferTypeBulk :
		  ((aType & KUsbEpTypeInterrupt) ? KUsbEpAttr_TransferTypeInterrupt : -1)));
	}


/** @internalTechnology
*/
struct TEndpointDescriptorInfo
	{
	TInt iSetting;											// alternate setting
	TInt iEndpoint;											// excludes ep0
	TAny* iArg;												// address of data
	};


/** @internalTechnology
*/
struct TCSDescriptorInfo
	{
	TInt iSetting;											// alternate setting
	TInt iEndpoint;											// excludes ep0, not used for CS ifc desc
	TAny* iArg;												// address of data
	TInt iSize;												// size of data (descriptor block)
	};

inline TUsbcEndpointInfo::TUsbcEndpointInfo(TUint aType, TUint aDir, TInt aSize,
											TInt aInterval, TInt aExtra)
	: iType(aType), iDir(aDir), iSize(aSize), iInterval(aInterval),
	  iInterval_Hs(-1), iTransactions(0), iExtra(aExtra), iFeatureWord1(0),
	  iReserved(0)
	{}

inline TUsbcClassInfo::TUsbcClassInfo(TInt aClass, TInt aSubClass, TInt aProtocol)
	: iClassNum(aClass), iSubClassNum(aSubClass), iProtocolNum(aProtocol), iReserved(0)
	{}


#endif