firewire_dice_protocols/focusrite/
spro26.rs

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