Changeset 1943

Show
Ignore:
Timestamp:
12/20/10 05:39:11 (10 years ago)
Author:
jwoithe
Message:

RME: fix for lengthy startup delay which prevented reliable startup in approximately 20% attempts. This may not be the approach adopted long-term since there seems to be something amiss with the way iso handlers are started in general (in short, the start cycle - m_switch_on_cycle in IsoHandler? - is never set to anything other than zero).

Files:

Legend:

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

    r1867 r1943  
    10091009} 
    10101010 
     1011void IsoHandlerManager::setIsoStartCycleForStream(Streaming::StreamProcessor *stream, signed int cycle) { 
     1012    // Permit the direct manipulation of the m_switch_on_cycle field from 
     1013    // the stream's handler.  This is usually used to set it to -1 so the 
     1014    // kernel (at least with the ieee1394 stack) starts the streaming as 
     1015    // soon as possible, something that is required for some interfaces (eg: 
     1016    // RME).  Note that as of 20 Dec 2010 it seems that ordinarily 
     1017    // m_switch_on_cycle remains fixed at 0 (its initialised value) because 
     1018    // requestEnable() doesn't set it.  This allows the override configured 
     1019    // by this function to take effect. 
     1020    IsoHandler *h = getHandlerForStream(stream); 
     1021    h->setIsoStartCycle(cycle); 
     1022} 
     1023 
    10111024bool 
    10121025IsoHandlerManager::startHandlerForStream(Streaming::StreamProcessor *stream) { 
     
    18621875} 
    18631876 
     1877// Explicitly preset m_switch_on_cycle since requestEnable doesn't do this 
     1878// and thus all enables requested via that route always occur on cycle 0. 
     1879void 
     1880IsoHandlerManager::IsoHandler::setIsoStartCycle(signed int cycle) 
     1881{ 
     1882  m_switch_on_cycle = cycle; 
     1883} 
     1884 
    18641885void 
    18651886IsoHandlerManager::IsoHandler::updateState() 
  • trunk/libffado/src/libieee1394/IsoHandlerManager.h

    r1849 r1943  
    138138            bool requestDisable(); 
    139139 
     140            // Manually set the start cycle for the iso handler 
     141            void setIsoStartCycle(signed int cycle = -1); 
     142 
    140143    /** 
    141144             * updates the internal state if required 
     
    351354        bool startHandlerForStream(Streaming::StreamProcessor *, int cycle);  
    352355 
     356        ///> Directly tells the handler attached to the stream to start on 
     357        ///> the given cycle regardless of what is passed to 
     358        ///> startHandlerForStream(). 
     359        void setIsoStartCycleForStream(Streaming::StreamProcessor *stream, signed int cycle); 
     360 
    353361        /** 
    354362         * returns the latency of a wake-up for this stream. 
  • trunk/libffado/src/libstreaming/rme/RmeReceiveStreamProcessor.cpp

    r1941 r1943  
    116116debugOutput( DEBUG_LEVEL_VERBOSE, "init: e2=%g, w=%g, B=%g, C=%g\n", 
    117117  rxdll_e2, w, rxdll_B, rxdll_C); 
     118 
     119    // Request that the iso streaming be started as soon as possible by the 
     120    // kernel. 
     121    m_IsoHandlerManager.setIsoStartCycleForStream(this, -1); 
    118122 
    119123    return true; 
     
    163167        uint64_t pkt_ctr_ticks = CYCLE_TIMER_TO_TICKS(pkt_ctr); 
    164168        double e = pkt_ctr_ticks - rxdll_t1; 
    165  
    166 #if 0 
     169        if (e < -64LL*TICKS_PER_SECOND) 
     170          e += 128LL*TICKS_PER_SECOND; 
     171 
     172#if 1 
    167173double p = m_last_timestamp; 
    168174debugOutput(DEBUG_LEVEL_VERBOSE, "ts read: %lld, prev=%lld, diff=%lld\n",  
     
    183189            rxdll_e2 += rxdll_C*e; 
    184190        } 
    185         if (rxdll_t1 > 128*TICKS_PER_SECOND) 
    186             rxdll_t1 -= 128*TICKS_PER_SECOND; 
    187 #if 0 
     191        if (rxdll_t1 > 128LL*TICKS_PER_SECOND) 
     192            rxdll_t1 -= 128LL*TICKS_PER_SECOND; 
     193#if 1 
    188194debugOutput(DEBUG_LEVEL_VERBOSE, "  returned: %lld (e=%g) T=%g, f=%g\n",  
    189195  m_last_timestamp, e, rxdll_e2, 7.0/rxdll_e2*24576000); 
  • trunk/libffado/src/libstreaming/rme/RmeTransmitStreamProcessor.cpp

    r1941 r1943  
    117117    // they will contain data. 
    118118    *sy = 0x00; 
    119     *length = n_events*m_event_size
     119    *length = 0
    120120 
    121121    signed int fc; 
     
    224224                // we are not that late and can still try to transmit the 
    225225                // packet 
     226                *length = n_events*m_event_size; 
    226227                m_tx_dbc += fillDataPacketHeader((quadlet_t *)data, length, presentation_time); 
    227228                m_last_timestamp = presentation_time; 
     
    238239        { 
    239240            // it's time send the packet 
     241            *length = n_events*m_event_size; 
    240242            m_tx_dbc += fillDataPacketHeader((quadlet_t *)data, length, presentation_time); 
    241243            m_last_timestamp = presentation_time; 
     
    401403} 
    402404#else 
    403 if (cx > 255) { 
     405//if (cx > 255) { 
     406
    404407  signed n_events = getNominalFramesPerPacket(); 
    405408//  if (cx < 255+64+10) { 
    406   if (cx < 255+(128+12)*n_events) { 
     409//  if (cx < 255+(128+12)*n_events) { 
     410  if (cx < (128+12)*n_events) { 
    407411    cx += n_events; 
    408412    *length = n_events * m_event_size; 
    409413m_last_timestamp = CYCLE_TIMER_TO_TICKS(pkt_ctr); 
    410 debugOutput(DEBUG_LEVEL_VERBOSE, "empty tx: %lld, ct=%08x (%03ld,%04ld,%04ld) len=%d\n", 
    411   m_last_timestamp, pkt_ctr, CYCLE_TIMER_GET_SECS(pkt_ctr), CYCLE_TIMER_GET_CYCLES(pkt_ctr), CYCLE_TIMER_GET_OFFSET(pkt_ctr), 
    412   *length); 
     414//debugOutput(DEBUG_LEVEL_VERBOSE, "empty tx: %lld, ct=%08x (%03ld,%04ld,%04ld) len=%d\n", 
     415//  m_last_timestamp, pkt_ctr, CYCLE_TIMER_GET_SECS(pkt_ctr), CYCLE_TIMER_GET_CYCLES(pkt_ctr), CYCLE_TIMER_GET_OFFSET(pkt_ctr), 
     416//  *length); 
    413417  } 
    414 } else 
    415   cx++; 
     418
     419//} else 
     420//  cx++; 
    416421#endif 
    417422//debugOutput(DEBUG_LEVEL_VERBOSE, "  txsize=%d\n", *length);