Show
Ignore:
Timestamp:
09/07/09 04:41:57 (11 years ago)
Author:
jwoithe
Message:

ieee1394Service: new method allocateFixedIsoChannelGeneric() to allocate a specific channel number instead of scanning for the next available channel number. This functionality is needed for the RME devices.
RME: assign/detect iso channels to use and allocate required bandwidth.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libieee1394/ieee1394service.cpp

    r1550 r1660  
    13021302 
    13031303/** 
     1304 * Allocates a specific fixed iso channel for use by the interface.  Returns  
     1305 * -1 on error (due to the requested channel not being free) or the fixed iso 
     1306 * channel number. 
     1307 * 
     1308 * Does not perform anything other than registering the channel and the 
     1309 * bandwidth at the IRM 
     1310 * 
     1311 * Also allocates the necessary bandwidth (in ISO allocation units). 
     1312 * 
     1313 * FIXME: As in libiec61883, channel 63 is not requested; this is either a 
     1314 * bug or it's omitted since that's the channel preferred by video devices. 
     1315 * 
     1316 * @chan the channel number being requested 
     1317 * @param bandwidth the bandwidth to allocate for this channel 
     1318 * @return the channel number 
     1319 */ 
     1320signed int Ieee1394Service::allocateFixedIsoChannelGeneric( 
     1321    unsigned int chan, unsigned int bandwidth 
     1322    ) { 
     1323    debugOutput(DEBUG_LEVEL_VERBOSE, "Allocating ISO channel %d using generic method...\n", chan ); 
     1324 
     1325    Util::MutexLockHelper lock(*m_handle_lock); 
     1326    struct ChannelInfo cinfo; 
     1327 
     1328    if (raw1394_channel_modify (m_handle, chan, RAW1394_MODIFY_ALLOC) == 0) { 
     1329        if (raw1394_bandwidth_modify(m_handle, bandwidth, RAW1394_MODIFY_ALLOC) < 0) { 
     1330            debugFatal("Could not allocate bandwidth of %d\n", bandwidth); 
     1331 
     1332            raw1394_channel_modify (m_handle, chan, RAW1394_MODIFY_FREE); 
     1333            return -1; 
     1334        } else { 
     1335            cinfo.channel=chan; 
     1336            cinfo.bandwidth=bandwidth; 
     1337            cinfo.alloctype=AllocGeneric; 
     1338 
     1339            cinfo.xmit_node=-1; 
     1340            cinfo.xmit_plug=-1; 
     1341            cinfo.recv_node=-1; 
     1342            cinfo.recv_plug=-1; 
     1343 
     1344            if (registerIsoChannel(chan, cinfo)) { 
     1345                return chan; 
     1346            } else { 
     1347                raw1394_bandwidth_modify(m_handle, bandwidth, RAW1394_MODIFY_FREE); 
     1348                raw1394_channel_modify (m_handle, chan, RAW1394_MODIFY_FREE); 
     1349                return -1; 
     1350            } 
     1351        } 
     1352    } 
     1353    return -1; 
     1354} 
     1355 
     1356/** 
    13041357 * Allocates an iso channel for use by the interface in a similar way to 
    13051358 * libiec61883.  Returns -1 on error (due to there being no free channels) 
  • trunk/libffado/src/libieee1394/ieee1394service.h

    r1568 r1660  
    360360    signed int getAvailableBandwidth(); 
    361361    signed int allocateIsoChannelGeneric(unsigned int bandwidth); 
     362    signed int allocateFixedIsoChannelGeneric( 
     363        unsigned int chan, unsigned int bandwidth); 
    362364    signed int allocateIsoChannelCMP(nodeid_t xmit_node, int xmit_plug, 
    363365                                     nodeid_t recv_node, int recv_plug);