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) 2008 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 | #ifndef _IOKIT_IOFIREWIREMULTIISOCHRECEIVE_H_␊ |
24 | #define _IOKIT_IOFIREWIREMULTIISOCHRECEIVE_H_␊ |
25 | ␊ |
26 | class IOFireWireMultiIsochReceiveListener;␊ |
27 | class IOFireWireMultiIsochReceivePacket;␊ |
28 | class IOFireWireController;␊ |
29 | ␊ |
30 | typedef IOReturn (*FWMultiIsochReceiveListenerCallback)(void *refcon, IOFireWireMultiIsochReceivePacket *pPacket);␊ |
31 | ␊ |
32 | // These are the parameters clients can set which help us to optimize the mult-isoch-receiver ␊ |
33 | // polling interval, and memory resources ␊ |
34 | typedef struct FWMultiIsochReceiveListenerParamsStruct␊ |
35 | ␉{␊ |
36 | ␉␉// How much latency, from when the packet arrives to when the client is notified, can the client tolerate. ␊ |
37 | ␉␉UInt32 maxLatencyInFireWireCycles;␊ |
38 | ␉␉␊ |
39 | ␉␉// In bits per second, the expected bit-rate of the incoming stream␊ |
40 | ␉␉UInt32 expectedStreamBitRate;␊ |
41 | ␉␉␊ |
42 | ␉␉// How long does the client expect to hold onto packets objects before returning them back to the receiver␊ |
43 | ␉␉UInt32 clientPacketReturnLatencyInFireWireCycles;␊ |
44 | ␉}FWMultiIsochReceiveListenerParams;␊ |
45 | ␊ |
46 | /*! @class IOFireWireMultiIsochReceiveListener␊ |
47 | */␊ |
48 | ␊ |
49 | class IOFireWireMultiIsochReceiveListener : public OSObject␊ |
50 | ␉{␊ |
51 | ␉␉friend class IOFireWireLink;␊ |
52 | ␉␉␊ |
53 | ␉protected:␊ |
54 | ␉␉OSDeclareDefaultStructors(IOFireWireMultiIsochReceiveListener)␊ |
55 | ␉␉bool init(IOFireWireController *fwController,␊ |
56 | ␉␉␉␉ UInt32 receiveChannel,␊ |
57 | ␉␉␉␉ FWMultiIsochReceiveListenerCallback callback,␊ |
58 | ␉␉␉␉ void *pCallbackRefCon,␊ |
59 | ␉␉␉␉ FWMultiIsochReceiveListenerParams *pListenerParams);␊ |
60 | ␉␉void free();␊ |
61 | ␉public:␊ |
62 | ␉␉static IOFireWireMultiIsochReceiveListener *create(IOFireWireController *fwController,␊ |
63 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ UInt32 channel,␊ |
64 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ FWMultiIsochReceiveListenerCallback callback,␊ |
65 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ void *pCallbackRefCon,␊ |
66 | ␉␉␉␉␉␉␉␉␉␉␉␉␉␉ FWMultiIsochReceiveListenerParams *pListenerParams);␊ |
67 | ␉␉␊ |
68 | ␉␉// Call this to activate the listener␊ |
69 | ␉␉IOReturn Activate();␊ |
70 | ␉␉␊ |
71 | ␉␉// Call this to deactivate the listener␊ |
72 | ␉␉IOReturn Deactivate();␊ |
73 | ␉␉␊ |
74 | ␉␉// Call this to modify the callback/refcon pointers. Only call this when not activated!␊ |
75 | ␉␉IOReturn SetCallback(FWMultiIsochReceiveListenerCallback callback,␊ |
76 | ␉␉␉␉␉␉␉ void *pCallbackRefCon);␊ |
77 | ␉␉␊ |
78 | ␉␉// Accessors␊ |
79 | ␉␉inline UInt32 getReceiveChannel(void) {return fChannel;};␊ |
80 | ␉␉inline FWMultiIsochReceiveListenerCallback getCallback(void){return fClientCallback;}; ␊ |
81 | ␉␉inline void * getRefCon(void){return fClientCallbackRefCon;};␊ |
82 | ␉␉inline bool getActivatedState(void) {return fActivated;};␊ |
83 | ␉␉␊ |
84 | ␉protected:␊ |
85 | ␉␉IOFireWireController *fControl;␊ |
86 | ␉␉UInt32 fChannel;␊ |
87 | ␉␉FWMultiIsochReceiveListenerCallback fClientCallback;␊ |
88 | ␉␉void *fClientCallbackRefCon;␊ |
89 | ␉␉bool fActivated;␊ |
90 | ␉␉FWMultiIsochReceiveListenerParams *fListenerParams;␊ |
91 | ␉};␊ |
92 | ␊ |
93 | #define kMaxRangesPerMultiIsochReceivePacket 6␊ |
94 | ␊ |
95 | /*! @class IOFireWireMultiIsochReceivePacket␊ |
96 | */␊ |
97 | ␊ |
98 | class IOFireWireMultiIsochReceivePacket : public OSObject␊ |
99 | ␉{␊ |
100 | ␉␉OSDeclareDefaultStructors(IOFireWireMultiIsochReceivePacket)␊ |
101 | ␉␉bool init(IOFireWireController *fwController);␊ |
102 | ␉␉void free();␊ |
103 | ␉public:␊ |
104 | ␉␉static IOFireWireMultiIsochReceivePacket *create(IOFireWireController *fwController);␊ |
105 | ␉␉␊ |
106 | ␉␉// The clients who are passed this packet by the ␊ |
107 | ␉␉// multi-isoch receiver calling their callback␊ |
108 | ␉␉// MUST call clientDone() on this packet to␊ |
109 | ␉␉// return it back for reuse!␊ |
110 | ␉␉void clientDone(void);␊ |
111 | ␉␉␊ |
112 | ␉␉UInt32 isochChannel(void);␊ |
113 | ␉␉UInt32 packetReceiveTime(void);␊ |
114 | ␉␉␊ |
115 | ␉␉UInt32 isochPayloadSize(void);␉// The size of just the isoch payload, not including header/trailer quads.␊ |
116 | ␉␉inline UInt32 isochPacketSize(void) {return isochPayloadSize()+8; };␉// The size of the packet, including header/trailer quads.␊ |
117 | ␉␉␊ |
118 | ␉␉// This returns a memory descriptor to the client. The client must call complete(), and release() on the␊ |
119 | ␉␉// memory descriptor when done.␊ |
120 | ␉␉IOMemoryDescriptor *createMemoryDescriptorForRanges(void);␊ |
121 | ␉␉␊ |
122 | ␉␉// These should be treated as read-only by clients,␊ |
123 | ␉␉// as should the data contained in these buffers!␊ |
124 | ␉␉IOAddressRange ranges[kMaxRangesPerMultiIsochReceivePacket] ;␊ |
125 | ␉␉UInt32 numRanges;␊ |
126 | ␉␉␊ |
127 | ␉␉// These should be treated private for clients!␊ |
128 | ␉␉// Messing with them will screw up the bookkeepping␊ |
129 | ␉␉// in the Multi-Isoch Receiver!␊ |
130 | ␉␉UInt32 numClientReferences;␊ |
131 | ␉␉void* elements[kMaxRangesPerMultiIsochReceivePacket];␊ |
132 | ␉␉␊ |
133 | ␉protected:␊ |
134 | ␉␉IOFireWireController *fControl;␊ |
135 | ␉};␊ |
136 | ␊ |
137 | #endif |