Index: trunk/libffado/src/libieee1394/test-cyclecalc.cpp =================================================================== --- trunk/libffado/src/libieee1394/test-cyclecalc.cpp (revision 1047) +++ trunk/libffado/src/libieee1394/test-cyclecalc.cpp (revision 1763) @@ -52,5 +52,5 @@ (unsigned int)CYCLE_TIMER_GET_OFFSET(now_ctr)); - debugOutput(DEBUG_LEVEL_VERBOSE,"NOW : %011llu (%03us %04uc %04ut)\n", + debugOutput(DEBUG_LEVEL_VERBOSE,"NOW : %011"PRIu64" (%03us %04uc %04ut)\n", now, (unsigned int)TICKS_TO_SECS(now), @@ -68,5 +68,5 @@ #endif - debugOutput(DEBUG_LEVEL_VERBOSE,"CALC_TS : %011llu (%03us %04uc %04ut)\n", + debugOutput(DEBUG_LEVEL_VERBOSE,"CALC_TS : %011"PRIu64" (%03us %04uc %04ut)\n", calc_ts, (unsigned int)TICKS_TO_SECS(calc_ts), Index: trunk/libffado/src/libieee1394/CycleTimerHelper.cpp =================================================================== --- trunk/libffado/src/libieee1394/CycleTimerHelper.cpp (revision 1531) +++ trunk/libffado/src/libieee1394/CycleTimerHelper.cpp (revision 1763) @@ -164,8 +164,8 @@ m_cycle_timer_prev, maxtries2); } - debugOutput( DEBUG_LEVEL_VERBOSE, " read : CTR: %11lu, local: %17llu\n", + debugOutput( DEBUG_LEVEL_VERBOSE, " read : CTR: %11u, local: %17"PRIu64"\n", m_cycle_timer_prev, local_time); debugOutput(DEBUG_LEVEL_VERBOSE, - " ctr : 0x%08X %11llu (%03us %04ucy %04uticks)\n", + " ctr : 0x%08X %11"PRIu64" (%03us %04ucy %04uticks)\n", (uint32_t)m_cycle_timer_prev, (uint64_t)CYCLE_TIMER_TO_TICKS(m_cycle_timer_prev), (unsigned int)CYCLE_TIMER_GET_SECS( m_cycle_timer_prev ), @@ -291,8 +291,8 @@ cycle_timer_ticks = CYCLE_TIMER_TO_TICKS(cycle_timer); - debugOutputExtreme( DEBUG_LEVEL_VERY_VERBOSE, " read : CTR: %11lu, local: %17llu\n", + debugOutputExtreme( DEBUG_LEVEL_VERY_VERBOSE, " read : CTR: %11u, local: %17"PRIu64"\n", cycle_timer, local_time); debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, - " ctr : 0x%08X %11llu (%03us %04ucy %04uticks)\n", + " ctr : 0x%08X %11"PRIu64" (%03us %04ucy %04uticks)\n", (uint32_t)cycle_timer, (uint64_t)cycle_timer_ticks, (unsigned int)TICKS_TO_SECS( (uint64_t)cycle_timer_ticks ), @@ -310,5 +310,5 @@ bw_abs, bw_rel); debugOutput(DEBUG_LEVEL_VERBOSE, - " usecs/update: %lu, ticks/update: %lu, m_dll_e2: %f\n", + " usecs/update: %u, ticks/update: %u, m_dll_e2: %f\n", m_usecs_per_update, m_ticks_per_update, m_dll_e2); debugOutput(DEBUG_LEVEL_VERBOSE, @@ -351,5 +351,5 @@ ffado_microsecs_t now = Util::SystemTimeSource::getCurrentTimeAsUsecs(); int sleep_time = m_sleep_until - now; - debugOutput( DEBUG_LEVEL_ULTRA_VERBOSE, "(%p) Sleep until %lld/%f (now: %lld, diff=%d) ...\n", + debugOutput( DEBUG_LEVEL_ULTRA_VERBOSE, "(%p) Sleep until %"PRId64"/%f (now: %"PRId64", diff=%d) ...\n", this, m_sleep_until, m_next_time_usecs, now, sleep_time); #endif @@ -390,8 +390,8 @@ if(not_good) { debugOutput(DEBUG_LEVEL_VERBOSE, - "(%p) have to retry CTR read, diff unrealistic: diff: %lld, max: +/- %ld (try: %d) %lld\n", + "(%p) have to retry CTR read, diff unrealistic: diff: %"PRId64", max: +/- %u (try: %d) %"PRId64"\n", this, err_ticks, 1*TICKS_PER_CYCLE, ntries, expected_ticks); // sleep half a cycle to make sure the hardware moved on - Util::SystemTimeSource::SleepUsecRelative(USECS_PER_CYCLE); + Util::SystemTimeSource::SleepUsecRelative(USECS_PER_CYCLE / 2); } @@ -409,5 +409,5 @@ // // simulate a random scheduling delay between (0-10ms) // ffado_microsecs_t tmp = Util::SystemTimeSource::SleepUsecRandom(10000); - // debugOutput( DEBUG_LEVEL_VERBOSE, " (%p) random sleep of %llu usecs...\n", this, tmp); + // debugOutput( DEBUG_LEVEL_VERBOSE, " (%p) random sleep of %u usecs...\n", this, tmp); if(m_unhandled_busreset) { @@ -419,8 +419,8 @@ } - debugOutputExtreme( DEBUG_LEVEL_ULTRA_VERBOSE, " read : CTR: %11lu, local: %17llu\n", + debugOutputExtreme( DEBUG_LEVEL_ULTRA_VERBOSE, " read : CTR: %11u, local: %17"PRIu64"\n", cycle_timer, local_time); debugOutputExtreme(DEBUG_LEVEL_ULTRA_VERBOSE, - " ctr : 0x%08X %11llu (%03us %04ucy %04uticks)\n", + " ctr : 0x%08X %11"PRIu64" (%03us %04ucy %04uticks)\n", (uint32_t)cycle_timer, (uint64_t)cycle_timer_ticks, (unsigned int)TICKS_TO_SECS( (uint64_t)cycle_timer_ticks ), @@ -436,5 +436,5 @@ } else if (diff_ticks > m_ticks_per_update * 20) { debugOutput(DEBUG_LEVEL_VERBOSE, - "re-init dll due to too large tick diff: %lld >> %f\n", + "re-init dll due to too large tick diff: %"PRId64" >> %f\n", diff_ticks, (float)(m_ticks_per_update * 20)); if(!initDLL()) { @@ -462,5 +462,5 @@ diff_ticks_corr = diff_ticks - ticks_late; debugOutputExtreme(DEBUG_LEVEL_ULTRA_VERBOSE, - "diff_ticks_corr=%lld, diff_ticks = %lld, ticks_late = %lld\n", + "diff_ticks_corr=%"PRId64", diff_ticks = %"PRId64", ticks_late = %"PRId64"\n", diff_ticks_corr, diff_ticks, ticks_late); } else { @@ -473,5 +473,5 @@ // makes no sense if not running realtime if(m_realtime && usecs_late > 1000) { - debugOutput(DEBUG_LEVEL_VERBOSE, "Rather late wakeup: %lld usecs\n", usecs_late); + debugOutput(DEBUG_LEVEL_VERBOSE, "Rather late wakeup: %"PRId64" usecs\n", usecs_late); } #endif @@ -526,11 +526,11 @@ debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, - " usecs: current: %f next: %f usecs_late=%lld ticks_late=%lld\n", + " usecs: current: %f next: %f usecs_late=%"PRId64" ticks_late=%"PRId64"\n", m_current_time_usecs, m_next_time_usecs, usecs_late, ticks_late); debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, - " ticks: current: %f next: %f diff=%lld\n", + " ticks: current: %f next: %f diff=%"PRId64"\n", m_current_time_ticks, m_next_time_ticks, diff_ticks); debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, - " ticks: current: %011llu (%03us %04ucy %04uticks)\n", + " ticks: current: %011"PRIu64" (%03us %04ucy %04uticks)\n", (uint64_t)m_current_time_ticks, (unsigned int)TICKS_TO_SECS( (uint64_t)m_current_time_ticks ), @@ -538,5 +538,5 @@ (unsigned int)TICKS_TO_OFFSET( (uint64_t)m_current_time_ticks ) ); debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, - " ticks: next : %011llu (%03us %04ucy %04uticks)\n", + " ticks: next : %011"PRIu64" (%03us %04ucy %04uticks)\n", (uint64_t)m_next_time_ticks, (unsigned int)TICKS_TO_SECS( (uint64_t)m_next_time_ticks ), @@ -545,5 +545,5 @@ debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, - " state: local: %11llu, dll_e2: %f, rate: %f\n", + " state: local: %11"PRIu64", dll_e2: %f, rate: %f\n", local_time, m_dll_e2, getRate()); } @@ -589,5 +589,5 @@ } int32_t ctr_diff = cycle_timer_ticks-dll_time; - debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, "(%p) CTR DIFF: HW %010llu - DLL %010lu = %010ld (%s)\n", + debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, "(%p) CTR DIFF: HW %010"PRIu64" - DLL %010u = %010d (%s)\n", this, cycle_timer_ticks, dll_time, ctr_diff, (ctr_diff>0?"lag":"lead")); #endif @@ -625,5 +625,5 @@ if (y_step_in_ticks_int > 0) { retval = addTicks(offset_in_ticks_int, y_step_in_ticks_int); -/* debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "y_step_in_ticks_int > 0: %lld, time_diff: %f, rate: %f, retval: %lu\n", +/* debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "y_step_in_ticks_int > 0: %d, time_diff: %f, rate: %f, retval: %u\n", y_step_in_ticks_int, time_diff, my_vars.rate, retval);*/ } else { @@ -631,5 +631,5 @@ // this can happen if the update thread was woken up earlier than it should have been -/* debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "y_step_in_ticks_int <= 0: %lld, time_diff: %f, rate: %f, retval: %lu\n", +/* debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "y_step_in_ticks_int <= 0: %d, time_diff: %f, rate: %f, retval: %u\n", y_step_in_ticks_int, time_diff, my_vars.rate, retval);*/ } @@ -792,5 +792,5 @@ if (diffTicks(cycle_timer_ticks, m_cycle_timer_ticks_prev) < 0) { debugOutput( DEBUG_LEVEL_VERY_VERBOSE, - "non-monotonic CTR (try %02d): %llu -> %llu\n", + "non-monotonic CTR (try %02d): %"PRIu64" -> %"PRIu64"\n", maxtries, m_cycle_timer_ticks_prev, cycle_timer_ticks); debugOutput( DEBUG_LEVEL_VERY_VERBOSE, @@ -798,5 +798,5 @@ m_cycle_timer_prev, *cycle_timer); debugOutput( DEBUG_LEVEL_VERY_VERBOSE, - " current: %011llu (%03us %04ucy %04uticks)\n", + " current: %011"PRIu64" (%03us %04ucy %04uticks)\n", cycle_timer_ticks, (unsigned int)TICKS_TO_SECS( cycle_timer_ticks ), @@ -804,5 +804,5 @@ (unsigned int)TICKS_TO_OFFSET( cycle_timer_ticks ) ); debugOutput( DEBUG_LEVEL_VERY_VERBOSE, - " prev : %011llu (%03us %04ucy %04uticks)\n", + " prev : %011"PRIu64" (%03us %04ucy %04uticks)\n", m_cycle_timer_ticks_prev, (unsigned int)TICKS_TO_SECS( m_cycle_timer_ticks_prev ), Index: trunk/libffado/src/libieee1394/cycletimer.h =================================================================== --- trunk/libffado/src/libieee1394/cycletimer.h (revision 1531) +++ trunk/libffado/src/libieee1394/cycletimer.h (revision 1763) @@ -95,5 +95,5 @@ #ifdef DEBUG if (x >= TICKS_PER_SECOND * 128L) { - debugWarning("insufficient wrapping: %llu\n",x); + debugWarning("insufficient wrapping: %"PRIu64"\n",x); } #endif @@ -118,5 +118,5 @@ #ifdef DEBUG if (x < 0) { - debugWarning("insufficient wrapping: %lld\n",x); + debugWarning("insufficient wrapping: %"PRId64"\n",x); } #endif @@ -145,8 +145,8 @@ #ifdef DEBUG if (x >= (int64_t)(TICKS_PER_SECOND * 128L)) { - debugWarning("insufficient wrapping (max): %llu\n",x); + debugWarning("insufficient wrapping (max): %"PRIu64"\n",x); } if (x < 0) { - debugWarning("insufficient wrapping (min): %lld\n",x); + debugWarning("insufficient wrapping (min): %"PRId64"\n",x); } #endif @@ -249,5 +249,5 @@ if(diff > max || diff < -max) { debugWarning("difference does not make any sense\n"); - debugWarning("diff=%lld max=%lld\n", diff, max); + debugWarning("diff=%"PRId64" max=%"PRId64"\n", diff, max); } @@ -302,5 +302,5 @@ uint64_t timestamp; - debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "SYT=%04llX CY=%u CTR=%08llX\n", + debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "SYT=%"PRIX64" CY=%u CTR=%08"PRIX64"\n", syt_timestamp, rcv_cycle, ctr_now); @@ -313,5 +313,5 @@ int diff_cycles = diffCycles(cc_cycles, rcv_cycle); if (diff_cycles<0) { - debugWarning("current cycle timer not ahead of receive cycle: rcv: %u / cc: %llu (%d)\n", + debugWarning("current cycle timer not ahead of receive cycle: rcv: %u / cc: %"PRIu64" (%d)\n", rcv_cycle, cc_cycles, diff_cycles); } @@ -351,5 +351,5 @@ } else { debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, - "Detected wraparound: %d + %d = %d\n", + "Detected wraparound: %u + %"PRId64" = %"PRId64"\n", rcv_cycle, delta_cycles, new_cycles); @@ -372,5 +372,5 @@ if(( TICKS_TO_CYCLE_TIMER(timestamp) & 0xFFFF) != syt_timestamp) { debugWarning("back-converted timestamp not equal to SYT\n"); - debugWarning("TS=%011llu TSC=%08lX SYT=%04X\n", + debugWarning("TS=%011"PRIu64" TSC=%08"PRIX64" SYT=%04"PRIX64"\n", timestamp, TICKS_TO_CYCLE_TIMER(timestamp), syt_timestamp); } @@ -391,5 +391,5 @@ uint64_t timestamp; - debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "SYT=%04llX RCV_CTR=%08X\n", + debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "SYT=%04"PRIX64" RCV_CTR=%08X\n", syt_timestamp, rcv_ctr); @@ -433,5 +433,5 @@ if(( TICKS_TO_CYCLE_TIMER(timestamp) & 0xFFFF) != syt_timestamp) { debugWarning("back-converted timestamp not equal to SYT\n"); - debugWarning("TS=%011llu TSC=%08lX SYT=%04X\n", + debugWarning("TS=%011"PRIu64" TSC=%08"PRIX64" SYT=%04"PRIX64"\n", timestamp, TICKS_TO_CYCLE_TIMER(timestamp), syt_timestamp); } @@ -457,5 +457,5 @@ uint64_t timestamp; - debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "SYT=%08llX CY=%04X CTR=%08llX\n", + debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "SYT=%08"PRIX64" CY=%04X CTR=%08"PRIX64"\n", syt_timestamp, xmt_cycle, ctr_now); @@ -467,5 +467,5 @@ int diff_cycles = diffCycles(xmt_cycle, cc_cycles); if (diff_cycles<0) { - debugWarning("xmit cycle not ahead of current cycle: xmt: %u / cc: %llu (%d)\n", + debugWarning("xmit cycle not ahead of current cycle: xmt: %u / cc: %"PRIu64" (%d)\n", xmt_cycle, cc_cycles, diff_cycles); } @@ -505,5 +505,5 @@ } else { debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, - "Detected wraparound: %d + %d = %d\n", + "Detected wraparound: %u + %"PRId64" = %"PRId64"\n", xmt_cycle, delta_cycles, new_cycles); @@ -526,5 +526,5 @@ if(( TICKS_TO_CYCLE_TIMER(timestamp) & 0xFFFF) != syt_timestamp) { debugWarning("back-converted timestamp not equal to SYT\n"); - debugWarning("TS=%011llu TSC=%08lX SYT=%04X\n", + debugWarning("TS=%011"PRIu64" TSC=%08"PRIX64" SYT=%04"PRIX64"\n", timestamp, TICKS_TO_CYCLE_TIMER(timestamp), syt_timestamp); } Index: trunk/libffado/src/libieee1394/ieee1394service.cpp =================================================================== --- trunk/libffado/src/libieee1394/ieee1394service.cpp (revision 1660) +++ trunk/libffado/src/libieee1394/ieee1394service.cpp (revision 1763) @@ -57,5 +57,5 @@ , m_armHelperRealtime( NULL ) , m_handle( 0 ) - , m_handle_lock( new Util::PosixMutex("SRCVHND") ) + , m_handle_lock( new Util::PosixMutex("SRVCHND") ) , m_util_handle( 0 ) , m_port( -1 ) @@ -85,5 +85,5 @@ , m_armHelperRealtime( NULL ) , m_handle( 0 ) - , m_handle_lock( new Util::PosixMutex("SRCVHND") ) + , m_handle_lock( new Util::PosixMutex("SRVCHND") ) , m_util_handle( 0 ) , m_port( -1 ) @@ -122,9 +122,9 @@ ++it ) { - debugOutput(DEBUG_LEVEL_VERBOSE, "Unregistering ARM handler for 0x%016llX\n", (*it)->getStart()); + debugOutput(DEBUG_LEVEL_VERBOSE, "Unregistering ARM handler for 0x%016"PRIX64"\n", (*it)->getStart()); if(m_armHelperNormal) { int err = raw1394_arm_unregister(m_armHelperNormal->get1394Handle(), (*it)->getStart()); if (err) { - debugError(" Failed to unregister ARM handler for 0x%016llX\n", (*it)->getStart()); + debugError(" Failed to unregister ARM handler for 0x%016"PRIX64"\n", (*it)->getStart()); debugError(" Error: %s\n", strerror(errno)); } @@ -557,5 +557,5 @@ #ifdef DEBUG debugOutput(DEBUG_LEVEL_VERY_VERBOSE, - "read: node 0x%hX, addr = 0x%016llX, length = %u\n", + "read: node 0x%hX, addr = 0x%016"PRIX64", length = %zd\n", nodeId, addr, length); printBuffer( DEBUG_LEVEL_VERY_VERBOSE, length, buffer ); @@ -566,5 +566,5 @@ #ifdef DEBUG debugOutput(DEBUG_LEVEL_VERBOSE, - "raw1394_read failed: node 0x%hX, addr = 0x%016llX, length = %u\n", + "raw1394_read failed: node 0x%hX, addr = 0x%016"PRIX64", length = %zd\n", nodeId, addr, length); #endif @@ -612,5 +612,5 @@ #ifdef DEBUG - debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"write: node 0x%hX, addr = 0x%016llX, length = %d\n", + debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"write: node 0x%hX, addr = 0x%016"PRIX64", length = %zd\n", nodeId, addr, length); printBuffer( DEBUG_LEVEL_VERY_VERBOSE, length, data ); @@ -649,7 +649,7 @@ } #ifdef DEBUG - debugOutput(DEBUG_LEVEL_VERBOSE,"lockCompareSwap64: node 0x%X, addr = 0x%016llX\n", + debugOutput(DEBUG_LEVEL_VERBOSE,"lockCompareSwap64: node 0x%X, addr = 0x%016"PRIX64"\n", nodeId, addr); - debugOutput(DEBUG_LEVEL_VERBOSE," if (*(addr)==0x%016llX) *(addr)=0x%016llX\n", + debugOutput(DEBUG_LEVEL_VERBOSE," if (*(addr)==0x%016"PRIX64") *(addr)=0x%016"PRIX64"\n", compare_value, swap_value); fb_octlet_t buffer; @@ -657,5 +657,5 @@ debugWarning("Could not read register\n"); } else { - debugOutput(DEBUG_LEVEL_VERBOSE,"before = 0x%016llX\n", buffer); + debugOutput(DEBUG_LEVEL_VERBOSE,"before = 0x%016"PRIX64"\n", buffer); } #endif @@ -681,5 +681,5 @@ debugWarning("Could not read register\n"); } else { - debugOutput(DEBUG_LEVEL_VERBOSE,"after = 0x%016llX\n", buffer); + debugOutput(DEBUG_LEVEL_VERBOSE,"after = 0x%016"PRIX64"\n", buffer); } #endif @@ -831,4 +831,17 @@ } + // check the request and figure out what happened + if(m_fcp_block.status == eFS_Waiting) { + debugOutput(DEBUG_LEVEL_VERBOSE, "FCP response timed out\n"); + retval = false; + goto out; + } + if(m_fcp_block.status == eFS_Error) { + debugError("FCP request/response error\n"); + retval = false; + goto out; + } + +out: // stop listening for FCP responses err = raw1394_stop_fcp_listen(m_handle); @@ -836,20 +849,6 @@ debugOutput(DEBUG_LEVEL_VERBOSE, "could not stop FCP listen (err=%d, errno=%d)\n", err, errno); retval = false; - goto out; - } - - // check the request and figure out what happened - if(m_fcp_block.status == eFS_Waiting) { - debugOutput(DEBUG_LEVEL_VERBOSE, "FCP response timed out\n"); - retval = false; - goto out; - } - if(m_fcp_block.status == eFS_Error) { - debugError("FCP request/response error\n"); - retval = false; - goto out; - } - -out: + } + m_fcp_block.status = eFS_Empty; return retval; @@ -876,5 +875,5 @@ fb_quadlet_t *data_quads = (fb_quadlet_t *)data; #ifdef DEBUG - debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"fcp response: node 0x%hX, response = %d, length = %d bytes\n", + debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"fcp response: node 0x%hX, response = %d, length = %zd bytes\n", nodeid, response, length); printBuffer(DEBUG_LEVEL_VERY_VERBOSE, (length+3)/4, data_quads ); @@ -906,5 +905,5 @@ } else if(FCP_MASK_SUBUNIT_AND_OPCODE(first_quadlet) != FCP_MASK_SUBUNIT_AND_OPCODE(CondSwapFromBus32(m_fcp_block.request[0]))) { - debugOutput(DEBUG_LEVEL_VERBOSE, "FCP response not for this request: %08lX != %08lX\n", + debugOutput(DEBUG_LEVEL_VERBOSE, "FCP response not for this request: %08X != %08X\n", FCP_MASK_SUBUNIT_AND_OPCODE(first_quadlet), FCP_MASK_SUBUNIT_AND_OPCODE(CondSwapFromBus32(m_fcp_block.request[0]))); @@ -970,5 +969,5 @@ return 0; } - debugOutput(DEBUG_LEVEL_VERBOSE, " READ HI: 0x%08lX\n", split_timeout_hi); + debugOutput(DEBUG_LEVEL_VERBOSE, " READ HI: 0x%08X\n", split_timeout_hi); if(!readNoLock( 0xffc0 | nodeId, CSR_REGISTER_BASE + CSR_SPLIT_TIMEOUT_LO, 1, @@ -977,5 +976,5 @@ return 0; } - debugOutput(DEBUG_LEVEL_VERBOSE, " READ LO: 0x%08lX\n", split_timeout_low); + debugOutput(DEBUG_LEVEL_VERBOSE, " READ LO: 0x%08X\n", split_timeout_low); split_timeout_hi = CondSwapFromBus32(split_timeout_hi); @@ -1073,6 +1072,7 @@ bool Ieee1394Service::registerARMHandler(ARMHandler *h) { - debugOutput(DEBUG_LEVEL_VERBOSE, "Registering ARM handler (%p) for 0x%016llX, length %u\n", - h, h->getStart(), h->getLength()); + debugOutput(DEBUG_LEVEL_VERBOSE, + "Registering ARM handler (%p) for 0x%016"PRIX64", length %zu\n", + h, h->getStart(), h->getLength()); // FIXME: note that this will result in the ARM handlers not running in a realtime context @@ -1083,5 +1083,5 @@ h->getClientTransactions()); if (err) { - debugError("Failed to register ARM handler for 0x%016llX\n", h->getStart()); + debugError("Failed to register ARM handler for 0x%016"PRIX64"\n", h->getStart()); debugError(" Error: %s\n", strerror(errno)); return false; @@ -1092,5 +1092,5 @@ bool Ieee1394Service::unregisterARMHandler( ARMHandler *h ) { - debugOutput(DEBUG_LEVEL_VERBOSE, "Unregistering ARM handler (%p) for 0x%016llX\n", + debugOutput(DEBUG_LEVEL_VERBOSE, "Unregistering ARM handler (%p) for 0x%016"PRIX64"\n", h, h->getStart()); @@ -1123,6 +1123,7 @@ */ nodeaddr_t Ieee1394Service::findFreeARMBlock( nodeaddr_t start, size_t length, size_t step ) { - debugOutput(DEBUG_LEVEL_VERBOSE, "Finding free ARM block of %d bytes, from 0x%016llX in steps of %d bytes\n", - length, start, step); + debugOutput(DEBUG_LEVEL_VERBOSE, + "Finding free ARM block of %zd bytes, from 0x%016"PRIX64" in steps of %zd bytes\n", + length, start, step); int cnt=0; @@ -1135,9 +1136,9 @@ if (err) { - debugOutput(DEBUG_LEVEL_VERBOSE, " -> cannot use 0x%016llX\n", start); + debugOutput(DEBUG_LEVEL_VERBOSE, " -> cannot use 0x%016"PRIX64"\n", start); debugError(" Error: %s\n", strerror(errno)); start += step; } else { - debugOutput(DEBUG_LEVEL_VERBOSE, " -> use 0x%016llX\n", start); + debugOutput(DEBUG_LEVEL_VERBOSE, " -> use 0x%016"PRIX64"\n", start); err = raw1394_arm_unregister(m_handle, start); if (err) { @@ -1188,5 +1189,5 @@ raw1394_arm_response_t arm_resp = arm_req_resp->response; - debugOutput(DEBUG_LEVEL_VERBOSE,"ARM handler for address 0x%016llX called\n", + debugOutput(DEBUG_LEVEL_VERBOSE,"ARM handler for address 0x%016"PRIX64" called\n", (*it)->getStart()); debugOutput(DEBUG_LEVEL_VERBOSE," request type : 0x%02X\n", request_type); @@ -1583,5 +1584,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, " CycleTimerHelper: %p, IsoManager: %p, WatchDog: %p\n", m_pCTRHelper, m_pIsoManager, m_pWatchdog ); - debugOutput( DEBUG_LEVEL_VERBOSE, " Time: %011llu (%03us %04ucy %04uticks)\n", + debugOutput( DEBUG_LEVEL_VERBOSE, " Time: %011"PRIu64" (%03us %04ucy %04uticks)\n", ctr, (unsigned int)TICKS_TO_SECS( ctr ), Index: trunk/libffado/src/libieee1394/ARMHandler.cpp =================================================================== --- trunk/libffado/src/libieee1394/ARMHandler.cpp (revision 1550) +++ trunk/libffado/src/libieee1394/ARMHandler.cpp (revision 1763) @@ -123,7 +123,7 @@ debugOutput(DEBUG_LEVEL_VERBOSE, " tlabel: 0x%02X, tcode: 0x%02X, extended tcode: 0x%02X\n", arm_req->tlabel, arm_req->tcode, arm_req->extended_transaction_code); - debugOutput(DEBUG_LEVEL_VERBOSE, " generation: %lu\n", + debugOutput(DEBUG_LEVEL_VERBOSE, " generation: %u\n", arm_req->generation); - debugOutput(DEBUG_LEVEL_VERBOSE, " buffer length: %lu\n", + debugOutput(DEBUG_LEVEL_VERBOSE, " buffer length: %u\n", arm_req->buffer_length); printBufferBytes(DEBUG_LEVEL_VERBOSE, arm_req->buffer_length, arm_req->buffer); Index: trunk/libffado/src/libieee1394/configrom.cpp =================================================================== --- trunk/libffado/src/libieee1394/configrom.cpp (revision 1336) +++ trunk/libffado/src/libieee1394/configrom.cpp (revision 1763) @@ -486,5 +486,5 @@ { debugOutput( DEBUG_LEVEL_VERBOSE, - "Checking for updated node id for device with GUID 0x%016llX...\n", + "Checking for updated node id for device with GUID 0x%016"PRIX64"...\n", getGuid()); @@ -517,5 +517,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, - " Node has GUID 0x%016llX\n", + " Node has GUID 0x%016"PRIX64"\n", guid); @@ -524,5 +524,5 @@ if ( nodeId != getNodeId() ) { debugOutput( DEBUG_LEVEL_VERBOSE, - "Device with GUID 0x%016llX changed node id " + "Device with GUID 0x%016"PRIX64" changed node id " "from %d to %d\n", getGuid(), @@ -532,5 +532,5 @@ } else { debugOutput( DEBUG_LEVEL_VERBOSE, - "Device with GUID 0x%016llX kept node id %d\n", + "Device with GUID 0x%016"PRIX64" kept node id %d\n", getGuid(), getNodeId()); @@ -549,5 +549,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, - "Device with GUID 0x%016llX could not be found on " + "Device with GUID 0x%016"PRIX64" could not be found on " "the bus anymore (removed?)\n", getGuid() ); @@ -562,5 +562,5 @@ debugOutput(DEBUG_LEVEL_NORMAL, "Config ROM\n" ); debugOutput(DEBUG_LEVEL_NORMAL, "\tCurrent Node Id:\t%d\n", getNodeId() ); - debugOutput(DEBUG_LEVEL_NORMAL, "\tGUID:\t\t\t0x%016llX\n", getGuid()); + debugOutput(DEBUG_LEVEL_NORMAL, "\tGUID:\t\t\t0x%016"PRIX64"\n", getGuid()); debugOutput(DEBUG_LEVEL_NORMAL, "\tVendor Name:\t\t%s\n", getVendorName().c_str() ); debugOutput(DEBUG_LEVEL_NORMAL, "\tModel Name:\t\t%s\n", getModelName().c_str() ); @@ -583,5 +583,5 @@ printMessage("Config ROM\n" ); printMessage("\tCurrent Node Id:\t%d\n", getNodeId() ); - printMessage("\tGUID:\t\t\t0x%016llX\n", getGuid()); + printMessage("\tGUID:\t\t\t0x%016"PRIX64"\n", getGuid()); printMessage("\tVendor Name:\t\t%s\n", getVendorName().c_str() ); printMessage("\tModel Name:\t\t%s\n", getModelName().c_str() ); Index: trunk/libffado/src/libieee1394/IsoHandlerManager.cpp =================================================================== --- trunk/libffado/src/libieee1394/IsoHandlerManager.cpp (revision 1731) +++ trunk/libffado/src/libieee1394/IsoHandlerManager.cpp (revision 1763) @@ -114,5 +114,5 @@ if (!h->handleBusReset()) { - debugWarning("Failed to handle busreset on %p\n"); + debugWarning("Failed to handle busreset on %p\n", h); retval = false; } @@ -261,5 +261,5 @@ if(no_one_to_poll) { - debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, + debugOutputExtreme(DEBUG_LEVEL_VERBOSE, "(%p, %s) No one to poll, waiting for something to happen\n", this, (m_handlerType == IsoHandler::eHT_Transmit? "Transmit": "Receive")); @@ -325,9 +325,9 @@ debugOutputExtreme(DEBUG_LEVEL_VERBOSE, - "(%p, %s) check handler %d: diff = %lld, max = %lld, now: %08lX, last: %08lX\n", + "(%p, %s) check handler %d: diff = %"PRId64", max = %"PRId64", now: %08X, last: %08X\n", this, (m_handlerType == IsoHandler::eHT_Transmit? "Transmit": "Receive"), i, measured_diff_ticks, max_diff_ticks, ctr_at_poll_return, last_packet_seen); if(measured_diff_ticks > max_diff_ticks) { - debugFatal("(%p, %s) Handler died: now: %08lX, last: %08lX, diff: %lld (max: %lld)\n", + debugFatal("(%p, %s) Handler died: now: %08X, last: %08X, diff: %"PRId64" (max: %"PRId64")\n", this, (m_handlerType == IsoHandler::eHT_Transmit? "Transmit": "Receive"), ctr_at_poll_return, last_packet_seen, measured_diff_ticks, max_diff_ticks); @@ -410,12 +410,14 @@ debugError("(%p) sem_timedwait error (result=%d errno=EINVAL)\n", this, result); - debugError("(%p) timeout_nsec=%lld ts.sec=%d ts.nsec=%lld\n", - this, m_activity_wait_timeout_nsec, ts.tv_sec, ts.tv_nsec); + debugError("(%p) timeout_nsec=%lld ts.sec=%"PRId64" ts.nsec=%"PRId64"\n", + this, m_activity_wait_timeout_nsec, + (int64_t)ts.tv_sec, (int64_t)ts.tv_nsec); return eAR_Error; } else { debugError("(%p) sem_timedwait error (result=%d errno=%d)\n", this, result, errno); - debugError("(%p) timeout_nsec=%lld ts.sec=%d ts.nsec=%lld\n", - this, m_activity_wait_timeout_nsec, ts.tv_sec, ts.tv_nsec); + debugError("(%p) timeout_nsec=%lld ts.sec=%"PRId64" ts.nsec=%"PRId64"\n", + this, m_activity_wait_timeout_nsec, + (int64_t)ts.tv_sec, (int64_t)ts.tv_nsec); return eAR_Error; } @@ -885,5 +887,5 @@ m_StreamProcessors.push_back(stream); - debugOutput( DEBUG_LEVEL_VERBOSE, " %d streams, %d handlers registered\n", + debugOutput( DEBUG_LEVEL_VERBOSE, " %zd streams, %zd handlers registered\n", m_StreamProcessors.size(), m_IsoHandlers.size()); return true; Index: trunk/libffado/src/libieee1394/IsoHandler.cpp =================================================================== --- trunk/libffado/src/libieee1394/IsoHandler.cpp (revision 1731) +++ trunk/libffado/src/libieee1394/IsoHandler.cpp (revision 1763) @@ -261,5 +261,5 @@ // wake ourselves up - raw1394_wake_up(m_handle); + if(m_handle) raw1394_wake_up(m_handle); } @@ -396,7 +396,11 @@ if((pkt_ctr & ~0x0FFFL) != pkt_ctr_ref) { debugWarning("reconstructed CTR counter discrepancy\n"); - debugWarning(" ingredients: %X, %lX, %lX, %lX, %lX, %ld, %ld, %ld, %lld\n", - cycle, pkt_ctr_ref, pkt_ctr, now, m_last_now, now_secs_ref, CYCLE_TIMER_GET_SECS(now), CYCLE_TIMER_GET_SECS(m_last_now), tmp); - debugWarning(" diffcy = %ld \n", diff_cycles); + debugWarning(" ingredients: %X, %X, %X, %X, %X, %d, %ld, %ld, %"PRId64"\n", + cycle, pkt_ctr_ref, pkt_ctr, + now, m_last_now, now_secs_ref, + (long int)CYCLE_TIMER_GET_SECS(now), + (long int)CYCLE_TIMER_GET_SECS(m_last_now), + tmp); + debugWarning(" diffcy = %"PRId64" \n", diff_cycles); } #endif @@ -475,7 +479,11 @@ if(((pkt_ctr & ~0x0FFFL) != pkt_ctr_ref) && (m_packets > m_buf_packets)) { debugWarning("reconstructed CTR counter discrepancy\n"); - debugWarning(" ingredients: %X, %lX, %lX, %lX, %lX, %ld, %ld, %ld, %lld\n", - cycle, pkt_ctr_ref, pkt_ctr, now, m_last_now, now_secs_ref, CYCLE_TIMER_GET_SECS(now), CYCLE_TIMER_GET_SECS(m_last_now), tmp); - debugWarning(" diffcy = %ld \n", diff_cycles); + debugWarning(" ingredients: %X, %X, %X, %X, %X, %d, %ld, %ld, %"PRId64"\n", + cycle, pkt_ctr_ref, pkt_ctr, + now, m_last_now, now_secs_ref, + (long int)CYCLE_TIMER_GET_SECS(now), + (long int)CYCLE_TIMER_GET_SECS(m_last_now), + tmp); + debugWarning(" diffcy = %"PRId64" \n", diff_cycles); } #endif