firewire_dice_protocols/focusrite/
spro24.rs

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