Changeset 1020

Show
Ignore:
Timestamp:
04/24/08 10:20:56 (13 years ago)
Author:
ppalmers
Message:

cope with situation where a cc_cycle < rcv_cycle

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libieee1394/cycletimer.h

    r1019 r1020  
    315315    // check for bogus ctr 
    316316    // the cycle timer should be ahead of the receive timer 
    317     if (diffCycles(cc_cycles, rcv_cycle)<0) { 
     317    int diff_cycles = diffCycles(cc_cycles, rcv_cycle); 
     318    if (diff_cycles<0) { 
    318319        debugWarning("current cycle timer not ahead of receive cycle: rcv: %u / cc: %llu (%d)\n", 
    319                         rcv_cycle, cc_cycles, diffCycles(cc_cycles, rcv_cycle)); 
     320                        rcv_cycle, cc_cycles, diff_cycles); 
    320321    } 
    321322 
     
    323324    // we want cc_seconds to reflect the 'seconds' at the point this 
    324325    // was received 
    325     if (rcv_cycle>cc_cycles) { 
     326    if (rcv_cycle>cc_cycles && (diff_cycles>=0)) { 
    326327        if (cc_seconds) { 
    327328            cc_seconds--; 
     
    407408 
    408409    // check for bogus CTR 
    409     if (diffCycles(xmt_cycle, cc_cycles)<0) { 
     410    int diff_cycles = diffCycles(xmt_cycle, cc_cycles); 
     411    if (diff_cycles<0) { 
    410412        debugWarning("xmit cycle not ahead of current cycle: xmt: %u / cc: %llu (%d)\n", 
    411                         xmt_cycle, cc_cycles, diffCycles(xmt_cycle, cc_cycles)); 
     413                        xmt_cycle, cc_cycles, diff_cycles); 
    412414    } 
    413415 
     
    415417    // we want cc_seconds to reflect the 'seconds' at the point this 
    416418    // is to be transmitted 
    417     if (cc_cycles>xmt_cycle) { 
     419    if (cc_cycles>xmt_cycle && (diff_cycles>=0)) { 
    418420        if (cc_seconds) { 
    419421            cc_seconds--;