Changeset 1032

Show
Ignore:
Timestamp:
04/25/08 10:21:07 (13 years ago)
Author:
ppalmers
Message:

some more shuffling. Eliminate the CTR read from the generic transmit SP.

Files:

Legend:

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

    r1031 r1032  
    9898#ifdef DEBUG 
    9999   , m_packets ( 0 ) 
     100   , m_dropped( 0 ) 
     101   , m_min_ahead( 7999 ) 
    100102#endif 
    101103{ 
     
    118120   , m_packets ( 0 ) 
    119121   , m_dropped( 0 ) 
     122   , m_min_ahead( 7999 ) 
    120123#endif 
    121124{ 
     
    302305        debugOutputShort( DEBUG_LEVEL_NORMAL, "  Speed, PreBuffers...........: %2d, %2d\n", 
    303306                                            m_speed, m_prebuffers); 
     307        #ifdef DEBUG 
     308        debugOutputShort( DEBUG_LEVEL_NORMAL, "  Min ISOXMT bufferfill : %04d\n", m_min_ahead); 
     309        #endif 
    304310    } 
    305311    #ifdef DEBUG 
     
    460466    if (cycle >= 0) { 
    461467        m_last_cycle = cycle; 
     468         
     469        #ifdef DEBUG 
     470/*        int ahead = diffCycles(cycle, now_cycles); 
     471        if (ahead < m_min_ahead) m_min_ahead = ahead; 
     472*/ 
     473        #endif 
    462474    } 
    463475 
     
    576588    } 
    577589 
     590    m_min_ahead = 7999; 
    578591    m_State = E_Running; 
    579592    return true; 
  • trunk/libffado/src/libieee1394/IsoHandler.h

    r1031 r1032  
    177177    unsigned int    m_packets; 
    178178    unsigned int    m_dropped; 
     179    int             m_min_ahead; 
    179180    #endif 
    180181 
  • trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp

    r1031 r1032  
    7878    , m_sync_delay( 0 ) 
    7979    , m_in_xrun( false ) 
    80     , m_min_ahead( 7999 ) 
    8180{ 
    8281    // create the timestamped buffer and register ourselves as its client 
     
    292291 
    293292    // bypass based upon state 
     293#ifdef DEBUG 
    294294    if (m_state == ePS_Invalid) { 
    295295        debugError("Should not have state %s\n", ePSToString(m_state) ); 
    296296        return RAW1394_ISO_ERROR; 
    297297    } 
     298#endif 
     299    // FIXME: isn't this also an error condition? 
    298300    if (m_state == ePS_Created) { 
    299301        return RAW1394_ISO_DEFER; 
     
    485487    } 
    486488    unsigned int cycle = CYCLE_TIMER_GET_CYCLES(pkt_ctr); 
    487  
    488     unsigned int ctr; 
    489489    uint64_t prev_timestamp; 
    490     int now_cycles; 
    491     int cycle_diff; 
    492490 
    493491    // note that we can ignore skipped cycles since 
     
    520518#endif 
    521519 
     520    // FIXME: can this happen? 
    522521    if (m_state == ePS_Created) { 
    523522        *tag = 0; 
     
    528527 
    529528    // normal processing 
    530     // note that we can't use getCycleTimer directly here, 
    531     // because packets are queued in advance. This means that 
    532     // we the packet we are constructing will be sent out 
    533     // on 'cycle', not 'now'. 
    534     ctr = m_1394service.getCycleTimer(); 
    535     now_cycles = (int)CYCLE_TIMER_GET_CYCLES(ctr); 
    536  
    537     // the difference between the cycle this 
    538     // packet is intended for and 'now' 
    539     cycle_diff = diffCycles(cycle, now_cycles); 
    540  
    541     if(cycle_diff < 0 && (m_state == ePS_Running || m_state == ePS_DryRunning)) { 
    542         unsigned int fc = m_data_buffer->getBufferFill(); 
    543         debugWarning("Requesting packet for cycle %04d which is in the past (now=%04dcy, fill=%u)\n", 
    544             cycle, now_cycles, fc); 
    545         if(m_state == ePS_Running) { 
    546             debugShowBackLogLines(200); 
    547 //             flushDebugOutput(); 
    548 //             assert(0); 
    549             debugWarning("generatePacketData xrun\n"); 
    550             m_in_xrun = true; 
    551             debugOutput(DEBUG_LEVEL_VERBOSE, "Should update state to WaitingForStreamDisable due to data xrun\n"); 
    552             m_cycle_to_switch_state = cycle + 1; 
    553             m_next_state = ePS_WaitingForStreamDisable; 
    554             // execute the requested change 
    555             if (!updateState()) { // we are allowed to change the state directly 
    556                 debugError("Could not update state!\n"); 
    557                 return RAW1394_ISO_ERROR; 
    558             } 
    559             goto send_empty_packet; 
    560         } 
    561     } 
    562529 
    563530    // store the previous timestamp 
     
    565532    // a valid packet will be sent 
    566533    prev_timestamp = m_last_timestamp; 
    567      
     534 
    568535    // NOTE: synchronized switching is restricted to a 0.5 sec span (4000 cycles) 
    569536    //       it happens on the first 'good' cycle for the wait condition 
     
    616583    // check whether we are waiting for a stream to startup 
    617584    else if(m_state == ePS_WaitingForStream) { 
    618         // as long as the cycle parameter is not in sync with 
    619         // the current time, the stream is considered not 
    620         // to be 'running' 
    621         // we then check whether we have to switch on this cycle 
    622         if ((cycle_diff >= 0) && (diffCycles(cycle, m_cycle_to_switch_state) >= 0)) { 
     585        // check whether we have to switch on this cycle 
     586        if ((diffCycles(cycle, m_cycle_to_switch_state) >= 0)) { 
    623587            debugOutput(DEBUG_LEVEL_VERBOSE, "Should update state to WaitingForStream to DryRunning\n"); 
    624588            // hence go to the dryRunning state 
     
    636600        enum eChildReturnValue result = generatePacketHeader(data, length, tag, sy, cycle, dropped_cycles, max_length); 
    637601        if (result == eCRV_Packet || result == eCRV_Defer) { 
    638             int ahead = diffCycles(cycle, now_cycles); 
    639             if (ahead < m_min_ahead) m_min_ahead = ahead; 
    640602            debugOutputExtreme(DEBUG_LEVEL_VERBOSE, 
    641                                "XMIT: CY=%04u TS=%011llu NOW_CY=%04u AHEAD=%04d\n", 
    642                                cycle, m_last_timestamp, now_cycles, ahead); 
     603                               "XMIT: CY=%04u TS=%011llu\n", 
     604                               cycle, m_last_timestamp); 
    643605 
    644606            // valid packet timestamp 
     
    752714        } 
    753715    } 
    754      
    755     { // context to avoid ahead var clash 
    756         int ahead = diffCycles(cycle, now_cycles); 
    757         if (ahead < m_min_ahead) m_min_ahead = ahead; 
    758         debugOutputExtreme(DEBUG_LEVEL_VERBOSE, 
    759                            "XMIT EMPTY: CY=%04u, NOW_CY=%04u, AHEAD=%04d\n", 
    760                            cycle, now_cycles, ahead); 
    761     } 
     716    debugOutputExtreme(DEBUG_LEVEL_VERBOSE, 
     717                       "XMIT EMPTY: CY=%04u\n", 
     718                       cycle); 
    762719 
    763720    generateEmptyPacketHeader(data, length, tag, sy, cycle, dropped_cycles, max_length); 
     
    15231480                                             this); 
    15241481            m_in_xrun = false; 
    1525             m_min_ahead = 7999; 
    15261482            m_local_node_id = m_1394service.getLocalNodeId() & 0x3f; 
    15271483            m_data_buffer->setTransparent(false); 
     
    18351791                        (unsigned int)TICKS_TO_CYCLES(now), 
    18361792                        (unsigned int)TICKS_TO_OFFSET(now)); 
    1837     if(getType() == ePT_Transmit) { 
    1838         debugOutputShort( DEBUG_LEVEL_NORMAL, "  Min ISOXMT bufferfill : %04d\n", m_min_ahead); 
    1839     } 
    18401793    debugOutputShort( DEBUG_LEVEL_NORMAL, "  Xrun?                 : %s\n", (m_in_xrun ? "True":"False")); 
    18411794    if (m_state == m_next_state) { 
  • trunk/libffado/src/libstreaming/generic/StreamProcessor.h

    r1031 r1032  
    473473        {return ePTToString(getType());}; 
    474474 
    475     int m_min_ahead; // DEBUG 
    476  
    477475    DECLARE_DEBUG_MODULE; 
    478476};