Changeset 415 for branches

Show
Ignore:
Timestamp:
02/24/07 09:51:56 (17 years ago)
Author:
pieterpalmers
Message:

ieee1394service:
- implemented 64bit compare-swap-lock operation (needed for DICE)
- small name change of (un)registerARMhandler to (un)registerARMHandler

iavdevice.h:
- made the stream start/stop functions return bool instead of int
- updated function documentation for consistency and to reflect changes

BeBoB avdevice:
- replaced the 2 fixed streamprocessor pointers with a 2 vectors of streamprocessors
- implemented the 'snoop mode' (cannot be activated yet)

libstreaming:
- removed unused 'type' attribute from AmdtpPortInfo? & children

mh_avdevice, motu_avdevice, rme_avdevice:
- replaced m_1394service with m_p1394service for consistence

maudio_avdevice.cpp:
- removed unused code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/streaming-rework/src/bebob/bebob_avdevice.cpp

    r413 r415  
    7777    , m_nodeId ( nodeId ) 
    7878    , m_id( 0 ) 
    79     , m_receiveProcessor ( 0 ) 
    80     , m_receiveProcessorBandwidth ( -1 ) 
    81     , m_transmitProcessor ( 0 ) 
    82     , m_transmitProcessorBandwidth ( -1 ) 
     79    , m_snoopMode( false ) 
    8380{ 
    8481    setDebugLevel( verboseLevel ); 
     
    9693    , m_nodeId ( -1 ) 
    9794    , m_id( 0 ) 
    98     , m_receiveProcessor ( 0 ) 
    99     , m_receiveProcessorBandwidth ( -1 ) 
    100     , m_transmitProcessor ( 0 ) 
    101     , m_transmitProcessorBandwidth ( -1 ) 
     95    , m_snoopMode( false ) 
    10296{ 
    10397} 
     
    982976 
    983977    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( 
    985983                             m_p1394Service->getPort(), 
    986984                             samplerate, 
    987985                             outputPlug->getNrOfChannels()); 
    988986 
    989     if(!m_receiveProcessor->init()) { 
     987    if(!p->init()) { 
    990988        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)) { 
    996995        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); 
    9991001 
    10001002    // 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( 
    10231011                                m_p1394Service->getPort(), 
    10241012                                samplerate, 
    10251013                                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)) { 
    10351026            debugFatal("Could not add plug to processor!\n"); 
    10361027            return false; 
    10371028        } 
    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    } 
    10391036 
    10401037    return true; 
     
    10791076                        channelInfo->m_streamPosition - 1, 
    10801077                        channelInfo->m_location, 
    1081                         FreebobStreaming::AmdtpPortInfo::E_MBLA, 
    1082                         clusterInfo->m_portType 
     1078                        FreebobStreaming::AmdtpPortInfo::E_MBLA 
    10831079                ); 
    10841080                break; 
     
    10931089                        channelInfo->m_streamPosition - 1, 
    10941090                        channelInfo->m_location, 
    1095                         FreebobStreaming::AmdtpPortInfo::E_Midi, 
    1096                         clusterInfo->m_portType 
     1091                        FreebobStreaming::AmdtpPortInfo::E_Midi 
    10971092                ); 
    10981093 
     
    11231118} 
    11241119 
    1125 // #define TEST_XMIT_ONLY 
    1126  
    1127 #ifdef TEST_XMIT_ONLY 
    1128  
    1129 #else 
    11301120int 
    11311121AvDevice::getStreamCount() { 
    1132     return 2; // one receive, one transmit 
     1122    return m_receiveProcessors.size() + m_transmitProcessors.size(); 
    11331123} 
    11341124 
    11351125FreebobStreaming::StreamProcessor * 
    11361126AvDevice::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 
     1137bool 
    11541138AvDevice::startStreamByIndex(int i) { 
    11551139    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 channel 
    1162 //             // from the target plug 
    1163 // 
    1164 //             // TODO: get isochannel from plug 
    1165 // 
    1166 //             // set the channel obtained by the connection management 
    1167 //             m_receiveProcessor->setChannel(iso_channel); 
    1168 //             break; 
    1169 //         case 1: 
    1170 //             // snooping doesn't use CMP, but obtains the info of the channel 
    1171 //             // from the target plug 
    1172 // 
    1173 //             // TODO: get isochannel from plug 
    1174 // 
    1175 //             // set the channel obtained by the connection management 
    1176 //             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; 
    12061140     
    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 
     1178bool 
    12131179AvDevice::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
    12491210 
    12501211template <typename T> bool serializeVector( Glib::ustring path, 
  • branches/streaming-rework/src/bebob/bebob_avdevice.h

    r412 r415  
    7676    bool unlock(); 
    7777 
    78     virtual int startStreamByIndex(int i); 
    79     virtual int stopStreamByIndex(int i); 
     78    bool startStreamByIndex(int i); 
     79    bool stopStreamByIndex(int i); 
    8080 
    8181    virtual bool addXmlDescription( xmlNodePtr deviceNode ); 
     
    182182    int                       m_nodeId; 
    183183    unsigned int              m_id; 
     184    bool                      m_snoopMode; 
    184185 
    185186    // 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; 
    191190 
    192191    DECLARE_DEBUG_MODULE; 
  • branches/streaming-rework/src/bounce/bounce_avdevice.cpp

    r413 r415  
    244244                i, 
    245245                0, 
    246                 FreebobStreaming::AmdtpPortInfo::E_MBLA, 
    247                 0 
     246                FreebobStreaming::AmdtpPortInfo::E_MBLA 
    248247        ); 
    249248 
     
    331330} 
    332331 
    333 int 
     332bool 
    334333BounceDevice::startStreamByIndex(int i) { 
    335334//      int iso_channel=0; 
     
    376375                break; 
    377376        default: 
    378                 return -1
     377                return false
    379378        } 
    380379 
    381         return 0
    382  
    383 } 
    384  
    385 int 
     380        return true
     381 
     382} 
     383 
     384bool 
    386385BounceDevice::stopStreamByIndex(int i) { 
    387386        // do connection management: break connection 
     
    421420//      } 
    422421 
    423         return 0
     422        return false
    424423} 
    425424 
  • branches/streaming-rework/src/bounce/bounce_avdevice.h

    r412 r415  
    7373        virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i); 
    7474         
    75         virtual int startStreamByIndex(int i); 
    76          
    77         virtual int stopStreamByIndex(int i); 
     75    bool startStreamByIndex(int i); 
     76    bool stopStreamByIndex(int i); 
    7877     
    7978    virtual void showDevice() const; 
  • branches/streaming-rework/src/dice/dice_avdevice.cpp

    r413 r415  
    191191} 
    192192 
    193 int 
     193bool 
    194194DiceAvDevice::startStreamByIndex(int i) { 
    195195 
     
    216216         
    217217    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 
     224bool 
    225225DiceAvDevice::stopStreamByIndex(int i) { 
    226226 
     
    236236         
    237237    default: // Invalid stream index 
    238         return -1
    239     } 
    240  
    241     return 0
     238        return false
     239    } 
     240 
     241    return true
    242242} 
    243243 
  • branches/streaming-rework/src/dice/dice_avdevice.h

    r412 r415  
    7272    bool unlock(); 
    7373     
    74     int startStreamByIndex(int i); 
    75     int stopStreamByIndex(int i); 
     74    bool startStreamByIndex(int i); 
     75    bool stopStreamByIndex(int i); 
    7676 
    7777    signed int getIsoRecvChannel(void); 
  • branches/streaming-rework/src/freebob_streaming.cpp

    r412 r415  
    226226        debugOutput(DEBUG_LEVEL_VERBOSE,"Starting stream %d of device %d\n",j,i); 
    227227            // 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            } 
    229232        } 
    230233    } 
     
    255258                debugOutput(DEBUG_LEVEL_VERBOSE,"Stopping stream %d of device %d\n",j,i); 
    256259                // 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                } 
    258265            } 
    259266        } 
  • branches/streaming-rework/src/iavdevice.h

    r412 r415  
    3232} 
    3333/*! 
    34 \brief Interface that is to be implemented to support a device. 
     34@brief Interface that is to be implemented to support a device. 
    3535 
    3636 This interface should be used to implement freebob support  
     
    4848         * @brief This is called by the DeviceManager to discover & configure the device 
    4949         *  
    50          * @return true if the device was discovered successfull
     50         * @return true if the device was discovered successful
    5151         */ 
    5252        virtual bool discover() = 0; 
     
    5555         * @brief Set the samping frequency 
    5656         * @param samplingFrequency  
    57          * @return true if successfull 
     57         * @return true if successful 
    5858         */ 
    5959        virtual bool setSamplingFrequency( ESamplingFrequency samplingFrequency ) = 0; 
     
    7878     * the port names as 'dev1_OutputLeft' and 'dev2_OutputLeft' 
    7979     * 
    80      * \note Currently this is a simple integer that is equal to 
     80     * @note Currently this is a simple integer that is equal to 
    8181     *       the position of the device in the devicemanager's  
    8282     *       device list. Therefore it is dependant on the order 
     
    9090     * 
    9191     * @param id  
    92      * @return true if successfull 
     92     * @return true if successful 
    9393     */ 
    9494    virtual bool setId(unsigned int id) = 0; 
     
    102102         * 
    103103         * @param deviceNode  
    104          * @return true if successfull 
     104         * @return true if successful, false if not 
    105105         */ 
    106106        virtual bool addXmlDescription( xmlNodePtr deviceNode ) = 0; 
     
    123123         * make sure that no other controller claims control of the device. 
    124124         * 
     125         * @return true if successful, false if not 
    125126         */ 
    126127        virtual bool lock() = 0; 
     
    135136         * give up exclusive control of the device. 
    136137         * 
     138         * @return true if successful, false if not 
    137139         */ 
    138140        virtual bool unlock() = 0; 
     
    150152         * after calling this function. 
    151153         * 
     154         * @return true if successful, false if not 
    152155         */ 
    153156        virtual bool prepare() = 0; 
     
    163166         *   for the device. 
    164167         * 
    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. 
    166169         *       getStreamProcessorByIndex(i) should return a valid StreamProcessor 
    167170         *       for i=0 to i=getStreamCount()-1 
    168171         * 
    169          * @return  
     172         * @return number of streams available (both transmit and receive) 
    170173         */ 
    171174        virtual int getStreamCount() = 0; 
     
    174177         * @brief Returns the StreamProcessor object for the stream with index i 
    175178         * 
    176          * \note a streamprocessor returned by getStreamProcessorByIndex(i) 
     179         * @note a streamprocessor returned by getStreamProcessorByIndex(i) 
    177180         *       cannot be the same object as one returned by 
    178181         *       getStreamProcessorByIndex(j) if i isn't equal to j 
    179          * \note you cannot have two streamprocessors handling the same ISO 
     182         * @note you cannot have two streamprocessors handling the same ISO 
    180183         *       channel (on the same port) 
    181184         * 
    182          * \param i : Stream index 
    183          * \pre \ref i smaller than getStreamCount() 
    184          * @return a StreamProcessor object if successfull, NULL otherwise 
     185         * @param i : Stream index 
     186         * @pre @ref i smaller than getStreamCount() 
     187         * @return a StreamProcessor object if successful, NULL otherwise 
    185188         */ 
    186189        virtual FreebobStreaming::StreamProcessor *getStreamProcessorByIndex(int i) = 0; 
     
    197200         * Ieee1394Service object that is passed in the constructor. 
    198201         * 
    199          * \param i : Stream index 
    200          * \pre \ref i smaller than getStreamCount() 
    201          * \return the ISO channel number assigned to this stream 
    202          */ 
    203         virtual int startStreamByIndex(int i) = 0; 
    204          
    205         /**  
    206          * @brief stops the stream with index \ref i 
    207          * 
    208          * \param i : Stream index 
    209          * \pre \ref i smaller than getStreamCount() 
    210          * \return 0 on success, -1 else 
    211          */ 
    212         virtual int stopStreamByIndex(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; 
    213216 
    214217}; 
  • branches/streaming-rework/src/libfreebobavc/avc_definitions.cpp

    r336 r415  
    5353        break; 
    5454    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: 
    5564        value = 192000; 
    5665        break; 
  • branches/streaming-rework/src/libfreebobavc/avc_definitions.h

    r336 r415  
    9090    eSF_176400Hz = 0x06, 
    9191    eSF_192000Hz = 0x07, 
     92    eSF_AnyLow   = 0x0B, 
     93    eSF_AnyMid   = 0x0C, 
     94    eSF_AnyHigh  = 0x0D, 
     95    eSF_None     = 0x0E, 
    9296    eSF_DontCare = 0x0F, 
    9397}; 
  • branches/streaming-rework/src/libieee1394/ieee1394service.cpp

    r414 r415  
    213213} 
    214214 
     215bool  
     216Ieee1394Service::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 
    215233fb_quadlet_t* 
    216234Ieee1394Service::transactionBlock( fb_nodeid_t nodeId, 
     
    328346} 
    329347 
    330 bool Ieee1394Service::registerARMhandler(ARMHandler *h) { 
     348bool Ieee1394Service::registerARMHandler(ARMHandler *h) { 
    331349    debugOutput(DEBUG_LEVEL_VERBOSE, "Registering ARM handler (%p) for 0x%016llX, length %u\n", 
    332350        h, h->getStart(), h->getLength()); 
     
    348366} 
    349367 
    350 bool Ieee1394Service::unregisterARMhandler( ARMHandler *h ) { 
     368bool Ieee1394Service::unregisterARMHandler( ARMHandler *h ) { 
    351369    debugOutput(DEBUG_LEVEL_VERBOSE, "Unregistering ARM handler (%p) for 0x%016llX\n",  
    352370        h, h->getStart()); 
     
    407425    debugOutput(DEBUG_LEVEL_VERBOSE, " Could not find free block in %d tries\n",cnt); 
    408426    return 0xFFFFFFFFFFFFFFFFLLU; 
    409      
    410427} 
    411428 
  • branches/streaming-rework/src/libieee1394/ieee1394service.h

    r414 r415  
    5959    * @brief get the node id of the local node 
    6060    * 
     61    * @note does not include the bus part (0xFFC0) 
     62    * 
    6163    * @return the node id of the local node 
    6264    * This value can change with every bus reset. 
     
    114116                        fb_octlet_t data ); 
    115117 
     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 
    116138    fb_quadlet_t* transactionBlock( fb_nodeid_t nodeId, 
    117139                                    fb_quadlet_t* buf, 
     
    136158     **/ 
    137159 
    138     bool registerARMhandler( ARMHandler *h ); 
     160    bool registerARMHandler( ARMHandler *h ); 
    139161 
    140162    /** 
     
    143165     * @return true if successful, false otherwise 
    144166     */ 
    145     bool unregisterARMhandler( ARMHandler *h ); 
     167    bool unregisterARMHandler( ARMHandler *h ); 
    146168     
    147169    nodeaddr_t findFreeARMBlock( nodeaddr_t start, size_t length, size_t step ); 
  • branches/streaming-rework/src/libstreaming/AmdtpPort.h

    r407 r415  
    5555                           int position,  
    5656                           int location,  
    57                            enum E_Formats format,  
    58                            int type) 
     57                           enum E_Formats format) 
    5958        : AudioPort(name, direction), 
    60           AmdtpPortInfo(name, position, location, format, type
     59          AmdtpPortInfo(name, position, location, format
    6160        {}; 
    6261 
     
    8382                           int position,  
    8483                           int location,  
    85                            enum E_Formats format,  
    86                            int type) 
     84                           enum E_Formats format) 
    8785                : MidiPort(name, direction), 
    88                   AmdtpPortInfo(name, position, location, format, type)  
     86                  AmdtpPortInfo(name, position, location, format)  
    8987        {}; 
    9088 
  • branches/streaming-rework/src/libstreaming/AmdtpPortInfo.h

    r407 r415  
    5757                E_SPDIF,///< IEC.... format 
    5858        }; 
    59         enum E_Types { 
    6059 
    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) 
    6562        {}; 
    6663        virtual ~AmdtpPortInfo() {}; 
     
    7168        int getPosition()     {return m_position;}; 
    7269        enum E_Formats getFormat()       {return m_format;}; 
    73         int getType()         {return m_type;}; 
    7470 
    7571protected: 
     
    7975    int m_location; 
    8076    enum E_Formats m_format; 
    81     int m_type; 
    8277 
    8378}; 
  • branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.h

    r407 r415  
    7474 
    7575public: 
     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     */ 
    7683    AmdtpTransmitStreamProcessor(int port, int framerate, int dimension); 
    7784 
     
    160167 
    161168public: 
     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     */ 
    162176        AmdtpReceiveStreamProcessor(int port, int framerate, int dimension); 
    163177 
  • branches/streaming-rework/src/maudio/maudio_avdevice.cpp

    r413 r415  
    435435} 
    436436 
    437 int 
     437bool 
    438438AvDevice::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 
     442bool 
    507443AvDevice::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  
    6363    bool lock(); 
    6464    bool unlock(); 
    65      
    6665 
    67     virtual int startStreamByIndex(int i); 
    68     virtual int stopStreamByIndex(int i); 
     66    bool startStreamByIndex(int i); 
     67    bool stopStreamByIndex(int i); 
    6968 
    7069protected: 
  • branches/streaming-rework/src/metrichalo/mh_avdevice.cpp

    r413 r415  
    5252                    int verboseLevel ) 
    5353    : m_configRom( configRom ) 
    54     , m_1394Service( &ieee1394service ) 
     54    , m_p1394Service( &ieee1394service ) 
    5555    , m_model( NULL ) 
    5656    , m_nodeId( nodeId ) 
     
    192192} 
    193193 
    194 int 
     194bool 
    195195MHAvDevice::startStreamByIndex(int i) { 
    196196 
    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 
     200bool 
    226201MHAvDevice::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; 
    243203} 
    244204 
  • branches/streaming-rework/src/metrichalo/mh_avdevice.h

    r412 r415  
    7272    bool unlock(); 
    7373 
    74     virtual int startStreamByIndex(int i); 
    75     virtual int stopStreamByIndex(int i); 
     74    bool startStreamByIndex(int i); 
     75    bool stopStreamByIndex(int i); 
    7676 
    7777    signed int getIsoRecvChannel(void); 
     
    8080protected: 
    8181    std::auto_ptr<ConfigRom>( m_configRom ); 
    82     Ieee1394Service* m_1394Service; 
     82    Ieee1394Service* m_p1394Service; 
    8383     
    8484    struct VendorModelEntry *m_model; 
  • branches/streaming-rework/src/motu/motu_avdevice.cpp

    r413 r415  
    5757                    int verboseLevel ) 
    5858    : m_configRom( configRom ) 
    59     , m_1394Service( &ieee1394service ) 
     59    , m_p1394Service( &ieee1394service ) 
    6060    , m_motu_model( MOTUFW_MODEL_NONE ) 
    6161    , m_nodeId( nodeId ) 
     
    7979{ 
    8080    // 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)) { 
    8383            debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free recv iso channel %d\n", m_iso_recv_channel); 
    8484             
    8585        } 
    86         if(m_1394Service->freeIsoChannel(m_iso_send_channel)) { 
     86        if(m_p1394Service->freeIsoChannel(m_iso_send_channel)) { 
    8787            debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 
    8888             
     
    364364        // Assign iso channels if not already done 
    365365        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); 
    367367                 
    368368        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); 
    370370 
    371371        debugOutput(DEBUG_LEVEL_VERBOSE, "recv channel = %d, send channel = %d\n", 
     
    375375                // be nice and deallocate 
    376376                if (m_iso_recv_channel >= 0) 
    377                         m_1394Service->freeIsoChannel(m_iso_recv_channel); 
     377                        m_p1394Service->freeIsoChannel(m_iso_recv_channel); 
    378378                if (m_iso_send_channel >= 0) 
    379                         m_1394Service->freeIsoChannel(m_iso_send_channel); 
     379                        m_p1394Service->freeIsoChannel(m_iso_send_channel); 
    380380                 
    381381                debugFatal("Could not allocate iso channels!\n"); 
     
    384384 
    385385        m_receiveProcessor=new FreebobStreaming::MotuReceiveStreamProcessor( 
    386                 m_1394Service->getPort(), samp_freq, event_size_in); 
     386                m_p1394Service->getPort(), samp_freq, event_size_in); 
    387387 
    388388        // The first thing is to initialize the processor.  This creates the 
     
    448448        // Do the same for the transmit processor 
    449449        m_transmitProcessor=new FreebobStreaming::MotuTransmitStreamProcessor( 
    450                 m_1394Service->getPort(), getSamplingFrequency(), event_size_out); 
     450                m_p1394Service->getPort(), getSamplingFrequency(), event_size_out); 
    451451 
    452452        m_transmitProcessor->setVerboseLevel(getDebugLevel()); 
     
    527527} 
    528528 
    529 int 
     529bool 
    530530MotuDevice::startStreamByIndex(int i) { 
    531531 
     
    570570                 
    571571        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 
     578bool 
    579579MotuDevice::stopStreamByIndex(int i) { 
    580580 
     
    604604                 
    605605        default: // Invalid stream index 
    606                 return -1
    607         } 
    608  
    609         return 0
     606                return false
     607        } 
     608 
     609        return true
    610610} 
    611611 
     
    861861 
    862862quadlet_t quadlet; 
    863 assert(m_1394Service); 
     863assert(m_p1394Service); 
    864864         
    865865  quadlet = 0; 
    866866  // 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) { 
    868868    debugError("Error doing motu read from register 0x%06x\n",reg); 
    869869  } 
     
    881881 
    882882  // 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) { 
    884884    err = 1; 
    885885    debugError("Error doing motu write to register 0x%06x\n",reg); 
  • branches/streaming-rework/src/motu/motu_avdevice.h

    r412 r415  
    119119    bool unlock(); 
    120120     
    121     virtual int startStreamByIndex(int i); 
    122     virtual int stopStreamByIndex(int i); 
     121    bool startStreamByIndex(int i); 
     122    bool stopStreamByIndex(int i); 
    123123 
    124124    signed int getIsoRecvChannel(void); 
     
    131131protected: 
    132132    std::auto_ptr<ConfigRom>( m_configRom ); 
    133     Ieee1394Service* m_1394Service; 
     133    Ieee1394Service* m_p1394Service; 
    134134     
    135135    signed int       m_motu_model; 
  • branches/streaming-rework/src/rme/rme_avdevice.cpp

    r413 r415  
    5050                    int verboseLevel ) 
    5151    : m_configRom( configRom ) 
    52     , m_1394Service( &ieee1394service ) 
     52    , m_p1394Service( &ieee1394service ) 
    5353    , m_model( NULL ) 
    5454    , m_nodeId( nodeId ) 
     
    7272{ 
    7373    // 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)) { 
    7676            debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free recv iso channel %d\n", m_iso_recv_channel); 
    7777             
    7878        } 
    79         if(m_1394Service->freeIsoChannel(m_iso_send_channel)) { 
     79        if(m_p1394Service->freeIsoChannel(m_iso_send_channel)) { 
    8080            debugOutput(DEBUG_LEVEL_VERBOSE, "Could not free send iso channel %d\n", m_iso_send_channel); 
    8181             
     
    202202} 
    203203 
    204 int 
     204bool 
    205205RmeDevice::startStreamByIndex(int i) { 
    206     return -1
    207 } 
    208  
    209 int 
     206    return false
     207} 
     208 
     209bool 
    210210RmeDevice::stopStreamByIndex(int i) { 
    211     return -1
     211    return false
    212212 
    213213} 
  • branches/streaming-rework/src/rme/rme_avdevice.h

    r412 r415  
    7373    bool unlock(); 
    7474 
    75     virtual int startStreamByIndex(int i); 
    76     virtual int stopStreamByIndex(int i); 
     75    bool startStreamByIndex(int i); 
     76    bool stopStreamByIndex(int i); 
    7777 
    7878    signed int getIsoRecvChannel(void); 
     
    8383protected: 
    8484    std::auto_ptr<ConfigRom>( m_configRom ); 
    85     Ieee1394Service* m_1394Service; 
     85    Ieee1394Service* m_p1394Service; 
    8686     
    8787    struct VendorModelEntry *m_model; 
  • branches/streaming-rework/tests/test-ieee1394service.cpp

    r414 r415  
    8787    printf(" adding (%p) as arm handler\n", test_arm); 
    8888     
    89     if (!m_service->registerARMhandler(test_arm)) { 
     89    if (!m_service->registerARMHandler(test_arm)) { 
    9090        printf("  failed\n"); 
    9191    } 
     
    101101    printf(" adding (%p) as arm handler\n", test_arm2); 
    102102     
    103     if (!m_service->registerARMhandler(test_arm2)) { 
     103    if (!m_service->registerARMHandler(test_arm2)) { 
    104104        printf("  failed\n"); 
    105105    }