root/trunk/libffado/src/rme/rme_avdevice.cpp

Revision 639, 4.4 kB (checked in by ppalmers, 15 years ago)

- Introduce a generic infrastructure for FFADODevices to present the clock sources they support and their state
- Implement this infrastructure for BeBoB devices
- Implement this infrastructure for ECHO Fireworks devices

Line 
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     {FW_VENDORID_RME, 0x0001, "RME", "Fireface-800"},  // RME Fireface-800
50 };
51
52 RmeDevice::RmeDevice( Ieee1394Service& ieee1394Service,
53                       std::auto_ptr<ConfigRom>( configRom ))
54     : FFADODevice( ieee1394Service, configRom )
55     , m_model( NULL )
56 {
57     debugOutput( DEBUG_LEVEL_VERBOSE, "Created Rme::RmeDevice (NodeID %d)\n",
58                  getConfigRom().getNodeId() );
59 }
60
61 RmeDevice::~RmeDevice()
62 {
63
64 }
65
66 bool
67 RmeDevice::probe( ConfigRom& configRom )
68 {
69     unsigned int vendorId = configRom.getNodeVendorId();
70     unsigned int modelId = configRom.getModelId();
71
72     for ( unsigned int i = 0;
73           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
74           ++i )
75     {
76         if ( ( supportedDeviceList[i].vendor_id == vendorId )
77              && ( supportedDeviceList[i].model_id == modelId )
78            )
79         {
80             return true;
81         }
82     }
83
84     return false;
85 }
86
87 FFADODevice *
88 RmeDevice::createDevice( Ieee1394Service& ieee1394Service,
89                          std::auto_ptr<ConfigRom>( configRom ))
90 {
91     return new RmeDevice(ieee1394Service, configRom );
92 }
93
94 bool
95 RmeDevice::discover()
96 {
97     unsigned int vendorId = m_pConfigRom->getNodeVendorId();
98     unsigned int modelId = m_pConfigRom->getModelId();
99
100     for ( unsigned int i = 0;
101           i < ( sizeof( supportedDeviceList )/sizeof( VendorModelEntry ) );
102           ++i )
103     {
104         if ( ( supportedDeviceList[i].vendor_id == vendorId )
105              && ( supportedDeviceList[i].model_id == modelId )
106            )
107         {
108             m_model = &(supportedDeviceList[i]);
109         }
110     }
111
112     if (m_model != NULL) {
113         debugOutput( DEBUG_LEVEL_VERBOSE, "found %s %s\n",
114                 m_model->vendor_name, m_model->model_name);
115         return true;
116     }
117
118     return false;
119 }
120
121 int
122 RmeDevice::getSamplingFrequency( ) {
123 /*
124  * Retrieve the current sample rate from the RME device.
125  */
126         return 48000;
127 }
128
129 int
130 RmeDevice::getConfigurationId()
131 {
132     return 0;
133 }
134
135 bool
136 RmeDevice::setSamplingFrequency( int samplingFrequency )
137 {
138 /*
139  * Set the RME device's samplerate.
140  */
141         if (samplingFrequency == 48000)
142                 return true;
143         return false;
144 }
145
146 FFADODevice::ClockSourceVector
147 RmeDevice::getSupportedClockSources() {
148     FFADODevice::ClockSourceVector r;
149     return r;
150 }
151
152 bool
153 RmeDevice::setActiveClockSource(ClockSource s) {
154     return false;
155 }
156
157 FFADODevice::ClockSource
158 RmeDevice::getActiveClockSource() {
159     ClockSource s;
160     return s;
161 }
162
163 bool
164 RmeDevice::lock() {
165
166     return true;
167 }
168
169
170 bool
171 RmeDevice::unlock() {
172
173     return true;
174 }
175
176 void
177 RmeDevice::showDevice()
178 {
179         debugOutput(DEBUG_LEVEL_VERBOSE,
180                 "%s %s at node %d\n", m_model->vendor_name, m_model->model_name,
181                 getNodeId());
182 }
183
184 bool
185 RmeDevice::prepare() {
186
187         debugOutput(DEBUG_LEVEL_NORMAL, "Preparing RmeDevice...\n" );
188
189         return true;
190 }
191
192 int
193 RmeDevice::getStreamCount() {
194         return 0; // one receive, one transmit
195 }
196
197 Streaming::StreamProcessor *
198 RmeDevice::getStreamProcessorByIndex(int i) {
199     return NULL;
200 }
201
202 bool
203 RmeDevice::startStreamByIndex(int i) {
204     return false;
205 }
206
207 bool
208 RmeDevice::stopStreamByIndex(int i) {
209     return false;
210
211 }
212
213 }
Note: See TracBrowser for help on using the browser.