Changeset 1037

Show
Ignore:
Timestamp:
04/25/08 12:07:32 (14 years ago)
Author:
ppalmers
Message:

use new pkt_ctr in receive SP, calculate it fully in the IsoHandler?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp

    r1036 r1037  
    9494                                                 uint32_t pkt_ctr) 
    9595{ 
    96     #ifdef DEBUG 
    97     static uint32_t now_prev=0; 
    98     static uint64_t now_prev_ticks=0; 
    99     #endif 
    100  
    10196    struct iec61883_packet *packet = (struct iec61883_packet *) data; 
    10297    assert(packet); 
    10398    bool ok = (packet->syt != 0xFFFF) && 
    104                   (packet->fdf != 0xFF) && 
    105                   (packet->fmt == 0x10) && 
    106                   (packet->dbs > 0) && 
    107                   (length >= 2*sizeof(quadlet_t)); 
     99              (packet->fdf != 0xFF) && 
     100              (packet->fmt == 0x10) && 
     101              (packet->dbs > 0) && 
     102              (length >= 2*sizeof(quadlet_t)); 
    108103    if(ok) { 
     104        m_last_timestamp = sytRecvToFullTicks2((uint32_t)ntohs(packet->syt), pkt_ctr); 
     105        //#ifdef DEBUG 
     106        #if 0 
    109107        uint32_t now = m_1394service.getCycleTimer(); 
    110108 
    111         #ifdef DEBUG 
    112         uint64_t now_ticks = CYCLE_TIMER_TO_TICKS(now); 
    113  
    114         if (diffTicks(now_ticks, now_prev_ticks) < 0) { 
    115             debugWarning("non-monotonic CTR on cycle %04u: %llu -> %llu\n",  
    116                          CYCLE_TIMER_GET_CYCLES(pkt_ctr), now_prev_ticks, now_ticks); 
    117             debugWarning("                               : %08X -> %08X\n", now_prev, now); 
    118             debugOutput ( DEBUG_LEVEL_VERBOSE, 
    119                         " current: %011llu (%03us %04ucy %04uticks)\n", 
    120                         now, 
    121                         (unsigned int)TICKS_TO_SECS( now ), 
    122                         (unsigned int)TICKS_TO_CYCLES( now ), 
    123                         (unsigned int)TICKS_TO_OFFSET( now ) ); 
    124             debugOutput ( DEBUG_LEVEL_VERBOSE, 
    125                         " prev   : %011llu (%03us %04ucy %04uticks)\n", 
    126                         now_prev, 
    127                         (unsigned int)TICKS_TO_SECS( now_prev ), 
    128                         (unsigned int)TICKS_TO_CYCLES( now_prev ), 
    129                         (unsigned int)TICKS_TO_OFFSET( now_prev ) ); 
    130         } 
    131         now_prev = now; 
    132         now_prev_ticks=now_ticks; 
     109        //=> convert the SYT to a full timestamp in ticks 
     110        uint64_t old_last_timestamp = sytRecvToFullTicks((uint32_t)ntohs(packet->syt), 
     111                                              CYCLE_TIMER_GET_CYCLES(pkt_ctr), now); 
     112        if(m_last_timestamp != old_last_timestamp) { 
     113            debugWarning("discepancy between timestamp calculations\n"); 
     114        } 
    133115        #endif 
    134  
    135         //=> convert the SYT to a full timestamp in ticks 
    136         m_last_timestamp = sytRecvToFullTicks((uint32_t)ntohs(packet->syt), 
    137                                               CYCLE_TIMER_GET_CYCLES(pkt_ctr), now); 
    138116    } 
    139117    return (ok ? eCRV_OK : eCRV_Invalid ); 
  • trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp

    r1036 r1037  
    9393    // the base timestamp is the one of the next sample in the buffer 
    9494    ffado_timestamp_t ts_head_tmp; 
    95     m_data_buffer->getBufferHeadTimestamp ( &ts_head_tmp, &fc ); // thread safe 
     95    m_data_buffer->getBufferHeadTimestamp( &ts_head_tmp, &fc ); // thread safe 
    9696 
    9797    // the timestamp gives us the time at which we want the sample block 
     
    100100 
    101101    // now we calculate the time when we have to transmit the sample block 
    102     transmit_at_time = substractTicks ( presentation_time, AMDTP_TRANSMIT_TRANSFER_DELAY ); 
     102    transmit_at_time = substractTicks( presentation_time, AMDTP_TRANSMIT_TRANSFER_DELAY ); 
    103103 
    104104    // calculate the cycle this block should be presented in