Changeset 415
- Timestamp:
- 02/24/07 09:51:56 (17 years ago)
- Files:
-
- branches/streaming-rework/src/bebob/bebob_avdevice.cpp (modified) (6 diffs)
- branches/streaming-rework/src/bebob/bebob_avdevice.h (modified) (2 diffs)
- branches/streaming-rework/src/bounce/bounce_avdevice.cpp (modified) (4 diffs)
- branches/streaming-rework/src/bounce/bounce_avdevice.h (modified) (1 diff)
- branches/streaming-rework/src/dice/dice_avdevice.cpp (modified) (3 diffs)
- branches/streaming-rework/src/dice/dice_avdevice.h (modified) (1 diff)
- branches/streaming-rework/src/freebob_streaming.cpp (modified) (2 diffs)
- branches/streaming-rework/src/iavdevice.h (modified) (12 diffs)
- branches/streaming-rework/src/libfreebobavc/avc_definitions.cpp (modified) (1 diff)
- branches/streaming-rework/src/libfreebobavc/avc_definitions.h (modified) (1 diff)
- branches/streaming-rework/src/libieee1394/ieee1394service.cpp (modified) (4 diffs)
- branches/streaming-rework/src/libieee1394/ieee1394service.h (modified) (4 diffs)
- branches/streaming-rework/src/libstreaming/AmdtpPort.h (modified) (2 diffs)
- branches/streaming-rework/src/libstreaming/AmdtpPortInfo.h (modified) (3 diffs)
- branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.h (modified) (2 diffs)
- branches/streaming-rework/src/maudio/maudio_avdevice.cpp (modified) (1 diff)
- branches/streaming-rework/src/maudio/maudio_avdevice.h (modified) (1 diff)
- branches/streaming-rework/src/metrichalo/mh_avdevice.cpp (modified) (2 diffs)
- branches/streaming-rework/src/metrichalo/mh_avdevice.h (modified) (2 diffs)
- branches/streaming-rework/src/motu/motu_avdevice.cpp (modified) (11 diffs)
- branches/streaming-rework/src/motu/motu_avdevice.h (modified) (2 diffs)
- branches/streaming-rework/src/rme/rme_avdevice.cpp (modified) (3 diffs)
- branches/streaming-rework/src/rme/rme_avdevice.h (modified) (2 diffs)
- branches/streaming-rework/tests/test-ieee1394service.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/streaming-rework/src/bebob/bebob_avdevice.cpp
r413 r415 77 77 , m_nodeId ( nodeId ) 78 78 , m_id( 0 ) 79 , m_receiveProcessor ( 0 ) 80 , m_receiveProcessorBandwidth ( -1 ) 81 , m_transmitProcessor ( 0 ) 82 , m_transmitProcessorBandwidth ( -1 ) 79 , m_snoopMode( false ) 83 80 { 84 81 setDebugLevel( verboseLevel ); … … 96 93 , m_nodeId ( -1 ) 97 94 , m_id( 0 ) 98 , m_receiveProcessor ( 0 ) 99 , m_receiveProcessorBandwidth ( -1 ) 100 , m_transmitProcessor ( 0 ) 101 , m_transmitProcessorBandwidth ( -1 ) 95 , m_snoopMode( false ) 102 96 { 103 97 } … … 982 976 983 977 int samplerate=outputPlug->getSampleRate(); 984 m_receiveProcessor=new FreebobStreaming::AmdtpReceiveStreamProcessor( 978 979 // create & add streamprocessors 980 FreebobStreaming::StreamProcessor *p; 981 982 p=new FreebobStreaming::AmdtpReceiveStreamProcessor( 985 983 m_p1394Service->getPort(), 986 984 samplerate, 987 985 outputPlug->getNrOfChannels()); 988 986 989 if(! m_receiveProcessor->init()) {987 if(!p->init()) { 990 988 debugFatal("Could not initialize receive processor!\n"); 991 return false; 992 } 993 994 if (!addPlugToProcessor(*outputPlug,m_receiveProcessor, 995 FreebobStreaming::AmdtpAudioPort::E_Capture)) { 989 delete p; 990 return false; 991 } 992 993 if (!addPlugToProcessor(*outputPlug,p, 994 FreebobStreaming::Port::E_Capture)) { 996 995 debugFatal("Could not add plug to processor!\n"); 997 return false; 998 } 996 delete p; 997 return false; 998 } 999 1000 m_receiveProcessors.push_back(p); 999 1001 1000 1002 // do the transmit processor 1001 // if (m_snoopMode) { 1002 // // we are snooping, so these are receive too. 1003 // samplerate=inputPlug->getSampleRate(); 1004 // m_receiveProcessor2=new FreebobStreaming::AmdtpReceiveStreamProcessor( 1005 // channel, 1006 // m_1394Service->getPort(), 1007 // samplerate, 1008 // inputPlug->getNrOfChannels()); 1009 // 1010 // if(!m_receiveProcessor2->init()) { 1011 // debugFatal("Could not initialize snooping receive processor!\n"); 1012 // return false; 1013 // } 1014 // if (!addPlugToProcessor(*inputPlug,m_receiveProcessor2, 1015 // FreebobStreaming::AmdtpAudioPort::E_Capture)) { 1016 // debugFatal("Could not add plug to processor!\n"); 1017 // return false; 1018 // } 1019 // } else { 1020 // do the transmit processor 1021 samplerate=inputPlug->getSampleRate(); 1022 m_transmitProcessor=new FreebobStreaming::AmdtpTransmitStreamProcessor( 1003 if (m_snoopMode) { 1004 // we are snooping, so this is receive too. 1005 p=new FreebobStreaming::AmdtpReceiveStreamProcessor( 1006 m_p1394Service->getPort(), 1007 samplerate, 1008 inputPlug->getNrOfChannels()); 1009 } else { 1010 p=new FreebobStreaming::AmdtpTransmitStreamProcessor( 1023 1011 m_p1394Service->getPort(), 1024 1012 samplerate, 1025 1013 inputPlug->getNrOfChannels()); 1026 1027 if(!m_transmitProcessor->init()) { 1028 debugFatal("Could not initialize transmit processor!\n"); 1029 return false; 1030 1031 } 1032 1033 if (!addPlugToProcessor(*inputPlug,m_transmitProcessor, 1034 FreebobStreaming::AmdtpAudioPort::E_Playback)) { 1014 } 1015 1016 if(!p->init()) { 1017 debugFatal("Could not initialize transmit processor %s!\n", 1018 (m_snoopMode?" in snoop mode":"")); 1019 delete p; 1020 return false; 1021 } 1022 1023 if (m_snoopMode) { 1024 if (!addPlugToProcessor(*inputPlug,p, 1025 FreebobStreaming::Port::E_Capture)) { 1035 1026 debugFatal("Could not add plug to processor!\n"); 1036 1027 return false; 1037 1028 } 1038 // } 1029 } else { 1030 if (!addPlugToProcessor(*inputPlug,p, 1031 FreebobStreaming::Port::E_Playback)) { 1032 debugFatal("Could not add plug to processor!\n"); 1033 return false; 1034 } 1035 } 1039 1036 1040 1037 return true; … … 1079 1076 channelInfo->m_streamPosition - 1, 1080 1077 channelInfo->m_location, 1081 FreebobStreaming::AmdtpPortInfo::E_MBLA, 1082 clusterInfo->m_portType 1078 FreebobStreaming::AmdtpPortInfo::E_MBLA 1083 1079 ); 1084 1080 break; … … 1093 1089 channelInfo->m_streamPosition - 1, 1094 1090 channelInfo->m_location, 1095 FreebobStreaming::AmdtpPortInfo::E_Midi, 1096 clusterInfo->m_portType 1091 FreebobStreaming::AmdtpPortInfo::E_Midi 1097 1092 ); 1098 1093 … … 1123 1118 } 1124 1119 1125 // #define TEST_XMIT_ONLY1126 1127 #ifdef TEST_XMIT_ONLY1128 1129 #else1130 1120 int 1131 1121 AvDevice::getStreamCount() { 1132 return 2; // one receive, one transmit1122 return m_receiveProcessors.size() + m_transmitProcessors.size(); 1133 1123 } 1134 1124 1135 1125 FreebobStreaming::StreamProcessor * 1136 1126 AvDevice::getStreamProcessorByIndex(int i) { 1137 switch (i) { 1138 case 0: 1139 return m_receiveProcessor; 1140 case 1: 1141 // if (m_snoopMode) { 1142 // return m_receiveProcessor2; 1143 // } else { 1144 return m_transmitProcessor; 1145 // } 1146 default: 1147 return NULL; 1148 } 1149 return 0; 1150 } 1151 1152 // FIXME: error checking 1153 int 1127 1128 if (i<(int)m_receiveProcessors.size()) { 1129 return m_receiveProcessors.at(i); 1130 } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 1131 return m_transmitProcessors.at(i-m_receiveProcessors.size()); 1132 } 1133 1134 return NULL; 1135 } 1136 1137 bool 1154 1138 AvDevice::startStreamByIndex(int i) { 1155 1139 int iso_channel=-1; 1156 1157 // if (m_snoopMode) {1158 //1159 // switch (i) {1160 // case 0:1161 // // snooping doesn't use CMP, but obtains the info of the channel1162 // // from the target plug1163 //1164 // // TODO: get isochannel from plug1165 //1166 // // set the channel obtained by the connection management1167 // m_receiveProcessor->setChannel(iso_channel);1168 // break;1169 // case 1:1170 // // snooping doesn't use CMP, but obtains the info of the channel1171 // // from the target plug1172 //1173 // // TODO: get isochannel from plug1174 //1175 // // set the channel obtained by the connection management1176 // m_receiveProcessor2->setChannel(iso_channel);1177 //1178 // break;1179 // default:1180 // return 0;1181 // }1182 // } else {1183 1184 switch (i) {1185 case 0:1186 iso_channel=m_p1394Service->allocateIsoChannelCMP(1187 m_pConfigRom->getNodeId() | 0xffc0, 0,1188 m_p1394Service->getLocalNodeId()| 0xffc0, -1);1189 1190 m_receiveProcessor->setChannel(iso_channel);1191 break;1192 1193 case 1:1194 iso_channel=m_p1394Service->allocateIsoChannelCMP(1195 m_p1394Service->getLocalNodeId()| 0xffc0, -1,1196 m_pConfigRom->getNodeId() | 0xffc0, 0);1197 1198 m_transmitProcessor->setChannel(iso_channel);1199 break;1200 default:1201 return -1;1202 }1203 // }1204 1205 if (iso_channel < 0) return -1;1206 1140 1207 return 0; 1208 1209 } 1210 1211 // FIXME: error checking 1212 int 1141 if (i<(int)m_receiveProcessors.size()) { 1142 int n=i; 1143 FreebobStreaming::StreamProcessor *p=m_receiveProcessors.at(n); 1144 1145 iso_channel=m_p1394Service->allocateIsoChannelCMP( 1146 m_pConfigRom->getNodeId() | 0xffc0, 0, 1147 m_p1394Service->getLocalNodeId()| 0xffc0, -1); 1148 1149 if (iso_channel<0) { 1150 debugError("Could not allocate ISO channel for SP %d\n",i); 1151 return false; 1152 } 1153 1154 p->setChannel(iso_channel); 1155 return true; 1156 1157 } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 1158 int n=i-m_receiveProcessors.size(); 1159 FreebobStreaming::StreamProcessor *p=m_transmitProcessors.at(n); 1160 1161 iso_channel=m_p1394Service->allocateIsoChannelCMP( 1162 m_p1394Service->getLocalNodeId()| 0xffc0, -1, 1163 m_pConfigRom->getNodeId() | 0xffc0, 0); 1164 1165 if (iso_channel<0) { 1166 debugError("Could not allocate ISO channel for SP %d\n",i); 1167 return false; 1168 } 1169 1170 p->setChannel(iso_channel); 1171 return true; 1172 } 1173 1174 debugError("SP index %d out of range!\n",i); 1175 return false; 1176 } 1177 1178 bool 1213 1179 AvDevice::stopStreamByIndex(int i) { 1214 // do connection management: break connection 1215 1216 int plug=0; 1217 int hostplug=-1; 1218 // if (m_snoopMode) { 1219 // switch (i) { 1220 // case 0: 1221 // // do connection management: break connection 1222 // 1223 // break; 1224 // case 1: 1225 // // do connection management: break connection 1226 // 1227 // break; 1228 // default: 1229 // return 0; 1230 // } 1231 // } else { 1232 switch (i) { 1233 case 0: 1234 m_p1394Service->freeIsoChannel(m_receiveProcessor->getChannel()); 1235 break; 1236 1237 case 1: 1238 m_p1394Service->freeIsoChannel(m_transmitProcessor->getChannel()); 1239 break; 1240 1241 default: 1242 return 0; 1243 } 1244 // } 1245 1246 return 0; 1247 } 1248 #endif 1180 if (i<(int)m_receiveProcessors.size()) { 1181 int n=i; 1182 FreebobStreaming::StreamProcessor *p=m_receiveProcessors.at(n); 1183 1184 // deallocate ISO channel 1185 if(!m_p1394Service->freeIsoChannel(p->getChannel())) { 1186 debugError("Could not deallocate iso channel for SP %d\n",i); 1187 return false; 1188 } 1189 p->setChannel(-1); 1190 1191 return true; 1192 1193 } else if (i<(int)m_receiveProcessors.size() + (int)m_transmitProcessors.size()) { 1194 int n=i-m_receiveProcessors.size(); 1195 FreebobStreaming::StreamProcessor *p=m_transmitProcessors.at(n); 1196 1197 // deallocate ISO channel 1198 if(!m_p1394Service->freeIsoChannel(p->getChannel())) { 1199 debugError("Could not deallocate iso channel for SP %d\n",i); 1200 return false; 1201 } 1202 p->setChannel(-1); 1203 1204 return true; 1205 } 1206 1207 debugError("SP index %d out of range!\n",i); 1208 return false; 1209 } 1249 1210 1250 1211 template <typename T> bool serializeVector( Glib::ustring path, branches/streaming-rework/src/bebob/bebob_avdevice.h
r412 r415 76 76 bool unlock(); 77 77 78 virtual intstartStreamByIndex(int i);79 virtual intstopStreamByIndex(int i);78 bool startStreamByIndex(int i); 79 bool stopStreamByIndex(int i); 80 80 81 81 virtual bool addXmlDescription( xmlNodePtr deviceNode ); … … 182 182 int m_nodeId; 183 183 unsigned int m_id; 184 bool m_snoopMode; 184 185 185 186 // streaming stuff 186 FreebobStreaming::AmdtpReceiveStreamProcessor *m_receiveProcessor; 187 int m_receiveProcessorBandwidth; 188 189 FreebobStreaming::AmdtpTransmitStreamProcessor *m_transmitProcessor; 190 int m_transmitProcessorBandwidth; 187 typedef std::vector< FreebobStreaming::StreamProcessor * > StreamProcessorVector; 188 StreamProcessorVector m_receiveProcessors; 189 StreamProcessorVector m_transmitProcessors; 191 190 192 191 DECLARE_DEBUG_MODULE; branches/streaming-rework/src/bounce/bounce_avdevice.cpp
r413 r415 244 244 i, 245 245 0, 246 FreebobStreaming::AmdtpPortInfo::E_MBLA, 247 0 246 FreebobStreaming::AmdtpPortInfo::E_MBLA 248 247 ); 249 248 … … 331 330 } 332 331 333 int 332 bool 334 333 BounceDevice::startStreamByIndex(int i) { 335 334 // int iso_channel=0; … … 376 375 break; 377 376 default: 378 return -1;377 return false; 379 378 } 380 379 381 return 0;382 383 } 384 385 int 380 return true; 381 382 } 383 384 bool 386 385 BounceDevice::stopStreamByIndex(int i) { 387 386 // do connection management: break connection … … 421 420 // } 422 421 423 return 0;422 return false; 424 423 } 425 424 branches/streaming-rework/src/bounce/bounce_avdevice.h
r412 r415 73 73 virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i); 74 74 75 virtual int startStreamByIndex(int i); 76 77 virtual int stopStreamByIndex(int i); 75 bool startStreamByIndex(int i); 76 bool stopStreamByIndex(int i); 78 77 79 78 virtual void showDevice() const; branches/streaming-rework/src/dice/dice_avdevice.cpp
r413 r415 191 191 } 192 192 193 int 193 bool 194 194 DiceAvDevice::startStreamByIndex(int i) { 195 195 … … 216 216 217 217 default: // Invalid stream index 218 return -1;219 } 220 221 return 0;222 } 223 224 int 218 return false; 219 } 220 221 return true; 222 } 223 224 bool 225 225 DiceAvDevice::stopStreamByIndex(int i) { 226 226 … … 236 236 237 237 default: // Invalid stream index 238 return -1;239 } 240 241 return 0;238 return false; 239 } 240 241 return true; 242 242 } 243 243 branches/streaming-rework/src/dice/dice_avdevice.h
r412 r415 72 72 bool unlock(); 73 73 74 intstartStreamByIndex(int i);75 intstopStreamByIndex(int i);74 bool startStreamByIndex(int i); 75 bool stopStreamByIndex(int i); 76 76 77 77 signed int getIsoRecvChannel(void); branches/streaming-rework/src/freebob_streaming.cpp
r412 r415 226 226 debugOutput(DEBUG_LEVEL_VERBOSE,"Starting stream %d of device %d\n",j,i); 227 227 // start the stream 228 device->startStreamByIndex(j); 228 if (!device->startStreamByIndex(j)) { 229 debugWarning("Could not start stream %d of device %d\n",j,i); 230 continue; 231 } 229 232 } 230 233 } … … 255 258 debugOutput(DEBUG_LEVEL_VERBOSE,"Stopping stream %d of device %d\n",j,i); 256 259 // stop the stream 257 device->stopStreamByIndex(j); 260 // start the stream 261 if (!device->stopStreamByIndex(j)) { 262 debugWarning("Could not stop stream %d of device %d\n",j,i); 263 continue; 264 } 258 265 } 259 266 } branches/streaming-rework/src/iavdevice.h
r412 r415 32 32 } 33 33 /*! 34 \brief Interface that is to be implemented to support a device.34 @brief Interface that is to be implemented to support a device. 35 35 36 36 This interface should be used to implement freebob support … … 48 48 * @brief This is called by the DeviceManager to discover & configure the device 49 49 * 50 * @return true if the device was discovered successful ly50 * @return true if the device was discovered successfuly 51 51 */ 52 52 virtual bool discover() = 0; … … 55 55 * @brief Set the samping frequency 56 56 * @param samplingFrequency 57 * @return true if successful l57 * @return true if successful 58 58 */ 59 59 virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ) = 0; … … 78 78 * the port names as 'dev1_OutputLeft' and 'dev2_OutputLeft' 79 79 * 80 * \note Currently this is a simple integer that is equal to80 * @note Currently this is a simple integer that is equal to 81 81 * the position of the device in the devicemanager's 82 82 * device list. Therefore it is dependant on the order … … 90 90 * 91 91 * @param id 92 * @return true if successful l92 * @return true if successful 93 93 */ 94 94 virtual bool setId(unsigned int id) = 0; … … 102 102 * 103 103 * @param deviceNode 104 * @return true if successful l104 * @return true if successful, false if not 105 105 */ 106 106 virtual bool addXmlDescription( xmlNodePtr deviceNode ) = 0; … … 123 123 * make sure that no other controller claims control of the device. 124 124 * 125 * @return true if successful, false if not 125 126 */ 126 127 virtual bool lock() = 0; … … 135 136 * give up exclusive control of the device. 136 137 * 138 * @return true if successful, false if not 137 139 */ 138 140 virtual bool unlock() = 0; … … 150 152 * after calling this function. 151 153 * 154 * @return true if successful, false if not 152 155 */ 153 156 virtual bool prepare() = 0; … … 163 166 * for the device. 164 167 * 165 * \note you have to have a StreamProcessor for every stream. I.e.168 * @note you have to have a StreamProcessor for every stream. I.e. 166 169 * getStreamProcessorByIndex(i) should return a valid StreamProcessor 167 170 * for i=0 to i=getStreamCount()-1 168 171 * 169 * @return 172 * @return number of streams available (both transmit and receive) 170 173 */ 171 174 virtual int getStreamCount() = 0; … … 174 177 * @brief Returns the StreamProcessor object for the stream with index i 175 178 * 176 * \note a streamprocessor returned by getStreamProcessorByIndex(i)179 * @note a streamprocessor returned by getStreamProcessorByIndex(i) 177 180 * cannot be the same object as one returned by 178 181 * getStreamProcessorByIndex(j) if i isn't equal to j 179 * \note you cannot have two streamprocessors handling the same ISO182 * @note you cannot have two streamprocessors handling the same ISO 180 183 * channel (on the same port) 181 184 * 182 * \param i : Stream index183 * \pre \ref i smaller than getStreamCount()184 * @return a StreamProcessor object if successful l, NULL otherwise185 * @param i : Stream index 186 * @pre @ref i smaller than getStreamCount() 187 * @return a StreamProcessor object if successful, NULL otherwise 185 188 */ 186 189 virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i) = 0; … … 197 200 * Ieee1394Service object that is passed in the constructor. 198 201 * 199 * \param i : Stream index200 * \pre \ref i smaller than getStreamCount()201 * \return the ISO channel number assigned to this stream202 */ 203 virtual intstartStreamByIndex(int i) = 0;204 205 /** 206 * @brief stops the stream with index \ref i207 * 208 * \param i : Stream index209 * \pre \ref i smaller than getStreamCount()210 * \return 0 on success, -1 else211 */ 212 virtual intstopStreamByIndex(int i) = 0;202 * @param i : Stream index 203 * @pre @ref i smaller than getStreamCount() 204 * @return true if successful, false if not 205 */ 206 virtual bool startStreamByIndex(int i) = 0; 207 208 /** 209 * @brief stops the stream with index @ref i 210 * 211 * @param i : Stream index 212 * @pre @ref i smaller than getStreamCount() 213 * @return true if successful, false if not 214 */ 215 virtual bool stopStreamByIndex(int i) = 0; 213 216 214 217 }; branches/streaming-rework/src/libfreebobavc/avc_definitions.cpp
r336 r415 53 53 break; 54 54 case eSF_192000Hz: 55 value = 192000; 56 break; 57 case eSF_AnyLow: 58 value = 48000; 59 break; 60 case eSF_AnyMid: 61 value = 96000; 62 break; 63 case eSF_AnyHigh: 55 64 value = 192000; 56 65 break; branches/streaming-rework/src/libfreebobavc/avc_definitions.h
r336 r415 90 90 eSF_176400Hz = 0x06, 91 91 eSF_192000Hz = 0x07, 92 eSF_AnyLow = 0x0B, 93 eSF_AnyMid = 0x0C, 94 eSF_AnyHigh = 0x0D, 95 eSF_None = 0x0E, 92 96 eSF_DontCare = 0x0F, 93 97 }; branches/streaming-rework/src/libieee1394/ieee1394service.cpp
r414 r415 213 213 } 214 214 215 bool 216 Ieee1394Service::lockCompareSwap64( fb_nodeid_t nodeId, 217 fb_nodeaddr_t addr, 218 fb_octlet_t compare_value, 219 fb_octlet_t swap_value, 220 fb_octlet_t* result ) 221 { 222 #ifdef DEBUG 223 debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"lockCompareSwap64: node 0x%X, addr = 0x%016X\n", 224 nodeId, addr); 225 debugOutput(DEBUG_LEVEL_VERY_VERBOSE," if (*(addr)==0x%016llX) *(addr)=0x%016llX\n", 226 compare_value, swap_value); 227 #endif 228 229 return raw1394_lock64(m_handle, nodeId, addr, RAW1394_EXTCODE_COMPARE_SWAP, 230 swap_value, compare_value, result) == 0; 231 } 232 215 233 fb_quadlet_t* 216 234 Ieee1394Service::transactionBlock( fb_nodeid_t nodeId, … … 328 346 } 329 347 330 bool Ieee1394Service::registerARM handler(ARMHandler *h) {348 bool Ieee1394Service::registerARMHandler(ARMHandler *h) { 331 349 debugOutput(DEBUG_LEVEL_VERBOSE, "Registering ARM handler (%p) for 0x%016llX, length %u\n", 332 350 h, h->getStart(), h->getLength()); … … 348 366 } 349 367 350 bool Ieee1394Service::unregisterARM handler( ARMHandler *h ) {368 bool Ieee1394Service::unregisterARMHandler( ARMHandler *h ) { 351 369 debugOutput(DEBUG_LEVEL_VERBOSE, "Unregistering ARM handler (%p) for 0x%016llX\n", 352 370 h, h->getStart()); … … 407 425 debugOutput(DEBUG_LEVEL_VERBOSE, " Could not find free block in %d tries\n",cnt); 408 426 return 0xFFFFFFFFFFFFFFFFLLU; 409 410 427 } 411 428 branches/streaming-rework/src/libieee1394/ieee1394service.h
r414 r415 59 59 * @brief get the node id of the local node 60 60 * 61 * @note does not include the bus part (0xFFC0) 62 * 61 63 * @return the node id of the local node 62 64 * This value can change with every bus reset. … … 114 116 fb_octlet_t data ); 115 117 118 /** 119 * @brief send 64-bit compare-swap lock request and wait for response. 120 * 121 * swaps the content of \ref addr with \ref swap_value , but only if 122 * the content of \ref addr equals \ref compare_with 123 * 124 * @param nodeId target node ID 125 * @param addr address within target node address space 126 * @param compare_with value to compare \ref addr with 127 * @param swap_value new value to put in \ref addr 128 * @param result the value (originally) in \ref addr 129 * 130 * @return true if succesful, false otherwise 131 */ 132 bool lockCompareSwap64( fb_nodeid_t nodeId, 133 fb_nodeaddr_t addr, 134 fb_octlet_t compare_value, 135 fb_octlet_t swap_value, 136 fb_octlet_t* result ); 137 116 138 fb_quadlet_t* transactionBlock( fb_nodeid_t nodeId, 117 139 fb_quadlet_t* buf, … … 136 158 **/ 137 159 138 bool registerARM handler( ARMHandler *h );160 bool registerARMHandler( ARMHandler *h ); 139 161 140 162 /** … … 143 165 * @return true if successful, false otherwise 144 166 */ 145 bool unregisterARM handler( ARMHandler *h );167 bool unregisterARMHandler( ARMHandler *h ); 146 168 147 169 nodeaddr_t findFreeARMBlock( nodeaddr_t start, size_t length, size_t step ); branches/streaming-rework/src/libstreaming/AmdtpPort.h
r407 r415 55 55 int position, 56 56 int location, 57 enum E_Formats format, 58 int type) 57 enum E_Formats format) 59 58 : AudioPort(name, direction), 60 AmdtpPortInfo(name, position, location, format , type)59 AmdtpPortInfo(name, position, location, format) 61 60 {}; 62 61 … … 83 82 int position, 84 83 int location, 85 enum E_Formats format, 86 int type) 84 enum E_Formats format) 87 85 : MidiPort(name, direction), 88 AmdtpPortInfo(name, position, location, format , type)86 AmdtpPortInfo(name, position, location, format) 89 87 {}; 90 88 branches/streaming-rework/src/libstreaming/AmdtpPortInfo.h
r407 r415 57 57 E_SPDIF,///< IEC.... format 58 58 }; 59 enum E_Types {60 59 61 }; 62 63 AmdtpPortInfo(std::string name, int position, int location, enum E_Formats format, int type) 64 : m_name(name), m_position(position), m_location(location), m_format(format), m_type(type) 60 AmdtpPortInfo(std::string name, int position, int location, enum E_Formats format) 61 : m_name(name), m_position(position), m_location(location), m_format(format) 65 62 {}; 66 63 virtual ~AmdtpPortInfo() {}; … … 71 68 int getPosition() {return m_position;}; 72 69 enum E_Formats getFormat() {return m_format;}; 73 int getType() {return m_type;};74 70 75 71 protected: … … 79 75 int m_location; 80 76 enum E_Formats m_format; 81 int m_type;82 77 83 78 }; branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.h
r407 r415 74 74 75 75 public: 76 /** 77 * Create a AMDTP transmit StreamProcessor 78 * @param port 1394 port 79 * @param framerate frame rate 80 * @param dimension number of substreams in the ISO stream 81 * (midi-muxed is only one stream) 82 */ 76 83 AmdtpTransmitStreamProcessor(int port, int framerate, int dimension); 77 84 … … 160 167 161 168 public: 169 /** 170 * Create a AMDTP receive StreamProcessor 171 * @param port 1394 port 172 * @param framerate frame rate 173 * @param dimension number of substreams in the ISO stream 174 * (midi-muxed is only one stream) 175 */ 162 176 AmdtpReceiveStreamProcessor(int port, int framerate, int dimension); 163 177 branches/streaming-rework/src/maudio/maudio_avdevice.cpp
r413 r415 435 435 } 436 436 437 int 437 bool 438 438 AvDevice::startStreamByIndex(int i) { 439 int iso_channel=0; 440 int plug=0; 441 int hostplug=-1; 442 443 // if (m_snoopMode) { 444 // 445 // switch (i) { 446 // case 0: 447 // // snooping doesn't use CMP, but obtains the info of the channel 448 // // from the target plug 449 // 450 // // TODO: get isochannel from plug 451 // 452 // // set the channel obtained by the connection management 453 // m_receiveProcessor->setChannel(iso_channel); 454 // break; 455 // case 1: 456 // // snooping doesn't use CMP, but obtains the info of the channel 457 // // from the target plug 458 // 459 // // TODO: get isochannel from plug 460 // 461 // // set the channel obtained by the connection management 462 // m_receiveProcessor2->setChannel(iso_channel); 463 // 464 // break; 465 // default: 466 // return 0; 467 // } 468 // } else { 469 470 switch (i) { 471 case 0: 472 // do connection management: make connection 473 iso_channel = iec61883_cmp_connect( 474 m_p1394Service->getHandle(), 475 m_iNodeId | 0xffc0, 476 &plug, 477 raw1394_get_local_id (m_p1394Service->getHandle()), 478 &hostplug, 479 &m_receiveProcessorBandwidth); 480 481 // set the channel obtained by the connection management 482 m_receiveProcessor->setChannel(iso_channel); 483 break; 484 case 1: 485 // do connection management: make connection 486 iso_channel = iec61883_cmp_connect( 487 m_p1394Service->getHandle(), 488 raw1394_get_local_id (m_p1394Service->getHandle()), 489 &hostplug, 490 m_iNodeId | 0xffc0, 491 &plug, 492 &m_transmitProcessorBandwidth); 493 494 // set the channel obtained by the connection management 495 m_transmitProcessor->setChannel(iso_channel); 496 break; 497 default: 498 return 0; 499 } 500 // } 501 502 return 0; 503 504 } 505 506 int 439 return false; 440 } 441 442 bool 507 443 AvDevice::stopStreamByIndex(int i) { 508 // do connection management: break connection 509 510 int plug=0; 511 int hostplug=-1; 512 // if (m_snoopMode) { 513 // switch (i) { 514 // case 0: 515 // // do connection management: break connection 516 // 517 // break; 518 // case 1: 519 // // do connection management: break connection 520 // 521 // break; 522 // default: 523 // return 0; 524 // } 525 // } else { 526 switch (i) { 527 case 0: 528 // do connection management: break connection 529 iec61883_cmp_disconnect( 530 m_p1394Service->getHandle(), 531 m_iNodeId | 0xffc0, 532 plug, 533 raw1394_get_local_id (m_p1394Service->getHandle()), 534 hostplug, 535 m_receiveProcessor->getChannel(), 536 m_receiveProcessorBandwidth); 537 538 break; 539 case 1: 540 // do connection management: break connection 541 iec61883_cmp_disconnect( 542 m_p1394Service->getHandle(), 543 raw1394_get_local_id (m_p1394Service->getHandle()), 544 hostplug, 545 m_iNodeId | 0xffc0, 546 plug, 547 m_transmitProcessor->getChannel(), 548 m_transmitProcessorBandwidth); 549 550 break; 551 default: 552 return 0; 553 } 554 // } 555 556 return 0; 557 } 558 559 } 444 445 return false; 446 } 447 448 } branches/streaming-rework/src/maudio/maudio_avdevice.h
r412 r415 63 63 bool lock(); 64 64 bool unlock(); 65 66 65 67 virtual intstartStreamByIndex(int i);68 virtual intstopStreamByIndex(int i);66 bool startStreamByIndex(int i); 67 bool stopStreamByIndex(int i); 69 68 70 69 protected: branches/streaming-rework/src/metrichalo/mh_avdevice.cpp
r413 r415 52 52 int verboseLevel ) 53 53 : m_configRom( configRom ) 54 , m_ 1394Service( &ieee1394service )54 , m_p1394Service( &ieee1394service ) 55 55 , m_model( NULL ) 56 56 , m_nodeId( nodeId ) … … 192 192 } 193 193 194 int 194 bool 195 195 MHAvDevice::startStreamByIndex(int i) { 196 196 197 // NOTE: this assumes that you have two streams 198 switch (i) { 199 case 0: 200 // TODO: do the stuff that is nescessary to make the device 201 // transmit a stream 202 203 // Set the streamprocessor channel to the one obtained by 204 // the connection management 205 // m_receiveProcessor->setChannel(m_iso_recv_channel); 206 207 break; 208 case 1: 209 // TODO: do the stuff that is nescessary to make the device 210 // receive a stream 211 212 // Set the streamprocessor channel to the one obtained by 213 // the connection management 214 // m_transmitProcessor->setChannel(m_iso_send_channel); 215 216 break; 217 218 default: // Invalid stream index 219 return -1; 220 } 221 222 return 0; 223 } 224 225 int 197 return false; 198 } 199 200 bool 226 201 MHAvDevice::stopStreamByIndex(int i) { 227 228 // TODO: connection management: break connection 229 // cfr the start function 230 231 // NOTE: this assumes that you have two streams 232 switch (i) { 233 case 0: 234 break; 235 case 1: 236 break; 237 238 default: // Invalid stream index 239 return -1; 240 } 241 242 return 0; 202 return false; 243 203 } 244 204 branches/streaming-rework/src/metrichalo/mh_avdevice.h
r412 r415 72 72 bool unlock(); 73 73 74 virtual intstartStreamByIndex(int i);75 virtual intstopStreamByIndex(int i);74 bool startStreamByIndex(int i); 75 bool stopStreamByIndex(int i); 76 76 77 77 signed int getIsoRecvChannel(void); … … 80 80 protected: 81 81 std::auto_ptr<ConfigRom>( m_configRom ); 82 Ieee1394Service* m_ 1394Service;82 Ieee1394Service* m_p1394Service; 83 83 84 84 struct VendorModelEntry *m_model; branches/streaming-rework/src/motu/motu_avdevice.cpp
r413 r415 57 57 int verboseLevel ) 58 58 : m_configRom( configRom ) 59 , m_ 1394Service( &ieee1394service )59 , m_p1394Service( &ieee1394service ) 60 60 , m_motu_model( MOTUFW_MODEL_NONE ) 61 61 , m_nodeId( nodeId ) … … 79 79 { 80 80 // Free ieee1394 bus resources if they have been allocated 81 if (m_ 1394Service != NULL) {82 if(m_ 1394Service->freeIsoChannel(m_iso_recv_channel)) {81 if (m_p1394Service != NULL) { 82 if(m_p1394Service->freeIsoChannel(m_iso_recv_channel)) { 83 83 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free recv iso channel %d\n", m_iso_recv_channel); 84 84 85 85 } 86 if(m_ 1394Service->freeIsoChannel(m_iso_send_channel)) {86 if(m_p1394Service->freeIsoChannel(m_iso_send_channel)) { 87 87 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 88 88 … … 364 364 // Assign iso channels if not already done 365 365 if (m_iso_recv_channel < 0) 366 m_iso_recv_channel = m_ 1394Service->allocateIsoChannelGeneric(m_bandwidth);366 m_iso_recv_channel = m_p1394Service->allocateIsoChannelGeneric(m_bandwidth); 367 367 368 368 if (m_iso_send_channel < 0) 369 m_iso_send_channel = m_ 1394Service->allocateIsoChannelGeneric(m_bandwidth);369 m_iso_send_channel = m_p1394Service->allocateIsoChannelGeneric(m_bandwidth); 370 370 371 371 debugOutput(DEBUG_LEVEL_VERBOSE, "recv channel = %d, send channel = %d\n", … … 375 375 // be nice and deallocate 376 376 if (m_iso_recv_channel >= 0) 377 m_ 1394Service->freeIsoChannel(m_iso_recv_channel);377 m_p1394Service->freeIsoChannel(m_iso_recv_channel); 378 378 if (m_iso_send_channel >= 0) 379 m_ 1394Service->freeIsoChannel(m_iso_send_channel);379 m_p1394Service->freeIsoChannel(m_iso_send_channel); 380 380 381 381 debugFatal("Could not allocate iso channels!\n"); … … 384 384 385 385 m_receiveProcessor=new FreebobStreaming::MotuReceiveStreamProcessor( 386 m_ 1394Service->getPort(), samp_freq, event_size_in);386 m_p1394Service->getPort(), samp_freq, event_size_in); 387 387 388 388 // The first thing is to initialize the processor. This creates the … … 448 448 // Do the same for the transmit processor 449 449 m_transmitProcessor=new FreebobStreaming::MotuTransmitStreamProcessor( 450 m_ 1394Service->getPort(), getSamplingFrequency(), event_size_out);450 m_p1394Service->getPort(), getSamplingFrequency(), event_size_out); 451 451 452 452 m_transmitProcessor->setVerboseLevel(getDebugLevel()); … … 527 527 } 528 528 529 int 529 bool 530 530 MotuDevice::startStreamByIndex(int i) { 531 531 … … 570 570 571 571 default: // Invalid stream index 572 return -1;573 } 574 575 return 0;576 } 577 578 int 572 return false; 573 } 574 575 return true; 576 } 577 578 bool 579 579 MotuDevice::stopStreamByIndex(int i) { 580 580 … … 604 604 605 605 default: // Invalid stream index 606 return -1;607 } 608 609 return 0;606 return false; 607 } 608 609 return true; 610 610 } 611 611 … … 861 861 862 862 quadlet_t quadlet; 863 assert(m_ 1394Service);863 assert(m_p1394Service); 864 864 865 865 quadlet = 0; 866 866 // Note: 1394Service::read() expects a physical ID, not the node id 867 if (m_ 1394Service->read(0xffc0 | m_nodeId, MOTUFW_BASE_ADDR+reg, 1, &quadlet) < 0) {867 if (m_p1394Service->read(0xffc0 | m_nodeId, MOTUFW_BASE_ADDR+reg, 1, &quadlet) < 0) { 868 868 debugError("Error doing motu read from register 0x%06x\n",reg); 869 869 } … … 881 881 882 882 // Note: 1394Service::write() expects a physical ID, not the node id 883 if (m_ 1394Service->write(0xffc0 | m_nodeId, MOTUFW_BASE_ADDR+reg, 1, &data) < 0) {883 if (m_p1394Service->write(0xffc0 | m_nodeId, MOTUFW_BASE_ADDR+reg, 1, &data) < 0) { 884 884 err = 1; 885 885 debugError("Error doing motu write to register 0x%06x\n",reg); branches/streaming-rework/src/motu/motu_avdevice.h
r412 r415 119 119 bool unlock(); 120 120 121 virtual intstartStreamByIndex(int i);122 virtual intstopStreamByIndex(int i);121 bool startStreamByIndex(int i); 122 bool stopStreamByIndex(int i); 123 123 124 124 signed int getIsoRecvChannel(void); … … 131 131 protected: 132 132 std::auto_ptr<ConfigRom>( m_configRom ); 133 Ieee1394Service* m_ 1394Service;133 Ieee1394Service* m_p1394Service; 134 134 135 135 signed int m_motu_model; branches/streaming-rework/src/rme/rme_avdevice.cpp
r413 r415 50 50 int verboseLevel ) 51 51 : m_configRom( configRom ) 52 , m_ 1394Service( &ieee1394service )52 , m_p1394Service( &ieee1394service ) 53 53 , m_model( NULL ) 54 54 , m_nodeId( nodeId ) … … 72 72 { 73 73 // Free ieee1394 bus resources if they have been allocated 74 if (m_ 1394Service != NULL) {75 if(m_ 1394Service->freeIsoChannel(m_iso_recv_channel)) {74 if (m_p1394Service != NULL) { 75 if(m_p1394Service->freeIsoChannel(m_iso_recv_channel)) { 76 76 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free recv iso channel %d\n", m_iso_recv_channel); 77 77 78 78 } 79 if(m_ 1394Service->freeIsoChannel(m_iso_send_channel)) {79 if(m_p1394Service->freeIsoChannel(m_iso_send_channel)) { 80 80 debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 81 81 … … 202 202 } 203 203 204 int 204 bool 205 205 RmeDevice::startStreamByIndex(int i) { 206 return -1;207 } 208 209 int 206 return false; 207 } 208 209 bool 210 210 RmeDevice::stopStreamByIndex(int i) { 211 return -1;211 return false; 212 212 213 213 } branches/streaming-rework/src/rme/rme_avdevice.h
r412 r415 73 73 bool unlock(); 74 74 75 virtual intstartStreamByIndex(int i);76 virtual intstopStreamByIndex(int i);75 bool startStreamByIndex(int i); 76 bool stopStreamByIndex(int i); 77 77 78 78 signed int getIsoRecvChannel(void); … … 83 83 protected: 84 84 std::auto_ptr<ConfigRom>( m_configRom ); 85 Ieee1394Service* m_ 1394Service;85 Ieee1394Service* m_p1394Service; 86 86 87 87 struct VendorModelEntry *m_model; branches/streaming-rework/tests/test-ieee1394service.cpp
r414 r415 87 87 printf(" adding (%p) as arm handler\n", test_arm); 88 88 89 if (!m_service->registerARM handler(test_arm)) {89 if (!m_service->registerARMHandler(test_arm)) { 90 90 printf(" failed\n"); 91 91 } … … 101 101 printf(" adding (%p) as arm handler\n", test_arm2); 102 102 103 if (!m_service->registerARM handler(test_arm2)) {103 if (!m_service->registerARMHandler(test_arm2)) { 104 104 printf(" failed\n"); 105 105 }