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

Revision 554, 3.9 kB (checked in by ppalmers, 14 years ago)

Merge echoaudio branch into trunk.

This adds support for the Echo Audiofire devices to FFADO. Possibly also other devices working with the Apple Class Driver will work with this code. It is not fully complete yet, but the main rework is
done.

First of all the IAvDevice class/interface is renamed to FFADODevice, in order to separate the AV/C code from the FFADO API code. A device supported by FFADO implements a FFADODevice.

The BeBoB device has been split up into three groups:
- libavc/* : all code and commands that are specified by AV/C specs. Note that a lot of the code that used to be in BeBoB::AvDevice? now resides in AVC::Unit
- genericavc/* : a FFADODevice that uses AV/C descriptors & commands for discovery and config
- bebob/* : the bebob FFADODevice that inherits from GenericAVC::AvDevice? but that uses BridgeCo? commands for discovery

Everything has been moved as high as possible in the class hierarchy. If necessary, a subclass that uses device specific commands is introduced (e.g. BeBoB::Plug inherits from AVC::Plug and uses the
BridgeCo? extended plug info command to discover it's properties).

There are some other fixes along the way that have been done too.

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     {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     : FFADODevice( 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 int
124 RmeDevice::getConfigurationId()
125 {
126     return 0;
127 }
128
129 bool
130 RmeDevice::setSamplingFrequency( int samplingFrequency )
131 {
132 /*
133  * Set the RME device's samplerate.
134  */
135         if (samplingFrequency == 48000)
136                 return true;
137         return false;
138 }
139
140 bool
141 RmeDevice::lock() {
142
143     return true;
144 }
145
146
147 bool
148 RmeDevice::unlock() {
149
150     return true;
151 }
152
153 void
154 RmeDevice::showDevice()
155 {
156         debugOutput(DEBUG_LEVEL_VERBOSE,
157                 "%s %s at node %d\n", m_model->vendor_name, m_model->model_name,
158                 m_nodeId);
159 }
160
161 bool
162 RmeDevice::prepare() {
163
164         debugOutput(DEBUG_LEVEL_NORMAL, "Preparing RmeDevice...\n" );
165
166         return true;
167 }
168
169 int
170 RmeDevice::getStreamCount() {
171         return 0; // one receive, one transmit
172 }
173
174 Streaming::StreamProcessor *
175 RmeDevice::getStreamProcessorByIndex(int i) {
176     return NULL;
177 }
178
179 bool
180 RmeDevice::startStreamByIndex(int i) {
181     return false;
182 }
183
184 bool
185 RmeDevice::stopStreamByIndex(int i) {
186     return false;
187
188 }
189
190 }
Note: See TracBrowser for help on using the browser.