1 |
/* |
---|
2 |
* Copyright (C) 2005-2008 by Jonathan Woithe |
---|
3 |
* Copyright (C) 2005-2008 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 program is free software: you can redistribute it and/or modify |
---|
11 |
* it under the terms of the GNU General Public License as published by |
---|
12 |
* the Free Software Foundation, either version 2 of the License, or |
---|
13 |
* (at your option) version 3 of the License. |
---|
14 |
* |
---|
15 |
* This program is distributed in the hope that it will be useful, |
---|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 |
* GNU General Public License for more details. |
---|
19 |
* |
---|
20 |
* You should have received a copy of the GNU General Public License |
---|
21 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
22 |
* |
---|
23 |
*/ |
---|
24 |
|
---|
25 |
#ifndef RMEDEVICE_H |
---|
26 |
#define RMEDEVICE_H |
---|
27 |
|
---|
28 |
#include "ffadodevice.h" |
---|
29 |
|
---|
30 |
#include "debugmodule/debugmodule.h" |
---|
31 |
#include "libavc/avc_definitions.h" |
---|
32 |
|
---|
33 |
#include "libutil/Configuration.h" |
---|
34 |
|
---|
35 |
#include "fireface_def.h" |
---|
36 |
// #include "libstreaming/rme/RmeStreamProcessor.h" |
---|
37 |
|
---|
38 |
class ConfigRom; |
---|
39 |
class Ieee1394Service; |
---|
40 |
|
---|
41 |
namespace Rme { |
---|
42 |
|
---|
43 |
// Note: the values in this enum do not have to correspond to the unit |
---|
44 |
// version reported by the respective devices. It just so happens that they |
---|
45 |
// currently do for the Fireface-800 and Fireface-400. |
---|
46 |
enum ERmeModel { |
---|
47 |
RME_MODEL_NONE = 0x0000, |
---|
48 |
RME_MODEL_FIREFACE800 = 0x0001, |
---|
49 |
RME_MODEL_FIREFACE400 = 0x0002, |
---|
50 |
}; |
---|
51 |
|
---|
52 |
class Device : public FFADODevice { |
---|
53 |
public: |
---|
54 |
|
---|
55 |
Device( DeviceManager& d, |
---|
56 |
std::auto_ptr<ConfigRom>( configRom )); |
---|
57 |
virtual ~Device(); |
---|
58 |
|
---|
59 |
virtual bool buildMixer(); |
---|
60 |
virtual bool destroyMixer(); |
---|
61 |
|
---|
62 |
static bool probe( Util::Configuration& c, ConfigRom& configRom, bool generic = false ); |
---|
63 |
static FFADODevice * createDevice( DeviceManager& d, |
---|
64 |
std::auto_ptr<ConfigRom>( configRom )); |
---|
65 |
static int getConfigurationId( ); |
---|
66 |
virtual bool discover(); |
---|
67 |
|
---|
68 |
virtual void showDevice(); |
---|
69 |
|
---|
70 |
bool setDDSFrequency( int dds_freq ); |
---|
71 |
virtual bool setSamplingFrequency( int samplingFrequency ); |
---|
72 |
virtual int getSamplingFrequency( ); |
---|
73 |
virtual std::vector<int> getSupportedSamplingFrequencies(); |
---|
74 |
|
---|
75 |
virtual ClockSourceVector getSupportedClockSources(); |
---|
76 |
virtual bool setActiveClockSource(ClockSource); |
---|
77 |
virtual ClockSource getActiveClockSource(); |
---|
78 |
|
---|
79 |
virtual int getStreamCount(); |
---|
80 |
virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i); |
---|
81 |
|
---|
82 |
virtual bool prepare(); |
---|
83 |
virtual bool lock(); |
---|
84 |
virtual bool unlock(); |
---|
85 |
|
---|
86 |
virtual bool startStreamByIndex(int i); |
---|
87 |
virtual bool stopStreamByIndex(int i); |
---|
88 |
|
---|
89 |
unsigned int readRegister(fb_nodeaddr_t reg); |
---|
90 |
signed int readBlock(fb_nodeaddr_t reg, quadlet_t *buf, unsigned int n_quads); |
---|
91 |
signed int writeRegister(fb_nodeaddr_t reg, quadlet_t data); |
---|
92 |
signed int writeBlock(fb_nodeaddr_t reg, quadlet_t *data, unsigned int n_quads); |
---|
93 |
|
---|
94 |
/* Device control functions */ |
---|
95 |
signed int getPhantom(unsigned int channel); |
---|
96 |
signed int setPhantom(unsigned int channel, unsigned int status); |
---|
97 |
signed int getInputPadOpt(unsigned int channel); |
---|
98 |
signed int setInputPadOpt(unsigned int channel, unsigned int status); |
---|
99 |
signed int getInputInstrOpt(unsigned int channel); |
---|
100 |
signed int setInputInstrOpt(unsigned int channel, unsigned int status); |
---|
101 |
signed int getAmpGain(unsigned int index); |
---|
102 |
signed int setAmpGain(unsigned int index, signed int val); |
---|
103 |
|
---|
104 |
/* General information functions */ |
---|
105 |
signed int getRmeModel(void) { return m_rme_model; } |
---|
106 |
signed int getTcoPresent(void) { return tco_present; } |
---|
107 |
|
---|
108 |
protected: |
---|
109 |
enum ERmeModel m_rme_model; |
---|
110 |
|
---|
111 |
signed int is_streaming; |
---|
112 |
signed int m_dds_freq; // Optionally explicitly set hardware freq |
---|
113 |
signed int m_software_freq; // Sampling frequency in use by software |
---|
114 |
|
---|
115 |
signed int tco_present; |
---|
116 |
FF_software_settings_t settings; |
---|
117 |
FF_TCO_settings_t tco_settings; |
---|
118 |
|
---|
119 |
signed int num_channels; |
---|
120 |
signed int samples_per_packet; |
---|
121 |
signed int speed800; |
---|
122 |
|
---|
123 |
private: |
---|
124 |
unsigned long long int cmd_buffer_addr(); |
---|
125 |
unsigned long long int stream_init_reg(); |
---|
126 |
unsigned long long int stream_start_reg(); |
---|
127 |
unsigned long long int stream_end_reg(); |
---|
128 |
unsigned long long int flash_settings_addr(); |
---|
129 |
unsigned long long int flash_mixer_vol_addr(); |
---|
130 |
unsigned long long int flash_mixer_pan_addr(); |
---|
131 |
unsigned long long int flash_mixer_hw_addr(); |
---|
132 |
|
---|
133 |
/* Low-level flash memory functions */ |
---|
134 |
signed int wait_while_busy(unsigned int init_delay); |
---|
135 |
signed int get_revision(unsigned int *revision); |
---|
136 |
signed int read_flash(fb_nodeaddr_t addr, quadlet_t *buf, unsigned int n_quads); |
---|
137 |
signed int erase_flash(unsigned int flags); |
---|
138 |
signed int write_flash(fb_nodeaddr_t addr, quadlet_t *buf, unsigned int n_quads); |
---|
139 |
|
---|
140 |
/* Upper level flash memory functions */ |
---|
141 |
signed int read_device_flash_settings(FF_software_settings_t *settings); |
---|
142 |
signed int write_device_flash_settings(FF_software_settings_t *settings); |
---|
143 |
|
---|
144 |
/* Low-level hardware functions */ |
---|
145 |
unsigned int multiplier_of_freq(unsigned int freq); |
---|
146 |
signed int init_hardware(void); |
---|
147 |
signed int get_hardware_status(unsigned int *stat0, unsigned int *stat1); |
---|
148 |
signed int get_hardware_streaming_status(unsigned int *stat, unsigned int n); |
---|
149 |
signed int get_hardware_state(FF_state_t *state); |
---|
150 |
signed int set_hardware_params(FF_software_settings_t *use_settings = NULL); |
---|
151 |
|
---|
152 |
signed int read_tco(quadlet_t *tco_data, signed int size); |
---|
153 |
signed int write_tco(quadlet_t *tco_data, signed int size); |
---|
154 |
signed int hardware_is_streaming(void); |
---|
155 |
|
---|
156 |
signed int read_tco_state(FF_TCO_state_t *tco_state); |
---|
157 |
signed int write_tco_settings(FF_TCO_settings_t *tco_settings); |
---|
158 |
|
---|
159 |
signed int set_hardware_dds_freq(signed int freq); |
---|
160 |
|
---|
161 |
signed int hardware_init_streaming(unsigned int sample_rate, unsigned int tx_channel); |
---|
162 |
signed int hardware_start_streaming(unsigned int listen_channel); |
---|
163 |
signed int hardware_stop_streaming(void); |
---|
164 |
|
---|
165 |
signed int set_hardware_ampgain(unsigned int index, signed int val); |
---|
166 |
|
---|
167 |
Control::Container *m_MixerContainer; |
---|
168 |
Control::Container *m_ControlContainer; |
---|
169 |
}; |
---|
170 |
|
---|
171 |
} |
---|
172 |
|
---|
173 |
#endif |
---|