Changeset 2049

Show
Ignore:
Timestamp:
02/28/12 04:57:45 (11 years ago)
Author:
adi
Message:

DICE: generic speed-dependent EAP routing prototypes

Patch by Philippe Carriere

Routing depends on the sample rate, so Philippe has introduced three
different setup functions for single/double/quad speed.

Files:

Legend:

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

    r1955 r2049  
    201201            return false; 
    202202        } 
    203         setupSources(); 
    204         setupDestinations(); 
     203        m_router->update(); 
    205204 
    206205        // add the router to the EAP control container 
     
    213212} 
    214213 
     214 
     215void 
     216EAP::update() 
     217{ 
     218    // update EAP from the last init 
     219    //   update router sources and destinations 
     220    if (m_router) { 
     221        m_router->update(); 
     222    } 
     223} 
     224 
    215225void 
    216226EAP::setupSources() { 
    217     // add the routing sources and destinations for a DICE chip 
     227    // define router sources (possibly depending on the samplerate) 
     228    switch(m_device.getCurrentConfig()) { 
     229        case Device::eDC_Low: setupSources_low(); return; 
     230        case Device::eDC_Mid: setupSources_mid(); return; 
     231        case Device::eDC_High: setupSources_high(); return; 
     232        default: 
     233            debugError("Unsupported configuration mode\n"); 
     234            return; 
     235    } 
     236
     237 
     238void 
     239EAP::setupSources_low() { 
     240    // add the routing sources for a DICE chip 
    218241    switch(m_general_chip) { 
    219242        case DICE_EAP_CAP_GENERAL_CHIP_DICEII: 
     
    248271 
    249272void 
     273EAP::setupSources_mid() { 
     274    setupSources_low(); 
     275} 
     276 
     277void 
     278EAP::setupSources_high() { 
     279    setupSources_low(); 
     280} 
     281 
     282void 
    250283EAP::setupDestinations() { 
    251     // add the routing sources and destinations for a DICE chip 
     284    switch(m_device.getCurrentConfig()) { 
     285        case Device::eDC_Low: setupDestinations_low(); return; 
     286        case Device::eDC_Mid: setupDestinations_mid(); return; 
     287        case Device::eDC_High: setupDestinations_high(); return; 
     288        default: 
     289            debugError("Unsupported configuration mode\n"); 
     290            return; 
     291    } 
     292
     293 
     294void 
     295EAP::setupDestinations_low() { 
     296    // add the routing destinations for a DICE chip 
    252297    switch(m_general_chip) { 
    253298        case DICE_EAP_CAP_GENERAL_CHIP_DICEII: 
     
    280325            break; 
    281326    } 
     327} 
     328void 
     329EAP::setupDestinations_mid() { 
     330    setupDestinations_low(); 
     331} 
     332void 
     333EAP::setupDestinations_high() { 
     334    setupDestinations_low(); 
    282335} 
    283336 
     
    794847} 
    795848 
    796 // ----------- Mixer ------------- 
     849// -------------------------------- Mixer ---------------------------------- 
     850//   Dice matrix-mixer is a one-dimensional array with inputs index varying 
     851//    first 
     852// 
     853//   "ffado convention" is that inputs are rows and outputs are columns 
     854// 
    797855EAP::Mixer::Mixer(EAP &p) 
    798856: Control::MatrixMixer(&p.m_device, "MatrixMixer") 
     
    9741032    int cnt; 
    9751033 
     1034    // 
     1035    // Caution the user that, displaying as further, because inputs index varies first 
     1036    //  inputs will appears as columns at the opposite of the "ffado convention" 
     1037    printMessage("   -- inputs index -->>\n"); 
    9761038    cnt = 0; 
    9771039    for(int j=0; j < nb_inputs; j++) { 
     
    10331095    } 
    10341096    int nb_inputs = m_eap.m_mixer_nb_tx; 
    1035     int addr = ((nb_inputs * row) + col) * 4; 
     1097    int addr = ((nb_inputs * col) + row) * 4; 
    10361098    quadlet_t tmp = (quadlet_t) val; 
    10371099    if(!m_eap.writeRegBlock(eRT_Mixer, 4+addr, &tmp, 4)) { 
     
    10461108{ 
    10471109    int nb_inputs = m_eap.m_mixer_nb_tx; 
    1048     int addr = ((nb_inputs * row) + col) * 4; 
     1110    int addr = ((nb_inputs * col) + row) * 4; 
    10491111    quadlet_t tmp; 
    10501112    if(!m_eap.readRegBlock(eRT_Mixer, 4+addr, &tmp, 4)) { 
     
    11231185 
    11241186void 
     1187EAP::Router::update() 
     1188{ 
     1189    // Clear and 
     1190    //   define new sources and destinations for the router 
     1191    m_sources.clear(); 
     1192    m_eap.setupSources(); 
     1193    m_destinations.clear(); 
     1194    m_eap.setupDestinations(); 
     1195    return; 
     1196} 
     1197 
     1198void 
    11251199EAP::Router::addSource(const std::string& basename, enum eRouteSource srcid, 
    11261200                       unsigned int base, unsigned int cnt, unsigned int offset) 
     
    11881262{ 
    11891263    stringlist n; 
     1264 
    11901265    for (std::map<std::string, int>::iterator it=m_sources.begin(); it!=m_sources.end(); ++it) 
    11911266        n.push_back(it->first); 
  • trunk/libffado/src/dice/dice_eap.h

    r1806 r2049  
    395395        ~Router(); 
    396396 
     397        void update(); 
    397398        void show(); 
    398399 
     
    465466    bool init(); 
    466467 
     468    /// update EAP 
     469    void update(); 
     470 
    467471    /// Show information about the EAP 
    468472    void show(); 
     
    510514      To ease custom device support, this function is not in EAP::Router but here. 
    511515      */ 
    512     virtual void setupSources(); 
     516    void setupSources(); 
     517    virtual void setupSources_low(); 
     518    virtual void setupSources_mid(); 
     519    virtual void setupSources_high(); 
    513520    /** 
    514521      @brief Setup all the available destinations 
     
    520527      To ease custom device support, this function is not in EAP::Router but here. 
    521528      */ 
    522     virtual void setupDestinations(); 
     529    void setupDestinations(); 
     530    virtual void setupDestinations_low(); 
     531    virtual void setupDestinations_mid(); 
     532    virtual void setupDestinations_high(); 
    523533 
    524534    /**