IOFWBusCommand.cpp [plain text]
#include <IOKit/firewire/IOFWCommand.h>
#include <IOKit/firewire/IOFireWireController.h>
#include <IOKit/firewire/IOFireWireNub.h>
#include <IOKit/firewire/IOLocalConfigDirectory.h>
#include <IOKit/assert.h>
#include <IOKit/IOWorkLoop.h>
#include <IOKit/IOCommand.h>
OSDefineMetaClass( IOFWBusCommand, IOFWCommand )
OSDefineAbstractStructors(IOFWBusCommand, IOFWCommand)
OSMetaClassDefineReservedUnused(IOFWBusCommand, 0);
#pragma mark -
bool IOFWBusCommand::initWithController(IOFireWireController *control, FWBusCallback completion, void *refcon)
{
if(!IOFWCommand::initWithController(control))
return false;
fSync = completion == NULL;
fComplete = completion;
fRefCon = refcon;
return true;
}
IOReturn IOFWBusCommand::reinit(FWBusCallback completion, void *refcon)
{
if(fStatus == kIOReturnBusy || fStatus == kIOFireWirePending)
return fStatus;
fSync = completion == NULL;
fComplete = completion;
fRefCon = refcon;
return kIOReturnSuccess;
}
IOReturn IOFWBusCommand::complete(IOReturn state)
{
state = IOFWCommand::complete(state);
if(fSync)
fSyncWakeup->signal(state);
else if(fComplete)
(*fComplete)(fRefCon, state, fControl, this);
return state;
}