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

Revision 1534, 3.9 kB (checked in by jwoithe, 15 years ago)

RME: more low-level infrastructure development and experimentation

Line 
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 "libstreaming/rme/RmeStreamProcessor.h"
34
35 /* RME Fireface register definitions */
36 #define RME_REG_DDS_CONTROL       0xfc88f000
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 // struct to define the supported devices
53 struct VendorModelEntry {
54     unsigned int vendor_id;
55     unsigned int unit_version;
56     enum ERmeModel model;
57     const char *vendor_name;
58     const char *model_name;
59 };
60
61 class RmeDevice : public FFADODevice {
62 public:
63
64     RmeDevice( DeviceManager& d,
65                std::auto_ptr<ConfigRom>( configRom ));
66     virtual ~RmeDevice();
67
68     static bool probe( ConfigRom& configRom, bool generic = false );
69     static FFADODevice * createDevice( DeviceManager& d,
70                                         std::auto_ptr<ConfigRom>( configRom ));
71     static int getConfigurationId( );
72     virtual bool discover();
73
74     virtual void showDevice();
75
76     virtual bool setSamplingFrequency( int samplingFrequency );
77     virtual int getSamplingFrequency( );
78     virtual std::vector<int> getSupportedSamplingFrequencies();
79
80     virtual ClockSourceVector getSupportedClockSources();
81     virtual bool setActiveClockSource(ClockSource);
82     virtual ClockSource getActiveClockSource();
83
84     virtual int getStreamCount();
85     virtual Streaming::StreamProcessor *getStreamProcessorByIndex(int i);
86
87     virtual bool prepare();
88     virtual bool lock();
89     virtual bool unlock();
90
91     virtual bool startStreamByIndex(int i);
92     virtual bool stopStreamByIndex(int i);
93
94     unsigned int readRegister(fb_nodeaddr_t reg);
95     signed int readBlock(fb_nodeaddr_t reg, quadlet_t *buf, unsigned int n_quads);
96     signed int writeRegister(fb_nodeaddr_t reg, quadlet_t data);
97     signed int writeBlock(fb_nodeaddr_t reg, quadlet_t *data, unsigned int n_quads);
98
99 protected:
100     struct VendorModelEntry *m_model;
101     enum ERmeModel m_rme_model;
102
103     signed int m_ddsFreq;
104
105 private:
106     unsigned long long int cmd_buffer_addr();
107     unsigned long long int stream_start_reg();
108     unsigned long long int stream_end_reg();
109     unsigned long long int flash_settings_addr();
110     unsigned long long int flash_mixer_vol_addr();
111     unsigned long long int flash_mixer_pan_addr();
112     unsigned long long int flash_mixer_hw_addr();
113
114     /* Low-level flash memory functions */
115     signed int wait_while_busy(unsigned int init_delay);
116     signed int get_revision(unsigned int *revision);
117     signed int read_flash(fb_nodeaddr_t addr, quadlet_t *buf, unsigned int n_quads);
118
119     /* Upper level flash memory functions */
120     signed int read_device_settings(void);
121
122     /* Hardware functions */
123     signed int init_hardware(void);
124 };
125
126 }
127
128 #endif
Note: See TracBrowser for help on using the browser.