Available FireWire Isochronous Bandwidth

Q: Is there a way to find out the amount of isochronous bandwidth currently available on FireWire?

A: Yes, but this information has dubious value (see Caveats, below).

You can find the current Isochronous Resource Manager (IRM) for the FireWire bus your device is on and read the IRM's BANDWIDTH_AVAILABLE register.

For example:

Listing 1: Read avaliable FireWire isoch bandwidth

IOReturn
GetBandwidth( IOFireWireLibDeviceRef device, UInt32 * bandwidth )
{
    OSStatus        error ;
    UInt16      irmNodeID ;
    UInt32      generation ;

    // get current bus generation
    error = (**device).GetBusGeneration( device, & generation ) ;

    if ( !error )
    {
        // get ID of IRM
        error = (**device).GetIRMNodeID( device, generation, & irmNodeID ) ;
    }

    if ( !error )
    {
        // build the FireWire address of the BANDWIDTH_AVAILABLE register
        FWAddress address = { irmNodeID,
                              kCSRRegisterSpaceBaseAddressHi,
                              kCSRBandwidthAvailable } ;

        UInt32 size = sizeof( *bandwidth ) ;

        // read the BANDWIDTH_AVAILABLE register
        error = (**device).Read( device,
                                 0,
                                 address,
                                 bandwidth,
                                 &size,
                                 true,
                                 generation ) ;
    }

    return( error );
}

Note: Bandwidth values read from the BANDWIDTH_AVAILABLE register are measured in speed-dependent units. Please see the IEEE-1394 standard for details on the BANDWIDTH_AVAILABLE register.

Caveats

It's possible for a bus reset to occur at any time. If GetBandwidth returns kIOFireWireBusReset, try calling it again.

If GetBandwidth returns kIOReturnSuccess and *bandwidth indicates sufficient bandwidth for your purpose, it's still possible for your request to allocate bandwidth to fail. This is because another device on the bus could allocate some (or all) of the available bandwidth at any time.

In other words the only way to be sure there is enough bandwidth is to have your request to allocate bandwidth succeed. This means that your isochronous channel setup routine must be prepared to deal gracefully with an error due to insufficient bandwidth, even if the above technique indicates enough bandwidth is available.

Back to Top 

Document Revision History

DateNotes
2004-07-07Discusses attempting to "pre-flight" an isochronous bandwidth allocation request by reading the currently available bandwidth.

Posted: 2004-07-07


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.