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

Revision 587, 4.1 kB (checked in by ppalmers, 15 years ago)

- moved all vendor id's to one include file
- introduced the framework for the ECHO FireWorks? platform

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 bool
147 RmeDevice::lock() {
148
149     return true;
150 }
151
152
153 bool
154 RmeDevice::unlock() {
155
156     return true;
157 }
158
159 void
160 RmeDevice::showDevice()
161 {
162         debugOutput(DEBUG_LEVEL_VERBOSE,
163                 "%s %s at node %d\n", m_model->vendor_name, m_model->model_name,
164                 getNodeId());
165 }
166
167 bool
168 RmeDevice::prepare() {
169
170         debugOutput(DEBUG_LEVEL_NORMAL, "Preparing RmeDevice...\n" );
171
172         return true;
173 }
174
175 int
176 RmeDevice::getStreamCount() {
177         return 0; // one receive, one transmit
178 }
179
180 Streaming::StreamProcessor *
181 RmeDevice::getStreamProcessorByIndex(int i) {
182     return NULL;
183 }
184
185 bool
186 RmeDevice::startStreamByIndex(int i) {
187     return false;
188 }
189
190 bool
191 RmeDevice::stopStreamByIndex(int i) {
192     return false;
193
194 }
195
196 }
Note: See TracBrowser for help on using the browser.