Changeset 55
- Timestamp:
- 01/23/05 07:29:42 (18 years ago)
- Files:
-
- trunk/freebob/src/avdevice.cpp (modified) (3 diffs)
- trunk/freebob/src/avdevice.h (modified) (2 diffs)
- trunk/freebob/src/ieee1394service.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/freebob/src/avdevice.cpp
r46 r55 21 21 #include <libavc1394/avc1394.h> 22 22 #include <libavc1394/avc1394_vcr.h> 23 #include "threads.h" 23 24 #include "avdevice.h" 24 25 #include "avdevicepool.h" … … 62 63 } 63 64 AvDevicePool::instance()->unregisterAvDevice( this ); 65 } 66 67 void 68 AvDevice::execute( EStates state ) 69 { 70 switch ( state ) { 71 case eScanAndCreate: 72 if ( initialize() == eFBRC_Success ) { 73 // Put ourself to sleep until a something happends 74 sleepCall( this, &AvDevice::execute, eCheckState ); 75 } else { 76 asyncCall( this, &AvDevice::execute, eDestroy ); 77 } 78 break; 79 case eCheckState: 80 { 81 if ( m_iGeneration 82 != Ieee1394Service::instance()->getGenerationCount() ) { 83 asyncCall( this, &AvDevice::execute, eDestroy ); 84 } 85 } 86 break; 87 case eDestroy: 88 destroyCall( this ); 89 break; 90 default: 91 debugError( "Invalid state: %d\n", state ); 92 } 64 93 } 65 94 … … 178 207 "%d Asynchronous destination plugs\n", 179 208 m_iNbAsyncSourcePlugs, m_iNbAsyncDestinationPlugs); 209 210 211 return eFBRC_Success; 180 212 181 213 // create the subunits trunk/freebob/src/avdevice.h
r43 r55 33 33 class AvDevice { 34 34 public: 35 enum {35 enum EStates { 36 36 eScanAndCreate = 0, 37 eDestroy = 1 38 } EStates; 37 eCheckState = 1, // put this instance to the sleep queue 38 eDestroy = 2 39 }; 39 40 40 41 AvDevice( octlet_t oGuid ); … … 49 50 octlet_t getGuid() 50 51 { return m_oGuid; } 52 53 void execute( EStates state ); 51 54 52 55 quadlet_t * avcExecuteTransaction( quadlet_t *request, trunk/freebob/src/ieee1394service.cpp
r50 r55 41 41 #include "avoutputplugstatusinfoblock.h" 42 42 43 USE_GLOBAL_DEBUG_MODULE; 44 43 45 Ieee1394Service* Ieee1394Service::m_pInstance = 0; 44 46 … … 173 175 pAvDevice->setPort( m_iPort ); 174 176 175 FBReturnCodes eStatus = pAvDevice->initialize(); 176 if ( eStatus != eFBRC_Success ) { 177 debugError( "AvDevice with GUID 0x%08x%08x could " 178 "not be initialized\n", 179 (quadlet_t) (oGuid>>32), 180 (quadlet_t) (oGuid & 0xffffffff) ); 181 182 delete pAvDevice; 183 return eStatus; 184 } 177 asyncCall( pAvDevice, &AvDevice::execute, 178 AvDevice::eScanAndCreate ); 185 179 186 180 // XXX Pieter's test code. 187 //avDeviceTests( oGuid, m_iPort, iNodeId );181 // avDeviceTests( oGuid, m_iPort, iNodeId ); 188 182 } 189 183 break; … … 344 338 unsigned int iGeneration ) 345 339 { 340 debugGlobalPrint( DEBUG_LEVEL_SCHEDULER, 341 "Bus reset occured: generation count = %d\n", 342 iGeneration ); 343 346 344 raw1394_update_generation (handle, iGeneration); 347 345 Ieee1394Service* pInstance … … 349 347 pInstance->setGenerationCount( iGeneration ); 350 348 349 WorkerThread::instance()->wakeSleepers(); 351 350 asyncCall( pInstance, &Ieee1394Service::discoveryDevices, iGeneration ); 352 351 return 0;