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 <string> |
---|
36 |
#include <stdint.h> |
---|
37 |
#include <assert.h> |
---|
38 |
#include "libutil/ByteSwap.h" |
---|
39 |
#include <iostream> |
---|
40 |
#include <sstream> |
---|
41 |
|
---|
42 |
#include <libraw1394/csr.h> |
---|
43 |
|
---|
44 |
namespace MetricHalo { |
---|
45 |
|
---|
46 |
// to define the supported devices |
---|
47 |
static VendorModelEntry supportedDeviceList[] = |
---|
48 |
{ |
---|
49 |
{0x00000000, 0x0000, "Metric Halo", "XXX"}, |
---|
50 |
}; |
---|
51 |
|
---|
52 |
MHAvDevice::MHAvDevice( DeviceManager& d, |
---|
53 |
std::auto_ptr<ConfigRom>( configRom )) |
---|
54 |
: FFADODevice( d, configRom ) |
---|
55 |
, m_model( NULL ) |
---|
56 |
|
---|
57 |
{ |
---|
58 |
debugOutput( DEBUG_LEVEL_VERBOSE, "Created MetricHalo::MHAvDevice (NodeID %d)\n", |
---|
59 |
getConfigRom().getNodeId() ); |
---|
60 |
} |
---|
61 |
|
---|
62 |
MHAvDevice::~MHAvDevice() |
---|
63 |
{ |
---|
64 |
|
---|
65 |
} |
---|
66 |
|
---|
67 |
bool |
---|
68 |
MHAvDevice::probe( ConfigRom& configRom, bool generic ) |
---|
69 |
{ |
---|
70 |
if (generic) return false; |
---|
71 |
unsigned int vendorId = configRom.getNodeVendorId(); |
---|
72 |
unsigned int modelId = configRom.getModelId(); |
---|
73 |
|
---|
74 |
for ( unsigned int i = 0; |
---|
75 |
i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); |
---|
76 |
++i ) |
---|
77 |
{ |
---|
78 |
if ( ( supportedDeviceList[i].vendor_id == vendorId ) |
---|
79 |
&& ( supportedDeviceList[i].model_id == modelId ) |
---|
80 |
) |
---|
81 |
{ |
---|
82 |
return true; |
---|
83 |
} |
---|
84 |
} |
---|
85 |
|
---|
86 |
return false; |
---|
87 |
} |
---|
88 |
|
---|
89 |
FFADODevice * |
---|
90 |
MHAvDevice::createDevice( DeviceManager& d, |
---|
91 |
std::auto_ptr<ConfigRom>( configRom )) |
---|
92 |
{ |
---|
93 |
return new MHAvDevice(d, configRom ); |
---|
94 |
} |
---|
95 |
|
---|
96 |
bool |
---|
97 |
MHAvDevice::discover() |
---|
98 |
{ |
---|
99 |
unsigned int vendorId = getConfigRom().getNodeVendorId(); |
---|
100 |
unsigned int modelId = getConfigRom().getModelId(); |
---|
101 |
|
---|
102 |
for ( unsigned int i = 0; |
---|
103 |
i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); |
---|
104 |
++i ) |
---|
105 |
{ |
---|
106 |
if ( ( supportedDeviceList[i].vendor_id == vendorId ) |
---|
107 |
&& ( supportedDeviceList[i].model_id == modelId ) |
---|
108 |
) |
---|
109 |
{ |
---|
110 |
m_model = &(supportedDeviceList[i]); |
---|
111 |
} |
---|
112 |
} |
---|
113 |
|
---|
114 |
if (m_model != NULL) { |
---|
115 |
debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", |
---|
116 |
m_model->vendor_name, m_model->model_name); |
---|
117 |
return true; |
---|
118 |
} |
---|
119 |
|
---|
120 |
return false; |
---|
121 |
} |
---|
122 |
|
---|
123 |
int |
---|
124 |
MHAvDevice::getSamplingFrequency( ) { |
---|
125 |
return 0; |
---|
126 |
} |
---|
127 |
|
---|
128 |
std::vector<int> |
---|
129 |
MHAvDevice::getSupportedSamplingFrequencies() |
---|
130 |
{ |
---|
131 |
std::vector<int> frequencies; |
---|
132 |
return frequencies; |
---|
133 |
} |
---|
134 |
|
---|
135 |
FFADODevice::ClockSourceVector |
---|
136 |
MHAvDevice::getSupportedClockSources() { |
---|
137 |
FFADODevice::ClockSourceVector r; |
---|
138 |
return r; |
---|
139 |
} |
---|
140 |
|
---|
141 |
bool |
---|
142 |
MHAvDevice::setActiveClockSource(ClockSource s) { |
---|
143 |
return false; |
---|
144 |
} |
---|
145 |
|
---|
146 |
FFADODevice::ClockSource |
---|
147 |
MHAvDevice::getActiveClockSource() { |
---|
148 |
ClockSource s; |
---|
149 |
return s; |
---|
150 |
} |
---|
151 |
|
---|
152 |
|
---|
153 |
int |
---|
154 |
MHAvDevice::getConfigurationId( ) { |
---|
155 |
return 0; |
---|
156 |
} |
---|
157 |
|
---|
158 |
bool |
---|
159 |
MHAvDevice::setSamplingFrequency( int samplingFrequency ) |
---|
160 |
{ |
---|
161 |
|
---|
162 |
return false; |
---|
163 |
} |
---|
164 |
|
---|
165 |
bool |
---|
166 |
MHAvDevice::lock() { |
---|
167 |
|
---|
168 |
return true; |
---|
169 |
} |
---|
170 |
|
---|
171 |
|
---|
172 |
bool |
---|
173 |
MHAvDevice::unlock() { |
---|
174 |
|
---|
175 |
return true; |
---|
176 |
} |
---|
177 |
|
---|
178 |
void |
---|
179 |
MHAvDevice::showDevice() |
---|
180 |
{ |
---|
181 |
debugOutput(DEBUG_LEVEL_VERBOSE, |
---|
182 |
"%s %s at node %d\n", m_model->vendor_name, m_model->model_name, |
---|
183 |
getNodeId()); |
---|
184 |
} |
---|
185 |
|
---|
186 |
bool |
---|
187 |
MHAvDevice::prepare() { |
---|
188 |
|
---|
189 |
return true; |
---|
190 |
} |
---|
191 |
|
---|
192 |
int |
---|
193 |
MHAvDevice::getStreamCount() { |
---|
194 |
return 0; |
---|
195 |
} |
---|
196 |
|
---|
197 |
Streaming::StreamProcessor * |
---|
198 |
MHAvDevice::getStreamProcessorByIndex(int i) { |
---|
199 |
|
---|
200 |
return NULL; |
---|
201 |
} |
---|
202 |
|
---|
203 |
bool |
---|
204 |
MHAvDevice::startStreamByIndex(int i) { |
---|
205 |
return false; |
---|
206 |
} |
---|
207 |
|
---|
208 |
bool |
---|
209 |
MHAvDevice::stopStreamByIndex(int i) { |
---|
210 |
return false; |
---|
211 |
} |
---|
212 |
|
---|
213 |
} |
---|