Changeset 2167
- Timestamp:
- 06/19/12 05:10:51 (11 years ago)
- Files:
-
- trunk/libffado/src/libieee1394/ieee1394service.cpp (modified) (4 diffs)
- trunk/libffado/src/libieee1394/ieee1394service.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libieee1394/ieee1394service.cpp
r2164 r2167 47 47 #include <iostream> 48 48 #include <iomanip> 49 50 // Permit linking against older libraw1394 which didn't include this 51 // function. 52 #ifdef __GNUC__ 53 #ifdef __APPLE__ 54 #define WEAK_ATTRIBUTE weak_import 55 #else 56 #define WEAK_ATTRIBUTE __weak__ 57 #endif 58 int raw1394_read_cycle_timer_and_clock(raw1394handle_t handle, 59 u_int32_t *cycle_timer, u_int64_t *local_time, clockid_t clk_id) 60 __attribute__((WEAK_ATTRIBUTE)); 61 #endif 49 62 50 63 using namespace std; … … 318 331 uint32_t cycle_timer; 319 332 uint64_t local_time; 333 m_have_read_ctr_and_clock = false; 320 334 err = raw1394_read_cycle_timer(m_util_handle, &cycle_timer, &local_time); 321 335 if(err) { … … 330 344 m_have_new_ctr_read = false; 331 345 } else { 332 debugOutput(DEBUG_LEVEL_VERBOSE, "This system supports the raw1394_read_cycle_timer call, using it.\n");333 346 m_have_new_ctr_read = true; 347 348 // Only if raw1394_read_cycle_timer() is present is it worth even 349 // considering the option that raw1394_read_cycle_timer_and_clock() 350 // might be available. 351 if (raw1394_read_cycle_timer_and_clock != NULL) { 352 err = raw1394_read_cycle_timer_and_clock(m_util_handle, &cycle_timer, &local_time, CLOCK_MONOTONIC_RAW); 353 if (!err) 354 m_have_read_ctr_and_clock = true; 355 } 356 357 if (m_have_read_ctr_and_clock) 358 debugOutput(DEBUG_LEVEL_VERBOSE, "This system supports the raw1394_read_cycle_timer_and_clock call, using it.\n"); 359 else { 360 debugOutput(DEBUG_LEVEL_VERBOSE, "This system supports the raw1394_read_cycle_timer call, using it.\n"); 361 debugOutput(DEBUG_LEVEL_NORMAL, "The raw1394_read_cycle_timer_and_clock call is not available.\n"); 362 debugOutput(DEBUG_LEVEL_NORMAL, "Fallback to raw1394_read_cycle_timer.\n"); 363 debugOutput(DEBUG_LEVEL_NORMAL, "FFADO may be susceptible to NTP-induced clock discontinuities.\n"); 364 debugOutput(DEBUG_LEVEL_NORMAL, "Upgrade libraw1394 to version 2.1.0 or later if this is an issue.\n"); 365 } 334 366 } 335 367 … … 504 536 Ieee1394Service::readCycleTimerReg(uint32_t *cycle_timer, uint64_t *local_time) 505 537 { 538 if (m_have_read_ctr_and_clock) { 539 int err; 540 err = raw1394_read_cycle_timer_and_clock(m_util_handle, cycle_timer, local_time, CLOCK_MONOTONIC_RAW); 541 if(err) { 542 debugWarning("raw1394_read_cycle_timer_and_clock: %s\n", strerror(err)); 543 return false; 544 } 545 return true; 546 } else 506 547 if(m_have_new_ctr_read) { 507 548 int err; trunk/libffado/src/libieee1394/ieee1394service.h
r1660 r2167 461 461 CycleTimerHelper* m_pCTRHelper; 462 462 bool m_have_new_ctr_read; 463 bool m_have_read_ctr_and_clock; 463 464 464 465 bool m_filterFCPResponse;