IOFireWireLibIsochPort.h [plain text]
#import "IOFireWireLibIUnknown.h"
#import "IOFireWireLibPriv.h"
#import <IOKit/firewire/IOFireWireLibIsoch.h>
#import <pthread.h>
namespace IOFireWireLib {
class IsochChannel ;
class Device ;
class CoalesceTree ;
#pragma mark -
class IsochPort: public IOFireWireIUnknown
{
friend class IsochChannel ;
public:
IsochPort( const IUnknownVTbl & interface, Device & userclient,
bool talking, bool allocateKernPort ) ;
virtual ~IsochPort() ;
public:
virtual IOReturn GetSupported( IOFWSpeed & maxSpeed, UInt64 & chanSupported ) ;
virtual IOReturn AllocatePort( IOFWSpeed speed, UInt32 chan ) ;
virtual IOReturn ReleasePort() ;
virtual IOReturn Start() ;
virtual IOReturn Stop() ;
void SetRefCon( void * refCon ) { mRefCon = refCon ; }
void* GetRefCon() const { return mRefCon ; }
Boolean GetTalking() const { return mTalking ; }
protected:
UserObjectHandle GetKernPortRef() { return mKernPortRef; }
protected:
Device & mDevice ;
UserObjectHandle mKernPortRef ;
void * mRefCon ;
Boolean mTalking ;
} ;
#pragma mark -
class IsochPortCOM: public IsochPort
{
public:
IsochPortCOM( const IUnknownVTbl & interface, Device& inUserClient, bool talking, bool allocateKernPort = true ) ;
virtual ~IsochPortCOM() ;
public:
static IOReturn SGetSupported(
IOFireWireLibIsochPortRef self,
IOFWSpeed* maxSpeed,
UInt64* chanSupported ) ;
static IOReturn SAllocatePort(
IOFireWireLibIsochPortRef self,
IOFWSpeed speed,
UInt32 chan ) ;
static IOReturn SReleasePort(
IOFireWireLibIsochPortRef self) ;
static IOReturn SStart(
IOFireWireLibIsochPortRef self) ;
static IOReturn SStop(
IOFireWireLibIsochPortRef self) ;
static void SSetRefCon(
IOFireWireLibIsochPortRef self,
void* inRefCon) ;
static void* SGetRefCon(
IOFireWireLibIsochPortRef self) ;
static Boolean SGetTalking(
IOFireWireLibIsochPortRef self) ;
} ;
#pragma mark -
class RemoteIsochPort: public IsochPortCOM
{
protected:
typedef ::IOFireWireRemoteIsochPortInterface Interface ;
typedef ::IOFireWireLibRemoteIsochPortRef PortRef ;
public:
RemoteIsochPort( const IUnknownVTbl & interface, Device& userclient, bool talking ) ;
virtual ~RemoteIsochPort() {}
virtual IOReturn GetSupported(
IOFWSpeed& maxSpeed,
UInt64& chanSupported) ;
virtual IOReturn AllocatePort(
IOFWSpeed speed,
UInt32 chan ) ;
virtual IOReturn ReleasePort() ;
virtual IOReturn Start() ;
virtual IOReturn Stop() ;
IOFireWireLibIsochPortGetSupportedCallback
SetGetSupportedHandler(
IOFireWireLibIsochPortGetSupportedCallback inHandler) ;
IOFireWireLibIsochPortAllocateCallback
SetAllocatePortHandler(
IOFireWireLibIsochPortAllocateCallback inHandler) ;
IOFireWireLibIsochPortCallback
SetReleasePortHandler(
IOFireWireLibIsochPortCallback inHandler) ;
IOFireWireLibIsochPortCallback
SetStartHandler(
IOFireWireLibIsochPortCallback inHandler) ;
IOFireWireLibIsochPortCallback
SetStopHandler(
IOFireWireLibIsochPortCallback inHandler) ;
protected:
IOFireWireLibIsochPortGetSupportedCallback mGetSupportedHandler ;
IOFireWireLibIsochPortAllocateCallback mAllocatePortHandler ;
IOFireWireLibIsochPortCallback mReleasePortHandler ;
IOFireWireLibIsochPortCallback mStartHandler ;
IOFireWireLibIsochPortCallback mStopHandler ;
IOFireWireLibIsochPortRef mRefInterface ;
} ;
#pragma mark -
class RemoteIsochPortCOM: public RemoteIsochPort
{
public:
RemoteIsochPortCOM( Device& userclient, bool talking ) ;
virtual ~RemoteIsochPortCOM() ;
static Interface sInterface ;
static IUnknownVTbl** Alloc( Device& inUserClient, bool inTalking ) ;
virtual HRESULT QueryInterface( REFIID iid, void** ppv ) ;
static IOFireWireLibIsochPortGetSupportedCallback
SSetGetSupportedHandler(
PortRef self,
IOFireWireLibIsochPortGetSupportedCallback inHandler) ;
static IOFireWireLibIsochPortAllocateCallback
SSetAllocatePortHandler(
PortRef self,
IOFireWireLibIsochPortAllocateCallback inHandler) ;
static IOFireWireLibIsochPortCallback
SSetReleasePortHandler(
PortRef self,
IOFireWireLibIsochPortCallback inHandler) ;
static IOFireWireLibIsochPortCallback
SSetStartHandler(
PortRef self,
IOFireWireLibIsochPortCallback inHandler) ;
static IOFireWireLibIsochPortCallback
SSetStopHandler(
PortRef self,
IOFireWireLibIsochPortCallback inHandler) ;
} ;
#pragma mark -
class LocalIsochPort: public IsochPortCOM
{
protected:
typedef ::IOFireWireLibLocalIsochPortRef PortRef ;
typedef ::IOFireWireLibIsochPortFinalizeCallback FinalizeCallback ;
protected:
DCLCommand * mDCLProgram ;
UInt32 mExpectedStopTokens ;
UInt32 mDeferredReleaseCount ;
FinalizeCallback mFinalizeCallback ;
IOVirtualRange * mBufferRanges ;
unsigned mBufferRangeCount ;
pthread_mutex_t mMutex ;
bool mStarted ;
public:
LocalIsochPort ( const IUnknownVTbl & interface, Device & userClient, bool talking, DCLCommand * dclProgram,
UInt32 startEvent, UInt32 startState, UInt32 startMask,
IOVirtualRange programRanges[], UInt32 programRangeCount, IOVirtualRange bufferRanges[],
UInt32 bufferRangeCount, IOFWIsochPortOptions options ) ;
virtual ~LocalIsochPort () ;
protected :
IOReturn ExportDCLs(
IOVirtualAddress * exportBuffer,
IOByteCount * exportBytes ) ;
public:
virtual ULONG Release() ;
virtual IOReturn Start() ;
virtual IOReturn Stop() ;
IOReturn ModifyJumpDCL ( DCLJump * jump, DCLLabel * label ) ;
IOReturn ModifyTransferPacketDCLSize ( DCLTransferPacket * dcl, IOByteCount newSize ) ;
void DCLStopTokenCallProcHandler ( IOReturn) ;
#if 0
void S_DCLKernelCallout( DCLCallProc * dcl ) ;
void S_NuDCLKernelCallout ( NuDCL * dcl ) ;
#endif
inline void Lock () ;
inline void Unlock () ;
IOReturn SetResourceUsageFlags ( IOFWIsochResourceFlags flags ) ;
IOReturn Notify(
IOFWDCLNotificationType notificationType,
void ** inDCLList,
UInt32 numDCLs ) ;
} ;
#pragma mark -
class LocalIsochPortCOM: public LocalIsochPort
{
typedef ::IOFireWireLocalIsochPortInterface Interface ;
typedef ::IOFireWireLibLocalIsochPortRef PortRef ;
public:
LocalIsochPortCOM( Device& userclient, bool inTalking, DCLCommand* inDCLProgram, UInt32 inStartEvent,
UInt32 inStartState, UInt32 inStartMask, IOVirtualRange inDCLProgramRanges[],
UInt32 inDCLProgramRangeCount, IOVirtualRange inBufferRanges[], UInt32 inBufferRangeCount,
IOFWIsochPortOptions options ) ;
virtual ~LocalIsochPortCOM() ;
static IUnknownVTbl** Alloc(
Device& inUserClient,
Boolean inTalking,
DCLCommand* inDCLProgram,
UInt32 inStartEvent,
UInt32 inStartState,
UInt32 inStartMask,
IOVirtualRange inDCLProgramRanges[], UInt32 inDCLProgramRangeCount,
IOVirtualRange inBufferRanges[],
UInt32 inBufferRangeCount,
IOFWIsochPortOptions options ) ;
virtual HRESULT QueryInterface(
REFIID iid,
void** ppv ) ;
static IOReturn SModifyJumpDCL(
PortRef self,
DCLJump* inJump,
DCLLabel* inLabel) ;
static void SPrintDCLProgram(
PortRef self,
const DCLCommand* inProgram,
UInt32 inLength) ;
static IOReturn SModifyTransferPacketDCLSize( PortRef self, DCLTransferPacket* dcl, IOByteCount newSize ) ;
static IOReturn SModifyTransferPacketDCLBuffer( PortRef self, DCLTransferPacket* dcl, void* newBuffer ) ;
static IOReturn SModifyTransferPacketDCL( PortRef self, DCLTransferPacket* dcl, void* newBuffer, IOByteCount newSize ) ;
static IOReturn S_SetFinalizeCallback(
IOFireWireLibLocalIsochPortRef self,
FinalizeCallback finalizeCallback ) ;
static IOReturn S_SetResourceUsageFlags(
IOFireWireLibLocalIsochPortRef self,
IOFWIsochResourceFlags flags ) ;
static IOReturn S_Notify(
IOFireWireLibLocalIsochPortRef self,
IOFWDCLNotificationType notificationType,
void ** inDCLList,
UInt32 numDCLs ) ;
protected:
static Interface sInterface ;
} ;
inline void
LocalIsochPort :: Lock ()
{
pthread_mutex_lock( & mMutex ) ;
}
inline void
LocalIsochPort :: Unlock ()
{
pthread_mutex_unlock( & mMutex ) ;
}
}