Changeset 2074

Show
Ignore:
Timestamp:
03/08/12 05:27:34 (9 years ago)
Author:
jwoithe
Message:

Maybe improve streaming restart reliability by ensuring IsoHandler? fields are reset during enable. Move RME run/dryrun flags into transmit streaming object so they can be reset. Add new device method resetForStreaming() which is called just before streaming is started; devices can use this to initialise streaming related details. RME uses new resetForStreaming() method to ensure the run/dryrun transmit stream flags are set up correctly. Despite these changes, attempts to make the RME driver restart after jack freewheels have been unsuccessful so far.

Files:

Legend:

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

    r1789 r2074  
    857857    bool all_streams_started = true; 
    858858    bool device_start_failed = false; 
     859 
     860    if (device->resetForStreaming() == false) 
     861        return false; 
     862 
    859863    for(j=0; j < device->getStreamCount(); j++) { 
    860864        debugOutput(DEBUG_LEVEL_VERBOSE,"Starting stream %d of device %p\n", j, device); 
  • trunk/libffado/src/ffadodevice.h

    r1789 r2074  
    349349 
    350350    /** 
     351     * @brief Performs operations needed to prepare for a stream start 
     352     * 
     353     * This is called by the streaming layer just before streaming is 
     354     * started.  It provides a place where reset activity can be done which 
     355     * ensures the object is ready to restart streaming even if streaming 
     356     * has been previously started and stopped. 
     357     * 
     358     * @return true if successful, false if not 
     359     */ 
     360    virtual bool resetForStreaming() { return true; } 
     361 
     362    /** 
    351363     * @brief Returns the number of ISO streams implemented/used by this device 
    352364     * 
  • trunk/libffado/src/libieee1394/IsoHandlerManager.cpp

    r2019 r2074  
    17661766    raw1394_set_userdata(m_handle, static_cast<void *>(this)); 
    17671767 
     1768#ifdef DEBUG 
     1769    m_min_ahead = 7999; 
     1770#endif 
     1771 
     1772    m_packets = 0; 
     1773 
     1774    // indicate that the first iterate() still has to occur. 
     1775    m_last_now = 0xFFFFFFFF; 
     1776    m_last_packet_handled_at = 0xFFFFFFFF; 
     1777 
     1778    m_last_cycle = -1; 
     1779 
     1780 
    17681781    // prepare the handler, allocate the resources 
    17691782    debugOutput( DEBUG_LEVEL_VERBOSE, "Preparing iso handler (%p, client=%p)\n", this, m_Client); 
     
    18051818        } 
    18061819    } 
    1807  
    1808 #ifdef DEBUG 
    1809     m_min_ahead = 7999; 
    1810 #endif 
    1811  
    1812     m_packets = 0; 
    1813  
    1814     // indicate that the first iterate() still has to occur. 
    1815     m_last_now = 0xFFFFFFFF; 
    1816     m_last_packet_handled_at = 0xFFFFFFFF; 
    18171820 
    18181821    m_State = eHS_Running; 
  • trunk/libffado/src/libstreaming/rme/RmeTransmitStreamProcessor.cpp

    r1993 r2074  
    7878        , mb_tail( 0 ) 
    7979        , midi_lock( 0 ) 
     80        , streaming_has_run ( 0 ) 
     81        , streaming_has_dryrun ( 0 ) 
    8082{ 
    8183  int srate = m_Parent.getDeviceManager().getStreamProcessorManager().getNominalRate(); 
     
    98100RmeTransmitStreamProcessor::getNominalFramesPerPacket() { 
    99101    return static_cast<Rme::Device *>(&m_Parent)->getFramesPerPacket(); 
     102} 
     103 
     104bool 
     105RmeTransmitStreamProcessor::resetForStreaming() 
     106{ 
     107    streaming_has_run = 0; 
     108    streaming_has_dryrun = 0; 
     109    return true; 
    100110} 
    101111 
     
    342352{ 
    343353static signed int cx = 0; 
    344 static signed int has_dryrun = 0; 
    345 static signed int has_run = 0; 
    346354 
    347355    debugOutput ( DEBUG_LEVEL_VERY_VERBOSE, "XMIT EMPTY: CY=%04lu, TSP=%011llu (%04u)\n", 
     
    368376    // presently a quick and dirty hack and will be revisited in due course 
    369377    // once a final control method has been established. 
    370     if (has_run==0 && isDryRunning()) { 
     378    if (streaming_has_run==0 && isDryRunning()) { 
    371379        signed n_events = getNominalFramesPerPacket(); 
    372380//        unsigned int cycle = CYCLE_TIMER_GET_CYCLES(pkt_ctr); 
    373381 
    374         has_dryrun = 1; 
     382        streaming_has_dryrun = 1; 
    375383        if (cx < (1)*n_events) { 
    376384            cx += n_events; 
     
    379387    } 
    380388 
    381     if (!isDryRunning() && has_dryrun==1) 
    382         has_run=1; 
     389    if (!isDryRunning() && streaming_has_dryrun==1) 
     390        streaming_has_run=1; 
    383391 
    384392//    m_tx_dbc += fillNoDataPacketHeader ( (quadlet_t *)data, length ); 
  • trunk/libffado/src/libstreaming/rme/RmeTransmitStreamProcessor.h

    r1674 r2074  
    7373    virtual bool prepareChild(); 
    7474 
     75    bool resetForStreaming(); 
     76 
    7577public: 
    7678    virtual unsigned int getEventSize()  
     
    129131    unsigned int mb_head, mb_tail; 
    130132    unsigned int midi_lock; 
     133    signed int streaming_has_run, streaming_has_dryrun; 
    131134    unsigned int midi_tx_period; /* Measured in audio clock periods */ 
    132135}; 
  • trunk/libffado/src/rme/rme_avdevice.cpp

    r2062 r2074  
    622622 
    623623bool 
     624Device::resetForStreaming() { 
     625    signed int err; 
     626 
     627    // Ensure the transmit processor is ready to start streaming. 
     628    m_transmitProcessor->resetForStreaming(); 
     629 
     630    // FIXME: this may yet move back into prepare(). 
     631    err = hardware_init_streaming(dev_config->hardware_freq, iso_tx_channel) != 0; 
     632    if (err) { 
     633        debugFatal("Could not intialise device streaming system\n"); 
     634        return false; 
     635    } 
     636 
     637    return FFADODevice::resetForStreaming(); 
     638} 
     639 
     640bool 
    624641Device::prepare() { 
    625642 
     
    688705    } 
    689706 
    690     err = hardware_init_streaming(dev_config->hardware_freq, iso_tx_channel) != 0; 
    691     if (err) { 
    692         debugFatal("Could not intialise device streaming system\n"); 
    693     } 
     707//    err = hardware_init_streaming(dev_config->hardware_freq, iso_tx_channel) != 0; 
     708//    if (err) { 
     709//        debugFatal("Could not intialise device streaming system\n"); 
     710//    } 
    694711 
    695712    if (err == 0) { 
  • trunk/libffado/src/rme/rme_avdevice.h

    r2054 r2074  
    8484    virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i); 
    8585 
     86    virtual bool resetForStreaming(); 
    8687    virtual bool prepare(); 
    8788    virtual bool lock();