firewire_dice_protocols/focusrite/spro40.rs
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (c) 2021 Takashi Sakamoto
3
4//! Protocol specific to Focusrite Saffire Pro 40.
5//!
6//! The module includes structure, enumeration, and trait and its implementation for protocol
7//! defined by Focusrite for Saffire Pro 40.
8//!
9//! ## Diagram of internal signal flow for Saffire Pro 26.
10//!
11//! I note that optical input interface is available exclusively for ADAT input and S/PDIF input.
12//!
13//! ```text
14//!
15//! XLR input 1/2 ---------------------------------> analog-input-1/2
16//! XLR input 3/4 ---------------------------------> analog-input-3/4
17//! XLR input 5/6 ---------------------------------> analog-input-5/6
18//! XLR input 7/8 ---------------------------------> analog-input-7/8
19//! Coaxial input 1/2 -----------------------------> spdif-input-1/2
20//! Optical input --------------or-----------------> spdif-input-3/4
21//! +------------------> adat-input-1..8
22//!
23//! ++=============++
24//! analog-input-1/2 ------> || 56 x 60 || ----> analog-output-1/2
25//! analog-input-3/4 ------> || router || ----> analog-output-3/4
26//! analog-input-5/6 ------> || up to || ----> analog-output-5/6
27//! analog-input-7/8 ------> || 128 entries || ----> analog-output-7/8
28//! || || ----> analog-output-9/10
29//! spdif-input-1/2 -------> || || ----> spdif-output-1/2
30//! spdif-input-3/4 -------> || || ----> spdif-output-3/4
31//! adat-input-1/2 --------> || || ----> adat-input-1/2
32//! adat-input-3/4 --------> || || ----> adat-input-3/4
33//! adat-input-5/6 --------> || || ----> adat-input-5/6
34//! adat-input-7/8 --------> || || ----> adat-input-7/8
35//! || ||
36//! stream-input-A-1/2 ----> || || ----> stream-output-A-1/2
37//! stream-input-A-3/4 ----> || || ----> stream-output-A-3/4
38//! stream-input-A-5/6 ----> || || ----> stream-output-A-5/6
39//! stream-input-A-7/8 ----> || || ----> stream-output-A-7/8
40//! stream-input-A-9/10 ---> || || ----> stream-output-A-9/10
41//! stream-input-A-11/12 --> || ||
42//! || ||
43//! stream-input-B-1/2 ----> || || ----> stream-output-B-1/2
44//! stream-input-B-3/4 ----> || || ----> stream-output-B-3/4
45//! stream-input-B-5/6 ----> || || ----> stream-output-B-5/6
46//! stream-input-B-7/8 ----> || || ----> stream-output-B-7/8
47//! || || ----> stream-output-B-9/10
48//! || ||
49//! mixer-output-1/2 ------> || || ----> mixer-input-1/2
50//! mixer-output-3/4 ------> || || ----> mixer-input-3/4
51//! mixer-output-5/6 ------> || || ----> mixer-input-5/6
52//! mixer-output-7/8 ------> || || ----> mixer-input-7/8
53//! mixer-output-9/10 -----> || || ----> mixer-input-9/10
54//! mixer-output-11/12 ----> || || ----> mixer-input-11/12
55//! mixer-output-13/14 ----> || || ----> mixer-input-13/14
56//! mixer-output-15/16 ----> || || ----> mixer-input-15/16
57//! || || ----> mixer-input-17/18
58//! ++=============++
59//!
60//! ++=============++
61//! || || ----> Phone output 1/2
62//! || || ----> Phone output 3/4
63//! analog-output-1/2 -----> || || ----> Phone output 5/6
64//! analog-output-3/4 -----> || output ||
65//! analog-output-5/6 -----> || || --+-> Phone output 7/8
66//! analog-output-7/8 -----> || group || +-> Headphone output 1/2
67//! analog-output-9/10 ----> || ||
68//! || || --+-> Phone output 9/10
69//! || || +-> Headphone output 3/4
70//! || ||
71//! ++=============++
72//!
73//! spdif-output-1/2 ------------------------------> Coaxial output 1/2
74//!
75//! spdif-output-3/4 -------------or---------------> Optical output
76//! adat-output-1..8 -------------+
77//!
78//! ```
79
80use super::{tcat::tcd22xx_spec::*, *};
81
82/// Protocol implementation specific to Saffire Pro 40.
83#[derive(Default, Debug)]
84pub struct SPro40Protocol;
85
86impl TcatOperation for SPro40Protocol {}
87
88impl TcatGlobalSectionSpecification for SPro40Protocol {}
89
90impl TcatExtensionOperation for SPro40Protocol {}
91
92impl Tcd22xxSpecification for SPro40Protocol {
93 const INPUTS: &'static [Input] = &[
94 Input {
95 id: SrcBlkId::Ins1,
96 offset: 0,
97 count: 8,
98 label: None,
99 },
100 Input {
101 id: SrcBlkId::Aes,
102 offset: 0,
103 count: 2,
104 label: Some("S/PDIF-coax"),
105 },
106 // NOTE: share the same optical interface.
107 Input {
108 id: SrcBlkId::Adat,
109 offset: 0,
110 count: 8,
111 label: None,
112 },
113 Input {
114 id: SrcBlkId::Aes,
115 offset: 4,
116 count: 2,
117 label: Some("S/PDIF-opt"),
118 },
119 ];
120 const OUTPUTS: &'static [Output] = &[
121 Output {
122 id: DstBlkId::Ins0,
123 offset: 0,
124 count: 2,
125 label: None,
126 },
127 Output {
128 id: DstBlkId::Ins1,
129 offset: 0,
130 count: 8,
131 label: None,
132 },
133 Output {
134 id: DstBlkId::Aes,
135 offset: 0,
136 count: 2,
137 label: Some("S/PDIF-coax"),
138 },
139 // NOTE: share the same optical interface.
140 Output {
141 id: DstBlkId::Adat,
142 offset: 0,
143 count: 8,
144 label: None,
145 },
146 Output {
147 id: DstBlkId::Aes,
148 offset: 4,
149 count: 2,
150 label: Some("S/PDIF-opt"),
151 },
152 ];
153 // NOTE: The first 8 entries in router section are used to display hardware metering.
154 const FIXED: &'static [SrcBlk] = &[
155 SrcBlk {
156 id: SrcBlkId::Ins1,
157 ch: 0,
158 },
159 SrcBlk {
160 id: SrcBlkId::Ins1,
161 ch: 1,
162 },
163 SrcBlk {
164 id: SrcBlkId::Ins1,
165 ch: 2,
166 },
167 SrcBlk {
168 id: SrcBlkId::Ins1,
169 ch: 3,
170 },
171 SrcBlk {
172 id: SrcBlkId::Ins1,
173 ch: 4,
174 },
175 SrcBlk {
176 id: SrcBlkId::Ins1,
177 ch: 5,
178 },
179 SrcBlk {
180 id: SrcBlkId::Ins1,
181 ch: 6,
182 },
183 SrcBlk {
184 id: SrcBlkId::Ins1,
185 ch: 7,
186 },
187 ];
188}
189
190impl SaffireproSwNoticeOperation for SPro40Protocol {
191 const SW_NOTICE_OFFSET: usize = 0x0068;
192}
193
194const SRC_SW_NOTICE: u32 = 0x00000001;
195const DIM_MUTE_SW_NOTICE: u32 = 0x00000002;
196
197impl SaffireproOutGroupSpecification for SPro40Protocol {
198 const OUT_GROUP_STATE_OFFSET: usize = 0x000c;
199
200 const ENTRY_COUNT: usize = 10;
201 const HAS_VOL_HWCTL: bool = true;
202
203 const SRC_NOTICE: u32 = SRC_SW_NOTICE;
204 const DIM_MUTE_NOTICE: u32 = DIM_MUTE_SW_NOTICE;
205}
206
207impl SaffireproIoParamsSpecification for SPro40Protocol {
208 const AESEBU_IS_SUPPORTED: bool = false;
209 const MIC_PREAMP_TRANSFORMER_IS_SUPPORTED: bool = false;
210}