Changeset 1772 for trunk/libffado
- Timestamp:
- 01/01/10 14:09:19 (14 years ago)
- Files:
-
- trunk/libffado/src/dice/dice_avdevice.cpp (modified) (11 diffs)
- trunk/libffado/src/dice/dice_avdevice.h (modified) (4 diffs)
- trunk/libffado/src/dice/dice_eap.cpp (modified) (15 diffs)
- trunk/libffado/src/dice/dice_eap.h (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/dice/dice_avdevice.cpp
r1766 r1772 162 162 } 163 163 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; 182 179 } 183 180 return true; … … 393 390 #endif 394 391 395 diceNameVectornames = getClockSourceNameString();392 stringlist names = getClockSourceNameString(); 396 393 if( names.size() < DICE_CLOCKSOURCE_COUNT) { 397 394 debugError("Not enough clock source names on device\n"); … … 557 554 #endif 558 555 559 diceNameVectornames = getClockSourceNameString();556 stringlist names = getClockSourceNameString(); 560 557 if( names.size() < DICE_CLOCKSOURCE_COUNT) { 561 558 debugError("Not enough clock source names on device\n"); … … 651 648 debugOutput(DEBUG_LEVEL_VERBOSE," Clock caps : 0x%08"PRIX32"\n", tmp_quadlet); 652 649 653 diceNameVectornames=getClockSourceNameString();650 stringlist names=getClockSourceNameString(); 654 651 debugOutput(DEBUG_LEVEL_VERBOSE," Clock sources :\n"); 655 652 656 for ( diceNameVectorIterator it = names.begin();653 for ( stringlist::iterator it = names.begin(); 657 654 it != names.end(); 658 655 ++it ) … … 681 678 debugOutput(DEBUG_LEVEL_VERBOSE," AC3 enable : 0x%08"PRIX32"\n", tmp_quadlet); 682 679 683 diceNameVectorchannel_names=getTxNameString(i);680 stringlist channel_names=getTxNameString(i); 684 681 debugOutput(DEBUG_LEVEL_VERBOSE," Channel names :\n"); 685 for ( diceNameVectorIterator it = channel_names.begin();682 for ( stringlist::iterator it = channel_names.begin(); 686 683 it != channel_names.end(); 687 684 ++it ) … … 711 708 debugOutput(DEBUG_LEVEL_VERBOSE," AC3 enable : 0x%08"PRIX32"\n", tmp_quadlet); 712 709 713 diceNameVectorchannel_names=getRxNameString(i);710 stringlist channel_names=getRxNameString(i); 714 711 debugOutput(DEBUG_LEVEL_VERBOSE," Channel names :\n"); 715 for ( diceNameVectorIterator it = channel_names.begin();712 for ( stringlist::iterator it = channel_names.begin(); 716 713 it != channel_names.end(); 717 714 ++it ) … … 776 773 config.getValueForDeviceSetting(vendorid, modelid, "xmit_min_cycles_before_presentation", xmit_min_cycles_before_presentation); 777 774 778 diceNameVectornames_audio;779 diceNameVectornames_midi;775 stringlist names_audio; 776 stringlist names_midi; 780 777 // prepare receive SP's 781 778 // for (unsigned int i=0;i<1;i++) { … … 1505 1502 } 1506 1503 1507 diceNameVector 1504 stringlist 1508 1505 Device::getTxNameString(unsigned int i) { 1509 diceNameVectornames;1506 stringlist names; 1510 1507 char namestring[DICE_TX_NAMES_SIZE+1]; 1511 1508 … … 1525 1522 } 1526 1523 1527 diceNameVector 1524 stringlist 1528 1525 Device::getRxNameString(unsigned int i) { 1529 diceNameVectornames;1526 stringlist names; 1530 1527 char namestring[DICE_RX_NAMES_SIZE+1]; 1531 1528 … … 1545 1542 } 1546 1543 1547 diceNameVector 1544 stringlist 1548 1545 Device::getClockSourceNameString() { 1549 diceNameVectornames;1546 stringlist names; 1550 1547 char namestring[DICE_CLOCKSOURCENAMES_SIZE+1]; 1551 1548 … … 1603 1600 } 1604 1601 1605 diceNameVector 1602 1603 stringlist 1606 1604 Device::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, "\\"); 1625 1607 } 1626 1608 trunk/libffado/src/dice/dice_avdevice.h
r1766 r1772 25 25 #define DICEDEVICE_H 26 26 27 #include "ffadotypes.h" 27 28 #include "ffadodevice.h" 28 29 … … 54 55 class EAP; 55 56 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 */ 60 63 class Device : public FFADODevice { 61 64 // private: … … 63 66 64 67 public: 68 /// constructor 65 69 Device( DeviceManager& d, std::auto_ptr<ConfigRom>( configRom )); 70 /// destructor 66 71 ~Device(); 67 72 … … 144 149 bool maskedCheckNotZeroGlobalReg(fb_nodeaddr_t offset, fb_quadlet_t mask); 145 150 146 diceNameVectorsplitNameString(std::string in);147 diceNameVectorgetTxNameString(unsigned int i);148 diceNameVectorgetRxNameString(unsigned int i);149 diceNameVectorgetClockSourceNameString();151 stringlist splitNameString(std::string in); 152 stringlist getTxNameString(unsigned int i); 153 stringlist getRxNameString(unsigned int i); 154 stringlist getClockSourceNameString(); 150 155 std::string getDeviceNickName(); 151 156 bool setDeviceNickName(std::string name); trunk/libffado/src/dice/dice_eap.cpp
r1766 r1772 39 39 { 40 40 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"; 51 51 } 52 52 } … … 56 56 { 57 57 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"; 68 68 default : return "RSVD"; 69 69 } … … 77 77 , m_mixer( NULL ) 78 78 , 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 ) ) 81 81 , 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) ) 85 85 { 86 86 } … … 198 198 return false; 199 199 } 200 setupSources(); 201 setupDestinations(); 200 202 201 203 // add the router to the EAP control container … … 208 210 } 209 211 212 void 213 EAP::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 246 void 247 EAP::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 281 void 282 EAP::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 } 285 void 286 EAP::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 210 290 bool 211 291 EAP::updateConfigurationCache() … … 241 321 /** 242 322 * Returns the router configuration for the current rate mode 243 * @return244 323 */ 245 324 EAP::RouterConfig * … … 258 337 /** 259 338 * Returns the stream configuration for the current rate mode 260 * @return261 339 */ 262 340 EAP::StreamConfig * … … 598 676 } 599 677 600 // internal I/O operations 678 /* 679 I/O operations 680 */ 601 681 bool 602 682 EAP::readReg(enum eRegBase base, unsigned offset, fb_quadlet_t *result) { … … 1023 1103 , m_debugModule(p.m_debugModule) 1024 1104 { 1025 setupSources();1026 setupDestinations();1027 1105 } 1028 1106 … … 1055 1133 struct Destination d = {name, dstid, i}; 1056 1134 m_destinations.push_back(d); 1057 }1058 }1059 1060 1061 void1062 EAP::Router::setupSources() {1063 // add the routing sources and destinations for a DICE chip1064 switch(m_eap.m_general_chip) {1065 case DICE_EAP_CAP_GENERAL_CHIP_DICEII:1066 // router/EAP currently not supported1067 break;1068 case DICE_EAP_CAP_GENERAL_CHIP_DICEJR:1069 // these are unique to the junior1070 1071 // second audio port1072 setupSourcesAddSource("InS1", eRS_InS1, 0, 8);1073 1074 case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI:1075 // these are common to the mini and junior1076 1077 // the AES receiver1078 setupSourcesAddSource("AES", eRS_AES, 0, 8);1079 1080 // the ADAT receiver1081 setupSourcesAddSource("ADAT", eRS_ADAT, 0, 8);1082 1083 // the Mixer outputs1084 setupSourcesAddSource("MixerOut", eRS_Mixer, 0, 16);1085 1086 // the first audio port1087 setupSourcesAddSource("InS0", eRS_InS0, 0, 8);1088 1089 // the ARM audio port1090 setupSourcesAddSource("ARM", eRS_ARM, 0, 8);1091 1092 // the 1394 stream receivers1093 setupSourcesAddSource("1394_0", eRS_ARX0, 0, 16);1094 setupSourcesAddSource("1394_1", eRS_ARX1, 0, 16);1095 1096 // mute1097 setupSourcesAddSource("Mute", eRS_Muted, 0, 1);1098 1099 break;1100 default:1101 // this is an unsupported chip1102 break;1103 }1104 }1105 1106 void1107 EAP::Router::setupDestinations() {1108 // add the routing sources and destinations for a DICE chip1109 switch(m_eap.m_general_chip) {1110 case DICE_EAP_CAP_GENERAL_CHIP_DICEII:1111 // router/EAP currently not supported1112 break;1113 case DICE_EAP_CAP_GENERAL_CHIP_DICEJR:1114 // these are unique to the junior1115 1116 // second audio port1117 setupDestinationsAddDestination("InS1", eRD_InS1, 0, 8);1118 1119 case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI:1120 // these are common to the mini and junior1121 1122 // the AES receiver1123 setupDestinationsAddDestination("AES", eRD_AES, 0, 8);1124 1125 // the ADAT receiver1126 setupDestinationsAddDestination("ADAT", eRD_ADAT, 0, 8);1127 1128 // the Mixer outputs1129 setupDestinationsAddDestination("MixerIn", eRD_Mixer0, 0, 16);1130 setupDestinationsAddDestination("MixerIn", eRD_Mixer1, 16, 2);1131 1132 // the first audio port1133 setupDestinationsAddDestination("InS0", eRD_InS0, 0, 8);1134 1135 // the ARM audio port1136 setupDestinationsAddDestination("ARM", eRD_ARM, 0, 8);1137 1138 // the 1394 stream receivers1139 setupDestinationsAddDestination("1394_0", eRD_ATX0, 0, 16);1140 setupDestinationsAddDestination("1394_1", eRD_ATX1, 0, 16);1141 1142 // mute1143 setupDestinationsAddDestination("Mute", eRD_Muted, 0, 1);1144 1145 break;1146 default:1147 // this is an unsupported chip1148 break;1149 1135 } 1150 1136 } … … 1654 1640 } 1655 1641 if(nb_routes == 0) { 1656 debugWarning("No routes found \n");1642 debugWarning("No routes found. Base 0x%x, offset 0x%x\n", base, offset); 1657 1643 } 1658 1644 … … 1795 1781 1796 1782 #define CASE_INT_EQUAL_RETURN(_x) case (int)(_x): return _x; 1797 enum EAP::eRouteDestination1783 enum eRouteDestination 1798 1784 EAP::RouterConfig::intToRouteDestination(int dst) 1799 1785 { … … 1813 1799 } 1814 1800 1815 enum EAP::eRouteSource1801 enum eRouteSource 1816 1802 EAP::RouterConfig::intToRouteSource(int src) 1817 1803 { … … 2069 2055 } 2070 2056 2071 diceNameVector 2057 stringlist 2072 2058 EAP::StreamConfig::getNamesForBlock(struct ConfigBlock &b) 2073 2059 { 2074 diceNameVectornames;2060 stringlist names; 2075 2061 char namestring[DICE_EAP_CHANNEL_CONFIG_NAMESTR_LEN_BYTES+1]; 2076 2062 … … 2092 2078 debugOutput(DEBUG_LEVEL_VERBOSE, " Channel count : %u audio, %u midi\n", b.nb_audio, b.nb_midi); 2093 2079 debugOutput(DEBUG_LEVEL_VERBOSE, " AC3 Map : 0x%08X\n", b.ac3_map); 2094 diceNameVectorchannel_names = getNamesForBlock(b);2080 stringlist channel_names = getNamesForBlock(b); 2095 2081 debugOutput(DEBUG_LEVEL_VERBOSE," Channel names :\n"); 2096 for ( diceNameVectorIterator it = channel_names.begin();2082 for ( stringlist::iterator it = channel_names.begin(); 2097 2083 it != channel_names.end(); 2098 2084 ++it ) trunk/libffado/src/dice/dice_eap.h
r1766 r1772 125 125 126 126 /** 127 * this class represents the EAP interface 128 * available on some devices 129 */ 127 @brief Sources for audio hitting the router 128 */ 129 enum 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 */ 144 enum 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 */ 130 164 class EAP : public Control::Container 131 165 { 132 166 public: 167 /** 168 @brief Command status 169 */ 133 170 enum eWaitReturn { 134 171 eWR_Error, … … 137 174 eWR_Done, 138 175 }; 176 /** 177 @brief Constants for the EAP spaces 178 179 @see offsetGen for the calculation of the real offsets. 180 */ 139 181 enum eRegBase { 140 182 eRT_Base, … … 150 192 eRT_None, 151 193 }; 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 195 private: 196 197 /** 198 @brief Description of the routing in the hardware 199 */ 181 200 class RouterConfig { 201 private: 202 friend class Dice::EAP; 203 RouterConfig(EAP &); 204 RouterConfig(EAP &, enum eRegBase, unsigned int offset); 205 virtual ~RouterConfig(); 206 182 207 public: 183 208 struct Route … … 191 216 typedef std::vector<RouterConfig::Route> RouteVector; 192 217 typedef std::vector<RouterConfig::Route>::iterator RouteVectorIterator; 193 RouterConfig(EAP &);194 RouterConfig(EAP &, enum eRegBase, unsigned int offset);195 virtual ~RouterConfig();196 218 197 219 virtual bool read() {return read(m_base, m_offset);}; … … 231 253 }; 232 254 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 */ 235 258 class PeakSpace : public RouterConfig { 236 public: 259 private: 260 friend class Dice::EAP; 237 261 PeakSpace(EAP &p) : RouterConfig(p, eRT_Peak, 0) {}; 238 262 virtual ~PeakSpace() {}; 239 263 264 public: 240 265 virtual bool read() {return read(m_base, m_offset);}; 241 266 virtual bool write() {return write(m_base, m_offset);}; … … 245 270 }; 246 271 247 // ---------- 272 /** 273 @brief Description of the streams in the hardware 274 */ 248 275 class StreamConfig { 276 private: 277 friend class Dice::EAP; 278 StreamConfig(EAP &, enum eRegBase, unsigned int offset); 279 ~StreamConfig(); 280 249 281 public: 250 282 struct ConfigBlock { // FIXME: somewhere in the DICE avdevice this is present too … … 255 287 }; 256 288 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); 261 290 262 291 bool read() {return read(m_base, m_offset);}; … … 281 310 }; 282 311 283 public: // mixer control subclass 312 public: 313 314 /** 315 @brief The matrixmixer exposed 316 */ 284 317 class Mixer : public Control::MatrixMixer { 285 318 public: … … 330 363 }; 331 364 332 // ---------- 365 /** 366 @brief The router exposed 367 */ 333 368 class Router : public Control::CrossbarRouter { 334 369 private: … … 355 390 void show(); 356 391 357 // to be subclassed by the implementing358 // devices359 virtual void setupSources();360 virtual void setupDestinations();361 362 392 void setupDestinationsAddDestination(const char *name, enum eRouteDestination dstid, 363 393 unsigned int base, unsigned int cnt); … … 419 449 420 450 public: 451 /** constructor */ 421 452 EAP(Device &); 453 /** destructor */ 422 454 virtual ~EAP(); 423 455 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 */ 424 463 static bool supportsEAP(Device &); 464 465 /** 466 @brief Initialize the EAP 467 */ 425 468 bool init(); 426 469 470 /// Show information about the EAP 427 471 void show(); 472 /// Dump the first parts of the application space 428 473 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? 429 481 enum eWaitReturn operationBusy(); 482 /// Block until the current operation is done 430 483 enum eWaitReturn waitForOperationEnd(int max_wait_time_ms = 100); 431 484 485 /// Update all configurations from the device 432 486 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 505 protected: 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 538 private: 539 /// Return the router configuration for the current rate 433 540 RouterConfig * getActiveRouterConfig(); 541 /// Return the stream configuration for the current rate 434 542 StreamConfig * getActiveStreamConfig(); 435 543 544 /// Write a new router configuration to the device 436 545 bool updateRouterConfig(RouterConfig&, bool low, bool mid, bool high); 546 /// Write a new router configuration to the device 437 547 bool updateCurrentRouterConfig(RouterConfig&); 548 /// Write a new stream configuration to the device 438 549 bool updateStreamConfig(StreamConfig&, bool low, bool mid, bool high); 550 /// Write a new stream configuration to the device 439 551 bool updateStreamConfig(RouterConfig&, StreamConfig&, bool low, bool mid, bool high); 440 552 441 bool loadFlashConfig();442 bool storeFlashConfig();443 444 private:445 553 bool loadRouterConfig(bool low, bool mid, bool high); 446 554 bool loadStreamConfig(bool low, bool mid, bool high); 447 555 bool loadRouterAndStreamConfig(bool low, bool mid, bool high); 556 448 557 private: 449 558 bool m_router_exposed; … … 470 579 bool commandHelper(fb_quadlet_t cmd); 471 580 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 479 582 fb_nodeaddr_t offsetGen(enum eRegBase, unsigned, size_t); 480 481 protected:482 DECLARE_DEBUG_MODULE; //_REFERENCE;483 583 484 584 private: … … 492 592 StreamConfig m_current_cfg_stream_mid; 493 593 StreamConfig m_current_cfg_stream_high; 494 public:495 Mixer* getMixer() {return m_mixer;};496 Router* getRouter() {return m_router;};497 498 private:499 594 500 595 fb_quadlet_t m_capability_offset; … … 516 611 fb_quadlet_t m_app_offset; 517 612 fb_quadlet_t m_app_size; 613 614 protected: 615 DECLARE_DEBUG_MODULE; 518 616 }; 519 617