usbdrv/peripheral/public/d32usbcsc.h
author hgs
Wed, 20 Oct 2010 12:04:53 +0800
changeset 59 bbdce6bffaad
parent 48 21625e5de155
permissions -rw-r--r--
201041_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
59
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     1
/*
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     3
* All rights reserved.
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     4
* This component and the accompanying materials are made available
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     6
* which accompanies this distribution, and is available
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     8
*
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
     9
* Initial Contributors:
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    10
* Nokia Corporation - initial contribution.
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    11
*
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    12
* Contributors:
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    13
*
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    14
* Description:
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    15
* e32\include\d32usbcsc.h
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    16
* User side class definitions for USB Device support.
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    17
*
bbdce6bffaad 201041_02
hgs
parents: 48
diff changeset
    18
*/
33
089413cdde3c 201028_02
hgs
parents:
diff changeset
    19
089413cdde3c 201028_02
hgs
parents:
diff changeset
    20
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
    21
 @file d32usbcsc.h
089413cdde3c 201028_02
hgs
parents:
diff changeset
    22
 @publishedPartner
089413cdde3c 201028_02
hgs
parents:
diff changeset
    23
 @released
089413cdde3c 201028_02
hgs
parents:
diff changeset
    24
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
    25
089413cdde3c 201028_02
hgs
parents:
diff changeset
    26
#ifndef __D32USBCSC_H__
089413cdde3c 201028_02
hgs
parents:
diff changeset
    27
#define __D32USBCSC_H__
089413cdde3c 201028_02
hgs
parents:
diff changeset
    28
089413cdde3c 201028_02
hgs
parents:
diff changeset
    29
#include <e32ver.h>
089413cdde3c 201028_02
hgs
parents:
diff changeset
    30
#include <usb/usb.h>
089413cdde3c 201028_02
hgs
parents:
diff changeset
    31
#include <usb/d32usbcshared.h>
089413cdde3c 201028_02
hgs
parents:
diff changeset
    32
089413cdde3c 201028_02
hgs
parents:
diff changeset
    33
089413cdde3c 201028_02
hgs
parents:
diff changeset
    34
/** This means that SetInterface was called after RealizeInterface had been called.
089413cdde3c 201028_02
hgs
parents:
diff changeset
    35
    RealizeInterface is meant to signal that all interfaces have been set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
    36
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
    37
const TInt KErrUsbAlreadyRealized = -6813; //Changed from -6713 for future compatibility with the d32usbcshared.h file
089413cdde3c 201028_02
hgs
parents:
diff changeset
    38
089413cdde3c 201028_02
hgs
parents:
diff changeset
    39
const TInt KErrAlternateSettingChanged = -6814;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    40
089413cdde3c 201028_02
hgs
parents:
diff changeset
    41
089413cdde3c 201028_02
hgs
parents:
diff changeset
    42
const TUint KChunkCellSize = 1; //1 32 bit integer
089413cdde3c 201028_02
hgs
parents:
diff changeset
    43
const TInt KEpDescPacketSizeOffset = 4;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    44
089413cdde3c 201028_02
hgs
parents:
diff changeset
    45
/** The user side enpoint number of Endpoint Zero. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
    46
const TInt KEp0Number = 0;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    47
089413cdde3c 201028_02
hgs
parents:
diff changeset
    48
/* Used in TUsbcScHdrEndpointRecord to describe the endpoint type
089413cdde3c 201028_02
hgs
parents:
diff changeset
    49
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
    50
089413cdde3c 201028_02
hgs
parents:
diff changeset
    51
const TUint8 KUsbScHdrEpDirectionIn=1;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    52
const TUint8 KUsbScHdrEpDirectionOut=2;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    53
const TUint8 KUsbScHdrEpDirectionBiDir=3;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    54
089413cdde3c 201028_02
hgs
parents:
diff changeset
    55
089413cdde3c 201028_02
hgs
parents:
diff changeset
    56
const TUint8 KUsbScHdrEpTypeControl = 0;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    57
const TUint8 KUsbScHdrEpTypeIsochronous =1;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    58
const TUint8 KUsbScHdrEpTypeBulk = 2;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    59
const TUint8 KUsbScHdrEpTypeInterrupt = 3;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    60
const TUint8 KUsbScHdrEpTypeUnknown = ~0;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    61
/** Used in the the Shared Chunk Header, to represent an endpoint.
089413cdde3c 201028_02
hgs
parents:
diff changeset
    62
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
    63
class TUsbcScHdrEndpointRecord
089413cdde3c 201028_02
hgs
parents:
diff changeset
    64
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
    65
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
    66
    inline TUsbcScHdrEndpointRecord(TInt aBufferNo, TUint8 aType);
089413cdde3c 201028_02
hgs
parents:
diff changeset
    67
    inline TUint Direction() const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    68
    inline TUint Type() const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    69
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
    70
    TUint8 iBufferNo;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    71
    TUint8 iType;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    72
    TUint16 iReserved;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    73
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
    74
089413cdde3c 201028_02
hgs
parents:
diff changeset
    75
089413cdde3c 201028_02
hgs
parents:
diff changeset
    76
// This is used to hold the geometry of the shared buffers
089413cdde3c 201028_02
hgs
parents:
diff changeset
    77
class TUsbcScBufferRecord
089413cdde3c 201028_02
hgs
parents:
diff changeset
    78
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
    79
    friend class DLddUsbcScChannel;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    80
089413cdde3c 201028_02
hgs
parents:
diff changeset
    81
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
    82
    inline TUint Offset() const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    83
    inline TUint Size() const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    84
private:
089413cdde3c 201028_02
hgs
parents:
diff changeset
    85
    inline void Set(TUint aOffset, TUint aEndOffset);
089413cdde3c 201028_02
hgs
parents:
diff changeset
    86
    TUint iOffset;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    87
    TUint iSize;
089413cdde3c 201028_02
hgs
parents:
diff changeset
    88
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
    89
089413cdde3c 201028_02
hgs
parents:
diff changeset
    90
struct SUsbcScBufferHeader
089413cdde3c 201028_02
hgs
parents:
diff changeset
    91
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
    92
    TInt iHead;        // Where the LDD will next write a transfer
089413cdde3c 201028_02
hgs
parents:
diff changeset
    93
    TInt iTail;        // Indicates the fist packet that user side is processing (anything prior is disposable)
089413cdde3c 201028_02
hgs
parents:
diff changeset
    94
    TInt iBilTail;  // This is not used by LDD at all, but just for the BIL's benifit.
089413cdde3c 201028_02
hgs
parents:
diff changeset
    95
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
    96
089413cdde3c 201028_02
hgs
parents:
diff changeset
    97
089413cdde3c 201028_02
hgs
parents:
diff changeset
    98
struct SUsbcScAlternateSetting
089413cdde3c 201028_02
hgs
parents:
diff changeset
    99
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   100
    TUint16 iSetting;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   101
    TUint16 iSequence;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   102
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   103
089413cdde3c 201028_02
hgs
parents:
diff changeset
   104
/** Endpoint pair information.  This can be used to control pairing of endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
   105
for classes that require explicit pairing of endpoint, such as ADC.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   106
089413cdde3c 201028_02
hgs
parents:
diff changeset
   107
This is currently not used.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   108
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
   109
089413cdde3c 201028_02
hgs
parents:
diff changeset
   110
class TEndpointPairInfo
089413cdde3c 201028_02
hgs
parents:
diff changeset
   111
{
089413cdde3c 201028_02
hgs
parents:
diff changeset
   112
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   113
    TEndpointPairInfo(TUint8 aType=0, TUint16 aPair=0, TUint8 aSpare=0);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   114
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   115
    TUint8 iType;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   116
    TUint8 iSpare;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   117
    TUint16 iPair;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   118
}; 
089413cdde3c 201028_02
hgs
parents:
diff changeset
   119
089413cdde3c 201028_02
hgs
parents:
diff changeset
   120
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
   121
This is the buffer number reserved for use with endpoint zero with the  ReadDataNotify and WriteData methods.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   122
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
   123
const TInt KUsbcScEndpointZero = -1;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   124
089413cdde3c 201028_02
hgs
parents:
diff changeset
   125
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
   126
This flag is reserved in TUsbcscEndpointInfo::iFlags, to indicate that the client driver's client wishes reads to operate in a coupled fashion.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   127
This behaviour is not currently supported.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   128
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
   129
const TUint KUsbScCoupledRead = 0x1;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   130
089413cdde3c 201028_02
hgs
parents:
diff changeset
   131
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
   132
This flag, used in parameter aFlag of WriteData, is used to indicate that a ZLP should be sent.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   133
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
   134
const TUint KUsbcScWriteFlagsZlp = 0x0001;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   135
089413cdde3c 201028_02
hgs
parents:
diff changeset
   136
089413cdde3c 201028_02
hgs
parents:
diff changeset
   137
// Bit fields used in iFlags of TUsbcScTransferHeader
089413cdde3c 201028_02
hgs
parents:
diff changeset
   138
089413cdde3c 201028_02
hgs
parents:
diff changeset
   139
const TUint KUsbcScShortPacket = 0x0001;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   140
const TUint KUsbcScStateChange = 0x0004;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   141
089413cdde3c 201028_02
hgs
parents:
diff changeset
   142
class TUsbcScTransferHeader
089413cdde3c 201028_02
hgs
parents:
diff changeset
   143
{
089413cdde3c 201028_02
hgs
parents:
diff changeset
   144
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   145
#ifdef _DEBUG
089413cdde3c 201028_02
hgs
parents:
diff changeset
   146
    TUint iHashId;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   147
    TUint iSequence;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   148
#endif
089413cdde3c 201028_02
hgs
parents:
diff changeset
   149
    TUint iBytes;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   150
    TUint iFlags;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   151
    TUint iNext;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   152
    TUint16 iAltSettingSeq;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   153
    TInt16 iAltSetting;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   154
    union
089413cdde3c 201028_02
hgs
parents:
diff changeset
   155
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   156
        TUint  i[1]; // Extends
089413cdde3c 201028_02
hgs
parents:
diff changeset
   157
        TUint8 b[4]; // Extends
089413cdde3c 201028_02
hgs
parents:
diff changeset
   158
    } iData;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   159
};
089413cdde3c 201028_02
hgs
parents:
diff changeset
   160
089413cdde3c 201028_02
hgs
parents:
diff changeset
   161
/** The desired endpoint capabilities used in RDevUsbcScClient::SetInterface().
089413cdde3c 201028_02
hgs
parents:
diff changeset
   162
089413cdde3c 201028_02
hgs
parents:
diff changeset
   163
This derived class has additional fields used in the shared chunk USB driver.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   164
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
   165
class TUsbcScEndpointInfo: public TUsbcEndpointInfo
089413cdde3c 201028_02
hgs
parents:
diff changeset
   166
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   167
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   168
    TUsbcScEndpointInfo(TUint aType=UsbShai::KUsbEpTypeBulk, TUint aDir=UsbShai::KUsbEpDirOut, TInt aInterval=0, TInt aExtra=0,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   169
                                                TUint aBufferSize=0, TUint aReadSize=0);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   170
089413cdde3c 201028_02
hgs
parents:
diff changeset
   171
089413cdde3c 201028_02
hgs
parents:
diff changeset
   172
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   173
    /** This indicates the requested size of the endpoint buffer and must be at
089413cdde3c 201028_02
hgs
parents:
diff changeset
   174
        least as large as iReadSize.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   175
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   176
    TUint iBufferSize;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   177
089413cdde3c 201028_02
hgs
parents:
diff changeset
   178
    /** This is the amount of data that the LDD reads from the bus before it sets
089413cdde3c 201028_02
hgs
parents:
diff changeset
   179
        up another read and is normally intended to read many packets.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   180
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   181
    TUint iReadSize;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   182
089413cdde3c 201028_02
hgs
parents:
diff changeset
   183
    /** TEndpointPairInfo represents pairing information for isochronous endpoints.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   184
        Should be zero in other cases.  If this specifies paired endpoints then
089413cdde3c 201028_02
hgs
parents:
diff changeset
   185
        iExtra (in the base class TUsbcEndpointInfo) also needs to be set to the
089413cdde3c 201028_02
hgs
parents:
diff changeset
   186
        class specific size for this endpoint descriptor (This is here only for future use).
089413cdde3c 201028_02
hgs
parents:
diff changeset
   187
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   188
    TEndpointPairInfo iPairing;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   189
    
089413cdde3c 201028_02
hgs
parents:
diff changeset
   190
    /** The necessary alignment, in bytes, that needs to be applied to the transfer start points
089413cdde3c 201028_02
hgs
parents:
diff changeset
   191
        of the data.  This is only observed on OUT endpoints.  Zero can be specified to indicate
089413cdde3c 201028_02
hgs
parents:
diff changeset
   192
        there are no class side requirements for alignment.   The alignment for OUT endpoints is
089413cdde3c 201028_02
hgs
parents:
diff changeset
   193
        which ever is greater of this field or the USB hardware requirements.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   194
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   195
    TUint iAlignment;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   196
089413cdde3c 201028_02
hgs
parents:
diff changeset
   197
    /** Flags to indicate how the endpoint should function. None currently defined,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   198
        but could be used to allow support for direct read.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   199
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   200
    TUint iFlags;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   201
    
089413cdde3c 201028_02
hgs
parents:
diff changeset
   202
    /** Reserved for future use. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   203
    TUint32 iReserved2[2];
089413cdde3c 201028_02
hgs
parents:
diff changeset
   204
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   205
089413cdde3c 201028_02
hgs
parents:
diff changeset
   206
/** This must be filled in prior to a call to RDevUsbcClient::SetInterface().
089413cdde3c 201028_02
hgs
parents:
diff changeset
   207
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
   208
class TUsbcScInterfaceInfo
089413cdde3c 201028_02
hgs
parents:
diff changeset
   209
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   210
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   211
    TUsbcScInterfaceInfo(TInt aClass=0, TInt aSubClass=0, TInt aProtocol=0,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   212
                       TDesC16* aString=NULL, TUint aTotalEndpoints=0);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   213
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   214
    /** The class, subclass and protocol that this interface supports. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   215
    TUsbcClassInfo iClass;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   216
    /** The description string for the interface. Used to construct the interface string descriptor. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   217
    const TDesC16* iString;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   218
    /** Total number of endpoints being requested (0-5). Endpoint 0 should not be included in this number. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   219
    TUint iTotalEndpointsUsed;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   220
    /** Desired properties of the endpoints requested.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   221
        Do NOT include endpoint 0.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   222
        APIs use endpoint numbers that are offsets into this array.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   223
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   224
    TUsbcScEndpointInfo iEndpointData[KMaxEndpointsPerClient];
089413cdde3c 201028_02
hgs
parents:
diff changeset
   225
    /** 32 flag bits used for specifying miscellaneous Interface features.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   226
        Currently defined are:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   227
        - KUsbcInterfaceInfo_NoEp0RequestsPlease = 0x00000001
089413cdde3c 201028_02
hgs
parents:
diff changeset
   228
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   229
    TUint32 iFeatureWord;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   230
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   231
089413cdde3c 201028_02
hgs
parents:
diff changeset
   232
/** Package buffer for a TUsbcInterfaceInfo object.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   233
089413cdde3c 201028_02
hgs
parents:
diff changeset
   234
    @see TUsbcInterfaceInfo
089413cdde3c 201028_02
hgs
parents:
diff changeset
   235
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
   236
typedef TPckgBuf<TUsbcScInterfaceInfo> TUsbcScInterfaceInfoBuf;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   237
089413cdde3c 201028_02
hgs
parents:
diff changeset
   238
struct TUsbcScChunkHdrOffs
089413cdde3c 201028_02
hgs
parents:
diff changeset
   239
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   240
    TUint iBuffers;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   241
    TUint iAltSettings;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   242
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   243
089413cdde3c 201028_02
hgs
parents:
diff changeset
   244
089413cdde3c 201028_02
hgs
parents:
diff changeset
   245
class TUsbcScChunkBuffersHeader  // Not instantiable
089413cdde3c 201028_02
hgs
parents:
diff changeset
   246
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   247
    friend class DLddUsbcScChannel;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   248
    friend class TRealizeInfo;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   249
089413cdde3c 201028_02
hgs
parents:
diff changeset
   250
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   251
    inline TUsbcScBufferRecord* Ep0Out() const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   252
    inline TUsbcScBufferRecord* Ep0In() const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   253
    inline TUsbcScBufferRecord* Buffers(TInt aBuffer) const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   254
    inline TInt NumberOfBuffers() const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   255
089413cdde3c 201028_02
hgs
parents:
diff changeset
   256
private:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   257
    TUsbcScChunkBuffersHeader();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   258
private:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   259
    TInt iRecordSize;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   260
    TInt  iNumOfBufs;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   261
    TUint8 iBufferOffset[8]; // Extends
089413cdde3c 201028_02
hgs
parents:
diff changeset
   262
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   263
089413cdde3c 201028_02
hgs
parents:
diff changeset
   264
struct TUsbcScChunkAltSettingHeader // Not instantiable
089413cdde3c 201028_02
hgs
parents:
diff changeset
   265
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   266
    TInt iEpRecordSize;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   267
    TInt iNumOfAltSettings;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   268
    TUint iAltTableOffset[1]; // Extends
089413cdde3c 201028_02
hgs
parents:
diff changeset
   269
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   270
089413cdde3c 201028_02
hgs
parents:
diff changeset
   271
class TEndpointBuffer;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   272
089413cdde3c 201028_02
hgs
parents:
diff changeset
   273
089413cdde3c 201028_02
hgs
parents:
diff changeset
   274
/** The user side handle to the USB client driver.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   275
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
   276
class RDevUsbcScClient : public RBusLogicalChannel
089413cdde3c 201028_02
hgs
parents:
diff changeset
   277
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   278
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   279
    /** @internalComponent */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   280
    enum TVer
