Changeset 1019

Show
Ignore:
Timestamp:
04/24/08 07:31:34 (13 years ago)
Author:
ppalmers
Message:

fix sanity check

Files:

Legend:

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

    r1017 r1019  
    200200 */ 
    201201static inline int diffCycles(unsigned int x, unsigned int y) { 
    202     int diff = x - y; 
     202    int diff = (int)x - (int)y; 
    203203 
    204204    // the maximal difference we allow (64secs) 
     
    313313    uint64_t cc_seconds=CYCLE_TIMER_GET_SECS(ctr_now); 
    314314 
     315    // check for bogus ctr 
     316    // the cycle timer should be ahead of the receive timer 
     317    if (diffCycles(cc_cycles, rcv_cycle)<0) { 
     318        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    } 
     321 
    315322    // the cycletimer has wrapped since this packet was received 
    316323    // we want cc_seconds to reflect the 'seconds' at the point this 
    317324    // was received 
    318      
    319325    if (rcv_cycle>cc_cycles) { 
    320         if (!(diffCycles(cc_cycles, rcv_cycle)>=0)) { 
    321             debugWarning("possibly false cycle wraparound detected: rcv: %u / cc: %u (%d)\n", 
    322                          rcv_cycle, cc_cycles, diffCycles(cc_cycles, rcv_cycle)); 
    323         } 
    324326        if (cc_seconds) { 
    325327            cc_seconds--; 
     
    404406    uint64_t cc_seconds=CYCLE_TIMER_GET_SECS(ctr_now); 
    405407 
     408    // check for bogus CTR 
     409    if (diffCycles(xmt_cycle, cc_cycles)<0) { 
     410        debugWarning("xmit cycle not ahead of current cycle: xmt: %u / cc: %llu (%d)\n", 
     411                        xmt_cycle, cc_cycles, diffCycles(xmt_cycle, cc_cycles)); 
     412    } 
     413 
    406414    // the cycletimer has wrapped since this packet was received 
    407415    // we want cc_seconds to reflect the 'seconds' at the point this 
    408416    // is to be transmitted 
    409417    if (cc_cycles>xmt_cycle) { 
    410         if (!(diffCycles(xmt_cycle, cc_cycles)>=0)) { 
    411             debugWarning("possibly false cycle wraparound detected: cc: %u / xmt: %u (%d)\n", 
    412                          cc_cycles, xmt_cycle, diffCycles(xmt_cycle, cc_cycles)); 
    413         } 
    414  
    415418        if (cc_seconds) { 
    416419            cc_seconds--;