IOFWUserClientPsdoAddrSpace.h [plain text]
#ifndef __IOFWUserClientPsduAddrSpace_H__
#define __IOFWUserClientPsduAddrSpace_H__
#include <IOKit/OSMessageNotification.h>
#include <IOKit/firewire/IOFireWireFamilyCommon.h>
#include"IOFireWireUserClient.h"
typedef union IOFWPacketHeader_t
{
typedef enum QueueTag_t
{
kFree = 0,
kStopPacket = 'stop',
kBadPacket = ' bad',
kIncomingPacket = 'pckt',
kSkippedPacket = 'skip',
kReadPacket = 'read'
} QueueTag ;
struct CommonHeader_t
{
QueueTag_t type ;
IOFWPacketHeader_t* next ;
OSAsyncReference* whichAsyncRef ;
UInt32 argCount ;
UInt32 args[10] ;
} CommonHeader ;
struct IncomingPacket_t
{
QueueTag_t type ;
IOFWPacketHeader_t* next ;
OSAsyncReference* whichAsyncRef ;
UInt32 argCount ;
UInt32 commandID ; UInt32 packetSize ; UInt32 packetOffset ; UInt32 nodeID ;
UInt32 speed ;
UInt32 addrHi ;
UInt32 addrLo ;
UInt32 lockWrite ;
} IncomingPacket ;
struct SkippedPacket_t
{
QueueTag_t type ;
IOFWPacketHeader_t* next ;
OSAsyncReference* whichAsyncRef ;
UInt32 argCount ;
UInt32 commandID ; UInt32 skippedPacketCount ;
} SkippedPacket ;
struct ReadPacket_t
{
QueueTag_t type ;
IOFWPacketHeader_t* next ;
OSAsyncReference* whichAsyncRef ;
UInt32 argCount ;
UInt32 commandID ; UInt32 packetSize ; UInt32 packetOffset ; UInt32 nodeID ;
UInt32 speed ;
UInt32 addrHi ;
UInt32 addrLo ;
int tLabel ;
IOFWRequestRefCon reqrefcon ;
UInt32 generation ;
} ReadPacket ;
public:
IOFWPacketHeader_t() ;
} IOFWPacketHeader ;
inline IOByteCount& IOFWPacketHeaderGetSize(IOFWPacketHeader_t* hdr) ;
inline IOByteCount& IOFWPacketHeaderGetOffset(IOFWPacketHeader_t* hdr) ;
inline void InitIncomingPacketHeader(IOFWPacketHeader* header,
const union IOFWPacketHeader_t* next,
const IOByteCount len,
const IOByteCount offset,
OSAsyncReference ref,
void* refCon,
UInt16 nodeID,
const IOFWSpeed& speed,
const FWAddress& addr,
const Boolean lockWrite) ;
inline void InitSkippedPacketHeader(
IOFWPacketHeader* header,
const union IOFWPacketHeader_t* next,
const IOByteCount offset,
OSAsyncReference* ref,
void* refCon) ;
inline void InitReadPacketHeader(
IOFWPacketHeader* header,
IOFWPacketHeader* next,
UInt32 len,
UInt32 offset,
OSAsyncReference* ref,
void* refCon,
UInt16 nodeID,
IOFWSpeed& speed,
FWAddress addr,
IOFWRequestRefCon reqrefcon) ;
inline Boolean IsSkippedPacketHeader(const union IOFWPacketHeader_t* header) ;
inline Boolean IsFreePacketHeader(const union IOFWPacketHeader_t* header) ;
inline Boolean IsReadPacketHeader(const union IOFWPacketHeader_t* header) ;
class IOFWUserClientPseudoAddrSpace: public IOFWPseudoAddressSpace
{
OSDeclareDefaultStructors(IOFWUserClientPseudoAddrSpace)
public:
virtual bool initAll(
IOFireWireUserClient* inUserClient,
FWAddrSpaceCreateParams* inParams) ;
virtual void free() ;
virtual void deactivate() ;
const FWAddress& getBase() { return fBase;}
const UInt32 getLength() { return fLen; }
const UInt32 getUserRefCon() { return fUserRefCon ;}
const IOFireWireUserClient& getUserClient() { return *fUserClient ;}
static UInt32 simpleReader(
void* refcon,
UInt16 nodeID,
IOFWSpeed & speed,
FWAddress addr,
UInt32 len,
IOMemoryDescriptor** buf,
IOByteCount* offset,
IOFWRequestRefCon reqrefcon)
{ return IOFWPseudoAddressSpace::simpleReader(refcon, nodeID, speed, addr, len, buf, offset, reqrefcon); }
static UInt32 simpleWriter(
void* refcon,
UInt16 nodeID,
IOFWSpeed& speed,
FWAddress addr,
UInt32 len,
const void* buf,
IOFWRequestRefCon reqrefcon)
{ return IOFWPseudoAddressSpace::simpleWriter(refcon, nodeID, speed, addr, len, buf, reqrefcon); }
static UInt32 pseudoAddrSpaceReader(
void* refCon,
UInt16 nodeID,
IOFWSpeed& speed,
FWAddress addr,
UInt32 len,
IOMemoryDescriptor** buf,
IOByteCount* offset,
IOFWRequestRefCon reqrefcon) ;
static UInt32 pseudoAddrSpaceWriter(
void* refCon,
UInt16 nodeID,
IOFWSpeed& speed,
FWAddress addr,
UInt32 len,
const void* buf,
IOFWRequestRefCon reqrefcon) ;
virtual void setAsyncRef_Packet(
OSAsyncReference inAsyncRef) ;
virtual void setAsyncRef_SkippedPacket(
OSAsyncReference inAsyncRef) ;
virtual void setAsyncRef_Read(
OSAsyncReference inAsyncRef) ;
virtual void clientCommandIsComplete(
FWClientCommandID inCommandID,
IOReturn inResult ) ;
void sendPacketNotification(
IOFWPacketHeader* inPacketHeader) ;
private:
IOMemoryDescriptor* fPacketQueueBuffer ;
IOLock* fLock ;
UInt32 fUserRefCon ;
IOFireWireUserClient* fUserClient ;
IOFWPacketHeader* fLastWrittenHeader ;
IOFWPacketHeader* fLastReadHeader ;
UInt32 fBufferAvailable ;
FWAddress fAddress ;
OSAsyncReference fSkippedPacketAsyncNotificationRef ;
OSAsyncReference fPacketAsyncNotificationRef ;
OSAsyncReference fReadAsyncNotificationRef ;
bool fWaitingForUserCompletion ;
UInt32 fFlags ;
Boolean fPacketQueuePrepared ;
Boolean fBackingStorePrepared ;
} ;
#endif //__IOFWUserClientPsduAddrSpace_H__