Show
Ignore:
Timestamp:
08/29/07 02:19:04 (17 years ago)
Author:
ppalmers
Message:

- Clean up the FFADODevice constructor to remove the nodeid that

can be retrieved from the configrom.

- Implement new method of creating devices: a device is supposed

to implement the createDevice static method that should return
an instance of itself or a subclass of itself. This should ease
support for manufacturer specific customizations since we don't
have to put them into the device manager class.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/dice/dice_avdevice.cpp

    r554 r583  
    5151}; 
    5252 
    53 DiceAvDevice::DiceAvDevice( std::auto_ptr< ConfigRom >( configRom ), 
    54                     Ieee1394Service& ieee1394service, 
    55                     int nodeId ) 
    56     : FFADODevice( configRom, ieee1394service, nodeId ) 
     53DiceAvDevice::DiceAvDevice( Ieee1394Service& ieee1394Service, 
     54                            std::auto_ptr<ConfigRom>( configRom )) 
     55    : FFADODevice( ieee1394Service, configRom ) 
    5756    , m_model( NULL ) 
    5857    , m_global_reg_offset (0xFFFFFFFFLU) 
     
    7372{ 
    7473    debugOutput( DEBUG_LEVEL_VERBOSE, "Created Dice::DiceAvDevice (NodeID %d)\n", 
    75                  nodeId ); 
     74                 configRom->getNodeId() ); 
    7675 
    7776} 
     
    105104 
    106105    return false; 
     106} 
     107 
     108FFADODevice * 
     109DiceAvDevice::createDevice( Ieee1394Service& ieee1394Service, 
     110                            std::auto_ptr<ConfigRom>( configRom )) 
     111{ 
     112    return new DiceAvDevice(ieee1394Service, configRom ); 
    107113} 
    108114 
     
    282288    debugOutput(DEBUG_LEVEL_VERBOSE, 
    283289        "%s %s at node %d\n", m_model->vendor_name, m_model->model_name, 
    284         m_nodeId); 
     290        getNodeId()); 
    285291 
    286292    debugOutput(DEBUG_LEVEL_VERBOSE," DICE Parameter Space info:\n"); 
     
    666672 
    667673    debugOutput(DEBUG_LEVEL_VERBOSE, "Locking %s %s at node %d\n", 
    668         m_model->vendor_name, m_model->model_name, m_nodeId); 
     674        m_model->vendor_name, m_model->model_name, getNodeId()); 
    669675 
    670676    // get a notifier to handle device notifications 
     
    710716    swap_value |= m_notifier->getStart(); 
    711717 
    712     if (!m_p1394Service->lockCompareSwap64(  m_nodeId | 0xFFC0, addr, DICE_OWNER_NO_OWNER, 
     718    if (!m_p1394Service->lockCompareSwap64(  getNodeId() | 0xFFC0, addr, DICE_OWNER_NO_OWNER, 
    713719                                       swap_value, &result )) { 
    714720        debugWarning("Could not register ourselves as device owner\n"); 
     
    747753    compare_value |= m_notifier->getStart(); 
    748754 
    749     if (!m_p1394Service->lockCompareSwap64(  m_nodeId | 0xFFC0, addr, compare_value, 
     755    if (!m_p1394Service->lockCompareSwap64(  getNodeId() | 0xFFC0, addr, compare_value, 
    750756                                       DICE_OWNER_NO_OWNER, &result )) { 
    751757        debugWarning("Could not unregister ourselves as device owner\n"); 
     
    12021208 
    12031209    fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; 
    1204     fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
     1210    fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 
    12051211 
    12061212    if(!m_p1394Service->read_quadlet( nodeId, addr, result ) ) { 
     
    12271233 
    12281234    fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; 
    1229     fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
     1235    fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 
    12301236 
    12311237    if(!m_p1394Service->write_quadlet( nodeId, addr, htonl(data) ) ) { 
     
    12471253 
    12481254    fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; 
    1249     fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
     1255    fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 
    12501256 
    12511257    if(!m_p1394Service->read( nodeId, addr, length/4, data ) ) { 
     
    12721278 
    12731279    fb_nodeaddr_t addr=DICE_REGISTER_BASE + offset; 
    1274     fb_nodeid_t nodeId=m_nodeId | 0xFFC0; 
     1280    fb_nodeid_t nodeId=getNodeId() | 0xFFC0; 
    12751281 
    12761282    fb_quadlet_t data_out[length/4]; 
  • trunk/libffado/src/dice/dice_avdevice.h

    r554 r583  
    5656    class DiceNotifier; 
    5757public: 
    58     DiceAvDevice( std::auto_ptr<ConfigRom>( configRom ), 
    59                   Ieee1394Service& ieee1394Service, 
    60                   int nodeId); 
     58    DiceAvDevice( Ieee1394Service& ieee1394Service, 
     59                  std::auto_ptr<ConfigRom>( configRom )); 
    6160    ~DiceAvDevice(); 
    6261 
    6362    static bool probe( ConfigRom& configRom ); 
     63    static FFADODevice * createDevice( Ieee1394Service& ieee1394Service, 
     64                                        std::auto_ptr<ConfigRom>( configRom )); 
     65    virtual bool discover(); 
     66 
    6467    static int getConfigurationId( ); 
    65     virtual bool discover(); 
    6668 
    6769    virtual void showDevice();