IOFWUserIsochChannel.cpp [plain text]
#include <libkern/c++/OSCollectionIterator.h>
#include <libkern/c++/OSSet.h>
#include <IOKit/firewire/IOFireWireController.h>
#include <IOKit/firewire/IOFWCommand.h>
#include <IOKit/firewire/IOFWIsochPort.h>
#include "IOFWUserIsochChannel.h"
#include"IOFireWireUserClient.h"
OSDefineMetaClassAndStructors(IOFWUserIsochChannel, IOFWIsochChannel)
IOReturn
IOFWUserIsochChannel::allocateChannel()
{
IOLog("IOFWUserIsochChannel::allocateChannel called!\n") ;
return kIOReturnUnsupported ;
}
IOReturn
IOFWUserIsochChannel::releaseChannel()
{
IOLog("IOFWUserIsochChannel::releaseChannel called!\n") ;
return kIOReturnUnsupported ;
}
IOReturn
IOFWUserIsochChannel::start()
{
IOLog("IOFWUserIsochChannel::start called!\n") ;
return kIOReturnUnsupported ;
}
IOReturn
IOFWUserIsochChannel::stop()
{
IOLog("IOFWUserIsochChannel::stop called!\n") ;
return kIOReturnUnsupported ;
}
IOReturn
IOFWUserIsochChannel::userAllocateChannelBegin(
IOFWSpeed inSpeed,
UInt32 inAllowedChansHi,
UInt32 inAllowedChansLo,
IOFWSpeed* outActualSpeed,
UInt32* outActualChannel)
{
IOReturn err = kIOReturnSuccess;
if (!fBandwidthAllocated)
do {
err = allocateChannelBegin( inSpeed, (UInt64)inAllowedChansHi<<32 | inAllowedChansLo, fChannel ) ;
} while ( err == kIOFireWireBusReset || err == kIOReturnCannotLock ) ;
if ( !err )
{
IOFireWireUserClientLog_("-IOFWUserIsochChannel::userAllocateChannelBegin: result=0x%08x, fSpeed=%u, fChannel=0x%08lX\n", err, fSpeed, fChannel) ;
fSpeed = inSpeed ;
fBandwidthAllocated = true ;
*outActualSpeed = fSpeed ;
*outActualChannel = fChannel ;
}
if( err ) {
releaseChannel();
}
return err ;
}
IOReturn
IOFWUserIsochChannel::userReleaseChannelComplete()
{
if ( !fBandwidthAllocated )
return kIOReturnSuccess ;
fBandwidthAllocated = false ;
return releaseChannelComplete() ;
}
IOReturn
IOFWUserIsochChannel::allocateListenerPorts()
{
IOFWIsochPort* listen;
IOReturn result = kIOReturnSuccess ;
OSIterator* listenIterator = OSCollectionIterator::withCollection(fListeners) ;
if(listenIterator) {
listenIterator->reset();
while( (listen = (IOFWIsochPort *) listenIterator->getNextObject()) && (result == kIOReturnSuccess)) {
result = listen->allocatePort(fSpeed, fChannel);
}
listenIterator->release();
}
return result ;
}
IOReturn
IOFWUserIsochChannel::allocateTalkerPort()
{
IOReturn result = kIOReturnSuccess ;
if(fTalker)
result = fTalker->allocatePort(fSpeed, fChannel);
return result ;
}