IOFWAsyncStreamReceiver.h [plain text]
#ifndef _IOKIT_IOFWASYNCSTREAMRECEIVER_H
#define _IOKIT_IOFWASYNCSTREAMRECEIVER_H
#include <IOKit/firewire/IOFireWireLink.h>
#include <IOKit/firewire/IOFWCommand.h>
#include <IOKit/IOBufferMemoryDescriptor.h>
#include <IOKit/firewire/IOFWDCLProgram.h>
const int kMaxAsyncStreamReceiveBuffers = 9;
const int kMaxAsyncStreamReceiveBufferSize = 4096;
class IOFWAsyncStreamReceiver;
class IOFWAsyncStreamReceivePort;
class IOFWAsyncStreamReceiver : public OSObject
{
OSDeclareDefaultStructors(IOFWAsyncStreamReceiver)
friend class IOFWAsyncStreamListener;
public:
bool initAll( IOFireWireController *control, UInt32 channel );
IOReturn activate( IOFWSpeed broadcastSpeed );
IOReturn deactivate();
inline UInt16 getOverrunCounter() { return fIsoRxOverrun; };
inline bool listens ( UInt32 channel ) { return ( fChannel == channel ); };
inline bool receiverActive() { return fActive; };
inline bool receiverInitialized() { return fInitialized; };
bool addListener ( IOFWAsyncStreamListener *listener );
void removeListener ( IOFWAsyncStreamListener *listener );
void restart( );
static void receiveAsyncStream( DCLCommandStruct *dclProgram );
static IOReturn receiveAsyncStream(void *refcon, IOFireWireMultiIsochReceivePacket *pPacket);
UInt32 getClientsCount();
protected:
typedef struct
{
void *obj;
void *thisObj;
UInt8 *buffer;
UInt16 index;
} FWAsyncStreamReceiveRefCon ;
typedef struct FWAsyncStreamReceiveSegment
{
DCLLabelPtr pSegmentLabelDCL;
DCLJumpPtr pSegmentJumpDCL;
}FWAsyncStreamReceiveSegment, *FWAsyncStreamReceiveSegmentPtr;
struct ExpansionData { };
ExpansionData *reserved;
virtual void free();
private :
IOBufferMemoryDescriptor *fBufDesc;
DCLCommandStruct *fdclProgram;
IOFWAsyncStreamReceivePort *fAsynStreamPort;
IOFWIsochChannel *fAsyncStreamChan;
IODCLProgram *fIODclProgram;
IOFireWireController *fControl;
IOFireWireLink *fFWIM;
bool fActive;
bool fInitialized;
UInt32 fChannel;
IOFWSpeed fSpeed;
UInt32 fSegment;
FWAsyncStreamReceiveSegment *fReceiveSegmentInfoPtr;
DCLLabel *fDCLOverrunLabelPtr;
UInt16 fIsoRxOverrun;
UInt16 fIsoRxCallbacks;
IORecursiveLock *rxCommandLock;
OSSet *fAsyncStreamClients;
OSIterator *fAsyncStreamClientIterator;
IOFireWireMultiIsochReceiveListener *fListener;
DCLCommandStruct *CreateAsyncStreamRxDCLProgram( DCLCallCommandProc* proc,
void *callbackObject);
IOFWAsyncStreamReceivePort *CreateAsyncStreamPort( bool talking,
DCLCommandStruct *opcodes,
void *info,
UInt32 startEvent,
UInt32 startState,
UInt32 startMask,
UInt32 channel);
static void overrunNotification( DCLCommandStruct *callProc );
static IOReturn forceStopNotification( void* refCon, IOFWIsochChannel* channel, UInt32 stopCondition );
void FreeAsyncStreamRxDCLProgram( DCLCommandStruct *dclProgram );
void fixDCLJumps( bool restart );
void removeAllListeners();
void indicateListeners ( UInt8 *buffer );
IOReturn modifyDCLJumps( DCLCommandStruct *callProc );
OSMetaClassDeclareReservedUnused(IOFWAsyncStreamReceiver, 0);
OSMetaClassDeclareReservedUnused(IOFWAsyncStreamReceiver, 1);
};
#endif // _IOKIT_IOFWASYNCSTREAMRECEIVER_H