Show
Ignore:
Timestamp:
11/28/07 12:02:08 (13 years ago)
Author:
ppalmers
Message:

- Adapt the ffado external API (upgrade to v3)

NEEDS NEW JACK BACKEND

- simplify FFADODevice constructor even more
- implement first framework support for supporting multiple adapters.

currently all firewire adapters are scanned for supported devices unless specified otherwise
however attaching devices to separate adapters is not supported. using multiple adapters at
that are connected together might work.

Files:

Legend:

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

    r736 r739  
    6262ConfigRom::ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ) 
    6363    : Control::Element("ConfigRom") 
    64     , m_1394Service( &ieee1394service ) 
     64    , m_1394Service( ieee1394service ) 
    6565    , m_nodeId( nodeId ) 
    6666    , m_avcDevice( false ) // FIXME: this does not seem veryu 
     
    8989ConfigRom::ConfigRom() 
    9090    : Control::Element("ConfigRom") 
    91     , m_1394Service( 0
     91    , m_1394Service( *(new Ieee1394Service())
    9292    , m_nodeId( -1 ) 
    9393    , m_avcDevice( false ) // FIXME: this does not seem veryu 
     
    114114} 
    115115 
    116 ConfigRom::~ConfigRom() 
    117 
     116Ieee1394Service& 
     117ConfigRom::get1394Service() 
     118
     119    return m_1394Service; 
    118120} 
    119121 
     
    133135{ 
    134136     struct config_csr_info csr_info; 
    135      csr_info.service = m_1394Service; 
     137     csr_info.service = &m_1394Service; 
    136138     csr_info.nodeId = 0xffc0 | m_nodeId; 
    137139 
     
    140142                                 &csr_info ); 
    141143    if (!m_csr || csr1212_parse_csr( m_csr ) != CSR1212_SUCCESS) { 
    142         debugError( "Could not parse config rom of node %d on port %d\n", m_nodeId, m_1394Service->getPort() ); 
     144        debugError( "Could not parse config rom of node %d on port %d\n", m_nodeId, m_1394Service.getPort() ); 
    143145        if (m_csr) { 
    144146            csr1212_destroy_csr(m_csr); 
     
    451453    struct csr1212_csr* csr = NULL; 
    452454    for ( fb_nodeid_t nodeId = 0; 
    453           nodeId < m_1394Service->getNodeCount(); 
     455          nodeId < m_1394Service.getNodeCount(); 
    454456          ++nodeId ) 
    455457    { 
    456458        struct config_csr_info csr_info; 
    457         csr_info.service = m_1394Service; 
     459        csr_info.service = &m_1394Service; 
    458460        csr_info.nodeId = 0xffc0 | nodeId; 
    459461        debugOutput( DEBUG_LEVEL_VERBOSE, "Looking at node %d...\n", nodeId); 
     
    577579    } 
    578580 
    579     pConfigRom->m_1394Service = &ieee1394Service; 
     581    pConfigRom->m_1394Service = ieee1394Service; 
    580582 
    581583    bool result; 
  • trunk/libffado/src/libieee1394/configrom.h

    r673 r739  
    4444 public: 
    4545    ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId ); 
    46     virtual ~ConfigRom(); 
     46    virtual ~ConfigRom() {}; 
     47 
     48    Ieee1394Service& get1394Service(); 
    4749 
    4850    bool initialize(); 
     
    98100    static bool compareGUID(  const ConfigRom& a, const ConfigRom& b ); 
    99101 
    100     void printConfigRom() const; 
    101  
    102102    bool serialize( Glib::ustring path, Util::IOSerialize& ser ); 
    103103    static ConfigRom* deserialize( Glib::ustring path, 
     
    105105                   Ieee1394Service& ieee1394Service ); 
    106106 
     107    void printConfigRom() const; 
    107108    void setVerboseLevel(int level) { 
    108109        setDebugLevel(level); 
     
    117118    void processRootDirectory( struct csr1212_csr* csr ); 
    118119 
    119     Ieee1394Service* m_1394Service; 
     120    Ieee1394Service& m_1394Service; 
    120121    fb_nodeid_t      m_nodeId; 
    121122    bool             m_avcDevice; 
  • trunk/libffado/src/libieee1394/ieee1394service.cpp

    r677 r739  
    3737#include <iostream> 
    3838#include <iomanip> 
     39 
     40#define FFADO_MAX_FIREWIRE_PORTS 8 
    3941 
    4042IMPL_DEBUG_MODULE( Ieee1394Service, Ieee1394Service, DEBUG_LEVEL_NORMAL ); 
     
    8385} 
    8486 
     87unsigned int 
     88Ieee1394Service::detectNbPorts( ) 
     89{ 
     90    raw1394handle_t tmp_handle = raw1394_new_handle(); 
     91    if ( tmp_handle == NULL ) { 
     92        debugError("Could not get libraw1394 handle.\n"); 
     93        return 0; 
     94    } 
     95    struct raw1394_portinfo pinf[FFADO_MAX_FIREWIRE_PORTS]; 
     96    int nb_detected_ports = raw1394_get_port_info(tmp_handle, pinf, FFADO_MAX_FIREWIRE_PORTS); 
     97    raw1394_destroy_handle(tmp_handle); 
     98 
     99    if (nb_detected_ports < 0) { 
     100        debugError("Failed to detect number of ports\n"); 
     101        return 0; 
     102    } 
     103    return nb_detected_ports; 
     104} 
     105 
    85106bool 
    86107Ieee1394Service::initialize( int port ) 
     
    113134 
    114135    m_port = port; 
     136 
     137    // obtain port name 
     138    struct raw1394_portinfo pinf[FFADO_MAX_FIREWIRE_PORTS]; 
     139    int nb_detected_ports = raw1394_get_port_info(m_handle, pinf, FFADO_MAX_FIREWIRE_PORTS); 
     140 
     141    if(nb_detected_ports && port < FFADO_MAX_FIREWIRE_PORTS) { 
     142        m_portName = pinf[port].name; 
     143    } else { 
     144        m_portName = "Unknown"; 
     145    } 
     146    if (m_portName == "") { 
     147        m_portName = "Unknown"; 
     148    } 
    115149 
    116150    raw1394_set_userdata( m_handle, this ); 
     
    840874    setDebugLevel(l); 
    841875} 
     876 
     877void 
     878Ieee1394Service::show() 
     879{ 
     880    debugOutput( DEBUG_LEVEL_VERBOSE, "Port:  %d\n", getPort() ); 
     881    debugOutput( DEBUG_LEVEL_VERBOSE, " Name: %s\n", getPortName().c_str() ); 
     882} 
  • trunk/libffado/src/libieee1394/ieee1394service.h

    r677 r739  
    3737 
    3838#include <vector> 
     39#include <string> 
    3940 
    4041class ARMHandler; 
     
    4748    bool initialize( int port ); 
    4849 
     50   /** 
     51    * @brief get number of ports (firewire adapters) in this machine 
     52    * 
     53    * @return the number of ports 
     54    */ 
     55    static unsigned int detectNbPorts(); 
     56 
     57   /** 
     58    * @brief get port (adapter) id 
     59    * 
     60    * @return get port (adapter) id 
     61    */ 
    4962    int getPort() 
    50     { return m_port; } 
     63        { return m_port; } 
     64 
     65   /** 
     66    * @brief get port (adapter) name 
     67    * 
     68    * @return get port (adapter) name 
     69    */ 
     70    std::string getPortName() 
     71        { return m_portName; }; 
     72 
    5173   /** 
    5274    * @brief get number of nodes on the bus 
     
    238260    raw1394handle_t m_resetHandle; 
    239261    int             m_port; 
     262    std::string     m_portName; 
    240263 
    241264    pthread_t       m_thread; 
     
    256279public: 
    257280    void setVerboseLevel(int l); 
     281    void show(); 
    258282private: 
    259283    DECLARE_DEBUG_MODULE;