Changeset 1772

Show
Ignore:
Timestamp:
01/01/10 14:09:19 (13 years ago)
Author:
arnonym
Message:
  • Use stringlist.
  • Shuffle lots of code around.
  • Change public/private access.
  • Make setupSources() and setupDestinations() virtual functions in Dice::EAP for easier subclassing.
Files:

Legend:

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

    r1766 r1772  
    162162    } 
    163163 
    164     bool supports_eap = EAP::supportsEAP(*this); 
    165     if (supports_eap) { // FIXME: move to buildMixer() ?? 
    166         m_eap = createEAP(); 
    167         if(m_eap == NULL) { 
    168             debugError("Failed to allocate EAP.\n"); 
    169             return false; 
    170         } 
    171         if(!m_eap->init()) { 
    172             debugError("Could not init EAP\n"); 
    173             delete m_eap; 
    174             m_eap = NULL; 
    175             return false; 
    176         } 
    177         // register the EAP controls to the control structure 
    178         if(!addElement(m_eap)) { 
    179             debugError("Failed to add the EAP controls to the control tree\n"); 
    180             return false; 
    181         } 
     164    m_eap = createEAP(); 
     165    if(m_eap == NULL) { 
     166        debugError("Failed to allocate EAP.\n"); 
     167        return false; 
     168    } 
     169    if(!m_eap->init()) { 
     170        debugError("Could not init EAP\n"); 
     171        delete m_eap; 
     172        m_eap = NULL; 
     173        return false; 
     174    } 
     175    // register the EAP controls to the control structure 
     176    if(!addElement(m_eap)) { 
     177        debugError("Failed to add the EAP controls to the control tree\n"); 
     178        return false; 
    182179    } 
    183180    return true; 
     
    393390    #endif 
    394391 
    395     diceNameVector names = getClockSourceNameString(); 
     392    stringlist names = getClockSourceNameString(); 
    396393    if( names.size() < DICE_CLOCKSOURCE_COUNT) { 
    397394        debugError("Not enough clock source names on device\n"); 
     
    557554    #endif 
    558555 
    559     diceNameVector names = getClockSourceNameString(); 
     556    stringlist names = getClockSourceNameString(); 
    560557    if( names.size() < DICE_CLOCKSOURCE_COUNT) { 
    561558        debugError("Not enough clock source names on device\n"); 
     
    651648    debugOutput(DEBUG_LEVEL_VERBOSE,"  Clock caps       : 0x%08"PRIX32"\n", tmp_quadlet); 
    652649 
    653     diceNameVector names=getClockSourceNameString(); 
     650    stringlist names=getClockSourceNameString(); 
    654651    debugOutput(DEBUG_LEVEL_VERBOSE,"  Clock sources    :\n"); 
    655652 
    656     for ( diceNameVectorIterator it = names.begin(); 
     653    for ( stringlist::iterator it = names.begin(); 
    657654          it != names.end(); 
    658655          ++it ) 
     
    681678        debugOutput(DEBUG_LEVEL_VERBOSE,"   AC3 enable        : 0x%08"PRIX32"\n", tmp_quadlet); 
    682679 
    683         diceNameVector channel_names=getTxNameString(i); 
     680        stringlist channel_names=getTxNameString(i); 
    684681        debugOutput(DEBUG_LEVEL_VERBOSE,"   Channel names     :\n"); 
    685         for ( diceNameVectorIterator it = channel_names.begin(); 
     682        for ( stringlist::iterator it = channel_names.begin(); 
    686683            it != channel_names.end(); 
    687684            ++it ) 
     
    711708        debugOutput(DEBUG_LEVEL_VERBOSE,"   AC3 enable        : 0x%08"PRIX32"\n", tmp_quadlet); 
    712709 
    713         diceNameVector channel_names=getRxNameString(i); 
     710        stringlist channel_names=getRxNameString(i); 
    714711        debugOutput(DEBUG_LEVEL_VERBOSE,"   Channel names     :\n"); 
    715         for ( diceNameVectorIterator it = channel_names.begin(); 
     712        for ( stringlist::iterator it = channel_names.begin(); 
    716713            it != channel_names.end(); 
    717714            ++it ) 
     
    776773    config.getValueForDeviceSetting(vendorid, modelid, "xmit_min_cycles_before_presentation", xmit_min_cycles_before_presentation); 
    777774 
    778     diceNameVector names_audio; 
    779     diceNameVector names_midi; 
     775    stringlist names_audio; 
     776    stringlist names_midi; 
    780777    // prepare receive SP's 
    781778//     for (unsigned int i=0;i<1;i++) { 
     
    15051502} 
    15061503 
    1507 diceNameVector 
     1504stringlist 
    15081505Device::getTxNameString(unsigned int i) { 
    1509     diceNameVector names; 
     1506    stringlist names; 
    15101507    char namestring[DICE_TX_NAMES_SIZE+1]; 
    15111508 
     
    15251522} 
    15261523 
    1527 diceNameVector 
     1524stringlist 
    15281525Device::getRxNameString(unsigned int i) { 
    1529     diceNameVector names; 
     1526    stringlist names; 
    15301527    char namestring[DICE_RX_NAMES_SIZE+1]; 
    15311528 
     
    15451542} 
    15461543 
    1547 diceNameVector 
     1544stringlist 
    15481545Device::getClockSourceNameString() { 
    1549     diceNameVector names; 
     1546    stringlist names; 
    15501547    char namestring[DICE_CLOCKSOURCENAMES_SIZE+1]; 
    15511548 
     
    16031600} 
    16041601 
    1605 diceNameVector 
     1602 
     1603stringlist 
    16061604Device::splitNameString(std::string in) { 
    1607     diceNameVector names; 
    1608  
    1609     // find the end of the string 
    1610     string::size_type end = in.find(string("\\\\")); 
    1611     // cut the end 
    1612     in = in.substr(0,end); 
    1613  
    1614     string::size_type cut; 
    1615     while( (cut = in.find(string("\\"))) != in.npos ) { 
    1616         if(cut > 0) { 
    1617             names.push_back(in.substr(0,cut)); 
    1618         } 
    1619         in = in.substr(cut+1); 
    1620     } 
    1621     if(in.length() > 0) { 
    1622         names.push_back(in); 
    1623     } 
    1624     return names; 
     1605    in = in.substr(0,in.find("\\\\")); 
     1606    return stringlist::splitString(in, "\\"); 
    16251607} 
    16261608 
  • trunk/libffado/src/dice/dice_avdevice.h

    r1766 r1772  
    2525#define DICEDEVICE_H 
    2626 
     27#include "ffadotypes.h" 
    2728#include "ffadodevice.h" 
    2829 
     
    5455class EAP; 
    5556 
    56 typedef std::vector< std::string > diceNameVector; 
    57 typedef std::vector< std::string >::iterator diceNameVectorIterator; 
    58  
    59  
     57 
     58/** 
     59  @brief Devices based on the DICE-platform 
     60 
     61  This class is the basic implementation for devices using the DICE-chip. 
     62  */ 
    6063class Device : public FFADODevice { 
    6164// private: 
     
    6366 
    6467public: 
     68    /// constructor 
    6569    Device( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )); 
     70    /// destructor 
    6671    ~Device(); 
    6772 
     
    144149    bool maskedCheckNotZeroGlobalReg(fb_nodeaddr_t offset, fb_quadlet_t mask); 
    145150 
    146     diceNameVector splitNameString(std::string in); 
    147     diceNameVector getTxNameString(unsigned int i); 
    148     diceNameVector getRxNameString(unsigned int i); 
    149     diceNameVector getClockSourceNameString(); 
     151    stringlist splitNameString(std::string in); 
     152    stringlist getTxNameString(unsigned int i); 
     153    stringlist getRxNameString(unsigned int i); 
     154    stringlist getClockSourceNameString(); 
    150155    std::string getDeviceNickName(); 
    151156    bool setDeviceNickName(std::string name); 
  • trunk/libffado/src/dice/dice_eap.cpp

    r1766 r1772  
    3939{ 
    4040    switch(id) { 
    41         case 0: return "AES "; 
    42         case 1: return "ADAT"; 
    43         case 2: return "MXR "; 
    44         case 4: return "INS0"; 
    45         case 5: return "INS1"; 
    46         case 10: return "ARM "; 
    47         case 11: return "AVS0"; 
    48         case 12: return "AVS1"; 
    49         case 15: return "MUTE"; 
    50         default : return "RSVD"; 
     41        case eRS_AES:  return "AES "; 
     42        case eRS_ADAT: return "ADAT"; 
     43        case eRS_Mixer: return "MXR "; 
     44        case eRS_InS0: return "INS0"; 
     45        case eRS_InS1: return "INS1"; 
     46        case eRS_ARM:  return "ARM "; 
     47        case eRS_ARX0: return "AVS0"; 
     48        case eRS_ARX1: return "AVS1"; 
     49        case eRS_Muted: return "MUTE"; 
     50        default :       return "RSVD"; 
    5151    } 
    5252} 
     
    5656{ 
    5757    switch(id) { 
    58         case 0: return "AES "; 
    59         case 1: return "ADAT"; 
    60         case 2: return "MXR0"; 
    61         case 3: return "MXR1"; 
    62         case 4: return "INS0"; 
    63         case 5: return "INS1"; 
    64         case 10: return "ARM "; 
    65         case 11: return "AVS0"; 
    66         case 12: return "AVS1"; 
    67         case 15: return "MUTE"; 
     58        case eRD_AES:    return "AES "; 
     59        case eRD_ADAT:  return "ADAT"; 
     60        case eRD_Mixer0: return "MXR0"; 
     61        case eRD_Mixer1: return "MXR1"; 
     62        case eRD_InS0:  return "INS0"; 
     63        case eRD_InS1:  return "INS1"; 
     64        case eRD_ARM:    return "ARM "; 
     65        case eRD_ATX0:  return "AVS0"; 
     66        case eRD_ATX1:  return "AVS1"; 
     67        case eRD_Muted: return "MUTE"; 
    6868        default : return "RSVD"; 
    6969    } 
     
    7777, m_mixer( NULL ) 
    7878, m_router( NULL ) 
    79 , m_current_cfg_routing_low( RouterConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_LOW_ROUTER) ) 
    80 , m_current_cfg_routing_mid( RouterConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_MID_ROUTER) ) 
     79, m_current_cfg_routing_low ( RouterConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_LOW_ROUTER ) ) 
     80, m_current_cfg_routing_mid ( RouterConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_MID_ROUTER ) ) 
    8181, m_current_cfg_routing_high( RouterConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_HIGH_ROUTER) ) 
    82 , m_current_cfg_stream_low( StreamConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_LOW_STREAM) ) 
    83 , m_current_cfg_stream_mid( StreamConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_MID_STREAM) ) 
    84 , m_current_cfg_stream_high( StreamConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_HIGH_STREAM) ) 
     82, m_current_cfg_stream_low  ( StreamConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_LOW_STREAM ) ) 
     83, m_current_cfg_stream_mid  ( StreamConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_MID_STREAM ) ) 
     84, m_current_cfg_stream_high ( StreamConfig(*this, eRT_CurrentCfg, DICE_EAP_CURRCFG_HIGH_STREAM) ) 
    8585{ 
    8686} 
     
    198198            return false; 
    199199        } 
     200        setupSources(); 
     201        setupDestinations(); 
    200202 
    201203        // add the router to the EAP control container 
     
    208210} 
    209211 
     212void 
     213EAP::setupSources() { 
     214    // add the routing sources and destinations for a DICE chip 
     215    switch(m_general_chip) { 
     216        case DICE_EAP_CAP_GENERAL_CHIP_DICEII: 
     217            // router/EAP currently not supported 
     218            break; 
     219        case DICE_EAP_CAP_GENERAL_CHIP_DICEJR: 
     220            // second audio port (unique to the junior) 
     221            addSource("InS1", eRS_InS1, 0, 8); 
     222        case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI: 
     223            /// these are common to the mini and junior 
     224            // the AES receiver 
     225            addSource("AES", eRS_AES, 0, 8); 
     226            // the ADAT receiver 
     227            addSource("ADAT", eRS_ADAT, 0, 8); 
     228            // the Mixer outputs 
     229            addSource("MixerOut", eRS_Mixer, 0, 16); 
     230            // the first audio port 
     231            addSource("InS0", eRS_InS0, 0, 8); 
     232            // the ARM audio port 
     233            addSource("ARM", eRS_ARM, 0, 8); 
     234            // the 1394 stream receivers 
     235            addSource("1394_0", eRS_ARX0, 0, 16); 
     236            addSource("1394_1", eRS_ARX1, 0, 16); 
     237            // mute 
     238            addSource("Mute", eRS_Muted, 0, 1); 
     239            break; 
     240        default: 
     241            // this is an unsupported chip 
     242            break; 
     243    } 
     244} 
     245 
     246void 
     247EAP::setupDestinations() { 
     248    // add the routing sources and destinations for a DICE chip 
     249    switch(m_general_chip) { 
     250        case DICE_EAP_CAP_GENERAL_CHIP_DICEII: 
     251            // router/EAP currently not supported 
     252            break; 
     253        case DICE_EAP_CAP_GENERAL_CHIP_DICEJR: 
     254            // second audio port (unique to the junior) 
     255            addDestination("InS1", eRD_InS1, 0, 8); 
     256        case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI: 
     257            /// these are common to the mini and junior 
     258            // the AES receiver 
     259            addDestination("AES", eRD_AES, 0, 8); 
     260            // the ADAT receiver 
     261            addDestination("ADAT", eRD_ADAT, 0, 8); 
     262            // the Mixer outputs 
     263            addDestination("MixerIn", eRD_Mixer0, 0, 16); 
     264            addDestination("MixerIn", eRD_Mixer1, 16, 2); 
     265            // the first audio port 
     266            addDestination("InS0", eRD_InS0, 0, 8); 
     267            // the ARM audio port 
     268            addDestination("ARM", eRD_ARM, 0, 8); 
     269            // the 1394 stream receivers 
     270            addDestination("1394_0", eRD_ATX0, 0, 16); 
     271            addDestination("1394_1", eRD_ATX1, 0, 16); 
     272            // mute 
     273            addDestination("Mute", eRD_Muted, 0, 1); 
     274            break; 
     275        default: 
     276            // this is an unsupported chip 
     277            break; 
     278    } 
     279} 
     280 
     281void 
     282EAP::addSource( const std::string name, enum eRouteSource srcid, unsigned int base, unsigned int count ) { 
     283    m_router->setupSourcesAddSource(name.c_str(), srcid, base, count); 
     284} 
     285void 
     286EAP::addDestination( const std::string name, enum eRouteDestination destid, unsigned int base, unsigned int count ) { 
     287    m_router->setupDestinationsAddDestination(name.c_str(), destid, base, count); 
     288} 
     289 
    210290bool 
    211291EAP::updateConfigurationCache() 
     
    241321/** 
    242322 * Returns the router configuration for the current rate mode 
    243  * @return  
    244323 */ 
    245324EAP::RouterConfig * 
     
    258337/** 
    259338 * Returns the stream configuration for the current rate mode 
    260  * @return  
    261339 */ 
    262340EAP::StreamConfig * 
     
    598676} 
    599677 
    600 // internal I/O operations 
     678/* 
     679  I/O operations 
     680  */ 
    601681bool 
    602682EAP::readReg(enum eRegBase base, unsigned offset, fb_quadlet_t *result) { 
     
    10231103, m_debugModule(p.m_debugModule) 
    10241104{ 
    1025     setupSources(); 
    1026     setupDestinations(); 
    10271105} 
    10281106 
     
    10551133        struct Destination d = {name, dstid, i}; 
    10561134        m_destinations.push_back(d); 
    1057     } 
    1058 } 
    1059  
    1060  
    1061 void 
    1062 EAP::Router::setupSources() { 
    1063     // add the routing sources and destinations for a DICE chip 
    1064     switch(m_eap.m_general_chip) { 
    1065         case DICE_EAP_CAP_GENERAL_CHIP_DICEII: 
    1066             // router/EAP currently not supported 
    1067             break; 
    1068         case DICE_EAP_CAP_GENERAL_CHIP_DICEJR: 
    1069             // these are unique to the junior 
    1070  
    1071             // second audio port 
    1072             setupSourcesAddSource("InS1", eRS_InS1, 0, 8); 
    1073  
    1074         case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI: 
    1075             // these are common to the mini and junior 
    1076  
    1077             // the AES receiver 
    1078             setupSourcesAddSource("AES", eRS_AES, 0, 8); 
    1079  
    1080             // the ADAT receiver 
    1081             setupSourcesAddSource("ADAT", eRS_ADAT, 0, 8); 
    1082  
    1083             // the Mixer outputs 
    1084             setupSourcesAddSource("MixerOut", eRS_Mixer, 0, 16); 
    1085  
    1086             // the first audio port 
    1087             setupSourcesAddSource("InS0", eRS_InS0, 0, 8); 
    1088  
    1089             // the ARM audio port 
    1090             setupSourcesAddSource("ARM", eRS_ARM, 0, 8); 
    1091  
    1092             // the 1394 stream receivers 
    1093             setupSourcesAddSource("1394_0", eRS_ARX0, 0, 16); 
    1094             setupSourcesAddSource("1394_1", eRS_ARX1, 0, 16); 
    1095  
    1096             // mute 
    1097             setupSourcesAddSource("Mute", eRS_Muted, 0, 1); 
    1098  
    1099             break; 
    1100         default: 
    1101             // this is an unsupported chip 
    1102             break; 
    1103     } 
    1104 } 
    1105  
    1106 void 
    1107 EAP::Router::setupDestinations() { 
    1108     // add the routing sources and destinations for a DICE chip 
    1109     switch(m_eap.m_general_chip) { 
    1110         case DICE_EAP_CAP_GENERAL_CHIP_DICEII: 
    1111             // router/EAP currently not supported 
    1112             break; 
    1113         case DICE_EAP_CAP_GENERAL_CHIP_DICEJR: 
    1114             // these are unique to the junior 
    1115  
    1116             // second audio port 
    1117             setupDestinationsAddDestination("InS1", eRD_InS1, 0, 8); 
    1118  
    1119         case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI: 
    1120             // these are common to the mini and junior 
    1121  
    1122             // the AES receiver 
    1123             setupDestinationsAddDestination("AES", eRD_AES, 0, 8); 
    1124  
    1125             // the ADAT receiver 
    1126             setupDestinationsAddDestination("ADAT", eRD_ADAT, 0, 8); 
    1127  
    1128             // the Mixer outputs 
    1129             setupDestinationsAddDestination("MixerIn", eRD_Mixer0, 0, 16); 
    1130             setupDestinationsAddDestination("MixerIn", eRD_Mixer1, 16, 2); 
    1131  
    1132             // the first audio port 
    1133             setupDestinationsAddDestination("InS0", eRD_InS0, 0, 8); 
    1134  
    1135             // the ARM audio port 
    1136             setupDestinationsAddDestination("ARM", eRD_ARM, 0, 8); 
    1137  
    1138             // the 1394 stream receivers 
    1139             setupDestinationsAddDestination("1394_0", eRD_ATX0, 0, 16); 
    1140             setupDestinationsAddDestination("1394_1", eRD_ATX1, 0, 16); 
    1141  
    1142             // mute 
    1143             setupDestinationsAddDestination("Mute", eRD_Muted, 0, 1); 
    1144  
    1145             break; 
    1146         default: 
    1147             // this is an unsupported chip 
    1148             break; 
    11491135    } 
    11501136} 
     
    16541640    } 
    16551641    if(nb_routes == 0) { 
    1656         debugWarning("No routes found\n"); 
     1642        debugWarning("No routes found. Base 0x%x, offset 0x%x\n", base, offset); 
    16571643    } 
    16581644 
     
    17951781 
    17961782#define CASE_INT_EQUAL_RETURN(_x) case (int)(_x): return _x; 
    1797 enum EAP::eRouteDestination 
     1783enum eRouteDestination 
    17981784EAP::RouterConfig::intToRouteDestination(int dst) 
    17991785{ 
     
    18131799} 
    18141800 
    1815 enum EAP::eRouteSource 
     1801enum eRouteSource 
    18161802EAP::RouterConfig::intToRouteSource(int src) 
    18171803{ 
     
    20692055} 
    20702056 
    2071 diceNameVector 
     2057stringlist 
    20722058EAP::StreamConfig::getNamesForBlock(struct ConfigBlock &b) 
    20732059{ 
    2074     diceNameVector names; 
     2060    stringlist names; 
    20752061    char namestring[DICE_EAP_CHANNEL_CONFIG_NAMESTR_LEN_BYTES+1]; 
    20762062 
     
    20922078    debugOutput(DEBUG_LEVEL_VERBOSE, " Channel count : %u audio, %u midi\n", b.nb_audio, b.nb_midi); 
    20932079    debugOutput(DEBUG_LEVEL_VERBOSE, " AC3 Map       : 0x%08X\n", b.ac3_map); 
    2094     diceNameVector channel_names  = getNamesForBlock(b); 
     2080    stringlist channel_names  = getNamesForBlock(b); 
    20952081    debugOutput(DEBUG_LEVEL_VERBOSE,"  Channel names :\n"); 
    2096     for ( diceNameVectorIterator it = channel_names.begin(); 
     2082    for ( stringlist::iterator it = channel_names.begin(); 
    20972083        it != channel_names.end(); 
    20982084        ++it ) 
  • trunk/libffado/src/dice/dice_eap.h

    r1766 r1772  
    125125 
    126126/** 
    127  * this class represents the EAP interface 
    128  * available on some devices 
    129  */ 
     127  @brief Sources for audio hitting the router 
     128  */ 
     129enum eRouteSource { 
     130    eRS_AES = 0, 
     131    eRS_ADAT = 1, 
     132    eRS_Mixer = 2, 
     133    eRS_InS0 = 4, 
     134    eRS_InS1 = 5, 
     135    eRS_ARM = 10, 
     136    eRS_ARX0 = 11, 
     137    eRS_ARX1 = 12, 
     138    eRS_Muted = 15, 
     139    eRS_Invalid = 16, 
     140}; 
     141/** 
     142  @brief Destinations for audio exiting the router 
     143  */ 
     144enum eRouteDestination { 
     145    eRD_AES = 0, 
     146    eRD_ADAT = 1, 
     147    eRD_Mixer0 = 2, 
     148    eRD_Mixer1 = 3, 
     149    eRD_InS0 = 4, 
     150    eRD_InS1 = 5, 
     151    eRD_ARM = 10, 
     152    eRD_ATX0 = 11, 
     153    eRD_ATX1 = 12, 
     154    eRD_Muted = 15, 
     155    eRD_Invalid = 16, 
     156}; 
     157 
     158/** 
     159  @brief represents the EAP interface available on some devices 
     160 
     161  When available, the mixer and router are visible. This class is also the base for custom 
     162  implementations of EAP extensions. 
     163  */ 
    130164class EAP : public Control::Container 
    131165{ 
    132166public: 
     167    /** 
     168      @brief Command status 
     169      */ 
    133170    enum eWaitReturn { 
    134171        eWR_Error, 
     
    137174        eWR_Done, 
    138175    }; 
     176    /** 
     177      @brief Constants for the EAP spaces 
     178 
     179      @see offsetGen for the calculation of the real offsets. 
     180      */ 
    139181    enum eRegBase { 
    140182        eRT_Base, 
     
    150192        eRT_None, 
    151193    }; 
    152     enum eRouteSource { 
    153         eRS_AES = 0, 
    154         eRS_ADAT = 1, 
    155         eRS_Mixer = 2, 
    156         eRS_InS0 = 4, 
    157         eRS_InS1 = 5, 
    158         eRS_ARM = 10, 
    159         eRS_ARX0 = 11, 
    160         eRS_ARX1 = 12, 
    161         eRS_Muted = 15, 
    162         eRS_Invalid = 16, 
    163     }; 
    164     enum eRouteDestination { 
    165         eRD_AES = 0, 
    166         eRD_ADAT = 1, 
    167         eRD_Mixer0 = 2, 
    168         eRD_Mixer1 = 3, 
    169         eRD_InS0 = 4, 
    170         eRD_InS1 = 5, 
    171         eRD_ARM = 10, 
    172         eRD_ATX0 = 11, 
    173         eRD_ATX1 = 12, 
    174         eRD_Muted = 15, 
    175         eRD_Invalid = 16, 
    176     }; 
    177  
    178 public: 
    179  
    180     // ---------- 
     194 
     195private: 
     196 
     197    /** 
     198      @brief Description of the routing in the hardware 
     199      */ 
    181200    class RouterConfig { 
     201    private: 
     202        friend class Dice::EAP; 
     203        RouterConfig(EAP &); 
     204        RouterConfig(EAP &, enum eRegBase, unsigned int offset); 
     205        virtual ~RouterConfig(); 
     206 
    182207    public: 
    183208        struct Route 
     
    191216        typedef std::vector<RouterConfig::Route> RouteVector; 
    192217        typedef std::vector<RouterConfig::Route>::iterator RouteVectorIterator; 
    193         RouterConfig(EAP &); 
    194         RouterConfig(EAP &, enum eRegBase, unsigned int offset); 
    195         virtual ~RouterConfig(); 
    196218 
    197219        virtual bool read() {return read(m_base, m_offset);}; 
     
    231253    }; 
    232254 
    233     // ---------- 
    234     // the peak space is a special version of a router config 
     255    /** 
     256      the peak space is a special version of a router config 
     257      */ 
    235258    class PeakSpace : public RouterConfig { 
    236     public: 
     259    private: 
     260        friend class Dice::EAP; 
    237261        PeakSpace(EAP &p) : RouterConfig(p, eRT_Peak, 0) {}; 
    238262        virtual ~PeakSpace() {}; 
    239263 
     264    public: 
    240265        virtual bool read() {return read(m_base, m_offset);}; 
    241266        virtual bool write() {return write(m_base, m_offset);}; 
     
    245270    }; 
    246271 
    247     // ---------- 
     272    /** 
     273      @brief Description of the streams in the hardware 
     274      */ 
    248275    class StreamConfig { 
     276    private: 
     277        friend class Dice::EAP; 
     278        StreamConfig(EAP &, enum eRegBase, unsigned int offset); 
     279        ~StreamConfig(); 
     280 
    249281    public: 
    250282        struct ConfigBlock { // FIXME: somewhere in the DICE avdevice this is present too 
     
    255287        }; 
    256288        void showConfigBlock(struct ConfigBlock &); 
    257         diceNameVector getNamesForBlock(struct ConfigBlock &b); 
    258     public: 
    259         StreamConfig(EAP &, enum eRegBase, unsigned int offset); 
    260         ~StreamConfig(); 
     289        stringlist getNamesForBlock(struct ConfigBlock &b); 
    261290 
    262291        bool read() {return read(m_base, m_offset);}; 
     
    281310    }; 
    282311 
    283 public: // mixer control subclass 
     312public: 
     313 
     314    /** 
     315      @brief The matrixmixer exposed 
     316      */ 
    284317    class Mixer : public Control::MatrixMixer { 
    285318    public: 
     
    330363    }; 
    331364 
    332     // ---------- 
     365    /** 
     366      @brief The router exposed 
     367      */ 
    333368    class Router : public Control::CrossbarRouter { 
    334369    private: 
     
    355390        void show(); 
    356391 
    357         // to be subclassed by the implementing 
    358         // devices 
    359         virtual void setupSources(); 
    360         virtual void setupDestinations(); 
    361  
    362392        void setupDestinationsAddDestination(const char *name, enum eRouteDestination dstid, 
    363393                                             unsigned int base, unsigned int cnt); 
     
    419449 
    420450public: 
     451    /** constructor */ 
    421452    EAP(Device &); 
     453    /** destructor */ 
    422454    virtual ~EAP(); 
    423455 
     456    /** 
     457      @brief Does this device support the EAP? 
     458 
     459      When subclassing EAP, return true only on devices that actually have an EAP. 
     460 
     461      @todo Shouldn't this be inside Dice::Device? 
     462      */ 
    424463    static bool supportsEAP(Device &); 
     464 
     465    /** 
     466      @brief Initialize the EAP 
     467      */ 
    425468    bool init(); 
    426469 
     470    /// Show information about the EAP 
    427471    void show(); 
     472    /// Dump the first parts of the application space 
    428473    void showApplication(); 
     474 
     475    /// Restore from flash 
     476    bool loadFlashConfig(); 
     477    /// Store to flash 
     478    bool storeFlashConfig(); 
     479 
     480    /// Is the current operation still busy? 
    429481    enum eWaitReturn operationBusy(); 
     482    /// Block until the current operation is done 
    430483    enum eWaitReturn waitForOperationEnd(int max_wait_time_ms = 100); 
    431484 
     485    /// Update all configurations from the device 
    432486    bool updateConfigurationCache(); 
     487 
     488    /** 
     489      @{ 
     490      @brief Read and write registers on the device 
     491      */ 
     492    bool readReg(enum eRegBase, unsigned offset, quadlet_t *); 
     493    bool writeReg(enum eRegBase, unsigned offset, quadlet_t); 
     494    bool readRegBlock(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 
     495    bool writeRegBlock(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 
     496    bool readRegBlockSwapped(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 
     497    bool writeRegBlockSwapped(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 
     498    //@} 
     499 
     500    /** @brief Get access to the mixer */ 
     501    Mixer*  getMixer() {return m_mixer;}; 
     502    /** @brief Get access to the router */ 
     503    Router* getRouter() {return m_router;}; 
     504 
     505protected: 
     506    /** 
     507      @brief Setup all the available sources 
     508 
     509      This adds the needed entries for sources to the router. The default implementation decides on 
     510      the chip which sources to add, subclasses should only add the sources actually usable for the 
     511      device. 
     512 
     513      To ease custom device support, this function is not in EAP::Router but here. 
     514      */ 
     515    virtual void setupSources(); 
     516    /** 
     517      @brief Setup all the available destinations 
     518 
     519      This adds the needed entries for destinations to the router. The default implementation 
     520      decides on the chip which destinations to add, subclasses should only add the destinations 
     521      actually usable for the device. 
     522 
     523      To ease custom device support, this function is not in EAP::Router but here. 
     524      */ 
     525    virtual void setupDestinations(); 
     526 
     527    /** 
     528      @brief Actually add the source 
     529      */ 
     530    void addSource( const std::string name, enum eRouteSource srcid, 
     531            unsigned int base, unsigned int count ); 
     532    /** 
     533      @brief Actually add the destination 
     534      */ 
     535    void addDestination( const std::string name, enum eRouteDestination destid, 
     536            unsigned int base, unsigned int count ); 
     537 
     538private: 
     539    /// Return the router configuration for the current rate 
    433540    RouterConfig * getActiveRouterConfig(); 
     541    /// Return the stream configuration for the current rate 
    434542    StreamConfig * getActiveStreamConfig(); 
    435543 
     544    /// Write a new router configuration to the device 
    436545    bool updateRouterConfig(RouterConfig&, bool low, bool mid, bool high); 
     546    /// Write a new router configuration to the device 
    437547    bool updateCurrentRouterConfig(RouterConfig&); 
     548    /// Write a new stream configuration to the device 
    438549    bool updateStreamConfig(StreamConfig&, bool low, bool mid, bool high); 
     550    /// Write a new stream configuration to the device 
    439551    bool updateStreamConfig(RouterConfig&, StreamConfig&, bool low, bool mid, bool high); 
    440552 
    441     bool loadFlashConfig(); 
    442     bool storeFlashConfig(); 
    443  
    444 private: 
    445553    bool loadRouterConfig(bool low, bool mid, bool high); 
    446554    bool loadStreamConfig(bool low, bool mid, bool high); 
    447555    bool loadRouterAndStreamConfig(bool low, bool mid, bool high); 
     556 
    448557private: 
    449558    bool     m_router_exposed; 
     
    470579    bool commandHelper(fb_quadlet_t cmd); 
    471580 
    472 public: 
    473     bool readReg(enum eRegBase, unsigned offset, quadlet_t *); 
    474     bool writeReg(enum eRegBase, unsigned offset, quadlet_t); 
    475     bool readRegBlock(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 
    476     bool writeRegBlock(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 
    477     bool readRegBlockSwapped(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 
    478     bool writeRegBlockSwapped(enum eRegBase, unsigned, fb_quadlet_t *, size_t); 
     581    /// Calculate the real offset for the different spaces 
    479582    fb_nodeaddr_t offsetGen(enum eRegBase, unsigned, size_t); 
    480  
    481 protected: 
    482     DECLARE_DEBUG_MODULE; //_REFERENCE; 
    483583 
    484584private: 
     
    492592    StreamConfig m_current_cfg_stream_mid; 
    493593    StreamConfig m_current_cfg_stream_high; 
    494 public: 
    495     Mixer*  getMixer() {return m_mixer;}; 
    496     Router* getRouter() {return m_router;}; 
    497  
    498 private: 
    499594 
    500595    fb_quadlet_t m_capability_offset; 
     
    516611    fb_quadlet_t m_app_offset; 
    517612    fb_quadlet_t m_app_size; 
     613 
     614protected: 
     615    DECLARE_DEBUG_MODULE; 
    518616}; 
    519617