root/trunk/libffado/src/metrichalo/mh_avdevice.cpp

Revision 1543, 4.3 kB (checked in by ppalmers, 15 years ago)

- Clean up class names
- Change probe code for all devices (except MOTU) to use the config file based approach

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #warning Metric Halo support is currently useless
25
26 #include "metrichalo/mh_avdevice.h"
27
28 #include "libieee1394/configrom.h"
29 #include "libieee1394/ieee1394service.h"
30
31 #include "libavc/avc_definitions.h"
32
33 #include "debugmodule/debugmodule.h"
34
35 #include "devicemanager.h"
36
37 #include <string>
38 #include <stdint.h>
39 #include <assert.h>
40 #include "libutil/ByteSwap.h"
41 #include <iostream>
42 #include <sstream>
43
44 #include <libraw1394/csr.h>
45
46 namespace MetricHalo {
47
48 Device::Device( DeviceManager& d,
49                         std::auto_ptr<ConfigRom>( configRom ))
50     : FFADODevice( d, configRom )
51 {
52     debugOutput( DEBUG_LEVEL_VERBOSE, "Created MetricHalo::Device (NodeID %d)\n",
53                  getConfigRom().getNodeId() );
54 }
55
56 Device::~Device()
57 {
58
59 }
60
61 bool
62 Device::probe( Util::Configuration& c, ConfigRom& configRom, bool generic )
63 {
64     if (generic) {
65         return false;
66     } else {
67         // check if device is in supported devices list
68         unsigned int vendorId = configRom.getNodeVendorId();
69         unsigned int modelId = configRom.getModelId();
70
71         Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId );
72         return c.isValid(vme) && vme.driver == Util::Configuration::eD_MetricHalo;
73     }
74 }
75
76 FFADODevice *
77 Device::createDevice( DeviceManager& d,
78                           std::auto_ptr<ConfigRom>( configRom ))
79 {
80     return new Device(d, configRom );
81 }
82
83 bool
84 Device::discover()
85 {
86     unsigned int vendorId = getConfigRom().getNodeVendorId();
87     unsigned int modelId = getConfigRom().getModelId();
88
89     Util::Configuration &c = getDeviceManager().getConfiguration();
90     Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId );
91
92     if (c.isValid(vme) && vme.driver == Util::Configuration::eD_MetricHalo) {
93         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
94                      vme.vendor_name.c_str(),
95                      vme.model_name.c_str());
96     } else {
97         debugWarning("Using generic Metric Halo support for unsupported device '%s %s'\n",
98                      getConfigRom().getVendorName().c_str(), getConfigRom().getModelName().c_str());
99     }
100
101     return false;
102 }
103
104 int
105 Device::getSamplingFrequency( ) {
106     return 0;
107 }
108
109 std::vector<int>
110 Device::getSupportedSamplingFrequencies()
111 {
112     std::vector<int> frequencies;
113     return frequencies;
114 }
115
116 FFADODevice::ClockSourceVector
117 Device::getSupportedClockSources() {
118     FFADODevice::ClockSourceVector r;
119     return r;
120 }
121
122 bool
123 Device::setActiveClockSource(ClockSource s) {
124     return false;
125 }
126
127 FFADODevice::ClockSource
128 Device::getActiveClockSource() {
129     ClockSource s;
130     return s;
131 }
132
133
134 int
135 Device::getConfigurationId( ) {
136     return 0;
137 }
138
139 bool
140 Device::setSamplingFrequency( int samplingFrequency )
141 {
142
143     return false;
144 }
145
146 bool
147 Device::lock() {
148
149     return true;
150 }
151
152
153 bool
154 Device::unlock() {
155
156     return true;
157 }
158
159 void
160 Device::showDevice()
161 {
162     unsigned int vendorId = getConfigRom().getNodeVendorId();
163     unsigned int modelId = getConfigRom().getModelId();
164
165     Util::Configuration &c = getDeviceManager().getConfiguration();
166     Util::Configuration::VendorModelEntry vme = c.findDeviceVME( vendorId, modelId );
167
168     debugOutput(DEBUG_LEVEL_VERBOSE,
169         "%s %s at node %d\n", vme.vendor_name.c_str(), vme.model_name.c_str(), getNodeId());
170 }
171
172 bool
173 Device::prepare() {
174
175     return true;
176 }
177
178 int
179 Device::getStreamCount() {
180     return 0;
181 }
182
183 Streaming::StreamProcessor *
184 Device::getStreamProcessorByIndex(int i) {
185
186     return NULL;
187 }
188
189 bool
190 Device::startStreamByIndex(int i) {
191     return false;
192 }
193
194 bool
195 Device::stopStreamByIndex(int i) {
196     return false;
197 }
198
199 }
Note: See TracBrowser for help on using the browser.