Changeset 940

Show
Ignore:
Timestamp:
03/12/08 07:05:53 (13 years ago)
Author:
ppalmers
Message:

use RT watchdog for 1394 service threads

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libieee1394/CycleTimerHelper.cpp

    r932 r940  
    2828#include "libutil/PosixThread.h" 
    2929#include "libutil/Atomic.h" 
     30#include "libutil/Watchdog.h" 
    3031 
    3132#define DLL_PI        (3.141592653589793238) 
     
    135136        return false; 
    136137    } 
     138    // register the thread with the RT watchdog 
     139    Util::Watchdog *watchdog = m_Parent.getWatchdog(); 
     140    if(watchdog) { 
     141        if(!watchdog->registerThread(m_Thread)) { 
     142            debugWarning("could not register update thread with watchdog\n"); 
     143        } 
     144    } else { 
     145        debugWarning("could not find valid watchdog\n"); 
     146    } 
     147     
    137148    if (m_Thread->Start() != 0) { 
    138149        debugFatal("Could not start update thread\n"); 
  • trunk/libffado/src/libieee1394/ieee1394service.cpp

    r937 r940  
    3535 
    3636#include "libutil/SystemTimeSource.h" 
     37#include "libutil/Watchdog.h" 
    3738 
    3839#include <errno.h> 
     
    5657    , m_have_new_ctr_read ( false ) 
    5758    , m_pTimeSource ( new Util::SystemTimeSource() ) 
     59    , m_pWatchdog ( new Util::Watchdog() ) 
    5860{ 
    5961    pthread_mutex_init( &m_mutex, 0 ); 
     
    8284    , m_have_new_ctr_read ( false ) 
    8385    , m_pTimeSource ( new Util::SystemTimeSource() ) 
     86    , m_pWatchdog ( new Util::Watchdog() ) 
    8487{ 
    8588    pthread_mutex_init( &m_mutex, 0 ); 
     
    114117 
    115118    delete m_pTimeSource; 
     119    delete m_pWatchdog; 
    116120    if ( m_handle ) { 
    117121        raw1394_destroy_handle( m_handle ); 
     
    152156    if (port + 1 > nb_ports) { 
    153157        debugFatal("Requested port (%d) out of range (# ports: %d)\n", port, nb_ports); 
     158    } 
     159 
     160    if(!m_pWatchdog) { 
     161        debugError("No valid RT watchdog found.\n"); 
     162        return false; 
     163    } 
     164    if(!m_pWatchdog->start()) { 
     165        debugError("Could not start RT watchdog.\n"); 
     166        return false; 
    154167    } 
    155168 
     
    10911104    if (m_pIsoManager) m_pIsoManager->setVerboseLevel(l); 
    10921105    if (m_pCTRHelper) m_pCTRHelper->setVerboseLevel(l); 
     1106    if (m_pWatchdog) m_pWatchdog->setVerboseLevel(l); 
    10931107    setDebugLevel(l); 
    10941108    debugOutput( DEBUG_LEVEL_VERBOSE, "Setting verbose level to %d...\n", l ); 
  • trunk/libffado/src/libieee1394/ieee1394service.h

    r932 r940  
    4545namespace Util { 
    4646    class TimeSource; 
     47    class Watchdog; 
    4748} 
    4849 
     
    5556    bool initialize( int port ); 
    5657    bool setThreadParameters(bool rt, int priority); 
     58    Util::Watchdog *getWatchdog() {return m_pWatchdog;}; 
     59 
    5760   /** 
    5861    * @brief get number of ports (firewire adapters) in this machine 
     
    331334    Util::TimeSource*   m_pTimeSource; 
    332335 
     336    // the RT watchdog 
     337    Util::Watchdog*     m_pWatchdog; 
     338 
    333339    typedef std::vector< Util::Functor* > reset_handler_vec_t; 
    334340    reset_handler_vec_t m_busResetHandlers; 
  • trunk/libffado/src/libieee1394/IsoHandlerManager.cpp

    r938 r940  
    2929 
    3030#include "libutil/Atomic.h" 
    31  
    3231#include "libutil/PosixThread.h" 
    33  
    3432#include "libutil/SystemTimeSource.h" 
     33#include "libutil/Watchdog.h" 
    3534 
    3635#include <assert.h> 
     
    335334        return false; 
    336335    } 
     336    // register the thread with the RT watchdog 
     337    Util::Watchdog *watchdog = m_service.getWatchdog(); 
     338    if(watchdog) { 
     339        if(!watchdog->registerThread(m_IsoThread)) { 
     340            debugWarning("could not register iso thread with watchdog\n"); 
     341        } 
     342    } else { 
     343        debugWarning("could not find valid watchdog\n"); 
     344    } 
     345 
    337346    if (m_IsoThread->Start() != 0) { 
    338347        debugFatal("Could not start ISO thread\n");