089413cdde3c 201028_02
hgs
parents:
diff changeset
   281
        {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   282
        EMajorVersionNumber = 0,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   283
        EMinorVersionNumber = 1,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   284
        EBuildVersionNumber = KE32BuildVersionNumber
089413cdde3c 201028_02
hgs
parents:
diff changeset
   285
        };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   286
089413cdde3c 201028_02
hgs
parents:
diff changeset
   287
// Bit pattern. s = Request/Control.  c = Cancel,  m = mode bits, B = Buffer number, R = request number.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   288
//    scmm mmmm |  mmmm mmmm | mmBB BBBB |RRRR RRRR  
089413cdde3c 201028_02
hgs
parents:
diff changeset
   289
089413cdde3c 201028_02
hgs
parents:
diff changeset
   290
    enum TRequest
089413cdde3c 201028_02
hgs
parents:
diff changeset
   291
        {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   292
        ERequestWriteData = 1,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   293
        ERequestReadDataNotify = 2,     
089413cdde3c 201028_02
hgs
parents:
diff changeset
   294
        ERequestAlternateDeviceStatusNotify = 3,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   295
        ERequestReEnumerate = 4,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   296
        ERequestEndpointStatusNotify = 5,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   297
         ERequestOtgFeaturesNotify = 6,
48
21625e5de155 201035_01
hgs
parents: 33
diff changeset
   298
 		ERequestChargingPortTypeNotify = 7,
33
089413cdde3c 201028_02
hgs
parents:
diff changeset
   299
        ERequestMaxRequests, // 7
089413cdde3c 201028_02
hgs
parents:
diff changeset
   300
089413cdde3c 201028_02
hgs
parents:
diff changeset
   301
        ERequestCancel = 0x40000000,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   302
089413cdde3c 201028_02
hgs
parents:
diff changeset
   303
        ERequestWriteDataCancel                        = ERequestWriteData                   | ERequestCancel,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   304
        ERequestReadDataNotifyCancel                = ERequestReadDataNotify              | ERequestCancel,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   305
        ERequestAlternateDeviceStatusNotifyCancel     = ERequestAlternateDeviceStatusNotify | ERequestCancel,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   306
        ERequestReEnumerateCancel                     = ERequestReEnumerate                 | ERequestCancel,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   307
        ERequestEndpointStatusNotifyCancel             = ERequestEndpointStatusNotify        | ERequestCancel,
48
21625e5de155 201035_01
hgs
parents: 33
diff changeset
   308
        ERequestOtgFeaturesNotifyCancel             = ERequestOtgFeaturesNotify           | ERequestCancel,
21625e5de155 201035_01
hgs
parents: 33
diff changeset
   309
        ERequestChargingPortTypeNotifyCancel             = ERequestChargingPortTypeNotify           | ERequestCancel
33
089413cdde3c 201028_02
hgs
parents:
diff changeset
   310
        };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   311
089413cdde3c 201028_02
hgs
parents:
diff changeset
   312
    enum TControl
089413cdde3c 201028_02
hgs
parents:
diff changeset
   313
        {
089413cdde3c 201028_02
hgs
parents:
diff changeset
   314
        // Changing the order of these enums will break BC.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   315
        EControlEndpointZeroRequestError,                    // 00
089413cdde3c 201028_02
hgs
parents:
diff changeset
   316
        EControlEndpointCaps,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   317
        EControlDeviceCaps,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   318
        EControlGetAlternateSetting,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   319
        EControlDeviceStatus,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   320
        EControlEndpointStatus,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   321
        EControlSetInterface,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   322
        EControlReleaseInterface,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   323
        EControlSendEp0StatusPacket,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   324
        EControlHaltEndpoint,                                // 09
089413cdde3c 201028_02
hgs
parents:
diff changeset
   325
        //
089413cdde3c 201028_02
hgs
parents:
diff changeset
   326
        EControlClearHaltEndpoint,                            // 10
089413cdde3c 201028_02
hgs
parents:
diff changeset
   327
        EControlSetDeviceControl,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   328
        EControlReleaseDeviceControl,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   329
        EControlEndpointZeroMaxPacketSizes,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   330
        EControlSetEndpointZeroMaxPacketSize,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   331
        EControlGetDeviceDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   332
        EControlSetDeviceDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   333
        EControlGetDeviceDescriptorSize,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   334
        EControlGetConfigurationDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   335
        EControlSetConfigurationDescriptor,                    // 19
089413cdde3c 201028_02
hgs
parents:
diff changeset
   336
        //
089413cdde3c 201028_02
hgs
parents:
diff changeset
   337
        EControlGetConfigurationDescriptorSize,                // 20
089413cdde3c 201028_02
hgs
parents:
diff changeset
   338
        EControlGetInterfaceDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   339
        EControlSetInterfaceDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   340
        EControlGetInterfaceDescriptorSize,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   341
        EControlGetEndpointDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   342
        EControlSetEndpointDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   343
        EControlGetEndpointDescriptorSize,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   344
        EControlGetCSInterfaceDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   345
        EControlSetCSInterfaceDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   346
        EControlGetCSInterfaceDescriptorSize,                // 29
089413cdde3c 201028_02
hgs
parents:
diff changeset
   347
        //
089413cdde3c 201028_02
hgs
parents:
diff changeset
   348
        EControlGetCSEndpointDescriptor,                    // 30
089413cdde3c 201028_02
hgs
parents:
diff changeset
   349
        EControlSetCSEndpointDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   350
        EControlGetCSEndpointDescriptorSize,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   351
        EControlSignalRemoteWakeup,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   352
        EControlGetStringDescriptorLangId,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   353
        EControlSetStringDescriptorLangId,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   354
        EControlGetManufacturerStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   355
        EControlSetManufacturerStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   356
        EControlRemoveManufacturerStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   357
        EControlGetProductStringDescriptor,                    // 39
089413cdde3c 201028_02
hgs
parents:
diff changeset
   358
        //
089413cdde3c 201028_02
hgs
parents:
diff changeset
   359
        EControlSetProductStringDescriptor,                    // 40
089413cdde3c 201028_02
hgs
parents:
diff changeset
   360
        EControlRemoveProductStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   361
        EControlGetSerialNumberStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   362
        EControlSetSerialNumberStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   363
        EControlRemoveSerialNumberStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   364
        EControlGetConfigurationStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   365
        EControlSetConfigurationStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   366
        EControlRemoveConfigurationStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   367
        EControlDeviceDisconnectFromHost,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   368
        EControlDeviceConnectToHost,                        // 49
089413cdde3c 201028_02
hgs
parents:
diff changeset
   369
        //
089413cdde3c 201028_02
hgs
parents:
diff changeset
   370
        EControlDevicePowerUpUdc,                            // 50
089413cdde3c 201028_02
hgs
parents:
diff changeset
   371
        EControlDumpRegisters,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   372
        EControlAllocateEndpointResource,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   373
        EControlDeAllocateEndpointResource,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   374
        EControlQueryEndpointResourceUse,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   375
        EControlGetEndpointZeroMaxPacketSize,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   376
        EControlGetDeviceQualifierDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   377
        EControlSetDeviceQualifierDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   378
        EControlGetOtherSpeedConfigurationDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   379
        EControlSetOtherSpeedConfigurationDescriptor,        // 59
089413cdde3c 201028_02
hgs
parents:
diff changeset
   380
        //
089413cdde3c 201028_02
hgs
parents:
diff changeset
   381
        EControlCurrentlyUsingHighSpeed,                    // 60
089413cdde3c 201028_02
hgs
parents:
diff changeset
   382
        EControlSetStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   383
        EControlGetStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   384
        EControlRemoveStringDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   385
        EControlSetOtgDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   386
        EControlGetOtgDescriptor,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   387
        EControlGetOtgFeatures, 
089413cdde3c 201028_02
hgs
parents:
diff changeset
   388
        EControlRealizeInterface,
48
21625e5de155 201035_01
hgs
parents: 33
diff changeset
   389
        EControlStartNextInAlternateSetting,
21625e5de155 201035_01
hgs
parents: 33
diff changeset
   390
        EControlGetChargerDetectorCaps
33
089413cdde3c 201028_02
hgs
parents:
diff changeset
   391
        };
