#include <IOKit/IOWorkLoop.h>
#include <IOKit/firewire/IOFWIsochPort.h>
#include <IOKit/firewire/IOFWLocalIsochPort.h>
#include <IOKit/firewire/IOFWDCLProgram.h>
#include <IOKit/firewire/IOFWCommand.h>
#include <IOKit/firewire/IOFireWireController.h>
OSDefineMetaClass( IOFWIsochPort, OSObject )
OSDefineAbstractStructors(IOFWIsochPort, OSObject)
OSMetaClassDefineReservedUnused(IOFWIsochPort, 0);
OSMetaClassDefineReservedUnused(IOFWIsochPort, 1);
OSDefineMetaClassAndStructors(IOFWLocalIsochPort, IOFWIsochPort)
OSMetaClassDefineReservedUnused(IOFWLocalIsochPort, 0);
OSMetaClassDefineReservedUnused(IOFWLocalIsochPort, 1);
bool IOFWLocalIsochPort::init(IODCLProgram *program, IOFireWireController *control)
{
if(!IOFWIsochPort::init())
return false;
fProgram = program; fControl = control;
return true;
}
void IOFWLocalIsochPort::free()
{
if(fProgram)
fProgram->release();
IOFWIsochPort::free();
}
IOReturn IOFWLocalIsochPort::getSupported(IOFWSpeed &maxSpeed, UInt64 &chanSupported)
{
maxSpeed = kFWSpeedMaximum;
chanSupported = ~(UInt64)0;
return kIOReturnSuccess;
}
IOReturn IOFWLocalIsochPort::allocatePort(IOFWSpeed speed, UInt32 chan)
{
IOReturn res;
fControl->closeGate();
res = fProgram->allocateHW(speed, chan);
fControl->openGate();
if(kIOReturnSuccess != res)
return res;
return fProgram->compile(speed, chan); }
IOReturn IOFWLocalIsochPort::releasePort()
{
IOReturn res;
fControl->closeGate();
res = fProgram->releaseHW();
fControl->openGate();
return res;
}
IOReturn IOFWLocalIsochPort::start()
{
IOReturn res;
fControl->closeGate();
res = fProgram->start();
fControl->openGate();
return res;
}
IOReturn IOFWLocalIsochPort::stop()
{
fControl->closeGate();
fProgram->stop();
fControl->openGate();
return kIOReturnSuccess;
}
IOReturn IOFWLocalIsochPort::notify(UInt32 notificationType,
DCLCommandPtr *dclCommandList, UInt32 numDCLCommands)
{
IOReturn res;
fControl->closeGate();
res = fProgram->notify(notificationType,
dclCommandList, numDCLCommands);
fControl->openGate();
return res;
}