- Timestamp:
- 06/08/08 05:32:39 (16 years ago)
- Files:
-
- branches/libffado-2.0/SConstruct (modified) (1 diff)
- branches/libffado-2.0/src/libieee1394/cycletimer.h (modified) (1 diff)
- branches/libffado-2.0/src/libieee1394/IsoHandler.cpp (modified) (3 diffs)
- branches/libffado-2.0/src/libieee1394/IsoHandler.h (modified) (2 diffs)
- branches/libffado-2.0/src/libieee1394/IsoHandlerManager.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libffado-2.0/SConstruct
r1235 r1247 278 278 # 279 279 280 if conf.CheckForApp( "which pyuic" ) and conf.CheckForPyModule( 'dbus' ) and conf.CheckForPyModule( 'qt' ): 281 env['PYUIC'] = True 282 283 if conf.CheckForApp( "xdg-desktop-menu --help" ): 284 env['XDG_TOOLS'] = True 280 # PyQT checks 281 if conf.CheckForApp( "which pyuic" ) and conf.CheckForPyModule( 'dbus' ) and conf.CheckForPyModule( 'qt' ): 282 env['PYUIC'] = True 283 284 if conf.CheckForApp( "xdg-desktop-menu --help" ): 285 env['XDG_TOOLS'] = True 286 else: 287 print """ 288 I couldn't find the program 'xdg-desktop-menu'. Together with xdg-icon-resource 289 this is needed to add the fancy entry to your menu. But the mixer will be installed, you can start it by executing "ffadomixer". 290 """ 291 285 292 else: 286 293 print """ 287 I couldn't find the program 'xdg-desktop-menu'. Together with xdg-icon-resource 288 this is needed to add the fancy entry to your menu. But the mixer will be installed, you can start it by executing "ffadomixer". 289 """ 290 291 else: 292 print """ 293 I couldn't find all the prerequisites ('pyuic' and the python-modules 'dbus' and 294 'qt', the packages could be named like dbus-python and PyQt) to build the mixer. 295 Therefor the mixer won't get installed. 296 """ 294 I couldn't find all the prerequisites ('pyuic' and the python-modules 'dbus' and 295 'qt', the packages could be named like dbus-python and PyQt) to build the mixer. 296 Therefor the mixer won't get installed. 297 """ 297 298 298 299 config_guess = conf.ConfigGuess() branches/libffado-2.0/src/libieee1394/cycletimer.h
r1090 r1247 46 46 #define CYCLE_TIMER_GET_CYCLES(x) ((((x) & 0x01FFF000UL) >> 12)) 47 47 #define CYCLE_TIMER_GET_OFFSET(x) ((((x) & 0x00000FFFUL))) 48 49 #define CYCLE_TIMER_SET_SECS(v, x) (((v) & ~0xFE000000UL) | (((x) & 0x7F) << 25)) 50 #define CYCLE_TIMER_SET_CYCLES(v, x) ((((v) & ~0x01FFF000UL) | (((x) & 0x1FFF) << 12))) 51 #define CYCLE_TIMER_SET_OFFSET(v, x) ((((v) & ~0x00000FFFUL) | ((x) & 0xFFF))) 52 53 48 54 #define CYCLE_TIMER_TO_TICKS(x) ((CYCLE_TIMER_GET_SECS(x) * TICKS_PER_SECOND) +\ 49 55 (CYCLE_TIMER_GET_CYCLES(x) * TICKS_PER_CYCLE ) +\ branches/libffado-2.0/src/libieee1394/IsoHandler.cpp
r1172 r1247 184 184 bool 185 185 IsoHandler::iterate() { 186 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) Iterating ISO handler...\n", 187 this, getTypeString()); 186 return iterate(m_manager.get1394Service().getCycleTimer()); 187 } 188 189 bool 190 IsoHandler::iterate(uint32_t cycle_timer_now) { 191 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) Iterating ISO handler at %08X...\n", 192 this, getTypeString(), cycle_timer_now); 193 m_last_now = cycle_timer_now; 188 194 if(m_State == E_Running) { 189 195 #if ISOHANDLER_FLUSH_BEFORE_ITERATE 190 196 flush(); 191 197 #endif 192 m_last_now = m_manager.get1394Service().getCycleTimer();193 198 if(raw1394_loop_iterate(m_handle)) { 194 199 debugError( "IsoHandler (%p): Failed to iterate handler: %s\n", … … 294 299 m_manager.requestShadowMapUpdate(); 295 300 return 0; 301 } 302 303 /** 304 * Call this if you find out that this handler has died for some 305 * external reason. 306 */ 307 void 308 IsoHandler::notifyOfDeath() 309 { 310 // notify the client of the fact that we have died 311 m_Client->handlerDied(); 296 312 } 297 313 … … 717 733 m_min_ahead = 7999; 718 734 #endif 735 736 // indicate that the first iterate() still has to occur. 737 m_last_now = 0xFFFFFFFF; 738 719 739 m_State = E_Running; 720 740 return true; branches/libffado-2.0/src/libieee1394/IsoHandler.h
r1038 r1247 81 81 82 82 public: 83 // runnable interface 83 84 /** 85 * Iterate the handler, transporting ISO packets to the client(s) 86 * @return true if success 87 */ 84 88 bool iterate(); 89 90 /** 91 * Iterate the handler, transporting ISO packets to the client(s) 92 * @param ctr_now the CTR time at which the iterate call is done. 93 * @return true if success 94 */ 95 bool iterate(uint32_t ctr_now); 85 96 86 97 int getFileDescriptor() { return raw1394_get_fd(m_handle);}; … … 145 156 int getLastCycle() {return m_last_cycle;}; 146 157 158 /** 159 * @brief returns the CTR value saved at the last iterate() call 160 * @return CTR value saved at last iterate() call 161 */ 162 uint32_t getLastIterateTime() {return m_last_now;}; 163 164 void notifyOfDeath(); 147 165 private: 148 166 IsoHandlerManager& m_manager; branches/libffado-2.0/src/libieee1394/IsoHandlerManager.cpp
r1235 r1247 24 24 #include "config.h" 25 25 #include "IsoHandlerManager.h" 26 #include "ieee1394service.h" 26 #include "ieee1394service.h" 27 #include "cycletimer.h" 27 28 #include "libstreaming/generic/StreamProcessor.h" 28 29 … … 223 224 // FIXME: what to do here? 224 225 debugWarning("Timeout while waiting for activity\n"); 226 no_one_to_poll = false; // exit the loop to be able to detect failing handlers 225 227 break; 226 228 case IsoTask::eAR_Activity: … … 237 239 // the fd map everytime we run poll(). 238 240 err = poll (m_poll_fds_shadow, m_poll_nfds_shadow, m_poll_timeout); 241 uint32_t ctr_at_poll_return = m_manager.get1394Service().getCycleTimer(); 239 242 240 243 if (err < 0) { … … 247 250 } 248 251 252 // find handlers that have died 253 uint64_t ctr_at_poll_return_ticks = CYCLE_TIMER_TO_TICKS(ctr_at_poll_return); 254 bool handler_died = false; 255 for (i = 0; i < m_poll_nfds_shadow; i++) { 256 // figure out if a handler has died 257 // all handlers in the poll() are active, so they should be iterated 258 // now and then. If they aren't, the handler has died. 259 uint32_t last_call = m_IsoHandler_map_shadow[i]->getLastIterateTime(); 260 if (last_call == 0xFFFFFFFF) { 261 // this was not iterated yet, so can't be dead 262 continue; 263 } 264 265 uint64_t last_call_ticks = CYCLE_TIMER_TO_TICKS(last_call); 266 // we use 4 seconds since that should not cause issues with startup 267 int64_t max_diff_ticks = TICKS_PER_SECOND * 4; 268 int64_t measured_diff_ticks = diffTicks(ctr_at_poll_return_ticks, last_call_ticks); 269 270 if(measured_diff_ticks > max_diff_ticks) { 271 debugFatal("(%p, %s) Handler died: now: %08lX, last: %08lX, diff: %lld (max: %lld)\n", 272 this, (m_handlerType == IsoHandler::eHT_Transmit? "Transmit": "Receive"), 273 ctr_at_poll_return, last_call, measured_diff_ticks, max_diff_ticks); 274 m_IsoHandler_map_shadow[i]->notifyOfDeath(); 275 handler_died = true; 276 } 277 } 278 if(handler_died) { 279 return false; // one or more handlers have died 280 } 281 282 // iterate the handlers 249 283 for (i = 0; i < m_poll_nfds_shadow; i++) { 250 284 #ifdef DEBUG … … 264 298 // 2) the client can provide or accept packets (since we enabled polling) 265 299 if(m_poll_fds_shadow[i].revents & (POLLIN)) { 266 m_IsoHandler_map_shadow[i]->iterate( );300 m_IsoHandler_map_shadow[i]->iterate(ctr_at_poll_return); 267 301 } else { 268 302 // there might be some error condition … … 274 308 } 275 309 } 276 277 // #ifdef DEBUG278 // // check if the handler is still alive279 // if(m_IsoHandler_map_shadow[i]->isDead()) {280 // debugError("Iso handler (%p, %s) is dead!\n",281 // m_IsoHandler_map_shadow[i],282 // m_IsoHandler_map_shadow[i]->getTypeString());283 // return false; // shutdown the system284 // }285 // #endif286 287 310 } 288 311 return true;