root/branches/streaming-rework/src/metrichalo/mh_avdevice.cpp

Revision 415, 4.4 kB (checked in by pieterpalmers, 16 years ago)

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

Line 
1 /* mh_avdevice.cpp
2  * Copyright (C) 2007 by Pieter Palmers
3  *
4  * This file is part of FreeBob.
5  *
6  * FreeBob is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBob is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with FreeBob; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20
21 #warning Metric Halo support is currently useless
22
23 #include "metrichalo/mh_avdevice.h"
24
25 #include "libieee1394/configrom.h"
26 #include "libieee1394/ieee1394service.h"
27
28 #include "libfreebobavc/avc_definitions.h"
29
30 #include "debugmodule/debugmodule.h"
31
32 #include <string>
33 #include <stdint.h>
34 #include <assert.h>
35 #include <netinet/in.h>
36
37 #include <libraw1394/csr.h>
38
39 namespace MetricHalo {
40
41 IMPL_DEBUG_MODULE( MHAvDevice, MHAvDevice, DEBUG_LEVEL_NORMAL );
42
43 // to define the supported devices
44 static VendorModelEntry supportedDeviceList[] =
45 {
46     {0x00000000, 0x0000, "Metric Halo", "XXX"},
47 };
48
49 MHAvDevice::MHAvDevice( std::auto_ptr< ConfigRom >( configRom ),
50                     Ieee1394Service& ieee1394service,
51                     int nodeId,
52                     int verboseLevel )
53     : m_configRom( configRom )
54     , m_p1394Service( &ieee1394service )
55     , m_model( NULL )
56     , m_nodeId( nodeId )
57     , m_verboseLevel( verboseLevel )
58     , m_id(0)
59     , m_iso_recv_channel ( -1 )
60     , m_iso_send_channel ( -1 )
61    
62 {
63     setDebugLevel( verboseLevel );
64    
65     debugOutput( DEBUG_LEVEL_VERBOSE, "Created MetricHalo::MHAvDevice (NodeID %d)\n",
66                  nodeId );
67
68 }
69
70 MHAvDevice::~MHAvDevice()
71 {
72
73 }
74
75 ConfigRom&
76 MHAvDevice::getConfigRom() const
77 {
78     return *m_configRom;
79 }
80
81 bool
82 MHAvDevice::probe( ConfigRom& configRom )
83 {
84     unsigned int vendorId = configRom.getNodeVendorId();
85     unsigned int modelId = configRom.getModelId();
86
87     for ( unsigned int i = 0;
88           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
89           ++i )
90     {
91         if ( ( supportedDeviceList[i].vendor_id == vendorId )
92              && ( supportedDeviceList[i].model_id == modelId )
93            )
94         {
95             return true;
96         }
97     }
98
99     return false;
100 }
101
102 bool
103 MHAvDevice::discover()
104 {
105     unsigned int vendorId = m_configRom->getNodeVendorId();
106     unsigned int modelId = m_configRom->getModelId();
107
108     for ( unsigned int i = 0;
109           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
110           ++i )
111     {
112         if ( ( supportedDeviceList[i].vendor_id == vendorId )
113              && ( supportedDeviceList[i].model_id == modelId )
114            )
115         {
116             m_model = &(supportedDeviceList[i]);
117         }
118     }
119
120     if (m_model != NULL) {
121         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
122                 m_model->vendor_name, m_model->model_name);
123         return true;
124     }
125
126     return false;
127 }
128
129 int
130 MHAvDevice::getSamplingFrequency( ) {
131     return 0;
132 }
133
134 bool
135 MHAvDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency )
136 {
137
138     return false;
139 }
140
141 bool MHAvDevice::setId( unsigned int id) {
142     debugOutput( DEBUG_LEVEL_VERBOSE, "Set id to %d...\n", id);
143     m_id=id;
144     return true;
145 }
146
147 bool
148 MHAvDevice::lock() {
149
150     return true;
151 }
152
153
154 bool
155 MHAvDevice::unlock() {
156
157     return true;
158 }
159
160 void
161 MHAvDevice::showDevice() const
162 {
163     debugOutput(DEBUG_LEVEL_VERBOSE,
164         "%s %s at node %d\n", m_model->vendor_name, m_model->model_name,
165         m_nodeId);
166 }
167
168 bool
169 MHAvDevice::prepare() {
170
171     return true;
172 }
173
174 int
175 MHAvDevice::getStreamCount() {
176     return 0; // one receive, one transmit
177 }
178
179 FreebobStreaming::StreamProcessor *
180 MHAvDevice::getStreamProcessorByIndex(int i) {
181
182 //    switch (i) {
183 //    case 0:
184 //        return m_receiveProcessor;
185 //    case 1:
186 //        return m_transmitProcessor;
187 //    default:
188 //        return NULL;
189 //    }
190 //    return 0;
191     return NULL;
192 }
193
194 bool
195 MHAvDevice::startStreamByIndex(int i) {
196
197     return false;
198 }
199
200 bool
201 MHAvDevice::stopStreamByIndex(int i) {
202     return false;
203 }
204
205 signed int MHAvDevice::getIsoRecvChannel(void) {
206     return m_iso_recv_channel;
207 }
208
209 signed int MHAvDevice::getIsoSendChannel(void) {
210     return m_iso_send_channel;
211 }
212
213 }
Note: See TracBrowser for help on using the browser.