root/trunk/libffado/src/dice/focusrite/saffire_pro40.h

Revision 2802, 4.6 kB (checked in by jwoithe, 3 years ago)

Cosmetic: "Firewire" becomes "FireWire?".

Officially both the "F" and "W" were capitalised in the FireWire? name, so
reflect this throughout FFADO's source tree. This mostly affects comments.

This patch originated from pander on the ffado-devel mailing list. To
maintain consistency, the committed version has been expanded to include
files not originally included in the original patch.

Line 
1 /*
2  * Copyright (C) 2009 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free FireWire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program 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
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef DICE_FOCUSRITE_SAFFIRE_PRO40_H
25 #define DICE_FOCUSRITE_SAFFIRE_PRO40_H
26
27 #include "dice/dice_avdevice.h"
28
29 #include "libieee1394/configrom.h"
30
31 #include "focusrite_eap.h"
32
33 /**
34  *  Saffire Pro40 application space
35  */
36 // Versioning registers
37 #define SAFFIRE_PRO40_REGISTER_APP_VERSION 0x00
38 #define SAFFIRE_PRO40_REGISTER_APP_RELEASE 0x04
39 #define SAFFIRE_PRO40_REGISTER_APP_BUILDNR 0x08
40
41 // Nickname register
42 #define SAFFIRE_PRO40_REGISTER_APP_NICK_NAME 0x44
43 // NOTE: in bytes
44 #define SAFFIRE_PRO40_APP_NICK_NAME_SIZE 16
45
46 // Global monitor registers (application space)
47 #define SAFFIRE_PRO40_REGISTER_APP_GLOBAL_MUTE_SWITCH 0x0C
48 #define SAFFIRE_PRO40_REGISTER_APP_GLOBAL_DIM_SWITCH  0x10
49 #define SAFFIRE_PRO40_REGISTER_APP_GLOBAL_DIM_VOLUME 0x58
50 #define SAFFIRE_PRO40_REGISTER_APP_GLOBAL_MONITOR_VOLUME 0x54
51
52 // Per line/out monitor volume and switches: registers are expected to be one after the other
53 //  each register controlling two output lines
54 // The whole number of physical analog output is thus 2*SAFFIRE_PRO40_APP_STEREO_LINEOUT_SIZE
55 #define SAFFIRE_PRO40_APP_STEREO_LINEOUT_SIZE 5
56
57 // Volume and switch monitor register
58 #define SAFFIRE_PRO40_REGISTER_APP_LINEOUT_MONITOR_VOLUME 0x14
59 #define SAFFIRE_PRO40_REGISTER_APP_LINEOUT_MONITOR_SWITCH 0x28
60
61 // Switch controls
62 // per line/out mute, dim and mono
63 #define SAFFIRE_PRO40_REGISTER_APP_LINEOUT_SWITCH_CONTROL 0x3C
64 // ADAT as SPDIF
65 #define SAFFIRE_PRO40_REGISTER_APP_ADATSPDIF_SWITCH_CONTROL 0x5C
66
67 // Message set
68 //   The location of the message register and the values for each setting
69 #define SAFFIRE_PRO40_REGISTER_APP_MESSAGE_SET 0x68
70 #define SAFFIRE_PRO40_MESSAGE_SET_NO_MESSAGE 0
71 #define SAFFIRE_PRO40_MESSAGE_SET_LINEOUT_MONITOR_VOLUME 1
72 #define SAFFIRE_PRO40_MESSAGE_SET_GLOBAL_DIM_MUTE_SWITCH 2
73 #define SAFFIRE_PRO40_MESSAGE_SET_LINEOUT_SWITCH_CONTROL 3
74 #define SAFFIRE_PRO40_MESSAGE_SET_INSTLINE 4
75 #define SAFFIRE_PRO40_MESSAGE_SET_MESSAGE_END 5
76
77 // Standalone
78 #define SAFFIRE_PRO40_REGISTER_STANDALONE_SWITCH 0x60
79 #define SAFFIRE_PRO40_REGISTER_STANDALONE_SRC_SMPL 0x64 // Automatically stored
80
81 namespace Dice {
82 namespace Focusrite {
83
84 class SaffirePro40 : public Dice::Device {
85 public:
86     SaffirePro40( DeviceManager& d,
87                   ffado_smartptr<ConfigRom>( configRom ));
88     virtual ~SaffirePro40();
89
90     bool discover();
91
92     virtual void showDevice();
93
94     bool canChangeNickname() { return true; }
95     bool setNickname(std::string);
96     std::string getNickname();
97
98 private:
99     class SaffirePro40EAP : public FocusriteEAP
100     {
101     private:
102         // Adat as Spdif register state required to adapt the router settings
103         bool getADATSPDIF_state();
104     public:
105         SaffirePro40EAP(Dice::Device& dev) : FocusriteEAP(dev) {
106         }
107
108         void setupSources_low();
109         void setupDestinations_low();
110         void setupSources_mid();
111         void setupDestinations_mid();
112         void setupSources_high();
113         void setupDestinations_high();
114         void setupDefaultRouterConfig_low();
115         void setupDefaultRouterConfig_mid();
116         void setupDefaultRouterConfig_high();
117
118         // Pro 40 requires a specific switch which updates the view of the routing
119         // (essentially the ADAT/SPDIF switch)
120         class Switch : public FocusriteEAP::Switch
121         {
122         public:
123           Switch(Dice::Focusrite::FocusriteEAP*, std::string, size_t, int, size_t, int);
124           bool select(bool);
125         private:
126           Dice::Focusrite::FocusriteEAP* m_eap;
127           std::string m_name;
128           size_t m_offset;
129           int m_activevalue;
130           size_t m_msgset_offset;
131           int m_msgset_value;
132         };
133
134         class MonitorSection : public Control::Container
135         {
136         public:
137           MonitorSection(Dice::Focusrite::FocusriteEAP*, std::string);
138         private:
139           Dice::Focusrite::FocusriteEAP* m_eap;
140         };
141
142     };
143     Dice::EAP* createEAP();
144
145 };
146
147 }
148 }
149
150 #endif
151 // vim: et
Note: See TracBrowser for help on using the browser.