1 |
/* |
---|
2 |
* Copyright (C) 2005-2007 by Jonathan Woithe |
---|
3 |
* Copyright (C) 2005-2007 by Pieter Palmers |
---|
4 |
* |
---|
5 |
* This file is part of FFADO |
---|
6 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
7 |
* |
---|
8 |
* FFADO is based upon FreeBoB. |
---|
9 |
* |
---|
10 |
* This library is free software; you can redistribute it and/or |
---|
11 |
* modify it under the terms of the GNU Lesser General Public |
---|
12 |
* License version 2.1, as published by the Free Software Foundation; |
---|
13 |
* |
---|
14 |
* This library 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 GNU |
---|
17 |
* Lesser General Public License for more details. |
---|
18 |
* |
---|
19 |
* You should have received a copy of the GNU Lesser General Public |
---|
20 |
* License along with this library; if not, write to the Free Software |
---|
21 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
---|
22 |
* MA 02110-1301 USA |
---|
23 |
*/ |
---|
24 |
|
---|
25 |
#warning RME support is currently useless (detection only) |
---|
26 |
|
---|
27 |
#include "rme/rme_avdevice.h" |
---|
28 |
|
---|
29 |
#include "libieee1394/configrom.h" |
---|
30 |
#include "libieee1394/ieee1394service.h" |
---|
31 |
|
---|
32 |
#include "debugmodule/debugmodule.h" |
---|
33 |
|
---|
34 |
#include <string> |
---|
35 |
#include <stdint.h> |
---|
36 |
#include <assert.h> |
---|
37 |
#include <netinet/in.h> |
---|
38 |
|
---|
39 |
#include <iostream> |
---|
40 |
#include <sstream> |
---|
41 |
|
---|
42 |
#include <libraw1394/csr.h> |
---|
43 |
|
---|
44 |
namespace Rme { |
---|
45 |
|
---|
46 |
// to define the supported devices |
---|
47 |
static VendorModelEntry supportedDeviceList[] = |
---|
48 |
{ |
---|
49 |
{0x00000a35, 0x0001, "RME", "Fireface-800"}, // RME Fireface-800 |
---|
50 |
}; |
---|
51 |
|
---|
52 |
RmeDevice::RmeDevice( std::auto_ptr< ConfigRom >( configRom ), |
---|
53 |
Ieee1394Service& ieee1394service, |
---|
54 |
int nodeId ) |
---|
55 |
: IAvDevice( configRom, ieee1394service, nodeId ) |
---|
56 |
, m_model( NULL ) |
---|
57 |
{ |
---|
58 |
debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::RmeDevice (NodeID %d)\n", |
---|
59 |
nodeId ); |
---|
60 |
} |
---|
61 |
|
---|
62 |
RmeDevice::~RmeDevice() |
---|
63 |
{ |
---|
64 |
|
---|
65 |
} |
---|
66 |
|
---|
67 |
bool |
---|
68 |
RmeDevice::probe( ConfigRom& configRom ) |
---|
69 |
{ |
---|
70 |
unsigned int vendorId = configRom.getNodeVendorId(); |
---|
71 |
unsigned int modelId = configRom.getModelId(); |
---|
72 |
|
---|
73 |
for ( unsigned int i = 0; |
---|
74 |
i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); |
---|
75 |
++i ) |
---|
76 |
{ |
---|
77 |
if ( ( supportedDeviceList[i].vendor_id == vendorId ) |
---|
78 |
&& ( supportedDeviceList[i].model_id == modelId ) |
---|
79 |
) |
---|
80 |
{ |
---|
81 |
return true; |
---|
82 |
} |
---|
83 |
} |
---|
84 |
|
---|
85 |
return false; |
---|
86 |
} |
---|
87 |
|
---|
88 |
bool |
---|
89 |
RmeDevice::discover() |
---|
90 |
{ |
---|
91 |
unsigned int vendorId = m_pConfigRom->getNodeVendorId(); |
---|
92 |
unsigned int modelId = m_pConfigRom->getModelId(); |
---|
93 |
|
---|
94 |
for ( unsigned int i = 0; |
---|
95 |
i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) ); |
---|
96 |
++i ) |
---|
97 |
{ |
---|
98 |
if ( ( supportedDeviceList[i].vendor_id == vendorId ) |
---|
99 |
&& ( supportedDeviceList[i].model_id == modelId ) |
---|
100 |
) |
---|
101 |
{ |
---|
102 |
m_model = &(supportedDeviceList[i]); |
---|
103 |
} |
---|
104 |
} |
---|
105 |
|
---|
106 |
if (m_model != NULL) { |
---|
107 |
debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n", |
---|
108 |
m_model->vendor_name, m_model->model_name); |
---|
109 |
return true; |
---|
110 |
} |
---|
111 |
|
---|
112 |
return false; |
---|
113 |
} |
---|
114 |
|
---|
115 |
int |
---|
116 |
RmeDevice::getSamplingFrequency( ) { |
---|
117 |
/* |
---|
118 |
* Retrieve the current sample rate from the RME device. |
---|
119 |
*/ |
---|
120 |
return 48000; |
---|
121 |
} |
---|
122 |
|
---|
123 |
bool |
---|
124 |
RmeDevice::setSamplingFrequency( ESamplingFrequency samplingFrequency ) |
---|
125 |
{ |
---|
126 |
/* |
---|
127 |
* Set the RME device's samplerate. |
---|
128 |
*/ |
---|
129 |
if (samplingFrequency == eSF_48000Hz) |
---|
130 |
return true; |
---|
131 |
return false; |
---|
132 |
} |
---|
133 |
|
---|
134 |
bool |
---|
135 |
RmeDevice::lock() { |
---|
136 |
|
---|
137 |
return true; |
---|
138 |
} |
---|
139 |
|
---|
140 |
|
---|
141 |
bool |
---|
142 |
RmeDevice::unlock() { |
---|
143 |
|
---|
144 |
return true; |
---|
145 |
} |
---|
146 |
|
---|
147 |
void |
---|
148 |
RmeDevice::showDevice() |
---|
149 |
{ |
---|
150 |
debugOutput(DEBUG_LEVEL_VERBOSE, |
---|
151 |
"%s %s at node %d\n", m_model->vendor_name, m_model->model_name, |
---|
152 |
m_nodeId); |
---|
153 |
} |
---|
154 |
|
---|
155 |
bool |
---|
156 |
RmeDevice::prepare() { |
---|
157 |
|
---|
158 |
debugOutput(DEBUG_LEVEL_NORMAL, "Preparing RmeDevice...\n" ); |
---|
159 |
|
---|
160 |
return true; |
---|
161 |
} |
---|
162 |
|
---|
163 |
int |
---|
164 |
RmeDevice::getStreamCount() { |
---|
165 |
return 0; // one receive, one transmit |
---|
166 |
} |
---|
167 |
|
---|
168 |
Streaming::StreamProcessor * |
---|
169 |
RmeDevice::getStreamProcessorByIndex(int i) { |
---|
170 |
return NULL; |
---|
171 |
} |
---|
172 |
|
---|
173 |
bool |
---|
174 |
RmeDevice::startStreamByIndex(int i) { |
---|
175 |
return false; |
---|
176 |
} |
---|
177 |
|
---|
178 |
bool |
---|
179 |
RmeDevice::stopStreamByIndex(int i) { |
---|
180 |
return false; |
---|
181 |
|
---|
182 |
} |
---|
183 |
|
---|
184 |
} |
---|