sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
// This contains namespace USB
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef USBCONSTANTS_H
|
sl@0
|
20 |
#define USBCONSTANTS_H
|
sl@0
|
21 |
|
sl@0
|
22 |
/**
|
sl@0
|
23 |
* Namespace for constant variables and data types, common to USBerian
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
namespace USB
|
sl@0
|
26 |
{
|
sl@0
|
27 |
/**
|
sl@0
|
28 |
* USB logical device driver name
|
sl@0
|
29 |
* */
|
sl@0
|
30 |
#ifdef __WINS__
|
sl@0
|
31 |
_LIT(KLDDName, "testusbc");
|
sl@0
|
32 |
#else
|
sl@0
|
33 |
_LIT(KLDDName, "eusbc");
|
sl@0
|
34 |
#endif
|
sl@0
|
35 |
|
sl@0
|
36 |
/**
|
sl@0
|
37 |
* Endpoint type constants - Short descriptions of types
|
sl@0
|
38 |
(see USB 2.0 specification for details) */
|
sl@0
|
39 |
|
sl@0
|
40 |
/**
|
sl@0
|
41 |
Control
|
sl@0
|
42 |
"Control transfers are intended to support configuration/command/status
|
sl@0
|
43 |
type communication flows between client software and its function. Each
|
sl@0
|
44 |
USB device is required to implement the Default Control Pipe as a message pipe."
|
sl@0
|
45 |
*/
|
sl@0
|
46 |
_LIT(KEPControl, "Control");
|
sl@0
|
47 |
|
sl@0
|
48 |
/**
|
sl@0
|
49 |
Bulk
|
sl@0
|
50 |
"The bulk transfer type is designed to support devices that need to communicate
|
sl@0
|
51 |
relatively large amounts of data at highly variable times where the transfer can
|
sl@0
|
52 |
use any available bandwidth."
|
sl@0
|
53 |
*/
|
sl@0
|
54 |
_LIT(KEPBulk, "Bulk");
|
sl@0
|
55 |
|
sl@0
|
56 |
/**
|
sl@0
|
57 |
Interrupt
|
sl@0
|
58 |
"The interrupt transfer type is designed to support those devices that need to
|
sl@0
|
59 |
send or receive data infrequently but with bounded service periods."
|
sl@0
|
60 |
*/
|
sl@0
|
61 |
_LIT(KEPInterrupt, "Interrupt");
|
sl@0
|
62 |
/*
|
sl@0
|
63 |
Isochronous
|
sl@0
|
64 |
"Isochronous transfer type provides the requester:
|
sl@0
|
65 |
- guaranteed access to USB bandwidth with bounded latency
|
sl@0
|
66 |
- guaranteed constant data rate through the pipe as long as data is provided to the pipe
|
sl@0
|
67 |
- in the case of a delivery failure due to error, no retrying of the attempt to deliver the data "
|
sl@0
|
68 |
*/
|
sl@0
|
69 |
_LIT(KEPIsochronous, "Isochronous");
|
sl@0
|
70 |
|
sl@0
|
71 |
/**
|
sl@0
|
72 |
* Endpoint direction constants
|
sl@0
|
73 |
* */
|
sl@0
|
74 |
|
sl@0
|
75 |
_LIT(KEPIn, "In"); // "IN refers to transfers to the host"
|
sl@0
|
76 |
_LIT(KEPOut, "Out"); // "OUT refers to transfers from the host."
|
sl@0
|
77 |
_LIT(KEPBidirectional, "Bidirectional"); // only for control transfers
|
sl@0
|
78 |
|
sl@0
|
79 |
/**
|
sl@0
|
80 |
* The following are default offsets data in device descriptor
|
sl@0
|
81 |
Offsets are used to set */
|
sl@0
|
82 |
const TInt KSpecOffset = 2;
|
sl@0
|
83 |
const TInt KVendorOffset = 8;
|
sl@0
|
84 |
const TInt KProductIDOffset = 10;
|
sl@0
|
85 |
const TInt KReleaseOffset = 12;
|
sl@0
|
86 |
|
sl@0
|
87 |
/* Default number of channels to open. Used only to initialize variable with proper value */
|
sl@0
|
88 |
const TInt MinNumberOfChannels = 1;
|
sl@0
|
89 |
|
sl@0
|
90 |
/* Value which is not used by USB client driver, "For future compatibility, should always be zero." */
|
sl@0
|
91 |
const TInt KUSBChannelOpenParameter = 0;
|
sl@0
|
92 |
|
sl@0
|
93 |
/* Value for how long to wait before test case ends after re-enumeration */
|
sl@0
|
94 |
const TInt KSecond = 1000000; // 1 secs = 1000000 microseconds
|
sl@0
|
95 |
|
sl@0
|
96 |
enum TUSBEndPointMode {
|
sl@0
|
97 |
ENotChosen = -1,
|
sl@0
|
98 |
EBulk,
|
sl@0
|
99 |
EInterrupt,
|
sl@0
|
100 |
EIsochronous
|
sl@0
|
101 |
};
|
sl@0
|
102 |
|
sl@0
|
103 |
/**
|
sl@0
|
104 |
* USB Actions indicate which action is done in async call
|
sl@0
|
105 |
* The flag is set before async calls to RDevUsbcClient
|
sl@0
|
106 |
* It is used by USBReader and USBWriter classes
|
sl@0
|
107 |
*/
|
sl@0
|
108 |
|
sl@0
|
109 |
enum USBAction
|
sl@0
|
110 |
{
|
sl@0
|
111 |
|
sl@0
|
112 |
// Read Actions - used by USBReader
|
sl@0
|
113 |
ENone, // ENone Used by both USBReader and USBWriter
|
sl@0
|
114 |
ERead,
|
sl@0
|
115 |
EReadWithLength,
|
sl@0
|
116 |
EReadUntilShort,
|
sl@0
|
117 |
EReadUntilShortWithLength,
|
sl@0
|
118 |
EReadOneOrMore,
|
sl@0
|
119 |
EReadOneOrMoreWithLength,
|
sl@0
|
120 |
EReadError,
|
sl@0
|
121 |
|
sl@0
|
122 |
// Write Actions - used by USBWriter
|
sl@0
|
123 |
EWrite,
|
sl@0
|
124 |
EWriteFile,
|
sl@0
|
125 |
EWriteError
|
sl@0
|
126 |
|
sl@0
|
127 |
};
|
sl@0
|
128 |
|
sl@0
|
129 |
// Read and write buffers 0.5MB by default
|
sl@0
|
130 |
const TInt KDefaultReadBufferSize = 1024 * 512;
|
sl@0
|
131 |
const TInt KDefaultWriteBufferSize = 1024 * 512;
|
sl@0
|
132 |
|
sl@0
|
133 |
const TInt KDelayBetweenDataAvailabilityQueries = 1000000;
|
sl@0
|
134 |
|
sl@0
|
135 |
const TInt KTransferDataSize5MB = 5242880;
|
sl@0
|
136 |
const TInt KMicroSecondsToSecondsMultiplier = 1000000;
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
|
sl@0
|
140 |
|
sl@0
|
141 |
#endif
|
sl@0
|
142 |
|