Root/
Source at commit 1166 created 13 years 10 days ago. By meklort, Fixed recent Makefile changes. Please do not use /Users/evan/SourceCode/tmp/chameleon/trunk or VPATH. the *only* time you should use /Users/evan/SourceCode/tmp/chameleon/trunk is when setting the SRCROOT variable. Also note that very soon make pkg is going to be removed. The pkg build script in trunk is very out of date. Instead please use the package maker at http://forge.voodooprojects.org/p/chameleonApplications/. Once this is ready for trunk it will be merged. | |
---|---|
1 | /*␊ |
2 | * Copyright (c) 1998-2002 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * The contents of this file constitute Original Code as defined in and␊ |
7 | * are subject to the Apple Public Source License Version 1.1 (the␊ |
8 | * "License"). You may not use this file except in compliance with the␊ |
9 | * License. Please obtain a copy of the License at␊ |
10 | * http://www.apple.com/publicsource and read it before using this file.␊ |
11 | * ␊ |
12 | * This Original Code and all software distributed under the License are␊ |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the␊ |
17 | * License for the specific language governing rights and limitations␊ |
18 | * under the License.␊ |
19 | * ␊ |
20 | * @APPLE_LICENSE_HEADER_END@␊ |
21 | */␊ |
22 | /*␊ |
23 | *␊ |
24 | *␉IOFWCommand.h␊ |
25 | *␊ |
26 | */␊ |
27 | #ifndef _IOKIT_IOFWCOMMAND_H␊ |
28 | #define _IOKIT_IOFWCOMMAND_H␊ |
29 | ␊ |
30 | #include <IOKit/IOCommand.h>␊ |
31 | #include <IOKit/IOLib.h>␊ |
32 | ␊ |
33 | #include <IOKit/firewire/IOFireWireFamilyCommon.h>␊ |
34 | ␊ |
35 | #include <IOKit/firewire/IOFWSyncer.h>␊ |
36 | ␊ |
37 | #define kFWCmdDefaultRetries 3␊ |
38 | #define kFWCmdZeroRetries 0␊ |
39 | #define kFWCmdReducedRetries 2␊ |
40 | #define kFWCmdIncreasedRetries 6␊ |
41 | ␊ |
42 | class IOMemoryDescriptor;␊ |
43 | class IOSyncer;␊ |
44 | class IOFireWireBus;␊ |
45 | class IOFireWireController;␊ |
46 | class IOFireWireNub;␊ |
47 | class IOFWAddressSpace;␉// Description of chunk of local FW address space␊ |
48 | class IOFWCommand;␊ |
49 | class IOFWBusCommand;␊ |
50 | class IOFWAsyncStreamCommand;␊ |
51 | class IOCommandGate;␊ |
52 | class IOFWAsyncPHYCommand;␊ |
53 | ␊ |
54 | struct AsyncPendingTrans;␊ |
55 | ␊ |
56 | // Struct for head of command queue␊ |
57 | /*!␊ |
58 | @struct IOFWCmdQ␊ |
59 | @abstract Structure for head of a queue of IOFWCommands␊ |
60 | @field fHead Points to the head of the queue, or NULL if queue is empty␊ |
61 | @field fTail Points to the tail of the queue, or NULL if queue is empty␊ |
62 | @function headChanged called when head command is changed, or the command␊ |
63 | ␉itself changes state.␊ |
64 | */␊ |
65 | ␊ |
66 | struct IOFWCmdQ␊ |
67 | {␊ |
68 | IOFWCommand *fHead;␊ |
69 | IOFWCommand *fTail;␊ |
70 | bool executeQueue(bool all);␊ |
71 | virtual void headChanged(IOFWCommand *oldHead);␊ |
72 | ␉␊ |
73 | ␉virtual ~IOFWCmdQ() {}␊ |
74 | ␊ |
75 | ␉void checkProgress( void );␊ |
76 | };␊ |
77 | ␊ |
78 | // Callback when device command completes asynchronously␊ |
79 | typedef void (*FWDeviceCallback)(void *refcon, IOReturn status, IOFireWireNub *device, IOFWCommand *fwCmd);␊ |
80 | ␊ |
81 | // Callback when bus command completes asynchronously␊ |
82 | typedef void (*FWBusCallback)(void *refcon, IOReturn status, IOFireWireBus *bus, IOFWBusCommand *fwCmd);␊ |
83 | ␊ |
84 | // Callback when async stream command completes asynchronously␊ |
85 | typedef void (*FWAsyncStreamCallback)(void *refcon, IOReturn status, IOFireWireBus *bus, IOFWAsyncStreamCommand *fwCmd);␊ |
86 | ␊ |
87 | // Callback when async stream command completes asynchronously␊ |
88 | typedef void (*FWAsyncPHYCallback)(void *refcon, IOReturn status, IOFireWireBus *bus, IOFWAsyncPHYCommand *fwCmd );␊ |
89 | ␊ |
90 | // Callback when async stream packet is received␊ |
91 | typedef void (*FWAsyncStreamReceiveCallback)(void *refcon, const void *buf);␊ |
92 | ␊ |
93 | #pragma mark -␊ |
94 | ␊ |
95 | /*␊ |
96 | * Base class for FireWire commands␊ |
97 | */␊ |
98 | /*! @class IOFWCommand␊ |
99 | */␊ |
100 | class IOFWCommand : public IOCommand␊ |
101 | {␊ |
102 | OSDeclareAbstractStructors(IOFWCommand)␊ |
103 | ␊ |
104 | protected:␊ |
105 | IOReturn␉␉fStatus;␊ |
106 | IOFireWireController *fControl;␊ |
107 | IOFWCommand *␉fQueuePrev;␊ |
108 | IOFWCommand *␉fQueueNext;␊ |
109 | IOFWCmdQ *␉␉fQueue;␊ |
110 | UInt32␉␉␉fTimeout;␉// How long (in microsecs) after execute() to timeout␊ |
111 | AbsoluteTime␉fDeadline;␉// Time after which this command has timed out.␊ |
112 | IOFWSyncer *␉fSyncWakeup;␊ |
113 | UInt8␉␉␉fSync;␊ |
114 | UInt8␉␉␉fCancelOnReset;␊ |
115 | UInt8␉␉␉spare[2];␊ |
116 | ␊ |
117 | /*! @struct ExpansionData␊ |
118 | @discussion This structure will be used to expand the capablilties of the class in the future.␊ |
119 | */ ␊ |
120 | struct MemberVariables ␊ |
121 | ␉{␊ |
122 | ␉␉void *␉␉␉fFWIMRefCon;␊ |
123 | ␉␉IOReturn␉␉fCompletionStatus;␊ |
124 | ␉␉bool␉␉␉fSubmitTimeLatched;␊ |
125 | ␉ AbsoluteTime␉fSubmitTime;␊ |
126 | ␉␉bool␉␉␉fFlush;␊ |
127 | ␉};␊ |
128 | ␊ |
129 | /*! @var reserved␊ |
130 | Reserved for future use. (Internal use only) */␊ |
131 | MemberVariables * fMembers;␊ |
132 | ␊ |
133 | virtual IOReturn␉complete(IOReturn status);␊ |
134 | virtual void␉updateTimer();␊ |
135 | virtual IOReturn␉startExecution();␊ |
136 | ␊ |
137 | /*␉␊ |
138 | *␉Execute the FWCommand immediately␊ |
139 | *␉must be called with the workloop gate closed␊ |
140 | */␊ |
141 | virtual IOReturn␉execute() = 0;␊ |
142 | ␊ |
143 | public:␊ |
144 | ␊ |
145 | virtual bool␉initWithController(IOFireWireController *control);␊ |
146 | ␉virtual void␉free( void );␊ |
147 | ␉␊ |
148 | IOReturn␉␉getStatus() const { return fStatus; };␊ |
149 | ␊ |
150 | /*␉␊ |
151 | *␉Submit the FWCommand.␊ |
152 | *␉if queue is false the command's execute()␊ |
153 | *␉method will be called on the caller's thread, otherwise␊ |
154 | *␉the command wil be queued for execution on the work loop thread.␊ |
155 | */ ␊ |
156 | virtual IOReturn ␉submit(bool queue = false);␊ |
157 | ␊ |
158 | /*␊ |
159 | * Cancel command, causes it to complete with given status␊ |
160 | */␊ |
161 | virtual IOReturn␉cancel(IOReturn reason);␊ |
162 | ␊ |
163 | /*!␊ |
164 | @function setHead␊ |
165 | inserts a command at the head of a queue.␊ |
166 | @param queue queue command is being added to␊ |
167 | */␊ |
168 | virtual void setHead(IOFWCmdQ &queue);␊ |
169 | /*!␊ |
170 | @function insertAfter␊ |
171 | inserts a command after the specified one.␊ |
172 | @param prev command to insert after␊ |
173 | @param queue queue command is being added to␊ |
174 | */␊ |
175 | virtual void insertAfter(IOFWCommand &prev);␊ |
176 | ␊ |
177 | /*!␊ |
178 | @function removeFromQ␊ |
179 | Removes command from current queue.␊ |
180 | */␊ |
181 | virtual void removeFromQ();␊ |
182 | ␊ |
183 | IOFWCommand *getPrevious() const␊ |
184 | ␉{ return fQueuePrev; };␊ |
185 | IOFWCommand *getNext() const␊ |
186 | { return fQueueNext; };␊ |
187 | const AbsoluteTime &getDeadline() const␊ |
188 | ␉{ return fDeadline; };␊ |
189 | ␊ |
190 | bool cancelOnReset() const␊ |
191 | { return fCancelOnReset; };␊ |
192 | ␊ |
193 | bool Busy() const␊ |
194 | { return fStatus == kIOReturnBusy || fStatus == kIOFireWirePending;};␊ |
195 | ␊ |
196 | void setTimeout( UInt32 timeout )␊ |
197 | { fTimeout = timeout; };␊ |
198 | ␊ |
199 | friend class IOFWCmdQ;␊ |
200 | ␊ |
201 | ␉void * getFWIMRefCon( void )␊ |
202 | ␉{␊ |
203 | ␉␉return fMembers->fFWIMRefCon;␊ |
204 | ␉}␊ |
205 | ␉␊ |
206 | ␉void setFWIMRefCon( void * refcon )␊ |
207 | ␉{␊ |
208 | ␉␉fMembers->fFWIMRefCon = refcon;␊ |
209 | ␉}␊ |
210 | ␊ |
211 | ␉void setFlush( bool flush )␊ |
212 | ␉{␊ |
213 | ␉␉fMembers->fFlush = flush;␉␉␊ |
214 | ␉}␊ |
215 | ␉␊ |
216 | ␉virtual IOReturn checkProgress( void );␊ |
217 | ␉␊ |
218 | private:␊ |
219 | OSMetaClassDeclareReservedUsed(IOFWCommand, 0);␊ |
220 | OSMetaClassDeclareReservedUnused(IOFWCommand, 1);␊ |
221 | ␊ |
222 | };␊ |
223 | ␊ |
224 | #pragma mark -␊ |
225 | ␊ |
226 | /*␊ |
227 | * Bus control commands␊ |
228 | */␊ |
229 | /*! @class IOFWBusCommand␊ |
230 | */␊ |
231 | class IOFWBusCommand : public IOFWCommand␊ |
232 | {␊ |
233 | OSDeclareAbstractStructors(IOFWBusCommand)␊ |
234 | ␊ |
235 | protected:␊ |
236 | FWBusCallback␉fComplete;␊ |
237 | void *␉␉fRefCon;␊ |
238 | ␊ |
239 | /*! @struct ExpansionData␊ |
240 | @discussion This structure will be used to expand the capablilties of the class in the future.␊ |
241 | */ ␊ |
242 | struct ExpansionData { };␊ |
243 | ␊ |
244 | /*! @var reserved␊ |
245 | Reserved for future use. (Internal use only) */␊ |
246 | ExpansionData *reserved;␊ |
247 | ␊ |
248 | virtual IOReturn␉complete(IOReturn status);␊ |
249 | ␊ |
250 | virtual bool␉initWithController(IOFireWireController *control,␊ |
251 | ␉␉␉␉FWBusCallback completion=NULL, void *refcon=NULL);␊ |
252 | virtual IOReturn␉reinit(FWBusCallback completion, void *refcon);␊ |
253 | ␊ |
254 | private:␊ |
255 | OSMetaClassDeclareReservedUnused(IOFWBusCommand, 0);␊ |
256 | ␊ |
257 | };␊ |
258 | ␊ |
259 | #pragma mark -␊ |
260 | ␊ |
261 | /*␊ |
262 | * Command to execute some code after a specified delay (in microseconds)␊ |
263 | * All it does is timeout after the specified delay, hence calling the completion␊ |
264 | * callback.␊ |
265 | */␊ |
266 | /*! @class IOFWDelayCommand␊ |
267 | */␊ |
268 | class IOFWDelayCommand : public IOFWBusCommand␊ |
269 | {␊ |
270 | OSDeclareDefaultStructors(IOFWDelayCommand)␊ |
271 | ␊ |
272 | /*! @struct ExpansionData␊ |
273 | @discussion This structure will be used to expand the capablilties of the class in the future.␊ |
274 | */ ␊ |
275 | struct ExpansionData { };␊ |
276 | ␊ |
277 | /*! @var reserved␊ |
278 | Reserved for future use. (Internal use only) */␊ |
279 | ExpansionData *reserved;␊ |
280 | ␊ |
281 | protected:␊ |
282 | virtual IOReturn␉execute();␊ |
283 | ␊ |
284 | public:␊ |
285 | virtual bool␉initWithDelay(IOFireWireController *control, UInt32 uSecs,␊ |
286 | FWBusCallback completion, void *refcon);␊ |
287 | virtual IOReturn␉reinit(UInt32 uSecs, FWBusCallback completion, void *refcon);␊ |
288 | ␊ |
289 | private:␊ |
290 | OSMetaClassDeclareReservedUnused(IOFWDelayCommand, 0);␊ |
291 | ␊ |
292 | };␊ |
293 | ␊ |
294 | /*␊ |
295 | * Send an async request to a device␊ |
296 | */␊ |
297 | class IOFWUserReadQuadletCommand ;␊ |
298 | class IOFWUserWriteCommand ;␊ |
299 | ␊ |
300 | #pragma mark -␊ |
301 | ␊ |
302 | /*! @class IOFWAsyncCommand␊ |
303 | */␊ |
304 | class IOFWAsyncCommand : public IOFWCommand␊ |
305 | {␊ |
306 | ␉OSDeclareAbstractStructors(IOFWAsyncCommand)␊ |
307 | ␊ |
308 | protected:␊ |
309 | IOFireWireNub *␉fDevice;␊ |
310 | FWDeviceCallback␉fComplete;␊ |
311 | void *␉␉fRefCon;␊ |
312 | IOMemoryDescriptor *fMemDesc;␊ |
313 | AsyncPendingTrans *␉fTrans;␊ |
314 | UInt32␉␉fAddressHi;␊ |
315 | UInt32␉␉fAddressLo;␊ |
316 | IOByteCount␉␉fBytesTransferred;␊ |
317 | int␉␉␉fSize;␊ |
318 | int␉␉␉fSpeed;␊ |
319 | int␉␉␉fMaxPack;␊ |
320 | int␉␉␉fCurRetries;␊ |
321 | int␉␉␉fMaxRetries;␊ |
322 | UInt32␉␉fGeneration;␉// bus topology fNodeID is valid for.␊ |
323 | UInt16␉␉fNodeID;␊ |
324 | bool␉␉fFailOnReset;␊ |
325 | bool␉␉fWrite;␊ |
326 | ␊ |
327 | ␉typedef struct ␊ |
328 | ␉{ ␊ |
329 | ␉␉// some of our subclasses didn't have room for expansion data, so␊ |
330 | ␉␉// we've reserved space for their use here.␊ |
331 | ␉␉␊ |
332 | ␉␉void *␉␉␉fSubclassMembers;␊ |
333 | ␉␉int␉␉␉␉fMaxSpeed;␊ |
334 | ␉␉int␉␉␉␉fAckCode;␊ |
335 | ␉␉UInt32␉␉␉fResponseCode;␊ |
336 | ␉␉UInt32␉␉␉fFastRetryCount;␊ |
337 | ␉␉int␉␉␉␉fResponseSpeed;␊ |
338 | ␉␉bool␉␉␉fForceBlockRequests;␊ |
339 | ␉} ␊ |
340 | ␉MemberVariables;␊ |
341 | ␊ |
342 | MemberVariables * fMembers;␊ |
343 | ␊ |
344 | virtual IOReturn␉complete(IOReturn status);␊ |
345 | ␉virtual bool␉initWithController(IOFireWireController *control);␊ |
346 | virtual bool␉initAll(IOFireWireNub *device, FWAddress devAddress,␊ |
347 | ␉␉␉␉IOMemoryDescriptor *hostMem,␊ |
348 | ␉␉␉␉FWDeviceCallback completion, void *refcon, bool failOnReset);␊ |
349 | virtual bool␉initAll(IOFireWireController *control,␊ |
350 | UInt32 generation, FWAddress devAddress,␊ |
351 | IOMemoryDescriptor *hostMem,␊ |
352 | FWDeviceCallback completion, void *refcon);␊ |
353 | ␉virtual void free( void );␊ |
354 | virtual IOReturn␉reinit(FWAddress devAddress, IOMemoryDescriptor *hostMem,␊ |
355 | ␉␉␉␉FWDeviceCallback completion, void *refcon, bool failOnReset);␊ |
356 | virtual IOReturn␉reinit(UInt32 generation, FWAddress devAddress, IOMemoryDescriptor *hostMem,␊ |
357 | FWDeviceCallback completion, void *refcon);␊ |
358 | ␉bool createMemberVariables( void );␊ |
359 | ␉void destroyMemberVariables( void );␊ |
360 | public:␊ |
361 | ␉// Utility for setting generation on newly created command␊ |
362 | ␉virtual void␉setGeneration(UInt32 generation)␊ |
363 | ␉{ fGeneration = generation; }␊ |
364 | ␊ |
365 | // To be called by IOFireWireController and derived classes.␊ |
366 | virtual void ␉gotPacket(int rcode, const void* data, int size) = 0;␊ |
367 | virtual void␉gotAck(int ackCode);␊ |
368 | ␊ |
369 | // update nodeID/generation after bus reset, from the device object␊ |
370 | IOReturn␉␉updateGeneration();␊ |
371 | // explicitly update nodeID/generation after bus reset␊ |
372 | IOReturn␉␉updateNodeID(UInt32 generation, UInt16 nodeID);␊ |
373 | ␊ |
374 | // Generally useful stuff␊ |
375 | IOByteCount␉␉getBytesTransferred() const␊ |
376 | { return fBytesTransferred; };␊ |
377 | ␊ |
378 | FWAddress␉␉getAddress() const␊ |
379 | { return FWAddress(fAddressHi, fAddressLo, fNodeID); }␊ |
380 | ␊ |
381 | bool␉␉failOnReset() const␊ |
382 | { return fFailOnReset; }␊ |
383 | ␊ |
384 | IOFireWireNub *␉getDevice() const␊ |
385 | { return fDevice; }␊ |
386 | ␊ |
387 | /*!␊ |
388 | @function setMaxPacket␊ |
389 | Sets the maximum size for block transfers used by the command.␊ |
390 | The command is initialized to use the maximum packet size calculated from the device's␊ |
391 | PHY speed, bus info block and the bus topology.␊ |
392 | Call this method before calling submit().␊ |
393 | @param maxBytes Maximum packet size in bytes. If the maxsize is 4 then quadlet transfers will be used.␊ |
394 | */␊ |
395 | IOReturn␉setMaxPacket(UInt32 maxBytes)␊ |
396 | {␊ |
397 | if(fStatus == kIOReturnBusy || fStatus == kIOFireWirePending)␊ |
398 | return fStatus;␊ |
399 | fMaxPack = maxBytes;␊ |
400 | return kIOReturnSuccess;␊ |
401 | }␊ |
402 | ␊ |
403 | ␉void setMaxSpeed( int speed );␊ |
404 | ␉␊ |
405 | ␉void setAckCode( int ack );␊ |
406 | ␉int getAckCode( void );␊ |
407 | ␉␊ |
408 | ␉void setRetries( int retries);␊ |
409 | ␉int getMaxRetries( void );␊ |
410 | ␉␊ |
411 | ␉void setResponseCode( UInt32 rcode );␊ |
412 | ␉UInt32 getResponseCode( void ) const;␊ |
413 | ␊ |
414 | ␉void setFastRetryCount( UInt32 count ) ␊ |
415 | ␉␉{ fMembers->fFastRetryCount = count; };␊ |
416 | ␊ |
417 | ␉UInt32 getFastRetryCount( void ) ␊ |
418 | ␉␉{ return fMembers->fFastRetryCount; };␊ |
419 | ␉␉␊ |
420 | ␉void setResponseSpeed( int speed ) ␊ |
421 | ␉␉{ fMembers->fResponseSpeed = speed; };␊ |
422 | ␊ |
423 | ␉int getResponseSpeed( void ) ␊ |
424 | ␉␉{ return fMembers->fResponseSpeed; };␊ |
425 | ␊ |
426 | ␉// forces even 4 byte transactions to be block requests␊ |
427 | ␉void setForceBlockRequests( bool enabled )␊ |
428 | ␉␉{ fMembers->fForceBlockRequests = enabled; }␊ |
429 | ␊ |
430 | ␉virtual IOReturn checkProgress( void );␊ |
431 | ␉␉␉␊ |
432 | private:␊ |
433 | OSMetaClassDeclareReservedUnused(IOFWAsyncCommand, 0);␊ |
434 | OSMetaClassDeclareReservedUnused(IOFWAsyncCommand, 1);␊ |
435 | OSMetaClassDeclareReservedUnused(IOFWAsyncCommand, 2);␊ |
436 | OSMetaClassDeclareReservedUnused(IOFWAsyncCommand, 3);␊ |
437 | ␊ |
438 | };␊ |
439 | ␊ |
440 | #pragma mark -␊ |
441 | ␊ |
442 | /*␊ |
443 | * Concrete async requests - read, write and hordes of read/modify/write␊ |
444 | */␊ |
445 | class IOFWReadCommand : public IOFWAsyncCommand␊ |
446 | {␊ |
447 | OSDeclareDefaultStructors(IOFWReadCommand)␊ |
448 | ␊ |
449 | protected:␊ |
450 | ␉␊ |
451 | virtual void ␉gotPacket(int rcode, const void* data, int size);␊ |
452 | ␊ |
453 | virtual IOReturn␉execute();␊ |
454 | ␊ |
455 | public:␊ |
456 | virtual bool␉initAll(IOFireWireNub *device, FWAddress devAddress,␊ |
457 | ␉␉␉␉IOMemoryDescriptor *hostMem,␊ |
458 | ␉␉␉␉FWDeviceCallback completion, void *refcon, bool failOnReset);␊ |
459 | virtual bool␉initAll(IOFireWireController *control,␊ |
460 | UInt32 generation, FWAddress devAddress,␊ |
461 | IOMemoryDescriptor *hostMem,␊ |
462 | FWDeviceCallback completion, void *refcon);␊ |
463 | virtual IOReturn␉reinit(FWAddress devAddress, IOMemoryDescriptor *hostMem,␊ |
464 | ␉␉␉␉FWDeviceCallback completion=NULL, void *refcon=NULL,␊ |
465 | ␉␉␉␉bool failOnReset=false);␊ |
466 | virtual IOReturn␉reinit(UInt32 generation, FWAddress devAddress, IOMemoryDescriptor *hostMem,␊ |
467 | FWDeviceCallback completion=NULL, void *refcon=NULL);␊ |
468 | ␊ |
469 | private:␊ |
470 | OSMetaClassDeclareReservedUnused(IOFWReadCommand, 0);␊ |
471 | OSMetaClassDeclareReservedUnused(IOFWReadCommand, 1);␊ |
472 | };␊ |
473 | ␊ |
474 | #pragma mark -␊ |
475 | ␊ |
476 | /*!␊ |
477 | ␉@class IOFWReadQuadCommand␊ |
478 | ␉@discussion An easier to use version of IOFWReadCommand for use when the data to be transferred␊ |
479 | ␉is an integer number of quads.␊ |
480 | ␉Note that block read requests will be used for transfers greater than one quad unless setMaxPacket(4)␊ |
481 | ␉is called.␊ |
482 | */␊ |
483 | ␊ |
484 | class IOFWReadQuadCommand : public IOFWAsyncCommand␊ |
485 | {␊ |
486 | OSDeclareDefaultStructors(IOFWReadQuadCommand)␊ |
487 | ␊ |
488 | protected:␊ |
489 | ␊ |
490 | UInt32 *␉fQuads;␊ |
491 | ␊ |
492 | ␉typedef struct ␊ |
493 | ␉{ ␊ |
494 | ␉␉bool␉fPingTime;␊ |
495 | ␉}␊ |
496 | ␉MemberVariables;␊ |
497 | ␉␊ |
498 | ␉bool createMemberVariables( void );␊ |
499 | ␉void destroyMemberVariables( void );␊ |
500 | ␉virtual void free( void );␊ |
501 | ␉␊ |
502 | virtual void ␉gotPacket(int rcode, const void* data, int size);␊ |
503 | ␊ |
504 | virtual IOReturn␉execute();␊ |
505 | ␊ |
506 | public:␊ |
507 | virtual bool␉initAll(IOFireWireNub *device, FWAddress devAddress,␊ |
508 | ␉␉␉␉UInt32 *quads, int numQuads,␊ |
509 | ␉␉␉␉FWDeviceCallback completion, void *refcon, bool failOnReset);␊ |
510 | ␊ |
511 | virtual bool␉initAll(IOFireWireController *control,␊ |
512 | UInt32 generation, FWAddress devAddress,␊ |
513 | UInt32 *quads, int numQuads,␊ |
514 | FWDeviceCallback completion, void *refcon);␊ |
515 | ␊ |
516 | virtual IOReturn␉reinit(FWAddress devAddress, UInt32 *quads, int numQuads,␊ |
517 | ␉␉␉␉FWDeviceCallback completion=NULL, void *refcon=NULL,␊ |
518 | ␉␉␉␉bool failOnReset=false);␊ |
519 | ␊ |
520 | virtual IOReturn␉reinit(UInt32 generation, FWAddress devAddress, UInt32 *quads, int numQuads,␊ |
521 | FWDeviceCallback completion=NULL, void *refcon=NULL);␊ |
522 | ␊ |
523 | ␉void setPingTime( bool state ) ␊ |
524 | ␉␉{ ((MemberVariables*)fMembers->fSubclassMembers)->fPingTime = state; }; ␊ |
525 | ␊ |
526 | private:␊ |
527 | OSMetaClassDeclareReservedUnused(IOFWReadQuadCommand, 0);␊ |
528 | OSMetaClassDeclareReservedUnused(IOFWReadQuadCommand, 1);␊ |
529 | };␊ |
530 | ␊ |
531 | #pragma mark -␊ |
532 | ␊ |
533 | class IOFWWriteCommand : public IOFWAsyncCommand␊ |
534 | {␊ |
535 | ␊ |
536 | OSDeclareDefaultStructors(IOFWWriteCommand)␊ |
537 | ␊ |
538 | protected:␊ |
539 | ␊ |
540 | int␉␉␉fPackSize;␊ |
541 | ␉␊ |
542 | ␉typedef struct ␊ |
543 | ␉{ ␊ |
544 | ␉␉bool ␉fDeferredNotify;␊ |
545 | ␉␉bool␉fFastRetryOnBusy;␊ |
546 | ␉}␊ |
547 | ␉MemberVariables;␊ |
548 | ␉␉␊ |
549 | virtual IOReturn␉execute();␊ |
550 | ␊ |
551 | virtual void ␉gotPacket( int rcode, const void* data, int size );␊ |
552 | ␊ |
553 | ␉bool createMemberVariables( void );␊ |
554 | ␉void destroyMemberVariables( void );␊ |
555 | ␉␊ |
556 | public:␊ |
557 | ␊ |
558 | ␉virtual bool␉initWithController(IOFireWireController *control);␊ |
559 | virtual bool␉initAll(␉IOFireWireNub *␉␉␉device, ␊ |
560 | ␉␉␉␉␉␉␉␉FWAddress ␉␉␉␉devAddress,␊ |
561 | ␉␉␉␉␉␉␉␉IOMemoryDescriptor *␉hostMem,␊ |
562 | ␉␉␉␉␉␉␉␉FWDeviceCallback ␉␉completion, ␊ |
563 | ␉␉␉␉␉␉␉␉void *␉␉␉␉␉refcon, ␊ |
564 | ␉␉␉␉␉␉␉␉bool ␉␉␉␉␉failOnReset );␊ |
565 | ␉␉␉␉␉␉␉␉␊ |
566 | virtual bool␉initAll(␉IOFireWireController *␉control,␊ |
567 | UInt32 ␉␉␉␉␉generation, ␊ |
568 | ␉␉␉␉␉␉␉␉FWAddress ␉␉␉␉devAddress,␊ |
569 | IOMemoryDescriptor *␉hostMem,␊ |
570 | FWDeviceCallback ␉␉completion, ␊ |
571 | ␉␉␉␉␉␉␉␉void *␉␉␉␉␉refcon );␊ |
572 | ␉virtual void free( void );␊ |
573 | ␉␉␉␉␉␉␉␉␊ |
574 | virtual IOReturn␉reinit(␉FWAddress ␉␉␉␉devAddress, ␊ |
575 | ␉␉␉␉␉␉␉␉IOMemoryDescriptor *␉hostMem,␊ |
576 | ␉␉␉␉␉␉␉␉FWDeviceCallback ␉␉completion = NULL, ␊ |
577 | ␉␉␉␉␉␉␉␉void *␉␉␉␉␉refcon = NULL,␊ |
578 | ␉␉␉␉␉␉␉␉bool ␉␉␉␉␉failOnReset = false );␊ |
579 | ␉␉␉␉␉␉␉␉␊ |
580 | virtual IOReturn␉reinit(␉UInt32 ␉␉␉␉␉generation, ␊ |
581 | ␉␉␉␉␉␉␉␉FWAddress ␉␉␉␉devAddress, ␊ |
582 | ␉␉␉␉␉␉␉␉IOMemoryDescriptor *␉hostMem,␊ |
583 | FWDeviceCallback␉␉completion = NULL, ␊ |
584 | ␉␉␉␉␉␉␉␉void *␉␉␉␉␉refcon = NULL );␊ |
585 | ␊ |
586 | ␉void setDeferredNotify( bool state ) ␊ |
587 | ␉␉{ ((MemberVariables*)fMembers->fSubclassMembers)->fDeferredNotify = state; };␊ |
588 | ␊ |
589 | ␉void setFastRetryOnBusy( bool state ) ␊ |
590 | ␉␉{ ((MemberVariables*)fMembers->fSubclassMembers)->fFastRetryOnBusy = state; };␊ |
591 | ␉␊ |
592 | private:␊ |
593 | ␊ |
594 | OSMetaClassDeclareReservedUnused(IOFWWriteCommand, 0);␊ |
595 | OSMetaClassDeclareReservedUnused(IOFWWriteCommand, 1);␊ |
596 | ␊ |
597 | };␊ |
598 | ␊ |
599 | #pragma mark -␊ |
600 | ␊ |
601 | /*!␊ |
602 | ␉@class IOFWWriteQuadCommand␊ |
603 | ␉@discussion An easier to use version of IOFWWriteCommand for use when the data to be transferred␊ |
604 | ␉is small and an integer number of quads.␊ |
605 | ␉Note that block read requests will be used for transfers greater than one quad unless setMaxPacket(4)␊ |
606 | ␉is called.␊ |
607 | ␉kMaxWriteQuads is the largest legal number of quads that this object can be asked to transfer␊ |
608 | ␉(the data is copied into an internal buffer in init() and reinit()).␊ |
609 | */␊ |
610 | ␊ |
611 | class IOFWWriteQuadCommand : public IOFWAsyncCommand␊ |
612 | {␊ |
613 | ␊ |
614 | OSDeclareDefaultStructors(IOFWWriteQuadCommand)␊ |
615 | ␊ |
616 | public:␊ |
617 | ␊ |
618 | enum ␊ |
619 | ␉{␊ |
620 | kMaxWriteQuads = 8␊ |
621 | };␊ |
622 | ␊ |
623 | protected:␊ |
624 | ␊ |
625 | UInt32␉␉␉␉␉fQuads[kMaxWriteQuads];␊ |
626 | UInt32 *␉␉␉␉fQPtr;␊ |
627 | int␉␉␉␉␉␉fPackSize;␊ |
628 | ␉␊ |
629 | ␉typedef struct ␊ |
630 | ␉{ ␊ |
631 | ␉␉bool ␉␉␉␉␉fDeferredNotify;␊ |
632 | ␉␉IOMemoryDescriptor *␉fMemory;␊ |
633 | ␉} ␊ |
634 | ␉MemberVariables;␊ |
635 | ␉␊ |
636 | virtual void ␉gotPacket( int rcode, const void* data, int size );␊ |
637 | ␊ |
638 | virtual IOReturn␉execute();␊ |
639 | ␊ |
640 | ␉bool createMemberVariables( void );␊ |
641 | ␉void destroyMemberVariables( void );␊ |
642 | ␉␊ |
643 | public:␊ |
644 | ␉virtual bool␉initWithController(IOFireWireController *control);␊ |
645 | ␊ |
646 | ␉virtual bool␉initAll(␉IOFireWireNub *␉␉device, ␊ |
647 | ␉␉␉␉␉␉␉␉FWAddress ␉␉␉devAddress,␊ |
648 | ␉␉␉␉␉␉␉␉UInt32 *␉␉␉quads, ␊ |
649 | ␉␉␉␉␉␉␉␉int ␉␉␉␉numQuads,␊ |
650 | ␉␉␉␉␉␉␉␉FWDeviceCallback␉completion, ␊ |
651 | ␉␉␉␉␉␉␉␉void *␉␉␉␉refcon, ␊ |
652 | ␉␉␉␉␉␉␉␉bool ␉␉␉␉failOnReset );␊ |
653 | ␉␉␉␉␉␉␉␉␊ |
654 | virtual bool␉initAll(␉IOFireWireController *␉control,␊ |
655 | UInt32 ␉␉␉␉␉generation, ␊ |
656 | ␉␉␉␉␉␉␉␉FWAddress ␉␉␉␉devAddress,␊ |
657 | UInt32 *␉␉␉␉quads, ␊ |
658 | ␉␉␉␉␉␉␉␉int ␉␉␉␉␉numQuads,␊ |
659 | FWDeviceCallback ␉␉completion, ␊ |
660 | ␉␉␉␉␉␉␉␉void *␉␉␉␉␉refcon );␊ |
661 | ␊ |
662 | ␉virtual void free( void );␊ |
663 | ␊ |
664 | virtual IOReturn␉reinit(␉FWAddress ␉␉␉devAddress, ␊ |
665 | ␉␉␉␉␉␉␉␉UInt32 *␉␉␉quads, ␊ |
666 | ␉␉␉␉␉␉␉␉int ␉␉␉␉numQuads,␊ |
667 | ␉␉␉␉␉␉␉␉FWDeviceCallback␉completion = NULL, ␊ |
668 | ␉␉␉␉␉␉␉␉void *␉␉␉␉refcon = NULL,␊ |
669 | ␉␉␉␉␉␉␉␉bool ␉␉␉␉failOnReset = false );␊ |
670 | ␉␉␉␉␉␉␉␉␊ |
671 | virtual IOReturn␉reinit(␉UInt32 ␉␉␉␉generation, ␊ |
672 | ␉␉␉␉␉␉␉␉FWAddress ␉␉␉devAddress, ␊ |
673 | ␉␉␉␉␉␉␉␉UInt32 *␉␉␉quads, ␊ |
674 | ␉␉␉␉␉␉␉␉int ␉␉␉␉numQuads,␊ |
675 | FWDeviceCallback ␉completion = NULL, ␊ |
676 | ␉␉␉␉␉␉␉␉void *␉␉␉␉refcon = NULL );␊ |
677 | ␊ |
678 | protected:␊ |
679 | ␉␊ |
680 | ␉void setQuads( UInt32 * quads, int numQuads );␊ |
681 | ␉bool createMemoryDescriptor( void );␊ |
682 | ␉void destroyMemoryDescriptor( void );␊ |
683 | ␊ |
684 | public:␊ |
685 | ␊ |
686 | ␉void setDeferredNotify( bool state ) ␊ |
687 | ␉␉{ ((MemberVariables*)fMembers->fSubclassMembers)->fDeferredNotify = state; };␊ |
688 | ␉␊ |
689 | private:␊ |
690 | ␊ |
691 | ␉OSMetaClassDeclareReservedUnused(IOFWWriteQuadCommand, 0);␊ |
692 | OSMetaClassDeclareReservedUnused(IOFWWriteQuadCommand, 1);␊ |
693 | ␊ |
694 | };␊ |
695 | ␊ |
696 | /*␊ |
697 | * May need more parameters for some of these,␊ |
698 | * and/or derive from a base Lock transaction command␊ |
699 | */␊ |
700 | ␊ |
701 | #pragma mark -␊ |
702 | ␊ |
703 | /*! @class IOFWCompareAndSwapCommand␊ |
704 | */␊ |
705 | class IOFWCompareAndSwapCommand : public IOFWAsyncCommand␊ |
706 | {␊ |
707 | OSDeclareDefaultStructors(IOFWCompareAndSwapCommand)␊ |
708 | ␊ |
709 | protected:␊ |
710 | UInt32 ␉␉␉␉␉fInputVals[4];␊ |
711 | UInt32 ␉␉␉␉␉fOldVal[2];␊ |
712 | ␉␊ |
713 | ␉typedef struct ␊ |
714 | ␉{ ␊ |
715 | ␉␉IOMemoryDescriptor *␉fMemory;␊ |
716 | ␉} ␊ |
717 | ␉MemberVariables;␊ |
718 | ␉␊ |
719 | ␉MemberVariables * fMembers;␊ |
720 | ␊ |
721 | virtual void ␉gotPacket(int rcode, const void* data, int size);␊ |
722 | ␊ |
723 | virtual IOReturn␉execute();␊ |
724 | ␊ |
725 | public:␊ |
726 | // Compare to cmpVal, and if equal replace with newVal.␊ |
727 | // Size = 1 for 32 bit operation (one quad), 2 for 64 bit (two quads)␊ |
728 | ␉virtual bool␉initWithController(IOFireWireController *control);␊ |
729 | virtual bool␉initAll(IOFireWireNub *device, FWAddress devAddress,␊ |
730 | ␉␉␉␉const UInt32 *cmpVal, const UInt32 *newVal, int size,␊ |
731 | ␉␉␉␉FWDeviceCallback completion, void *refcon, bool failOnReset);␊ |
732 | virtual bool␉initAll(IOFireWireController *control,␊ |
733 | UInt32 generation, FWAddress devAddress,␊ |
734 | const UInt32 *cmpVal, const UInt32 *newVal, int size,␊ |
735 | FWDeviceCallback completion, void *refcon);␊ |
736 | ␊ |
737 | virtual IOReturn␉reinit(FWAddress devAddress, const UInt32 *cmpVal, const UInt32 *newVal, int size,␊ |
738 | FWDeviceCallback completion=NULL, void *refcon=NULL, bool failOnReset=false);␊ |
739 | virtual IOReturn␉reinit(UInt32 generation, FWAddress devAddress,␊ |
740 | const UInt32 *cmpVal, const UInt32 *newVal, int size,␊ |
741 | FWDeviceCallback completion=NULL, void *refcon=NULL);␊ |
742 | ␊ |
743 | // sets oldVal to the old value returned by the device, and␊ |
744 | // returns true if it was the expected value, ie. the lock succeeded␊ |
745 | virtual bool␉locked(UInt32 *oldVal);␊ |
746 | ␊ |
747 | ␉virtual void free( void );␊ |
748 | ␊ |
749 | protected:␊ |
750 | ␊ |
751 | ␉bool createMemberVariables( void );␊ |
752 | ␉void destroyMemberVariables( void );␊ |
753 | ␉␊ |
754 | ␉void setInputVals( const UInt32 *␉cmpVal, const UInt32 * newVal, int size );␊ |
755 | ␊ |
756 | ␉bool createMemoryDescriptor( void );␊ |
757 | ␉void destroyMemoryDescriptor( void );␊ |
758 | ␊ |
759 | private:␊ |
760 | OSMetaClassDeclareReservedUnused(IOFWCompareAndSwapCommand, 0);␊ |
761 | OSMetaClassDeclareReservedUnused(IOFWCompareAndSwapCommand, 1);␊ |
762 | OSMetaClassDeclareReservedUnused(IOFWCompareAndSwapCommand, 2);␊ |
763 | OSMetaClassDeclareReservedUnused(IOFWCompareAndSwapCommand, 3);␊ |
764 | ␊ |
765 | };␊ |
766 | ␊ |
767 | /*␊ |
768 | * Send an async stream packet␊ |
769 | */␊ |
770 | ␊ |
771 | #pragma mark -␊ |
772 | ␊ |
773 | /*! @class IOFWAsyncStreamCommand␊ |
774 | */␊ |
775 | class IOFWAsyncStreamCommand : public IOFWCommand␊ |
776 | {␊ |
777 | ␉// temporary for debugging:␊ |
778 | ␉friend class IOFireWireUserClient ;␊ |
779 | ␊ |
780 | ␉OSDeclareDefaultStructors(IOFWAsyncStreamCommand)␊ |
781 | ␊ |
782 | protected:␊ |
783 | FWAsyncStreamCallback␉fComplete;␊ |
784 | void *␉␉␉␉␉fRefCon;␊ |
785 | IOMemoryDescriptor ␉␉* fMemDesc;␊ |
786 | int␉␉␉␉␉␉fSpeed;␊ |
787 | int␉␉␉␉␉␉fSize;␊ |
788 | int␉␉␉␉␉␉fCurRetries;␊ |
789 | int␉␉␉␉␉␉fMaxRetries;␊ |
790 | int␉␉␉␉␉␉fChannel;␊ |
791 | int␉␉␉␉␉␉fSyncBits;␊ |
792 | int␉␉␉␉␉␉fTag;␊ |
793 | UInt32␉␉␉␉␉fGeneration;␉// bus topology fNodeID is valid for.␊ |
794 | bool␉␉␉␉␉fFailOnReset;␊ |
795 | ␊ |
796 | ␉typedef struct ␊ |
797 | ␉{ ␉} ␊ |
798 | ␉MemberVariables;␊ |
799 | ␊ |
800 | MemberVariables * fMembers;␉␉␊ |
801 | ␉␊ |
802 | virtual IOReturn␉complete(␊ |
803 | ␉␉␉␉␉␉␉IOReturn ␉␉␉␉status);␊ |
804 | ␉␉␉␉␉␉␉␊ |
805 | ␉// To be called by IOFireWireController and derived classes.␊ |
806 | virtual IOReturn␉execute();␊ |
807 | ␊ |
808 | public:␊ |
809 | ␊ |
810 | virtual bool␉␉initAll(␊ |
811 | ␉␉␉␉␉␉␉IOFireWireController ␉* control,␊ |
812 | UInt32 ␉␉␉␉␉generation, ␊ |
813 | UInt32 ␉␉␉␉␉channel,␊ |
814 | UInt32 ␉␉␉␉␉sync,␊ |
815 | UInt32 ␉␉␉␉␉tag,␊ |
816 | IOMemoryDescriptor ␉␉* hostMem,␊ |
817 | UInt32␉␉␉␉␉size,␊ |
818 | int␉␉␉␉␉␉speed,␊ |
819 | FWAsyncStreamCallback␉completion,␊ |
820 | void ␉␉␉␉␉* refcon);␊ |
821 | ␊ |
822 | ␉virtual void free( void );␊ |
823 | ␊ |
824 | virtual IOReturn␉reinit(␉UInt32 ␉␉␉␉␉generation, ␊ |
825 | UInt32 ␉␉␉␉␉channel,␊ |
826 | UInt32 ␉␉␉␉␉sync,␊ |
827 | UInt32 ␉␉␉␉␉tag,␊ |
828 | IOMemoryDescriptor ␉␉* hostMem,␊ |
829 | UInt32␉␉␉␉␉size,␊ |
830 | int␉␉␉␉␉␉speed,␊ |
831 | ␉FWAsyncStreamCallback␉completion,␊ |
832 | void ␉␉␉␉␉* refcon);␊ |
833 | ␉␉␉␉␉␉␉␉␊ |
834 | virtual void␉␉␉␉gotAck(␊ |
835 | ␉␉␉␉␉␉␉int ␉␉␉␉␉ackCode);␊ |
836 | ␉// Utility for setting generation on newly created command␊ |
837 | ␉virtual void␉␉␉␉setGeneration(␊ |
838 | ␉␉␉␉␉␉␉␉UInt32 ␉␉␉␉␉generation)␊ |
839 | ␉{ fGeneration = generation; }␊ |
840 | ␊ |
841 | ␊ |
842 | // update nodeID/generation after bus reset, from the device object␊ |
843 | IOReturn␉␉updateGeneration();␊ |
844 | ␊ |
845 | bool␉␉failOnReset() const␊ |
846 | { return fFailOnReset; }␊ |
847 | ␊ |
848 | private:␊ |
849 | OSMetaClassDeclareReservedUnused(IOFWAsyncStreamCommand, 0);␊ |
850 | OSMetaClassDeclareReservedUnused(IOFWAsyncStreamCommand, 1);␊ |
851 | ␊ |
852 | public:␊ |
853 | virtual bool␉␉initAll(␊ |
854 | ␉␉␉␉␉␉␉IOFireWireController ␉* control,␊ |
855 | UInt32 ␉␉␉␉␉generation, ␊ |
856 | UInt32 ␉␉␉␉␉channel,␊ |
857 | UInt32 ␉␉␉␉␉sync,␊ |
858 | UInt32 ␉␉␉␉␉tag,␊ |
859 | IOMemoryDescriptor ␉␉* hostMem,␊ |
860 | UInt32␉␉␉␉␉size,␊ |
861 | int␉␉␉␉␉␉speed,␊ |
862 | FWAsyncStreamCallback␉completion,␊ |
863 | void ␉␉␉␉␉* refcon,␊ |
864 | ␉␉␉␉␉␉␉␉bool␉␉␉␉␉failOnReset );␊ |
865 | ␉␉␉␉␉␉␉␉␊ |
866 | ␊ |
867 | ␉virtual IOReturn␉reinit(␊ |
868 | ␉␉␉␉␉␉␉␉UInt32 ␉␉␉␉␉generation, ␊ |
869 | UInt32 ␉␉␉␉␉channel,␊ |
870 | UInt32 ␉␉␉␉␉sync,␊ |
871 | UInt32 ␉␉␉␉␉tag,␊ |
872 | IOMemoryDescriptor ␉␉* hostMem,␊ |
873 | UInt32␉␉␉␉␉size,␊ |
874 | int␉␉␉␉␉␉speed,␊ |
875 | FWAsyncStreamCallback ␉completion,␊ |
876 | void ␉␉␉␉␉* refcon,␊ |
877 | ␉␉␉␉␉␉␉␉bool␉␉␉␉␉failOnReset);␊ |
878 | ␉␊ |
879 | ␊ |
880 | };␊ |
881 | ␊ |
882 | /*␊ |
883 | * Send an async PHY packet␊ |
884 | */␊ |
885 | ␊ |
886 | #pragma mark -␊ |
887 | ␊ |
888 | /*! @class IOFWAsyncPHYCommand␊ |
889 | */␊ |
890 | class IOFWAsyncPHYCommand : public IOFWCommand␊ |
891 | {␊ |
892 | ␉// temporary for debugging:␊ |
893 | ␉friend class IOFireWireUserClient;␊ |
894 | ␊ |
895 | ␉OSDeclareDefaultStructors( IOFWAsyncPHYCommand )␊ |
896 | ␊ |
897 | protected:␊ |
898 | ␉AsyncPendingTrans *␉␉fTrans;␊ |
899 | FWAsyncPHYCallback␉␉fComplete;␊ |
900 | void *␉␉␉␉␉fRefCon;␊ |
901 | int␉␉␉␉␉␉fCurRetries;␊ |
902 | int␉␉␉␉␉␉fMaxRetries;␊ |
903 | UInt32␉␉␉␉␉fGeneration;␊ |
904 | bool␉␉␉␉␉fFailOnReset;␊ |
905 | ␉UInt32␉␉␉␉␉fData1;␊ |
906 | ␉UInt32␉␉␉␉␉fData2;␊ |
907 | ␉int␉␉␉␉␉␉fAckCode;␊ |
908 | ␉UInt32␉␉␉␉␉fResponseCode;␊ |
909 | ␉␉␊ |
910 | ␉typedef struct ␊ |
911 | ␉{ ␉} ␊ |
912 | ␉MemberVariables;␊ |
913 | ␊ |
914 | MemberVariables * fMembers;␉␉␊ |
915 | ␉␊ |
916 | virtual IOReturn␉complete(␊ |
917 | ␉␉␉␉␉␉␉IOReturn ␉␉␉␉status );␊ |
918 | ␉␉␉␉␉␉␉␊ |
919 | ␉// To be called by IOFireWireController and derived classes.␊ |
920 | virtual IOReturn␉execute();␊ |
921 | ␊ |
922 | ␉void setResponseCode( UInt32 rcode );␊ |
923 | ␉void setAckCode( int ack );␊ |
924 | ␊ |
925 | public:␊ |
926 | ␊ |
927 | virtual bool␉␉initAll(␊ |
928 | ␉␉␉␉␉␉␉IOFireWireController ␉* control,␊ |
929 | UInt32 ␉␉␉␉␉generation, ␊ |
930 | UInt32␉␉␉␉␉data1,␊ |
931 | ␉␉␉␉␉␉␉␉UInt32␉␉␉␉␉data2,␊ |
932 | FWAsyncPHYCallback␉␉completion,␊ |
933 | void ␉␉␉␉␉* refcon,␊ |
934 | ␉␉␉␉␉␉␉␉bool ␉␉␉␉␉failOnReset );␊ |
935 | ␉virtual void free( void );␊ |
936 | ␊ |
937 | virtual IOReturn␉reinit(␉UInt32 ␉␉␉␉␉generation, ␊ |
938 | ␉␉␉␉␉␉␉␉UInt32␉␉␉␉␉data1,␊ |
939 | ␉␉␉␉␉␉␉␉UInt32␉␉␉␉␉data2,␊ |
940 | ␉FWAsyncPHYCallback␉␉completion,␊ |
941 | void ␉␉␉␉␉* refcon,␊ |
942 | ␉␉␉␉␉␉␉␉bool ␉␉␉␉␉failOnReset );␊ |
943 | ␊ |
944 | virtual void␉␉␉␉gotAck(␊ |
945 | ␉␉␉␉␉␉␉int ␉␉␉␉␉ackCode );␊ |
946 | ␉␉␉␉␉␉␉␉␊ |
947 | ␉// Utility for setting generation on newly created command␊ |
948 | ␉virtual void␉␉␉␉setGeneration(␊ |
949 | ␉␉␉␉␉␉␉␉UInt32 ␉␉␉␉␉generation )␊ |
950 | ␉␉␉{ fGeneration = generation; }␊ |
951 | ␊ |
952 | ␊ |
953 | // update nodeID/generation after bus reset, from the device object␊ |
954 | IOReturn␉␉updateGeneration();␊ |
955 | ␊ |
956 | bool␉␉failOnReset() const␊ |
957 | ␉␉{ return fFailOnReset; }␊ |
958 | ␊ |
959 | ␊ |
960 | ␉virtual void gotPacket( int rcode );␊ |
961 | ␊ |
962 | ␉int getAckCode( void );␊ |
963 | ␉UInt32 getResponseCode( void ) const;␊ |
964 | ␊ |
965 | ␉void setRetries( int retries);␊ |
966 | private:␊ |
967 | OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 0);␊ |
968 | OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 1);␊ |
969 | OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 2);␊ |
970 | OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 3);␊ |
971 | OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 4);␊ |
972 | OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 5);␊ |
973 | OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 6);␊ |
974 | OSMetaClassDeclareReservedUnused(IOFWAsyncPHYCommand, 7);␊ |
975 | };␊ |
976 | ␊ |
977 | #endif /* _IOKIT_IOFWCOMMAND_H */␊ |
978 |