1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/d32usbcshared.inl Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,113 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32/include/d32usbcshared.inl
1.18 +// User side class definitions for USB Device support.
1.19 +//
1.20 +//
1.21 +
1.22 +/**
1.23 + @file d32usbcshared.inl
1.24 + @publishedPartner
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef __D32USBCSHARED_INL__
1.29 +#define __D32USBCSHARED_INL__
1.30 +
1.31 +inline TInt TUsbcEndpointCaps::MaxPacketSize() const
1.32 + {
1.33 + return (iSizes & KUsbEpSize1024) ? 1024 :
1.34 + ((iSizes & KUsbEpSize1023) ? 1023 :
1.35 + ((iSizes & KUsbEpSize512) ? 512 :
1.36 + ((iSizes & KUsbEpSize256) ? 256 :
1.37 + ((iSizes & KUsbEpSize128) ? 128 :
1.38 + ((iSizes & KUsbEpSize64) ? 64 :
1.39 + ((iSizes & KUsbEpSize32) ? 32 :
1.40 + ((iSizes & KUsbEpSize16) ? 16 :
1.41 + ((iSizes & KUsbEpSize8) ? 8 : 0))))))));
1.42 + }
1.43 +
1.44 +
1.45 +inline TInt TUsbcEndpointCaps::MinPacketSize() const
1.46 + {
1.47 + return (iSizes & KUsbEpSize8) ? 8 :
1.48 + ((iSizes & KUsbEpSize16) ? 16 :
1.49 + ((iSizes & KUsbEpSize32) ? 32 :
1.50 + ((iSizes & KUsbEpSize64) ? 64 :
1.51 + ((iSizes & KUsbEpSize128) ? 128 :
1.52 + ((iSizes & KUsbEpSize256) ? 256 :
1.53 + ((iSizes & KUsbEpSize512) ? 512 :
1.54 + ((iSizes & KUsbEpSize1023) ? 1023 :
1.55 + ((iSizes & KUsbEpSize1024) ? 1024 : 0))))))));
1.56 + }
1.57 +
1.58 +
1.59 +static inline TUint PacketSize2Mask(TInt aSize)
1.60 + {
1.61 + return (aSize == 8) ? KUsbEpSize8 :
1.62 + ((aSize == 16) ? KUsbEpSize16 :
1.63 + ((aSize == 32) ? KUsbEpSize32 :
1.64 + ((aSize == 64) ? KUsbEpSize64 :
1.65 + ((aSize == 128) ? KUsbEpSize128 :
1.66 + ((aSize == 256) ? KUsbEpSize256 :
1.67 + ((aSize == 512) ? KUsbEpSize512 :
1.68 + ((aSize == 1023) ? KUsbEpSize1023 :
1.69 + ((aSize == 1024) ? KUsbEpSize1024 : 0))))))));
1.70 + }
1.71 +
1.72 +
1.73 +static inline TUint EpTypeMask2Value(TInt aType)
1.74 + {
1.75 + return (aType & KUsbEpTypeControl) ? KUsbEpAttr_TransferTypeControl :
1.76 + ((aType & KUsbEpTypeIsochronous) ? KUsbEpAttr_TransferTypeIsochronous :
1.77 + ((aType & KUsbEpTypeBulk) ? KUsbEpAttr_TransferTypeBulk :
1.78 + ((aType & KUsbEpTypeInterrupt) ? KUsbEpAttr_TransferTypeInterrupt : -1)));
1.79 + }
1.80 +
1.81 +
1.82 +/** @internalTechnology
1.83 +*/
1.84 +struct TEndpointDescriptorInfo
1.85 + {
1.86 + TInt iSetting; // alternate setting
1.87 + TInt iEndpoint; // excludes ep0
1.88 + TAny* iArg; // address of data
1.89 + };
1.90 +
1.91 +
1.92 +/** @internalTechnology
1.93 +*/
1.94 +struct TCSDescriptorInfo
1.95 + {
1.96 + TInt iSetting; // alternate setting
1.97 + TInt iEndpoint; // excludes ep0, not used for CS ifc desc
1.98 + TAny* iArg; // address of data
1.99 + TInt iSize; // size of data (descriptor block)
1.100 + };
1.101 +
1.102 +inline TUsbcEndpointInfo::TUsbcEndpointInfo(TUint aType, TUint aDir, TInt aSize,
1.103 + TInt aInterval, TInt aExtra)
1.104 + : iType(aType), iDir(aDir), iSize(aSize), iInterval(aInterval),
1.105 + iInterval_Hs(-1), iTransactions(0), iExtra(aExtra), iFeatureWord1(0),
1.106 + iReserved(0)
1.107 + {}
1.108 +
1.109 +inline TUsbcClassInfo::TUsbcClassInfo(TInt aClass, TInt aSubClass, TInt aProtocol)
1.110 + : iClassNum(aClass), iSubClassNum(aSubClass), iProtocolNum(aProtocol), iReserved(0)
1.111 + {}
1.112 +
1.113 +
1.114 +#endif
1.115 +
1.116 +