Chameleon

Chameleon Svn Source Tree

Root/branches/JrCs/i386/include/IOKit/firewire/IOFireWireMultiIsochReceive.h

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
26class IOFireWireMultiIsochReceiveListener;
27class IOFireWireMultiIsochReceivePacket;
28class IOFireWireController;
29
30typedef 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
34typedef struct FWMultiIsochReceiveListenerParamsStruct
35{
36// How much latency, from when the packet arrives to when the client is notified, can the client tolerate.
37UInt32 maxLatencyInFireWireCycles;
38
39// In bits per second, the expected bit-rate of the incoming stream
40UInt32 expectedStreamBitRate;
41
42// How long does the client expect to hold onto packets objects before returning them back to the receiver
43UInt32 clientPacketReturnLatencyInFireWireCycles;
44}FWMultiIsochReceiveListenerParams;
45
46/*! @class IOFireWireMultiIsochReceiveListener
47*/
48
49class IOFireWireMultiIsochReceiveListener : public OSObject
50{
51friend class IOFireWireLink;
52
53protected:
54OSDeclareDefaultStructors(IOFireWireMultiIsochReceiveListener)
55bool init(IOFireWireController *fwController,
56 UInt32 receiveChannel,
57 FWMultiIsochReceiveListenerCallback callback,
58 void *pCallbackRefCon,
59 FWMultiIsochReceiveListenerParams *pListenerParams);
60void free();
61public:
62static IOFireWireMultiIsochReceiveListener *create(IOFireWireController *fwController,
63 UInt32 channel,
64 FWMultiIsochReceiveListenerCallback callback,
65 void *pCallbackRefCon,
66 FWMultiIsochReceiveListenerParams *pListenerParams);
67
68// Call this to activate the listener
69IOReturn Activate();
70
71// Call this to deactivate the listener
72IOReturn Deactivate();
73
74// Call this to modify the callback/refcon pointers. Only call this when not activated!
75IOReturn SetCallback(FWMultiIsochReceiveListenerCallback callback,
76 void *pCallbackRefCon);
77
78// Accessors
79inline UInt32 getReceiveChannel(void) {return fChannel;};
80inline FWMultiIsochReceiveListenerCallback getCallback(void){return fClientCallback;};
81inline void * getRefCon(void){return fClientCallbackRefCon;};
82inline bool getActivatedState(void) {return fActivated;};
83
84protected:
85IOFireWireController *fControl;
86UInt32 fChannel;
87FWMultiIsochReceiveListenerCallback fClientCallback;
88void *fClientCallbackRefCon;
89bool fActivated;
90FWMultiIsochReceiveListenerParams *fListenerParams;
91};
92
93#define kMaxRangesPerMultiIsochReceivePacket 6
94
95/*! @class IOFireWireMultiIsochReceivePacket
96*/
97
98class IOFireWireMultiIsochReceivePacket : public OSObject
99{
100OSDeclareDefaultStructors(IOFireWireMultiIsochReceivePacket)
101bool init(IOFireWireController *fwController);
102void free();
103public:
104static 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!
110void clientDone(void);
111
112UInt32 isochChannel(void);
113UInt32 packetReceiveTime(void);
114
115UInt32 isochPayloadSize(void);// The size of just the isoch payload, not including header/trailer quads.
116inline 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.
120IOMemoryDescriptor *createMemoryDescriptorForRanges(void);
121
122// These should be treated as read-only by clients,
123// as should the data contained in these buffers!
124IOAddressRange ranges[kMaxRangesPerMultiIsochReceivePacket] ;
125UInt32 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!
130UInt32 numClientReferences;
131void* elements[kMaxRangesPerMultiIsochReceivePacket];
132
133protected:
134IOFireWireController *fControl;
135};
136
137#endif

Archive Download this file

Revision: 1466