Changeset 2137

Show
Ignore:
Timestamp:
05/01/12 17:34:17 (11 years ago)
Author:
jwoithe
Message:

dice: default router setup patch 4/10 from Philippe Carriere: DICE EAP Introduce EAP::setDefaultRouterConfig. This introduce the public EAP function to be called for resetting the content of the router memory space to a default config. The related functions for low, mid and high rate are also introduced for a generic device. These latters are intended to be customized for specific devices.

Files:

Legend:

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

    r2136 r2137  
    548548            return false; 
    549549    } 
     550} 
     551 
     552/** 
     553 * Set a default configuration for the router. 
     554 *  This is necessary for somes devices for hardware coherence, in which case the next 
     555 *  has to be customized 
     556 * @param  rcfg The new RouterConfig 
     557 * @return true if successful, false otherwise 
     558 */ 
     559void 
     560EAP::setupDefaultRouterConfig_low() { 
     561    unsigned int i; 
     562    // add the routing destinations for a DICE chip 
     563    switch(m_general_chip) { 
     564        case DICE_EAP_CAP_GENERAL_CHIP_DICEII: 
     565            // router/EAP currently not supported 
     566            break; 
     567        case DICE_EAP_CAP_GENERAL_CHIP_DICEJR: 
     568            // second audio port (unique to the junior) 
     569            addDestination("InS1", 0, 8, eRD_InS1); 
     570        case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI: 
     571            // the 1394 stream receivers 
     572            for (i=0; i<8; i++) { 
     573              addRoute(eRS_InS0, i, eRD_ATX0, i); 
     574            } 
     575            for (i=0; i<8; i++) { 
     576              addRoute(eRS_InS1, i, eRD_ATX0, i+8); 
     577            } 
     578            for (i=0; i<8; i++) { 
     579              addRoute(eRS_ADAT, i, eRD_ATX1, i); 
     580            } 
     581            for (i=0; i<8; i++) { 
     582              addRoute(eRS_AES, i, eRD_ATX1, i+8); 
     583            } 
     584            // The audio ports 
     585            // Ensure that audio port are not muted 
     586            for (i=0; i<8; i++) { 
     587              addRoute(eRS_ARX0, i, eRD_InS0, i); 
     588            } 
     589            // the AES receiver 
     590            for (i=0; i<8; i++) { 
     591              addRoute(eRS_Muted, 0, eRD_AES, i); 
     592            } 
     593            // the ADAT receiver 
     594            for (i=0; i<8; i++) { 
     595              addRoute(eRS_Muted, 0, eRD_ADAT, i); 
     596            } 
     597            // the Mixer outputs 
     598            for (i=0; i<8; i++) { 
     599              addRoute(eRS_InS0, i, eRD_Mixer0, i); 
     600            } 
     601            for (i=0; i<8; i++) { 
     602              addRoute(eRS_ADAT, i, eRD_Mixer0, i+8); 
     603            } 
     604            for (i=0; i<2; i++) { 
     605              addRoute(eRS_Muted, 0, eRD_Mixer0, i+16); 
     606            } 
     607            // the ARM audio port 
     608            for (i=0; i<0; i++) { 
     609              addRoute(eRS_Muted, 0, eRD_ARM, i); 
     610            } 
     611            // mute 
     612            addRoute(eRS_Muted, 0, eRD_Muted, 0); 
     613            break; 
     614        default: 
     615            // this is an unsupported chip 
     616            break; 
     617    } 
     618} 
     619 
     620void 
     621EAP::setupDefaultRouterConfig_mid() { 
     622    setupDefaultRouterConfig_low(); 
     623} 
     624 
     625void 
     626EAP::setupDefaultRouterConfig_high() { 
     627    setupDefaultRouterConfig_low(); 
     628} 
     629 
     630void 
     631EAP::setupDefaultRouterConfig() { 
     632    // First clear routes 
     633    RouterConfig *rcfg = getActiveRouterConfig(); 
     634    rcfg->clearRoutes(); 
     635 
     636    // Then define the configuration depending on the samplerate 
     637    switch(m_device.getCurrentConfig()) { 
     638        case Device::eDC_Low: setupDefaultRouterConfig_low(); break; 
     639        case Device::eDC_Mid: setupDefaultRouterConfig_mid(); break; 
     640        case Device::eDC_High: setupDefaultRouterConfig_high(); break; 
     641        default: 
     642            debugError("Unsupported configuration mode\n"); 
     643            return; 
     644    } 
     645 
     646    updateCurrentRouterConfig(*rcfg); 
    550647} 
    551648 
  • trunk/libffado/src/dice/dice_eap.h

    r2136 r2137  
    571571 
    572572    /** 
     573      @brief Set up a default configuration for the router 
     574 
     575      To ease custom device support, these functions are not in EAP::RouterConfig but here. 
     576      */ 
     577    virtual void setupDefaultRouterConfig_low(); 
     578    virtual void setupDefaultRouterConfig_mid(); 
     579    virtual void setupDefaultRouterConfig_high(); 
     580    void setupDefaultRouterConfig();   
     581 
     582    /** 
    573583      @brief Actually add the source 
    574584      */ 
     
    597607    /// Write a new stream configuration to the device 
    598608    bool updateStreamConfig(RouterConfig&, StreamConfig&, bool low, bool mid, bool high); 
    599  
     609  
    600610    bool loadRouterConfig(bool low, bool mid, bool high); 
    601611    bool loadStreamConfig(bool low, bool mid, bool high);