089413cdde3c 201028_02
hgs
parents:
diff changeset
   392
089413cdde3c 201028_02
hgs
parents:
diff changeset
   393
089413cdde3c 201028_02
hgs
parents:
diff changeset
   394
 // const static TUint KFieldIdPos     = 0;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   395
    const static TUint KFieldIdMask    = 0xFF;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   396
    const static TUint KFieldBuffPos   = 8;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   397
    const static TUint KFieldBuffMask  = 0x3F;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   398
    const static TUint KFieldFlagsPos  = 14;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   399
    const static TUint KFieldFlagsMask = 0xFFFF;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   400
089413cdde3c 201028_02
hgs
parents:
diff changeset
   401
089413cdde3c 201028_02
hgs
parents:
diff changeset
   402
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   403
089413cdde3c 201028_02
hgs
parents:
diff changeset
   404
#ifndef __KERNEL_MODE__
089413cdde3c 201028_02
hgs
parents:
diff changeset
   405
089413cdde3c 201028_02
hgs
parents:
diff changeset
   406
    /** Opens a channel.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   407
089413cdde3c 201028_02
hgs
parents:
diff changeset
   408
        @param aUnit This should be 0 (zero).
089413cdde3c 201028_02
hgs
parents:
diff changeset
   409
089413cdde3c 201028_02
hgs
parents:
diff changeset
   410
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   411
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   412
    inline TInt Open(TInt aUnit);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   413
089413cdde3c 201028_02
hgs
parents:
diff changeset
   414
    inline TVersion VersionRequired() const;
089413cdde3c 201028_02
hgs
parents:
diff changeset
   415
089413cdde3c 201028_02
hgs
parents:
diff changeset
   416
    /** Stalls ep0 to signal command fault to the host.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   417
089413cdde3c 201028_02
hgs
parents:
diff changeset
   418
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   419
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   420
    inline TInt EndpointZeroRequestError();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   421
089413cdde3c 201028_02
hgs
parents:
diff changeset
   422
    /** Retrieves the capabilities of all the endpoints on the device.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   423
089413cdde3c 201028_02
hgs
parents:
diff changeset
   424
        Suggested use is as follows:
089413cdde3c 201028_02
hgs
parents:
diff changeset
   425
089413cdde3c 201028_02
hgs
parents:
diff changeset
   426
        @code
089413cdde3c 201028_02
hgs
parents:
diff changeset
   427
        TUsbcEndpointData data[KUsbcMaxEndpoints];
089413cdde3c 201028_02
hgs
parents:
diff changeset
   428
        TPtr8 dataPtr(reinterpret_cast<TUint8*>(data), sizeof(data), sizeof(data));
089413cdde3c 201028_02
hgs
parents:
diff changeset
   429
        ret = usbPort.EndpointCaps(dataPtr);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   430
        @endcode
089413cdde3c 201028_02
hgs
parents:
diff changeset
   431
089413cdde3c 201028_02
hgs
parents:
diff changeset
   432
        @param aEpCapsBuf A descriptor encapsulating an array of TUsbcEndpointData.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   433
089413cdde3c 201028_02
hgs
parents:
diff changeset
   434
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   435
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   436
    inline TInt EndpointCaps(TDes8& aEpCapsBuf);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   437
089413cdde3c 201028_02
hgs
parents:
diff changeset
   438
    /** Retrieves the capabilities of the USB device.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   439
089413cdde3c 201028_02
hgs
parents:
diff changeset
   440
        @see TUsbDeviceCaps
089413cdde3c 201028_02
hgs
parents:
diff changeset
   441
089413cdde3c 201028_02
hgs
parents:
diff changeset
   442
        @param aDevCapsBuf A TUsbDeviceCaps object.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   443
089413cdde3c 201028_02
hgs
parents:
diff changeset
   444
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   445
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   446
    inline TInt DeviceCaps(TUsbDeviceCaps& aDevCapsBuf);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   447
089413cdde3c 201028_02
hgs
parents:
diff changeset
   448
    /** Copies the current alternate setting for this interface into aInterfaceNumber
089413cdde3c 201028_02
hgs
parents:
diff changeset
   449
        For USB Interfaces whose main interface is active, this will be 0 (zero).
089413cdde3c 201028_02
hgs
parents:
diff changeset
   450
089413cdde3c 201028_02
hgs
parents:
diff changeset
   451
        @param aInterfaceNumber Current alternate setting for this interface is copied into this.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   452
089413cdde3c 201028_02
hgs
parents:
diff changeset
   453
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   454
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   455
    inline TInt GetAlternateSetting(TInt& aInterfaceNumber);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   456
089413cdde3c 201028_02
hgs
parents:
diff changeset
   457
    /** Copies the current device status into aDeviceStatus.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   458
089413cdde3c 201028_02
hgs
parents:
diff changeset
   459
        @param aDeviceStatus Current device status is copied into this.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   460
089413cdde3c 201028_02
hgs
parents:
diff changeset
   461
        @return KErrNone if successful
089413cdde3c 201028_02
hgs
parents:
diff changeset
   462
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   463
    inline TInt DeviceStatus(TUsbcDeviceState& aDeviceStatus);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   464
089413cdde3c 201028_02
hgs
parents:
diff changeset
   465
    /** Copies the current endpoint status into aEndpointStatus.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   466
089413cdde3c 201028_02
hgs
parents:
diff changeset
   467
        @param aEndpoint Endpoint number valid for the current alternate setting.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   468
        @param aEndpointStatus The current endpoint status, might be stalled, not stalled or unknown.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   469
089413cdde3c 201028_02
hgs
parents:
diff changeset
   470
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   471
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   472
    inline TInt EndpointStatus(TInt aEndpoint, TEndpointState& aEndpointStatus);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   473
089413cdde3c 201028_02
hgs
parents:
diff changeset
   474
089413cdde3c 201028_02
hgs
parents:
diff changeset
   475
    /** Requests that a zero length status packet be sent to the host in response
089413cdde3c 201028_02
hgs
parents:
diff changeset
   476
        to a class or vendor specific ep0 SETUP packet.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   477
089413cdde3c 201028_02
hgs
parents:
diff changeset
   478
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   479
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   480
    inline TInt SendEp0StatusPacket();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   481
089413cdde3c 201028_02
hgs
parents:
diff changeset
   482
    /** Stalls endpoint aEndpoint, usually to indicate an error condition with a previous command.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   483
        The host will normally send a SET_FEATURE command on ep0 to acknowledge and clear the stall.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   484
089413cdde3c 201028_02
hgs
parents:
diff changeset
   485
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   486
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   487
    inline TInt HaltEndpoint(TInt aEndpoint);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   488
089413cdde3c 201028_02
hgs
parents:
diff changeset
   489
    /** Clears the stall condition on endpoint aEndpoint. This is inluded for symmetry and test purposes.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   490
089413cdde3c 201028_02
hgs
parents:
diff changeset
   491
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   492
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   493
    inline TInt ClearHaltEndpoint(TInt aEndpoint);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   494
089413cdde3c 201028_02
hgs
parents:
diff changeset
   495
    /** Requests that device control be allocated to this channel.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   496
089413cdde3c 201028_02
hgs
parents:
diff changeset
   497
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   498
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   499
    inline TInt SetDeviceControl();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   500
089413cdde3c 201028_02
hgs
parents:
diff changeset
   501
    /** Relinquishes device control previously allocated to this channel.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   502
089413cdde3c 201028_02
hgs
parents:
diff changeset
   503
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   504
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   505
    inline TInt ReleaseDeviceControl();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   506
089413cdde3c 201028_02
hgs
parents:
diff changeset
   507
    /** Returns a bitmap of available ep0 maximum packet sizes.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   508
089413cdde3c 201028_02
hgs
parents:
diff changeset
   509
        @return bitmap of available ep0 maximum packet sizes.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   510
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   511
    inline TUint EndpointZeroMaxPacketSizes();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   512
089413cdde3c 201028_02
hgs
parents:
diff changeset
   513
    /** Requests that a maximum packet size of aMaxPacketSize be set on ep0.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   514
089413cdde3c 201028_02
hgs
parents:
diff changeset
   515
        @param aMaxPacketSize The maximum packet size.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   516
089413cdde3c 201028_02
hgs
parents:
diff changeset
   517
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   518
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   519
    inline TInt SetEndpointZeroMaxPacketSize(TInt aMaxPacketSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   520
089413cdde3c 201028_02
hgs
parents:
diff changeset
   521
    /** Queries the current maximum packet size on ep0.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   522
089413cdde3c 201028_02
hgs
parents:
diff changeset
   523
        @return The currently set maximum packet size on ep0.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   524
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   525
    inline TInt GetEndpointZeroMaxPacketSize();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   526
089413cdde3c 201028_02
hgs
parents:
diff changeset
   527
    /** Copies the current device descriptor into aDeviceDescriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   528
089413cdde3c 201028_02
hgs
parents:
diff changeset
   529
        @param aDeviceDescriptor Receives the current device descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   530
089413cdde3c 201028_02
hgs
parents:
diff changeset
   531
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   532
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   533
    inline TInt GetDeviceDescriptor(TDes8& aDeviceDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   534
089413cdde3c 201028_02
hgs
parents:
diff changeset
   535
    /** Sets the contents of aDeviceDescriptor to be the current device descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   536
089413cdde3c 201028_02
hgs
parents:
diff changeset
   537
        @param aDeviceDescriptor Contains the device descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   538
089413cdde3c 201028_02
hgs
parents:
diff changeset
   539
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   540
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   541
    inline TInt SetDeviceDescriptor(const TDesC8& aDeviceDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   542
089413cdde3c 201028_02
hgs
parents:
diff changeset
   543
    /** Gets the size of the current device descriptor. This is unlikely to be anything other than 9.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   544
089413cdde3c 201028_02
hgs
parents:
diff changeset
   545
        @param aSize Receives the size of the current device descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   546
089413cdde3c 201028_02
hgs
parents:
diff changeset
   547
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   548
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   549
    inline TInt GetDeviceDescriptorSize(TInt& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   550
089413cdde3c 201028_02
hgs
parents:
diff changeset
   551
    /** Copies the current configuration descriptor into aConfigurationDescriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   552
089413cdde3c 201028_02
hgs
parents:
diff changeset
   553
        @param aConfigurationDescriptor Receives the current configuration descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   554
089413cdde3c 201028_02
hgs
parents:
diff changeset
   555
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   556
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   557
    inline TInt GetConfigurationDescriptor(TDes8& aConfigurationDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   558
089413cdde3c 201028_02
hgs
parents:
diff changeset
   559
    /** Sets the contents of aConfigurationDescriptor to be the current configuration descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   560
089413cdde3c 201028_02
hgs
parents:
diff changeset
   561
        @param aConfigurationDescriptor Contains the configuration descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   562
089413cdde3c 201028_02
hgs
parents:
diff changeset
   563
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   564
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   565
    inline TInt SetConfigurationDescriptor(const TDesC8& aConfigurationDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   566
089413cdde3c 201028_02
hgs
parents:
diff changeset
   567
    /** Gets the size of the current configuration descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   568
089413cdde3c 201028_02
hgs
parents:
diff changeset
   569
        @param aSize Receives the size of the current configuration descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   570
089413cdde3c 201028_02
hgs
parents:
diff changeset
   571
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   572
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   573
    inline TInt GetConfigurationDescriptorSize(TInt& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   574
089413cdde3c 201028_02
hgs
parents:
diff changeset
   575
    /** Copies the interface descriptor into aInterfaceDescriptor for the interface with alternate
089413cdde3c 201028_02
hgs
parents:
diff changeset
   576
        setting aSettingNumber, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   577
089413cdde3c 201028_02
hgs
parents:
diff changeset
   578
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   579
        @param aInterfaceDescriptor Receives the interface descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   580
089413cdde3c 201028_02
hgs
parents:
diff changeset
   581
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   582
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   583
    inline TInt GetInterfaceDescriptor(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   584
089413cdde3c 201028_02
hgs
parents:
diff changeset
   585
    /** Sets the interface descriptor contained in aInterfaceDescriptor for the interface with
089413cdde3c 201028_02
hgs
parents:
diff changeset
   586
        alternate setting aSettingNumber, 0 for the main interface, for transmission to the host
089413cdde3c 201028_02
hgs
parents:
diff changeset
   587
        during enumeration.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   588
089413cdde3c 201028_02
hgs
parents:
diff changeset
   589
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   590
        @param aInterfaceDescriptor Contains the interface descriptor to be set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   591
089413cdde3c 201028_02
hgs
parents:
diff changeset
   592
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   593
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   594
    inline TInt SetInterfaceDescriptor(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   595
089413cdde3c 201028_02
hgs
parents:
diff changeset
   596
    /** Copies the size of the interface descriptor for the interface with alternate
089413cdde3c 201028_02
hgs
parents:
diff changeset
   597
        setting aSettingNumber, 0 for the main interface, into aSize.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   598
089413cdde3c 201028_02
hgs
parents:
diff changeset
   599
        @param aSettingNumber The alternate setting.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   600
        @param aSize receives the size of the interface descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   601
089413cdde3c 201028_02
hgs
parents:
diff changeset
   602
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   603
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   604
    inline TInt GetInterfaceDescriptorSize(TInt aSettingNumber, TInt& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   605
089413cdde3c 201028_02
hgs
parents:
diff changeset
   606
    /** Copies the endpoint descriptor for logical endpoint number aEndpointNumber into aEndpointDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
   607
        for the interface with alternate setting aSettingNumber, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   608
089413cdde3c 201028_02
hgs
parents:
diff changeset
   609
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   610
        @param aEndpointNumber The endpoint number of the endpoint.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   611
        @param aEndpointDescriptor Receives the endpoint descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   612
089413cdde3c 201028_02
hgs
parents:
diff changeset
   613
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   614
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   615
    inline TInt GetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber, TDes8& aEndpointDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   616
089413cdde3c 201028_02
hgs
parents:
diff changeset
   617
    /** Sets the endpoint descriptor for logical endpoint number aEndpointNumber contained in
089413cdde3c 201028_02
hgs
parents:
diff changeset
   618
        aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   619
        for transmission to the host during enumeration.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   620
089413cdde3c 201028_02
hgs
parents:
diff changeset
   621
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   622
        @param aEndpointNumber Valid endpoint number on this interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   623
        @param aEndpointDescriptor Contains the endpoint descriptor to be set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   624
089413cdde3c 201028_02
hgs
parents:
diff changeset
   625
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   626
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   627
    inline TInt SetEndpointDescriptor(TInt aSettingNumber, TInt aEndpointNumber,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   628
                                      const TDesC8& aEndpointDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   629
089413cdde3c 201028_02
hgs
parents:
diff changeset
   630
    /** Copies the size of the endpoint descriptor for logical endpoint number aEndpointNumber for the
089413cdde3c 201028_02
hgs
parents:
diff changeset
   631
        interface with alternate setting aSettingNumber, 0 for the main interface, into aSize.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   632
089413cdde3c 201028_02
hgs
parents:
diff changeset
   633
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   634
        @param aEndpointNumber Valid endpoint number on this interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   635
        @param aSize Receives the size of the endpoint descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   636
089413cdde3c 201028_02
hgs
parents:
diff changeset
   637
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   638
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   639
    inline TInt GetEndpointDescriptorSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   640
089413cdde3c 201028_02
hgs
parents:
diff changeset
   641
    /** Get OTG descriptor size
089413cdde3c 201028_02
hgs
parents:
diff changeset
   642
089413cdde3c 201028_02
hgs
parents:
diff changeset
   643
        @param aSize TInt Reference which contains OTG descriptor size on return.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   644
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   645
    inline void GetOtgDescriptorSize(TInt& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   646
089413cdde3c 201028_02
hgs
parents:
diff changeset
   647
    /** Get OTG descriptor of USB on-the-go feature.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   648
089413cdde3c 201028_02
hgs
parents:
diff changeset
   649
        @param aOtgDesc User-side buffer to store copy of descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   650
089413cdde3c 201028_02
hgs
parents:
diff changeset
   651
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   652
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   653
    inline TInt GetOtgDescriptor(TDes8& aOtgDesc);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   654
089413cdde3c 201028_02
hgs
parents:
diff changeset
   655
    /** Set OTG descriptor by user to enable/disable USB on-the-go feature.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   656
089413cdde3c 201028_02
hgs
parents:
diff changeset
   657
        @param aOtgDesc Descriptor buffer containing OTG features.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   658
089413cdde3c 201028_02
hgs
parents:
diff changeset
   659
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   660
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   661
    inline TInt SetOtgDescriptor(const TDesC8& aOtgDesc);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   662
089413cdde3c 201028_02
hgs
parents:
diff changeset
   663
    /** Copies the current device_qualifier descriptor into aDescriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   664
089413cdde3c 201028_02
hgs
parents:
diff changeset
   665
        @param aDescriptor Receives the current device_qualifier descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   666
089413cdde3c 201028_02
hgs
parents:
diff changeset
   667
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   668
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   669
    inline TInt GetDeviceQualifierDescriptor(TDes8& aDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   670
089413cdde3c 201028_02
hgs
parents:
diff changeset
   671
    /** Sets the device_qualifier descriptor to the contents of aDescriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   672
089413cdde3c 201028_02
hgs
parents:
diff changeset
   673
        @param aDescriptor Contains the new device_qualifier descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   674
089413cdde3c 201028_02
hgs
parents:
diff changeset
   675
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   676
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   677
    inline TInt SetDeviceQualifierDescriptor(const TDesC8& aDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   678
089413cdde3c 201028_02
hgs
parents:
diff changeset
   679
    /** Copies the current other_speed_configuration descriptor into aDescriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   680
089413cdde3c 201028_02
hgs
parents:
diff changeset
   681
        @param aDescriptor Receives the current other_speed_configuration descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   682
089413cdde3c 201028_02
hgs
parents:
diff changeset
   683
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   684
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   685
    inline TInt GetOtherSpeedConfigurationDescriptor(TDes8& aDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   686
089413cdde3c 201028_02
hgs
parents:
diff changeset
   687
    /** Sets the other_speed_configuration descriptor to the contents of aDescriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   688
089413cdde3c 201028_02
hgs
parents:
diff changeset
   689
        @param aDescriptor Contains the new other_speed_configuration descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   690
089413cdde3c 201028_02
hgs
parents:
diff changeset
   691
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   692
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   693
    inline TInt SetOtherSpeedConfigurationDescriptor(const TDesC8& aDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   694
089413cdde3c 201028_02
hgs
parents:
diff changeset
   695
    /** Copies the class specific interface descriptor block into aInterfaceDescriptor for the interface
089413cdde3c 201028_02
hgs
parents:
diff changeset
   696
        with alternate setting aSettingNumber, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   697
089413cdde3c 201028_02
hgs
parents:
diff changeset
   698
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   699
        @param aInterfaceDescriptor Contains the interface descriptor to be set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   700
089413cdde3c 201028_02
hgs
parents:
diff changeset
   701
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   702
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   703
    inline TInt GetCSInterfaceDescriptorBlock(TInt aSettingNumber, TDes8& aInterfaceDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   704
089413cdde3c 201028_02
hgs
parents:
diff changeset
   705
    /** aSettingNumber is the alternate interface setting, 0 for the main interface, that the descriptor block
089413cdde3c 201028_02
hgs
parents:
diff changeset
   706
        aDes should be attached to. aDes is a block of data containing at least one class specific descriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
   707
        for transmission during enumeration after the class interface descriptor (or alternate interface
089413cdde3c 201028_02
hgs
parents:
diff changeset
   708
        descriptor) has been sent, but before the endpoint descriptors belonging to this interface are sent.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   709
        aDes may contain as many descriptors as are necessary or only one. SetCSInterfaceDescriptorBlock()
089413cdde3c 201028_02
hgs
parents:
diff changeset
   710
        should be called at any time after SetInterface() has been called to establish a main interface or an
089413cdde3c 201028_02
hgs
parents:
diff changeset
   711
        alternate interface. More than one call may be made - the data blocks will be concatenated prior to
089413cdde3c 201028_02
hgs
parents:
diff changeset
   712
        sending. No checking or validation of the contents of aDes will be made and it is the caller's
089413cdde3c 201028_02
hgs
parents:
diff changeset
   713
        responsibility to ensure that the data supplied is correct and appropriate to the interface identified
089413cdde3c 201028_02
hgs
parents:
diff changeset
   714
        by aSettingNumber.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   715
089413cdde3c 201028_02
hgs
parents:
diff changeset
   716
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   717
        @param aInterfaceDescriptor Contains the interface descriptor to be set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   718
089413cdde3c 201028_02
hgs
parents:
diff changeset
   719
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   720
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   721
    inline TInt SetCSInterfaceDescriptorBlock(TInt aSettingNumber, const TDesC8& aInterfaceDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   722
089413cdde3c 201028_02
hgs
parents:
diff changeset
   723
    /** Copies the size of the class specific interface descriptor block for the interface with alternate
089413cdde3c 201028_02
hgs
parents:
diff changeset
   724
        setting aSettingNumber, 0 for the main interface, into aSize.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   725
089413cdde3c 201028_02
hgs
parents:
diff changeset
   726
        @param aSettingNumber The alternate setting number.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   727
        @param aSize receives the size of the interface descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   728
089413cdde3c 201028_02
hgs
parents:
diff changeset
   729
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   730
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   731
    inline TInt GetCSInterfaceDescriptorBlockSize(TInt aSettingNumber, TInt& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   732
089413cdde3c 201028_02
hgs
parents:
diff changeset
   733
    /** Copies the class specific endpoint descriptor for logical endpoint number aEndpointNumber
089413cdde3c 201028_02
hgs
parents:
diff changeset
   734
        into aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main
089413cdde3c 201028_02
hgs
parents:
diff changeset
   735
        interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   736
089413cdde3c 201028_02
hgs
parents:
diff changeset
   737
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   738
        @param aEndpointNumber Valid endpoint number on this interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   739
        @param aEndpointDescriptor Receives the endpoint descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   740
089413cdde3c 201028_02
hgs
parents:
diff changeset
   741
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   742
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   743
    inline TInt GetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   744
                                             TDes8& aEndpointDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   745
089413cdde3c 201028_02
hgs
parents:
diff changeset
   746
    /** Sets the class specific endpoint descriptor for logical endpoint number aEndpointNumber contained in
089413cdde3c 201028_02
hgs
parents:
diff changeset
   747
        aEndpointDescriptor for the interface with alternate setting aSettingNumber, 0 for the main interface,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   748
        for transmission to the host during enumeration.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   749
089413cdde3c 201028_02
hgs
parents:
diff changeset
   750
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   751
        @param aEndpointNumber Valid endpoint number on this interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   752
        @param aEndpointDescriptor Contains the endpoint descriptor to be set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   753
089413cdde3c 201028_02
hgs
parents:
diff changeset
   754
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   755
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   756
    inline TInt SetCSEndpointDescriptorBlock(TInt aSettingNumber, TInt aEndpointNumber,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   757
                                             const TDesC8& aEndpointDescriptor);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   758
089413cdde3c 201028_02
hgs
parents:
diff changeset
   759
    /** Copies the size of the class specific endpoint descriptor block for logical endpoint number
089413cdde3c 201028_02
hgs
parents:
diff changeset
   760
        aEndpointNumber for the interface with alternate setting aSettingNumber, 0 for the main interface,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   761
        into aSize.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   762
089413cdde3c 201028_02
hgs
parents:
diff changeset
   763
        @param aSettingNumber Alternate setting number on the interface, 0 for the main interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   764
        @param aEndpointNumber Valid endpoint number on this interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   765
        @param aSize On return, contains the size of the class specific endpoint descriptor block.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   766
089413cdde3c 201028_02
hgs
parents:
diff changeset
   767
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   768
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   769
    inline TInt GetCSEndpointDescriptorBlockSize(TInt aSettingNumber, TInt aEndpointNumber, TInt& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   770
089413cdde3c 201028_02
hgs
parents:
diff changeset
   771
    /** Generates a Remote Wakeup bus condition.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   772
        The capability of the device to generate Remote Wakeup signalling is enquired in
089413cdde3c 201028_02
hgs
parents:
diff changeset
   773
        RDevUsbcClient::DeviceCaps.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   774
089413cdde3c 201028_02
hgs
parents:
diff changeset
   775
        @return KErrNone if this signalling is possible and the signal has been generated.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   776
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   777
    inline TInt SignalRemoteWakeup();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   778
089413cdde3c 201028_02
hgs
parents:
diff changeset
   779
    /** Simulates a physical removal of the USB cable by disabling the D+/- pull-ups.The iConnect member of
089413cdde3c 201028_02
hgs
parents:
diff changeset
   780
        TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(), indicates whether this functionality is
089413cdde3c 201028_02
hgs
parents:
diff changeset
   781
        supported.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   782
089413cdde3c 201028_02
hgs
parents:
diff changeset
   783
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   784
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   785
    inline TInt DeviceDisconnectFromHost();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   786
089413cdde3c 201028_02
hgs
parents:
diff changeset
   787
    /** Simulates a physical insertion of the USB cable by enabling the D+/- pull-ups.The iConnect member
089413cdde3c 201028_02
hgs
parents:
diff changeset
   788
        of TUsbDeviceCapsV01, returned by RDevUsbcClient::DeviceCaps(),  indicates whether this functionality
089413cdde3c 201028_02
hgs
parents:
diff changeset
   789
        is supported.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   790
089413cdde3c 201028_02
hgs
parents:
diff changeset
   791
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   792
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   793
    inline TInt DeviceConnectToHost();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   794
089413cdde3c 201028_02
hgs
parents:
diff changeset
   795
    /** Powers up the UDC and connects it to the bus if one or more interfaces exist.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   796
089413cdde3c 201028_02
hgs
parents:
diff changeset
   797
        @return KErrNone if UDC successfully powered up, KErrNotReady if no
089413cdde3c 201028_02
hgs
parents:
diff changeset
   798
        interfaces have been registered yet, KErrHardwareNotAvailable if UDC
089413cdde3c 201028_02
hgs
parents:
diff changeset
   799
        couldn't be activated.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   800
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   801
    inline TInt PowerUpUdc();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   802
089413cdde3c 201028_02
hgs
parents:
diff changeset
   803
    /** Enquires about the current operating speed of the UDC.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   804
089413cdde3c 201028_02
hgs
parents:
diff changeset
   805
        @return ETrue if the UDC is currently operating at High speed, EFalse otherwise.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   806
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   807
    inline TBool CurrentlyUsingHighSpeed();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   808
089413cdde3c 201028_02
hgs
parents:
diff changeset
   809
    /** Allocates the use of aResource to aEndpoint. It will be used from when the current bus transfer    has been
089413cdde3c 201028_02
hgs
parents:
diff changeset
   810
        completed.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   811
089413cdde3c 201028_02
hgs
parents:
diff changeset
   812
        @param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
   813
        behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   814
        @param aEndpoint The endpoint number to which the resource is to be allocated.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   815
089413cdde3c 201028_02
hgs
parents:
diff changeset
   816
        @return KErrNone if successful, KErrInUse if the resource is already consumed and cannot be allocated,
089413cdde3c 201028_02
hgs
parents:
diff changeset
   817
        KErrNotSupported if the endpoint does not support the resource requested.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   818
089413cdde3c 201028_02
hgs
parents:
diff changeset
   819
        @publishedPartner @deprecated
089413cdde3c 201028_02
hgs
parents:
diff changeset
   820
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   821
    inline TInt AllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   822
089413cdde3c 201028_02
hgs
parents:
diff changeset
   823
    /** Deallocates the use of aResource aEndpoint or ends a specified endpoint behaviour.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   824
089413cdde3c 201028_02
hgs
parents:
diff changeset
   825
        @param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
   826
        behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   827
        @param aEndpoint The endpoint number from which the resource is to be removed.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   828
089413cdde3c 201028_02
hgs
parents:
diff changeset
   829
        @return KErrNone if the resource has been successfully deallocated, KErrNotSupported if the endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
   830
        does not support the resource requested.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   831
089413cdde3c 201028_02
hgs
parents:
diff changeset
   832
        @publishedPartner @deprecated
089413cdde3c 201028_02
hgs
parents:
diff changeset
   833
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   834
    inline TInt DeAllocateEndpointResource(TInt aEndpoint, TUsbcEndpointResource aResource);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   835
089413cdde3c 201028_02
hgs
parents:
diff changeset
   836
    /** Queries endpoint resource use.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   837
089413cdde3c 201028_02
hgs
parents:
diff changeset
   838
        @param aResource is typically some rationed hardware resource or possibly specifies a type of endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
   839
        behaviour. aResource is not a bitmap and TEndpointResource values should not be combined.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   840
        @param aEndpoint The endpoint number at which the resource is to be queried.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   841
089413cdde3c 201028_02
hgs
parents:
diff changeset
   842
        @return ETrue is the specified resource is in use at the endpoint and EFalse if not.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   843
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   844
    inline TBool QueryEndpointResourceUse(TInt aEndpoint, TUsbcEndpointResource aResource);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   845
089413cdde3c 201028_02
hgs
parents:
diff changeset
   846
    /** Request (i.e. claim for this channel) up to five endpoints and set the class type for this USB
089413cdde3c 201028_02
hgs
parents:
diff changeset
   847
        interface. 'aInterfaceData' is a package buffer which describes the interface and all the endpoints
089413cdde3c 201028_02
hgs
parents:
diff changeset
   848
        being requested by the driver for this interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   849
089413cdde3c 201028_02
hgs
parents:
diff changeset
   850
        @param aInterfaceNumber Distinguishes between alternate interfaces. If these are not be used then this
089413cdde3c 201028_02
hgs
parents:
diff changeset
   851
        should always be zero. If this parameter is used, then its value must be one more than that of the
089413cdde3c 201028_02
hgs
parents:
diff changeset
   852
        proceeding alternate interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   853
        @param aInterfaceData A package buffer which describes the interface and all the endpoints being
089413cdde3c 201028_02
hgs
parents:
diff changeset
   854
        requested by the driver for this interface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   855
089413cdde3c 201028_02
hgs
parents:
diff changeset
   856
089413cdde3c 201028_02
hgs
parents:
diff changeset
   857
        @return KErrInUse if any of the endpoints being requested have already been claimed by another channel.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   858
        KErrNotSupported if an endpoint with all of the specified properties is not supported on this
089413cdde3c 201028_02
hgs
parents:
diff changeset
   859
        platform. KErrNoMemory if insufficient memory is available to complete the operation.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   860
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   861
    inline TInt SetInterface(TInt aInterfaceNumber, TUsbcScInterfaceInfoBuf& aInterfaceData);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   862
089413cdde3c 201028_02
hgs
parents:
diff changeset
   863
089413cdde3c 201028_02
hgs
parents:
diff changeset
   864
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
   865
        This method should be called after SetInterface has been called for all possible alternative settings.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   866
        Calling this invalidates further calls to SetInterface. On success, a chunk handle is created and
089413cdde3c 201028_02
hgs
parents:
diff changeset
   867
        passed back though aChunk.   This is needed for the user side to access the shared chunk where the
089413cdde3c 201028_02
hgs
parents:
diff changeset
   868
        data is stored.  Note that if you are using the BIL (described later), then FinalizeInterface (...)
089413cdde3c 201028_02
hgs
parents:
diff changeset
   869
        should be used instead, which will call this method.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   870
        
089413cdde3c 201028_02
hgs
parents:
diff changeset
   871
        @return KErrNone on successful completion, or one of the system wide error codes.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   872
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   873
    inline TInt RealizeInterface(RChunk& aChunk);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   874
089413cdde3c 201028_02
hgs
parents:
diff changeset
   875
089413cdde3c 201028_02
hgs
parents:
diff changeset
   876
    /** Release an interface previously claimed by this channel. Alternate interfaces need to be released
089413cdde3c 201028_02
hgs
parents:
diff changeset
   877
        in strict descending order, starting with the last (i.e. highest numbered) one.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   878
        It is not necessary to release an interface that wasn't successfully requested.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   879
089413cdde3c 201028_02
hgs
parents:
diff changeset
   880
        @param aInterfaceNumber Specifies the alternate setting number 'aInterfaceNum' of the interface to be
089413cdde3c 201028_02
hgs
parents:
diff changeset
   881
        released.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   882
089413cdde3c 201028_02
hgs
parents:
diff changeset
   883
        @return KErrNone if successful. KErrArgument if the alternate setting doesn't exist or is released out
089413cdde3c 201028_02
hgs
parents:
diff changeset
   884
        of order.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   885
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   886
    inline TInt ReleaseInterface(TInt aInterfaceNumber);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   887
089413cdde3c 201028_02
hgs
parents:
diff changeset
   888
    /** Copies the current string descriptor language ID (LANGID) code into the aLangId argument. Even though
089413cdde3c 201028_02
hgs
parents:
diff changeset
   889
        the USB spec allows for the existence of a whole array of LANGID codes, we only support one.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   890
089413cdde3c 201028_02
hgs
parents:
diff changeset
   891
        @param aLangId Receives the LANGID code.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   892
089413cdde3c 201028_02
hgs
parents:
diff changeset
   893
        @return KErrNone if successful, KErrArgument if problem with argument (memory cannot be written to, etc.).
089413cdde3c 201028_02
hgs
parents:
diff changeset
   894
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   895
    inline TInt GetStringDescriptorLangId(TUint16& aLangId);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   896
089413cdde3c 201028_02
hgs
parents:
diff changeset
   897
    /** Sets the string descriptor language ID (LANGID). Even though the USB spec allows for the existence of
089413cdde3c 201028_02
hgs
parents:
diff changeset
   898
        a whole array of LANGID codes, we only support one.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   899
089413cdde3c 201028_02
hgs
parents:
diff changeset
   900
        @param aLangId The LANGID code to be set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   901
089413cdde3c 201028_02
hgs
parents:
diff changeset
   902
        @return KErrNone if successful.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   903
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   904
    inline TInt SetStringDescriptorLangId(TUint16 aLangId);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   905
089413cdde3c 201028_02
hgs
parents:
diff changeset
   906
    /** Copies the string descriptor identified by the iManufacturer index field of the Standard Device
089413cdde3c 201028_02
hgs
parents:
diff changeset
   907
        Descriptor into the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   908
089413cdde3c 201028_02
hgs
parents:
diff changeset
   909
        @param aString Receives manufacturer string.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   910
089413cdde3c 201028_02
hgs
parents:
diff changeset
   911
        @return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
089413cdde3c 201028_02
hgs
parents:
diff changeset
   912
        descriptor, KErrNotFound if the string descriptor couldn't be found.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   913
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   914
    inline TInt GetManufacturerStringDescriptor(TDes16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   915
089413cdde3c 201028_02
hgs
parents:
diff changeset
   916
    /** Sets the string descriptor identified by the iManufacturer index field of the Standard Device
089413cdde3c 201028_02
hgs
parents:
diff changeset
   917
        Descriptor to the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   918
089413cdde3c 201028_02
hgs
parents:
diff changeset
   919
        @param aString Contains the new manufacturer string descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   920
089413cdde3c 201028_02
hgs
parents:
diff changeset
   921
        @return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
089413cdde3c 201028_02
hgs
parents:
diff changeset
   922
        aString (in which case the old string descriptor will be preserved).
089413cdde3c 201028_02
hgs
parents:
diff changeset
   923
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   924
    inline TInt SetManufacturerStringDescriptor(const TDesC16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   925
089413cdde3c 201028_02
hgs
parents:
diff changeset
   926
    /** Removes (deletes) the string descriptor identified by the iManufacturer index field of the Standard
089413cdde3c 201028_02
hgs
parents:
diff changeset
   927
        Device Descriptor and sets that field to zero.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   928
089413cdde3c 201028_02
hgs
parents:
diff changeset
   929
        @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   930
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   931
    inline TInt RemoveManufacturerStringDescriptor();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   932
089413cdde3c 201028_02
hgs
parents:
diff changeset
   933
    /** Retrieves the string descriptor identified by the iProduct index field of the Standard Device
089413cdde3c 201028_02
hgs
parents:
diff changeset
   934
        Descriptor into the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   935
089413cdde3c 201028_02
hgs
parents:
diff changeset
   936
        @param aString Receives product string.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   937
089413cdde3c 201028_02
hgs
parents:
diff changeset
   938
        @return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
089413cdde3c 201028_02
hgs
parents:
diff changeset
   939
        descriptor, KErrNotFound if the string descriptor couldn't be found.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   940
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   941
    inline TInt GetProductStringDescriptor(TDes16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   942
089413cdde3c 201028_02
hgs
parents:
diff changeset
   943
    /** Sets the string descriptor identified by the iProduct index field of the Standard Device Descriptor to
089413cdde3c 201028_02
hgs
parents:
diff changeset
   944
        the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   945
089413cdde3c 201028_02
hgs
parents:
diff changeset
   946
        @param aString Contains the new product string descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   947
089413cdde3c 201028_02
hgs
parents:
diff changeset
   948
        @return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
089413cdde3c 201028_02
hgs
parents:
diff changeset
   949
        aString (in which case the old string descriptor will be preserved).
089413cdde3c 201028_02
hgs
parents:
diff changeset
   950
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   951
    inline TInt SetProductStringDescriptor(const TDesC16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   952
089413cdde3c 201028_02
hgs
parents:
diff changeset
   953
    /** Removes (deletes) the string descriptor identified by the iProduct index field of the Standard Device
089413cdde3c 201028_02
hgs
parents:
diff changeset
   954
        Descriptor and sets that field to zero.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   955
089413cdde3c 201028_02
hgs
parents:
diff changeset
   956
        @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   957
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   958
    inline TInt RemoveProductStringDescriptor();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   959
089413cdde3c 201028_02
hgs
parents:
diff changeset
   960
    /** Retrieves the string descriptor identified by the iSerialNumber index field of the Standard Device
089413cdde3c 201028_02
hgs
parents:
diff changeset
   961
        Descriptor into the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   962
089413cdde3c 201028_02
hgs
parents:
diff changeset
   963
        @param aString Receives product string.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   964
089413cdde3c 201028_02
hgs
parents:
diff changeset
   965
        @return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
089413cdde3c 201028_02
hgs
parents:
diff changeset
   966
        descriptor, KErrNotFound if the string descriptor couldn't be found.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   967
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   968
    inline TInt GetSerialNumberStringDescriptor(TDes16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   969
089413cdde3c 201028_02
hgs
parents:
diff changeset
   970
    /** Sets the string descriptor identified by the iSerialNumber index field of the Standard Device
089413cdde3c 201028_02
hgs
parents:
diff changeset
   971
        Descriptor to the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   972
089413cdde3c 201028_02
hgs
parents:
diff changeset
   973
        @param aString Contains the new serial number string descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   974
089413cdde3c 201028_02
hgs
parents:
diff changeset
   975
        @return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
089413cdde3c 201028_02
hgs
parents:
diff changeset
   976
        aString (in which case the old string descriptor will be preserved).
089413cdde3c 201028_02
hgs
parents:
diff changeset
   977
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   978
    inline TInt SetSerialNumberStringDescriptor(const TDesC16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   979
089413cdde3c 201028_02
hgs
parents:
diff changeset
   980
    /** Removes (deletes) the string descriptor identified by the iSerialNumber index field of the Standard
089413cdde3c 201028_02
hgs
parents:
diff changeset
   981
        Device Descriptor and sets that field to zero.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   982
089413cdde3c 201028_02
hgs
parents:
diff changeset
   983
        @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   984
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   985
    inline TInt RemoveSerialNumberStringDescriptor();
089413cdde3c 201028_02
hgs
parents:
diff changeset
   986
089413cdde3c 201028_02
hgs
parents:
diff changeset
   987
    /** Retrieves the string descriptor identified by the iConfiguration index field of the (first) Standard
089413cdde3c 201028_02
hgs
parents:
diff changeset
   988
        Configuration Descriptor into the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   989
089413cdde3c 201028_02
hgs
parents:
diff changeset
   990
        @param aString Receives configuration string.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   991
089413cdde3c 201028_02
hgs
parents:
diff changeset
   992
        @return KErrNone if successful, KErrArgument if MaxLength of aString is too small to hold the entire
089413cdde3c 201028_02
hgs
parents:
diff changeset
   993
        descriptor, KErrNotFound if the string descriptor couldn't be found.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   994
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
   995
    inline TInt GetConfigurationStringDescriptor(TDes16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
   996
089413cdde3c 201028_02
hgs
parents:
diff changeset
   997
    /** Sets the string descriptor identified by the iConfiguration index field of the Standard Configuration
089413cdde3c 201028_02
hgs
parents:
diff changeset
   998
        Descriptor to the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
   999
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1000
        @param aString Contains the new serial number string descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1001
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1002
        @return KErrNone if successful, KErrNoMemory if no memory is available to store the new string from
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1003
        aString (in which case the old string descriptor will be preserved).
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1004
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1005
    inline TInt SetConfigurationStringDescriptor(const TDesC16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1006
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1007
    /** Removes (deletes) the string descriptor identified by the iConfiguration index field of the Standard
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1008
        Configuration Descriptor and sets that field to zero.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1009
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1010
        @return KErrNone if successful, KErrNotFound if the string descriptor couldn't be found.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1011
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1012
    inline TInt RemoveConfigurationStringDescriptor();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1013
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1014
    /** Copies the string of the USB string descriptor at the specified index in the string descriptor array
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1015
        into the aString argument.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1016
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1017
        Although this function can also be used for it, for querying most standard string descriptors
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1018
        there exists a set of dedicated access functions.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1019
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1020
        @see RDevUsbcClient::GetStringDescriptorLangId
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1021
        @see RDevUsbcClient::GetManufacturerStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1022
        @see RDevUsbcClient::GetProductStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1023
        @see RDevUsbcClient::GetSerialNumberStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1024
        @see RDevUsbcClient::GetConfigurationStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1025
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1026
        @param aIndex The position of the string descriptor in the string descriptor array.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1027
        @param aString The target location for the string descriptor copy.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1028
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1029
        @return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index,
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1030
        KErrArgument if MaxLength() of aString is too small to hold the entire descriptor.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1031
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1032
    inline TInt GetStringDescriptor(TUint8 aIndex, TDes16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1033
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1034
    /** Sets the aString argument to be the string of a USB string descriptor at the specified index in the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1035
        string descriptor array. If a string descriptor already exists at that position then its string will
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1036
        be replaced.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1037
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1038
        Care should be taken, when choosing aIndex, not to inadvertently overwrite one of the standard
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1039
        string descriptors.    For their manipulation there exists a set of dedicated access functions.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1040
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1041
        @see RDevUsbcClient::SetStringDescriptorLangId
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1042
        @see RDevUsbcClient::SetManufacturerStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1043
        @see RDevUsbcClient::SetProductStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1044
        @see RDevUsbcClient::SetSerialNumberStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1045
        @see RDevUsbcClient::SetConfigurationStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1046
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1047
        @param aIndex The position of the string descriptor in the string descriptor array.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1048
        @param aString Contains the string descriptor to be set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1049
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1050
        @return KErrNone if successful, KErrArgument if aIndex is invalid, KErrNoMemory if no memory
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1051
        is available to store the new string (an existing descriptor at that index will be preserved).
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1052
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1053
    inline TInt SetStringDescriptor(TUint8 aIndex, const TDesC16& aString);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1054
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1055
    /** Removes (deletes) the USB string descriptor at the specified index in the string descriptor array.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1056
        The position in the array of other string descriptors is not affected.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1057
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1058
        Care should be taken, when choosing aIndex, not to inadvertently delete a standard string descriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1059
        (also because index references from non-string descriptors would be invalidated). For the deletion
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1060
        of most standard string descriptors there exists a set of dedicated functions.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1061
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1062
        @see RDevUsbcClient::RemoveManufacturerStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1063
        @see RDevUsbcClient::RemoveProductStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1064
        @see RDevUsbcClient::RemoveSerialNumberStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1065
        @see RDevUsbcClient::RemoveConfigurationStringDescriptor
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1066
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1067
        @param aIndex The position of the string descriptor in the string descriptor array.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1068
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1069
        @return KErrNone if successful, KErrNotFound if no string descriptor exists at the specified index.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1070
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1071
    inline TInt RemoveStringDescriptor(TUint8 aIndex);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1072
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1073
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1074
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1075
    /**  Requests notification for when there is data available on the buffer indicated.  If the buffer
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1076
         already has data in it, it will return immediately, otherwise it will block until there is.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1077
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1078
    If the BIL methods are being used (recommended), then this method should not be called directly,
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1079
    using TEndpointBuffer::GetBuffer instead.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1080
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1081
    @param aBufferNumber Indicates the buffer for which the caller wishes to know about data 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1082
    additions.  The buffer needed of any given endpoint can be found by inspecting the alternative
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1083
    setting table, in the chunk header.  The location of the buffer can be found by looking at the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1084
    buffer offset table, also in the chunk header. 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1085
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1086
    @param aStatus The request status where notification of completion is directed. KErrCancel is
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1087
    returned if the asynchronous operation was cancelled.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1088
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1089
    @param aLength A preference for the quantity of data to be read.  This value is only a 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1090
    suggestion and my be ignored.  The default value of 0 indicates no preference.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1091
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1092
    @return KErrNone on success, or KErrArgument if the buffer number is invalid.    
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1093
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1094
    inline TInt ReadDataNotify(TInt aBufferNumber, TRequestStatus& aStatus, TInt aLength=0);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1095
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1096
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1097
    /**  Requests the LDD to write the contents of the given buffer to the USB hardware.  Notification is
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1098
    given when this is complete.  More then one write request can be queued on any one endpoint, to allow
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1099
    for less Hardware idling between buffers.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1100
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1101
    If the BIL methods are being used (recommended), then this method should not be called directly,
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1102
    using TEndpointBuffer::WriteBuffer instead.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1103
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1104
    @param aBufferNumber represents the buffer number of the buffer of which the caller has placed the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1105
    data. As described with ReadDataNotify(...), details of the buffers can be found in the chunk header.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1106
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1107
    @param aStart Represents the start offset of the data within the chunk.  This start location must be
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1108
    aligned to a multiple of the maximum packet size for the endpoint, so that the data can be DMAed
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1109
    straight out of the buffer.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1110
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1111
    @param aLength Represents the amount of data to be sent to the host in bytes.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1112
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1113
    @param aFlags Is a bitfield, where bit 0 should be set if a ZLP is to be sent to the host after the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1114
    current transaction.  All other bits are reserved for future use.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1115
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1116
    inline void WriteData(TInt aBufferNumber, TUint aStart, TUint aLength, TUint aFlags, TRequestStatus& aStatus);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1117
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1118
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1119
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1120
    /** Cancels an outstanding read request on endpoint buffer aBufferNumber.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1121
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1122
        @param aBufferNumber The endpoint buffer number whose read is to be cancelled.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1123
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1124
    inline void ReadCancel(TInt aBufferNumber);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1125
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1126
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1127
    /** Cancels an outstanding write request on endpoint buffer aBufferNumber.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1128
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1129
        @param aBufferNumber The endpoint buffer number whose write is to be cancelled.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1130
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1131
    inline void WriteCancel(TInt aBufferNumber);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1132
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1133
    /** Cancels any transfer on any endpoint buffer specified in aBufferMask.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1134
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1135
        @code
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1136
        // Cancel transfer requests on buffers 1, 2, 3 & 4
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1137
        usbPort.EndpointTransferCancel(1 | 2 | 4 | 8);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1138
        @endcode
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1139
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1140
        @param aBufferMask bitmap of the endpoint buffer numbers.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1141
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1142
    inline void EndpointTransferCancel(TUint aBufferMask);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1143
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1144
    /**    Register for notification when a change of the Interface alternate setting or the USB Controller's
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1145
        current state occurs. When the alternate setting or the Controller state changes, then the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1146
        asynchronous function completes and the current alternate setting number or Controller state is
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1147
        written back to aValue. If the KUsbAlternateSetting bit is set then the remaining bits are the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1148
        alternate setting number. Otherwise aValue is interpreted as a TUsbcDeviceState.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1149
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1150
        @see TUsbcDeviceState
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1151
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1152
        @param aStatus The request status.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1153
        @param aValue Receives the alternate setting number or Controller state.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1154
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1155
    inline void AlternateDeviceStatusNotify(TRequestStatus& aStatus, TUint& aValue);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1156
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1157
    /** Completes an AlternateDeviceStatusNotify request. If a request has previously been made then the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1158
        status variable is updated with the current device state.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1159
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1160
    inline void AlternateDeviceStatusNotifyCancel();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1161
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1162
    /** If the channel has changed the grouping of endpoints between interfaces or changed the interface class
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1163
        type from the defaults then it is necessary to force a re-enumeration. This will typically involve the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1164
        Symbian OS device initiating a disconnection and re-connection. This is an asynchronous operation
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1165
        which will complete when the Controller is successfully configured by the host, i.e. has achieved
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1166
        UsbShai::EUsbPeripheralStateConfigured.  Since it is not known if the operation has failed, at the same time that
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1167
        a ReEnumerate request is made, a timer should be set up to complete after approximately 5 seconds. It
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1168
        can be assumed that if the operation has not completed after this time interval then it will not
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1169
        complete.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1170
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1171
        @param aStatus The request status.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1172
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1173
    inline void ReEnumerate(TRequestStatus& aStatus);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1174
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1175
    /** Cancels an outstanding ReEnumerate() request.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1176
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1177
    inline void ReEnumerateCancel();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1178
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1179
    /**    Register for notification when a change in stall status of any of the interface's endpoints occurs,
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1180
        but not ep0. When a change in stall status occurs, then the asynchronous function completes and the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1181
        current stall state is written back to 'aEndpointStatus' as a bit map: Only stall state changes caused
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1182
        by SET_FEATURE and CLEAR_FEATURE standard commands on ep0 will be notified when this function
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1183
        completes. After this request completes the request should be re-issued to obtain future
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1184
        notifications.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1185
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1186
        @param aStatus The request status.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1187
        @param aEndpointMask A bitmap of the endpoints' stall status. This is filled in when the call completes.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1188
        bit 1 represents the interface's virtual endpoint 1, (KUsbcEndpoint1Bit)
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1189
        bit 2 represents the interface's virtual endpoint 2, (KUsbcEndpoint2Bit) etc.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1190
        bit value 0 - not stalled,
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1191
        bit value 1 - stalled.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1192
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1193
    inline void EndpointStatusNotify(TRequestStatus& aStatus, TUint& aEndpointMask);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1194
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1195
    /** Completes an endpoint status notify request.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1196
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1197
     inline void EndpointStatusNotifyCancel();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1198
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1199
    /** Get current on-the-go features relating to the ability of device/host pair to
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1200
        perform OTG role swap.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1201
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1202
        @param aFeatures On return it contains features the device currently has.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1203
                bit 2 represents b_hnp_enable,       (KUsbOtgAttr_B_HnpEnable)
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1204
                bit 3 represents a_hnp_support,      (KUsbOtgAttr_A_HnpSupport)
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1205
                bit 4 represents a_alt_hnp_support,  (KUsbOtgAttr_A_AltHnpSupport)
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1206
        @return KErrNone if successful, KErrNotSupported if OTG is not supported by
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1207
                this device, otherwise system-wide error returns.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1208
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1209
    inline TInt GetOtgFeatures(TUint8& aFeatures);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1210
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1211
    /** Register for notification on USB on-the-go features' change. If any OTG feature
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1212
        is changed, request completes and current feature value is filled in aValue.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1213
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1214
        @param aStatus Request status object.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1215
        @param aValue On request completion, contains current OTG feature value.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1216
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1217
    inline void OtgFeaturesNotify(TRequestStatus& aStatus, TUint8& aValue);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1218
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1219
    /** Cancel pending OTG feature request.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1220
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1221
    inline void OtgFeaturesNotifyCancel();
48
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1222
    
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1223
    /** Register for notification on USB charger type' change. If any usb charger
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1224
        is detected, request completes and current charger type value is filled in aValue.
33
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1225
48
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1226
        @param aStatus Request status object
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1227
        @param aValue On request completion, it contains current charger type value
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1228
    */
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1229
    inline void ChargingPortTypeNotify(TRequestStatus& aStatus, TUint& aValue);
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1230
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1231
    /** Cancel pending Charger Type request.
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1232
    */
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1233
    inline void ChargingPortTypeNotifyCancel();     
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1234
    inline TInt ChargerDetectorCaps(TUsbcChargerDetectorProperties& aProperties);
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1235
	/**	This function retrieves the alternate setting that the WriteData function can
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1236
		write to.  After a host sets the alternate setting, writes to the IN endpoint
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1237
		are not permitted by the LDD until this method has been called.
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1238
		This function is not asynchronous nor blocking, and should not be used to
21625e5de155 201035_01
hgs
parents: 33
diff changeset
  1239
		detect that an alternate setting has happened.
33
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1240
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1241
        If the BIL methods are being used (recommended), then this method should not be called directly. 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1242
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1243
        @return The alternative setting number or KErrInUse if the current alternative
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1244
         setting is already in use, that is to say that the alternative setting has not changed.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1245
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1246
    inline TInt StartNextInAlternateSetting();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1247
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1248
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1249
    /*******************************\
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1250
    *  Buffer Interface Layer (BIL) *
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1251
    \*******************************/
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1252
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1253
    // This following functions, as well as the ones in TEndpointBuffer (below), 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1254
    // can be considered the BIL.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1255
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1256
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1257
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1258
    Finalize the interface, creating a chunk for use with reading/writing to endpoints.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1259
    FinalizeInterface should be called after all alternate interfaces have been set up with SetInteface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1260
    Any attempt to call SetInterface after this stage will fail.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1261
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1262
    @return        KErrNone if operation is successfull
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1263
                System wide error codes if chunk creation failed
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1264
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1265
    IMPORT_C TInt FinalizeInterface();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1266
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1267
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1268
    Finalize the interface, creating a chunk for use with reading/writing to endpoints. This 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1269
    version of the method provides a handle to the chunk, which is needed if the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1270
    buffer is to be passed and used by other processes. 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1271
    FinalizeInterface should be called after all alternate interfaces have been set up with SetInteface.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1272
    Any attempt to call SetInterface after this stage will fail.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1273
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1274
    @param    aChunk    On success aChunk points to the created chunk.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1275
    @return            KErrNone if operation is successfull
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1276
                    System wide error codes if chunk creation failed
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1277
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1278
    IMPORT_C TInt FinalizeInterface(RChunk*& aChunk);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1279
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1280
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1281
    Opens an endpoint, an endpoint should be opened before any operations are attempted on it.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1282
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1283
    @param    aEpB    On success aEpB will be filled with the relevant details for that endpoint    
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1284
    @param    aEpI    endpoint number to be opened
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1285
    @return            KErrNone if operation is successfull
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1286
                    KErrNotFound if endpoint number is not valid for current alternate setting
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1287
                    KErrInUse if endpoint is already opened
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1288
                    KErrArgument if endpoint buffer argument passed is already in existence and being used
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1289
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1290
    IMPORT_C TInt OpenEndpoint(TEndpointBuffer & aEpB, TInt aEpI);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1291
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1292
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1293
    Switches to processing from one Alternate setting to the next. All open endpoints (except EP0) must
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1294
    be close before this can be called.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1295
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1296
    @param    aFlush    If ETrue, the method will purge the buffers of any data unread for the old setting.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1297
                    If each endpoint was not read up until KErrEof was reached, then this should be set.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1298
                     
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1299
    @return        the alternate Setting if operation is successful
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1300
                KErrInUse if any endpoints in present alternate setting is still open (except Ep0)
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1301
                KErrNotReady if there is no change in alternate setting
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1302
                KErrInUse if StartNextInAlternateSetting detects no change in alternate setting.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1303
                KErrCorrupt if the buffer structure becomes corrupt.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1304
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1305
    IMPORT_C TInt StartNextOutAlternateSetting(TBool aFlush);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1306
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1307
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1308
    Sets aChunk to RChunk currently in use by BIL.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1309
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1310
    @param    aChunk    aChunk will point to RChunk currently in use by BIL
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1311
    @return KErrNone on success otherwise a system wide error code, if an error has occurred.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1312
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1313
    IMPORT_C TInt GetDataTransferChunk(RChunk*& aChunk);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1314
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1315
private:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1316
    /** @internalTechnology */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1317
    TInt Drain(TUint aBuffer);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1318
    /** @internalTechnology */ 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1319
    TInt Peek(TUint aBuffer);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1320
    /** @internalTechnology */ 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1321
    TInt FindNextAlternateSetting();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1322
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1323
private:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1324
    TUint8 iEndpointStatus;    /** @internalTechnology Each bit corresponds to each endpoint's open/close status. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1325
    RChunk iSharedChunk;     /** @internalTechnology The shared chunk in use. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1326
    TInt iAltSettingSeq;    /** @internalTechnology Used to track alternate setting changes. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1327
    TInt iAlternateSetting; /** @internalTechnology The alternate setting used by OUT endpoints, which may lag that of IN endpoints. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1328
    TInt iNewAltSetting;     /** @internalTechnology Used to track the next alternate setting change on OUT endpoints,
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1329
                                during transition from one to the next. */ 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1330
    TInt iInAltSetting;     /** @internalTechnology The alternate setting used by IN endpoints, which may be ahead of OUT endpoints. */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1331
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1332
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1333
    friend class TEndpointBuffer;    
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1334
#endif // #ifndef __KERNEL_MODE__
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1335
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1336
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1337
#ifndef __KERNEL_MODE__
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1338
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1339
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1340
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1341
 This class forms part of the Buffer Interface Layer (BIL), which forms the 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1342
 user side component of the USB Shared Chunk Client.  Objects of this type
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1343
 represent the shared chunk buffer, for a given endpoint.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1344
 The method RDevUsbcScClient::OpenEndpoint() should be used to initialise
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1345
 objects of this type.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1346
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1347
class TEndpointBuffer
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1348
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1349
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1350
 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1351
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1352
    This return value used by GetBuffer indicates that the item pointed to by 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1353
    aBuffer/aOffset represents a state change, instead of endpoint data.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1354
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1355
    const static TInt KStateChange = 0x01;
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1356
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1357
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1358
    IMPORT_C TEndpointBuffer();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1359
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1360
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1361
    Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process one block of data at a time. 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1362
    This method also expires the previously read block, meaning that the memory used by the block of data may be re-used by the system, overwriting it
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1363
    with new data.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1364
    @param    aBuffer    aBuffer will point to data location in shared chunk    
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1365
    @param    aSize    aSize will hold the number of valid bytes that can be read
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1366
    @param    aZLP    aZLP will indicate whether its a short packet or not
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1367
    @param    aStatus    In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1368
                    asynchronous call ReadDataNotify to return
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1369
    @param    aLength    Not used at the moment
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1370
    @return            KErrCompletion if operation is successfull and data is available in the buffer
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1371
                    KErrNone if no data is available to be read
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1372
                    KErrEof if alternate setting has changed
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1373
                    KErrAccessDenied if endpoint is not opened
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1374
                    KErrNotSupported if its an IN endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1375
                    TEndpointBuffer::KStateChange if the returned data represents a state change (Ep0 only)
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1376
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1377
    IMPORT_C TInt GetBuffer(TAny*& aBuffer,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength=0);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1378
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1379
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1380
    Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process one block of data at a time. 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1381
    This method also expires the previously read block, meaning that the memory used by the block of data may be re-used by the system, overwriting it
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1382
    with new data. 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1383
    @param    aOffset    aOffset will point to data offset in shared chunk    
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1384
    @param    aSize    aSize will hold the number of valid bytes that can be read
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1385
    @param    aZLP    aZLP will indicate whether its a short packet or not
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1386
    @param    aStatus    In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1387
            asynchronous call ReadDataNotify to return
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1388
    @param    aLength    Not used at the moment
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1389
    @return    KErrCompletion if operation is successfull and data is available in the buffer
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1390
            KErrNone if no data is available to be read
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1391
            KErrEof if alternate setting has changed
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1392
            KErrAccessDenied if endpoint is not opened
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1393
            KErrNotSupported if its an IN endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1394
            TEndpointBuffer::KStateChange if the returned data represents a state change (Ep0 only)
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1395
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1396
    inline   TInt GetBuffer(TUint& aOffset,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength=0);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1397
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1398
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1399
    Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process more than one block of data
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1400
    simultaneously. The user must call one of the Expire() methods to free the memory used by the block of data, and make it available for new data.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1401
    @param    aBuffer    aBuffer will point to data location in shared chunk    
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1402
    @param    aSize    aSize will hold the number of valid bytes that can be read
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1403
    @param    aZLP    aZLP will indicate whether its a short packet or not
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1404
    @param    aStatus    In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1405
                    asynchronous call ReadDataNotify to return
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1406
    @param    aLength    Not used at the moment
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1407
    @return            KErrCompletion if operation is successfull and data is available in the buffer
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1408
                    KErrNone if no data is available to be read
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1409
                    KErrEof if alternate setting has changed
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1410
                    KErrAccessDenied if endpoint is not opened
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1411
                    KErrNotSupported if its an IN endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1412
                    TEndpointBuffer::KStateChange if the returned data represents a state change (Ep0 only)
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1413
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1414
    IMPORT_C TInt TakeBuffer(TAny*& aBuffer,TUint& aSize,TBool& aZLP,TRequestStatus& aStatus,TUint aLength=0);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1415
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1416
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1417
    Used in conjunction with TakeBuffer method. This will make the 'oldest' block of data previously read out using the TakeBuffer method, but not
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1418
    already    expired, to be released back to the system. This block can then be overwritten with new data, when it becomes available.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1419
    @return         KErrNotSupported if its an IN endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1420
                    KErrNone if iTail is successfully bumped to the next transfer to be read
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1421
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1422
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1423
    IMPORT_C TInt Expire();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1424
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1425
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1426
    Used in conjunction with TakeBuffer method. This function allows blocks to be expired in a different order from which the user read the data out
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1427
    of the buffer. Note that the system will only reuse blocks up to the point of the oldest non-expired block read. This means that the user must
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1428
    ensure to expire all blocks in a timely manner to prevent the system from running out of usable memory.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1429
    @param    aAddress aAddress is the start address of the block of data previously read by the user which can be overwritten.    
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1430
    @return            KErrNotSupported if its an IN endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1431
                    KErrNone if iTail  is successfully bumped to the next transfer to be read
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1432
                    KErrNotFound if a 'transfer' with start address of the data block is aAddress is not found
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1433
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1434
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1435
    IMPORT_C TInt Expire(TAny* aAddress);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1436
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1437
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1438
    Initiates write operation.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1439
    @param    aBuffer    aBuffer will point to data in shared chunk to be written out. aBuffer should be aligned    
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1440
    @param    aSize    aSize will hold the number of valid bytes to be written out
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1441
    @param    aZLP    aZLP will indicate whether a ZLP should be transmitted after writing the data out
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1442
    @param    aStatus    This is an asynchronous function and user side should wait on status to know the end of write operation
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1443
    @return            KErrNone if a write is successfully queued
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1444
                    KErrEof if an alternate setting change has occurred, ending this endpoint.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1445
                    KErrNotSupported if its an OUT endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1446
                    KErrAccessDenied if endpoint is not opened, or if buffer is out of range
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1447
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1448
    IMPORT_C TInt WriteBuffer(TAny* aBuffer,TUint aSize,TBool aZLP,TRequestStatus& aStatus);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1449
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1450
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1451
    Initiates write operation.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1452
    @param    aOffset    aOffset will point to offset of data in shared chunk to be written out.     
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1453
    @param    aSize    aSize will hold the number of valid bytes to be written out
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1454
    @param    aZLP    aZLP will indicate whether a ZLP should be transmitted after writing the data out
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1455
    @param    aStatus    This is an asynchronous function and user side should wait on status to know the end of write operation
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1456
    @return            KErrNone if a write is successfully queued
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1457
                    KErrEof if an alternate setting change has occurred, ending this endpoint.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1458
                    KErrNotSupported if its an OUT endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1459
                    KErrAccessDenied if endpoint is not opened, or if buffer is out of range
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1460
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1461
    IMPORT_C TInt WriteBuffer(TUint aOffset,TUint aSize,TBool aZLP,TRequestStatus& aStatus);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1462
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1463
    For IN endpoints, this method retrieves the geometry for the buffer, for which the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1464
    caller should stay within, when using the WriteBuffer method.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1465
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1466
    @param aStart A pointer, which is set to point to the start of the buffer.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1467
    @param aSize An TUint for which the size (in bytes) of buffer, is written into.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1468
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1469
    @returns KErrNotSupported if the object is on an open IN endpoint, 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1470
            otherwise it KErrNone is returned on success.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1471
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1472
    IMPORT_C TInt GetInBufferRange(TAny*& aStart, TUint& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1473
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1474
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1475
    For IN endpoints, this method retrieves the geometry for the buffer, for which the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1476
    caller should stay within, when using the WriteBuffer method.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1477
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1478
    @param aStart A TUint for which the buffer's start offset from the start of the chunk,
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1479
                    in written into.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1480
    @param aSize An TUint for which the size (in bytes) of buffer, is written into.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1481
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1482
    @returns KErrNotSupported if the object is on an open IN endpoint, 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1483
            otherwise it KErrNone is returned on success.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1484
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1485
    IMPORT_C TInt GetInBufferRange(TUint& aStart, TUint& aSize);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1486
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1487
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1488
    This method closes the endpoint, after it was opened with 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1489
    RDevUsbcScClient::OpenEndpoint(...).
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1490
    No method of this object can be used after this    call, until
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1491
    RDevUsbcScClient::OpenEndpoint(...) is called on it again.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1492
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1493
    @return    KErrNone on success, otherwise KErrNotFound, if the current object is not open.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1494
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1495
    IMPORT_C TInt Close();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1496
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1497
    IMPORT_C void Dump();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1498
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1499
    /**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1500
    Used to retrieve the endpoint number for which this object was open on.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1501
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1502
    @returns the endpoint number opened by this object.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1503
    */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1504
    inline TInt GetEndpointNumber();
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1505
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1506
private:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1507
    /** @internalTechnology */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1508
    void Construct(RDevUsbcScClient* aClient, TUint8* aBaseAddr, const TUsbcScHdrEndpointRecord* aEpType,
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1509
                         TInt aEndpointNumber, SUsbcScBufferHeader* aEndpointHdr=NULL);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1510
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1511
private:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1512
    enum TDir {EValid = KErrNone, ENotValid = KErrNotSupported, EEOF = KErrEof};
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1513
    TDir iInState;                        /** @internalTechnology describes state of endpoint, KErrNone if IN endpoint and ready to use, KErrNotSupportd if not an IN endpoint, KErrEof on alternate setting change */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1514
    TDir iOutState;                        /** @internalTechnology describes state of endpoint, KErrNone if OUT endpoint and ready to use, KErrNotSupportd if not an OUT endpoint, KErrEoF on alternate setting change */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1515
    TInt iEndpointNumber;                /** @internalTechnology associated endpoint number */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1516
    TInt iBufferNum;                    /** @internalTechnology buffer number within shared chunk */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1517
    RDevUsbcScClient *iClient;            /** @internalTechnology Parent RDevUsbcScClient object */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1518
    TUint iBaseAddr;                    /** @internalTechnology The address of the beginning of the Ldd's chunk */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1519
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1520
    SUsbcScBufferHeader* iEndpointHdr;  /** @internalTechnology Pointer to the buffer Header for OUT/BI endpoints */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1521
    TUint8* iBufferStartAddr;             /** @internalTechnology IN/BI endpoint buffer start address within shared chunk */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1522
    TUint iSize;                        /** @internalTechnology IN/BI endpoint buffer size within shared chunk */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1523
    friend class RDevUsbcScClient;
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1524
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1525
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1526
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1527
This class can be used to retrieve the geometry of the structures 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1528
within a shared chunk, as used by RDevUsbcScClient.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1529
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1530
@see RDevUsbcScClient
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1531
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1532
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1533
class TUsbcScChunkHeader
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1534
    {
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1535
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1536
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1537
The constructor for the TUsbcScChunkHeader class takes a RChunk object, 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1538
containing USBcSc data structures, and initialises itself, so that
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1539
GetNumberOfEndpoints & GetBuffer can be used to interpret the chunk structures.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1540
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1541
@param    An RChunk object, which represents an shared chunk, containing the
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1542
        USBcSc data structures to be retrieved.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1543
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1544
    IMPORT_C TUsbcScChunkHeader(RChunk aChunk);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1545
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1546
Retrieves the available information in the chunk, about the given endpoint, 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1547
on the given alternate setting.  The returned TUsbcScBufferRecord, 
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1548
represents the buffer geometry, used for for the endpoint, while
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1549
the filled in TUsbcScHdrEndpointRecord represents additional endpoint
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1550
information.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1551
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1552
@param aAltSetting The alternate setting, for which the provided endpoint number, is a member of.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1553
@param aEndpoint    The endpoint, who's buffer geometry is required.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1554
@param aEndpointInf    The provided record is filled in with details of the endpoint, who's number was given.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1555
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1556
    IMPORT_C TUsbcScBufferRecord* GetBuffer(TInt aAltSetting, TInt aEndpoint, TUsbcScHdrEndpointRecord*& aEndpointInf);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1557
/**
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1558
Retrieves the number of endpoints found in a given alternate setting.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1559
@param aAltSetting The alternate setting number, for which the number of endpoints contained within, is needed.
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1560
*/
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1561
    IMPORT_C TInt GetNumberOfEndpoints(TInt aAltSetting);
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1562
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1563
public:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1564
    TUsbcScChunkBuffersHeader*    iBuffers;        /** A pointer to the TUsbcScChunkBuffersHeader object, within the chunk header */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1565
    TUsbcScChunkAltSettingHeader* iAltSettings;    /** A pointer to the TUsbcScChunkAltSettingHeader object, within the chunk header */
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1566
private:
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1567
    RChunk iChunk;
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1568
    };
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1569
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1570
#endif
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1571
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1572
#include <usb/d32usbcsc.inl>
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1573
089413cdde3c 201028_02
hgs
parents:
diff changeset
  1574
#endif // __D32USBCSC_H__