sl@0
|
1 |
#ifndef __TEST_ENDPOINT_BASE_H
|
sl@0
|
2 |
#define __TEST_ENDPOINT_BASE_H
|
sl@0
|
3 |
|
sl@0
|
4 |
/*
|
sl@0
|
5 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
6 |
* All rights reserved.
|
sl@0
|
7 |
* This component and the accompanying materials are made available
|
sl@0
|
8 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
9 |
* which accompanies this distribution, and is available
|
sl@0
|
10 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Initial Contributors:
|
sl@0
|
13 |
* Nokia Corporation - initial contribution.
|
sl@0
|
14 |
*
|
sl@0
|
15 |
* Contributors:
|
sl@0
|
16 |
*
|
sl@0
|
17 |
* Description:
|
sl@0
|
18 |
* @file testendpointbase.h
|
sl@0
|
19 |
* @internalComponent
|
sl@0
|
20 |
*
|
sl@0
|
21 |
*
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <e32base.h>
|
sl@0
|
27 |
#include <d32usbc.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
namespace NUnitTesting_USBDI
|
sl@0
|
30 |
{
|
sl@0
|
31 |
|
sl@0
|
32 |
/**
|
sl@0
|
33 |
This class describes a resource endpoint for use in transfers.
|
sl@0
|
34 |
An endpoint is configured with respect to the host so an 'in' endpoint
|
sl@0
|
35 |
is one where data is transfered to the host and an 'out' endpoint is where
|
sl@0
|
36 |
data is received from the host
|
sl@0
|
37 |
*/
|
sl@0
|
38 |
class TEndpoint
|
sl@0
|
39 |
{
|
sl@0
|
40 |
friend class CInterfaceBase;
|
sl@0
|
41 |
friend class CInterfaceSettingBase;
|
sl@0
|
42 |
friend class CControlXfer;
|
sl@0
|
43 |
|
sl@0
|
44 |
public:
|
sl@0
|
45 |
// Compiler copy constructor and assignment ok
|
sl@0
|
46 |
|
sl@0
|
47 |
protected:
|
sl@0
|
48 |
/**
|
sl@0
|
49 |
Constructor
|
sl@0
|
50 |
@param aEndpointNumber the number of the endpoint on the setting for the interface
|
sl@0
|
51 |
specify only EEndpoint1, EEndpoint2, EEndpoint3, EEndpoint4 or EEndpoint5
|
sl@0
|
52 |
*/
|
sl@0
|
53 |
explicit TEndpoint(TEndpointNumber aEndpointNumber) : iEndpointNumber(aEndpointNumber)
|
sl@0
|
54 |
{
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
/**
|
sl@0
|
58 |
Non-virtual Destructor
|
sl@0
|
59 |
*/
|
sl@0
|
60 |
~TEndpoint()
|
sl@0
|
61 |
{
|
sl@0
|
62 |
}
|
sl@0
|
63 |
|
sl@0
|
64 |
protected:
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
The information for the endpoint
|
sl@0
|
67 |
*/
|
sl@0
|
68 |
TUsbcEndpointInfo iEndpointInfo;
|
sl@0
|
69 |
|
sl@0
|
70 |
/**
|
sl@0
|
71 |
The number for the endpoint w.r.t the interface it is associated with
|
sl@0
|
72 |
*/
|
sl@0
|
73 |
TEndpointNumber iEndpointNumber;
|
sl@0
|
74 |
};
|
sl@0
|
75 |
|
sl@0
|
76 |
|
sl@0
|
77 |
/**
|
sl@0
|
78 |
This class represents an endpoint that a device can use to send
|
sl@0
|
79 |
data to the host via a transfer pipe
|
sl@0
|
80 |
*/
|
sl@0
|
81 |
class TInEndpoint : public TEndpoint
|
sl@0
|
82 |
{
|
sl@0
|
83 |
protected:
|
sl@0
|
84 |
/**
|
sl@0
|
85 |
Constructor, build an endpoint that will be used to transfer data
|
sl@0
|
86 |
to the host
|
sl@0
|
87 |
@param the number for the endpoint
|
sl@0
|
88 |
*/
|
sl@0
|
89 |
explicit TInEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
90 |
: TEndpoint(aEndpointNumber)
|
sl@0
|
91 |
{
|
sl@0
|
92 |
iEndpointInfo.iDir = KUsbEpDirIn;
|
sl@0
|
93 |
}
|
sl@0
|
94 |
};
|
sl@0
|
95 |
|
sl@0
|
96 |
|
sl@0
|
97 |
/**
|
sl@0
|
98 |
This class represents an endpoint that a device can use to receive
|
sl@0
|
99 |
data from the host via a transfer pipe
|
sl@0
|
100 |
*/
|
sl@0
|
101 |
class TOutEndpoint : public TEndpoint
|
sl@0
|
102 |
{
|
sl@0
|
103 |
protected:
|
sl@0
|
104 |
/**
|
sl@0
|
105 |
Constructor, build an endpoint that will be used to receive data
|
sl@0
|
106 |
from the host in a transfer
|
sl@0
|
107 |
@param the number for the endpoint
|
sl@0
|
108 |
*/
|
sl@0
|
109 |
explicit TOutEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
110 |
: TEndpoint(aEndpointNumber)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
iEndpointInfo.iDir = KUsbEpDirOut;
|
sl@0
|
113 |
}
|
sl@0
|
114 |
};
|
sl@0
|
115 |
|
sl@0
|
116 |
|
sl@0
|
117 |
/**
|
sl@0
|
118 |
This class represents an allocated endpoint for bi-directional capacity
|
sl@0
|
119 |
via a transfer pipe
|
sl@0
|
120 |
*/
|
sl@0
|
121 |
class TBiEndpoint : public TEndpoint
|
sl@0
|
122 |
{
|
sl@0
|
123 |
protected:
|
sl@0
|
124 |
/**
|
sl@0
|
125 |
Constructor, build an endpoint that will be used to send/receive data with host
|
sl@0
|
126 |
@param the number for the endpoint
|
sl@0
|
127 |
*/
|
sl@0
|
128 |
explicit TBiEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
129 |
: TEndpoint(aEndpointNumber)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
iEndpointInfo.iDir = KUsbEpDirBidirect;
|
sl@0
|
132 |
}
|
sl@0
|
133 |
};
|
sl@0
|
134 |
|
sl@0
|
135 |
/**
|
sl@0
|
136 |
This class describes an endpoint for Bulk in tansfers
|
sl@0
|
137 |
*/
|
sl@0
|
138 |
class TBulkInEndpoint : public TInEndpoint
|
sl@0
|
139 |
{
|
sl@0
|
140 |
public:
|
sl@0
|
141 |
/**
|
sl@0
|
142 |
Constructor, build a bulk in endpoint
|
sl@0
|
143 |
@param the number for the endpoint
|
sl@0
|
144 |
*/
|
sl@0
|
145 |
explicit TBulkInEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
146 |
: TInEndpoint(aEndpointNumber)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
iEndpointInfo.iType = KUsbEpTypeBulk;
|
sl@0
|
149 |
}
|
sl@0
|
150 |
};
|
sl@0
|
151 |
|
sl@0
|
152 |
/**
|
sl@0
|
153 |
This class describes an endpoint for Bulk out transfers
|
sl@0
|
154 |
*/
|
sl@0
|
155 |
class TBulkOutEndpoint : public TOutEndpoint
|
sl@0
|
156 |
{
|
sl@0
|
157 |
public:
|
sl@0
|
158 |
/**
|
sl@0
|
159 |
Constructor, build a bulk out endpoint
|
sl@0
|
160 |
@param the number for the endpoint
|
sl@0
|
161 |
*/
|
sl@0
|
162 |
explicit TBulkOutEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
163 |
: TOutEndpoint(aEndpointNumber)
|
sl@0
|
164 |
{
|
sl@0
|
165 |
iEndpointInfo.iType = KUsbEpTypeBulk;
|
sl@0
|
166 |
}
|
sl@0
|
167 |
};
|
sl@0
|
168 |
|
sl@0
|
169 |
|
sl@0
|
170 |
/**
|
sl@0
|
171 |
This class describes an endpoint for Control transfers
|
sl@0
|
172 |
*/
|
sl@0
|
173 |
class TCtrlEndpoint : public TBiEndpoint
|
sl@0
|
174 |
{
|
sl@0
|
175 |
public:
|
sl@0
|
176 |
/**
|
sl@0
|
177 |
Constructor, build a control endpoint
|
sl@0
|
178 |
@param the number for the endpoint
|
sl@0
|
179 |
*/
|
sl@0
|
180 |
explicit TCtrlEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
181 |
: TBiEndpoint(aEndpointNumber)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
iEndpointInfo.iType = KUsbEpTypeControl;
|
sl@0
|
184 |
}
|
sl@0
|
185 |
};
|
sl@0
|
186 |
|
sl@0
|
187 |
|
sl@0
|
188 |
/**
|
sl@0
|
189 |
This class describes an endpoint for Interrupt in transfers
|
sl@0
|
190 |
*/
|
sl@0
|
191 |
class TIntInEndpoint : public TInEndpoint
|
sl@0
|
192 |
{
|
sl@0
|
193 |
public:
|
sl@0
|
194 |
/**
|
sl@0
|
195 |
Constructor, build a interrupt in endpoint
|
sl@0
|
196 |
@param the number for the endpoint
|
sl@0
|
197 |
@param the interrupt transfer polling interval for the host
|
sl@0
|
198 |
*/
|
sl@0
|
199 |
explicit TIntInEndpoint(TEndpointNumber aEndpointNumber,TInt aPollingInterval)
|
sl@0
|
200 |
: TInEndpoint(aEndpointNumber)
|
sl@0
|
201 |
{
|
sl@0
|
202 |
iEndpointInfo.iType = KUsbEpTypeInterrupt;
|
sl@0
|
203 |
iEndpointInfo.iInterval = aPollingInterval;
|
sl@0
|
204 |
}
|
sl@0
|
205 |
};
|
sl@0
|
206 |
|
sl@0
|
207 |
/**
|
sl@0
|
208 |
This class describes an endpoint for Interrupt out transfers
|
sl@0
|
209 |
*/
|
sl@0
|
210 |
class TIntOutEndpoint : public TOutEndpoint
|
sl@0
|
211 |
{
|
sl@0
|
212 |
public:
|
sl@0
|
213 |
/**
|
sl@0
|
214 |
Constructor, build an interrupt out endpoint
|
sl@0
|
215 |
@param the number for the endpoint
|
sl@0
|
216 |
*/
|
sl@0
|
217 |
explicit TIntOutEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
218 |
: TOutEndpoint(aEndpointNumber)
|
sl@0
|
219 |
{
|
sl@0
|
220 |
iEndpointInfo.iType = KUsbEpTypeInterrupt;
|
sl@0
|
221 |
}
|
sl@0
|
222 |
};
|
sl@0
|
223 |
|
sl@0
|
224 |
/**
|
sl@0
|
225 |
This class describes an endpoint for Isochronous in transfers
|
sl@0
|
226 |
*/
|
sl@0
|
227 |
class TIsochInEndpoint : public TInEndpoint
|
sl@0
|
228 |
{
|
sl@0
|
229 |
public:
|
sl@0
|
230 |
/**
|
sl@0
|
231 |
Constructor, build an isochronous in endpoint
|
sl@0
|
232 |
@param the number for the endpoint
|
sl@0
|
233 |
*/
|
sl@0
|
234 |
explicit TIsochInEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
235 |
: TInEndpoint(aEndpointNumber)
|
sl@0
|
236 |
{
|
sl@0
|
237 |
iEndpointInfo.iType = KUsbEpTypeIsochronous;
|
sl@0
|
238 |
}
|
sl@0
|
239 |
};
|
sl@0
|
240 |
|
sl@0
|
241 |
/**
|
sl@0
|
242 |
This class describes an endpoint for Isochronous out transfers
|
sl@0
|
243 |
*/
|
sl@0
|
244 |
class TIsochOutEndpoint : public TOutEndpoint
|
sl@0
|
245 |
{
|
sl@0
|
246 |
public:
|
sl@0
|
247 |
/**
|
sl@0
|
248 |
Constructor, build an isochronous out endpoint
|
sl@0
|
249 |
@param the number for the endpoint
|
sl@0
|
250 |
*/
|
sl@0
|
251 |
explicit TIsochOutEndpoint(TEndpointNumber aEndpointNumber)
|
sl@0
|
252 |
: TOutEndpoint(aEndpointNumber)
|
sl@0
|
253 |
{
|
sl@0
|
254 |
iEndpointInfo.iType = KUsbEpTypeIsochronous;
|
sl@0
|
255 |
}
|
sl@0
|
256 |
};
|
sl@0
|
257 |
|
sl@0
|
258 |
|
sl@0
|
259 |
}
|
sl@0
|
260 |
|
sl@0
|
261 |
|
sl@0
|
262 |
#endif
|
sl@0
|
263 |
|