Changeset 860 for trunk/libffado/src/libieee1394/IsoHandler.cpp
- Timestamp:
- 01/19/08 10:47:41 (16 years ago)
- Files:
-
- trunk/libffado/src/libieee1394/IsoHandler.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libieee1394/IsoHandler.cpp
r841 r860 174 174 IsoHandler::waitForClient() 175 175 { 176 //debugOutput(DEBUG_LEVEL_VERBOSE, "waiting...\n");176 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "waiting...\n"); 177 177 if(m_Client) { 178 bool result = m_Client->waitForSignal(); 179 //debugOutput(DEBUG_LEVEL_VERBOSE, " returns %d\n", result); 178 bool result; 179 if (m_type == eHT_Receive) { 180 result = m_Client->waitForProducePacket(); 181 } else { 182 result = m_Client->waitForConsumePacket(); 183 } 184 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, " returns %d\n", result); 180 185 return result; 181 186 } else { … … 188 193 IsoHandler::tryWaitForClient() 189 194 { 190 //debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "waiting...\n");195 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "waiting...\n"); 191 196 if(m_Client) { 192 bool result = m_Client->tryWaitForSignal(); 193 //debugOutput(DEBUG_LEVEL_VERBOSE, " returns %d\n", result); 197 bool result; 198 if (m_type == eHT_Receive) { 199 result = m_Client->canProducePacket(); 200 } else { 201 result = m_Client->canConsumePacket(); 202 } 203 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, " returns %d\n", result); 194 204 return result; 195 205 } else { … … 214 224 // wait for the availability of frames in the client 215 225 // (blocking for transmit handlers) 216 #if 0 //#ifdef DEBUG 217 if (getType() == eHT_Transmit) { 218 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p) Waiting for Client to signal frame availability...\n", this); 219 } 220 #endif 221 if (getType() == eHT_Receive || waitForClient()) { 222 226 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) Waiting for Client activity...\n", this, getTypeString()); 227 if (waitForClient()) { 223 228 #if ISOHANDLER_USE_POLL 224 229 bool result = true; 225 while(result && m_Client && m_Client->canProcessPackets()) {230 while(result && m_Client && tryWaitForClient()) { 226 231 int err = poll(&m_poll_fd, 1, m_poll_timeout); 227 232 if (err == -1) { … … 255 260 // so poll'ing is not really necessary 256 261 bool result = true; 257 while(result && m_Client && m_Client->canProcessPackets()) {262 while(result && m_Client && tryWaitForClient()) { 258 263 result = iterate(); 259 264 // if (getType() == eHT_Receive) { … … 272 277 bool 273 278 IsoHandler::iterate() { 274 // if(m_type==eHT_Receive) { 275 // debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) Iterating ISO handler\n", 276 // this, (m_type==eHT_Receive?"Receive":"Transmit")); 277 // } 279 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) Iterating ISO handler...\n", 280 this, getTypeString()); 278 281 if(m_State == E_Running) { 279 282 #if ISOHANDLER_FLUSH_BEFORE_ITERATE … … 285 288 return false; 286 289 } 287 // debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) done iterating ISO handler\n", 288 // this, (m_type==eHT_Receive?"Receive":"Transmit"));290 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) done interating ISO handler...\n", 291 this, getTypeString()); 289 292 return true; 290 293 } else { 291 294 debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) Not iterating a non-running handler...\n", 292 this, (m_type==eHT_Receive?"Receive":"Transmit"));295 this, getTypeString()); 293 296 return false; 294 297 } … … 415 418 416 419 debugOutputShort( DEBUG_LEVEL_NORMAL, " Handler type................: %s\n", 417 (this->getType() == eHT_Receive ? "Receive" : "Transmit"));420 getTypeString()); 418 421 debugOutputShort( DEBUG_LEVEL_NORMAL, " Port, Channel...............: %2d, %2d\n", 419 422 m_manager.get1394Service().getPort(), channel); … … 475 478 unsigned int cycle, unsigned int dropped) { 476 479 477 debugOutput( DEBUG_LEVEL_VERY_VERBOSE,480 /* debugOutput( DEBUG_LEVEL_VERY_VERBOSE, 478 481 "received packet: length=%d, channel=%d, cycle=%d\n", 479 length, channel, cycle ); 482 length, channel, cycle );*/ 480 483 m_packetcount++; 481 484 m_dropped += dropped; … … 494 497 int cycle, unsigned int dropped) { 495 498 496 debugOutput( DEBUG_LEVEL_ULTRA_VERBOSE,499 /* debugOutput( DEBUG_LEVEL_ULTRA_VERBOSE, 497 500 "sending packet: length=%d, cycle=%d\n", 498 *length, cycle ); 501 *length, cycle );*/ 499 502 m_packetcount++; 500 503 m_dropped += dropped; … … 503 506 return m_Client->getPacket(data, length, tag, sy, cycle, dropped, m_max_packet_size); 504 507 } 508 *tag = 0; 509 *sy = 0; 510 *length = 0; 505 511 return RAW1394_ISO_OK; 506 512 } … … 594 600 return true; 595 601 } 602 603 /** 604 * @brief convert a EHandlerType to a string 605 * @param t the type 606 * @return a char * describing the state 607 */ 608 const char * 609 IsoHandler::eHTToString(enum EHandlerType t) { 610 switch (t) { 611 case eHT_Receive: return "Receive"; 612 case eHT_Transmit: return "Transmit"; 613 default: return "error: unknown type"; 614 } 615 }