firewire_dice_protocols/focusrite/spro14.rs
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (c) 2021 Takashi Sakamoto
3
4//! Protocol specific to Focusrite Saffire Pro 14.
5//!
6//! The module includes structure, enumeration, and trait and its implementation for protocol
7//! defined by Focusrite for Saffire Pro 14.
8//!
9//! ## Diagram of internal signal flow for Saffire Pro 14.
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//! Phone input 3/4 -----------------------------> analog-input-3/4
22//! Coaxial input 1/2 ---------------------------> spdif-input-1/2
23//!
24//! ++=============++
25//! analog-input-1/2 ----> || 34 x 32 || ----> analog-output-1/2
26//! analog-input-3/4 ----> || router || ----> analog-output-3/4
27//! spdif-input-1/2 -----> || up to || ----> spdif-output-1/2
28//! || 128 entries ||
29//! stream-input-1/2 ----> || || ----> stream-output-1/2
30//! stream-input-3/4 ----> || || ----> stream-output-3/4
31//! stream-input-5/6 ----> || || ----> stream-output-5/6
32//! stream-input-7/8 ----> || || ----> stream-output-7/8
33//! stream-input-9/10 ---> || ||
34//! stream-input-11/12 --> || ||
35//! || ||
36//! mixer-output-1/2 ----> || || ----> mixer-input-1/2
37//! mixer-output-3/4 ----> || || ----> mixer-input-3/4
38//! mixer-output-5/6 ----> || || ----> mixer-input-5/6
39//! mixer-output-7/8 ----> || || ----> mixer-input-7/8
40//! mixer-output-9/10 ---> || || ----> mixer-input-9/10
41//! mixer-output-11/12 --> || || ----> mixer-input-11/12
42//! mixer-output-13/14 --> || || ----> mixer-input-13/14
43//! mixer-output-15/16 --> || || ----> mixer-input-15/16
44//! || || ----> mixer-input-17/18
45//! ++=============++
46//!
47//! ++=============++
48//! mixer-input-1/2 -----> || || ----> mixer-output-1/2
49//! mixer-input-3/4 -----> || || ----> mixer-output-3/4
50//! mixer-input-5/6 -----> || || ----> mixer-output-5/6
51//! mixer-input-7/8 -----> || mixer || ----> mixer-output-7/8
52//! mixer-input-9/10 ----> || || ----> mixer-output-9/10
53//! mixer-input-11/12 ---> || 18 x 16 || ----> mixer-output-10/12
54//! mixer-input-13/14 ---> || || ----> mixer-output-12/14
55//! mixer-input-15/16 ---> || || ----> mixer-output-14/16
56//! mixer-input-17/18 ---> || ||
57//! ++=============++
58//!
59//! ++=============++
60//! || || ----> Phone output 1/2
61//! analog-output-1/2 ---> || output ||
62//! analog-output-3/4 ---> || group || --+-> Phone output 3/4
63//! || || +-> Headphone output 1/2
64//! ++=============++
65//!
66//! spdif-output-1/2 ----------------------------> Coaxial output 1/2
67//!
68//! ```
69
70use super::{tcat::tcd22xx_spec::*, *};
71
72/// Protocol implementation specific to Saffire Pro 14.
73#[derive(Default, Debug)]
74pub struct SPro14Protocol;
75
76impl TcatOperation for SPro14Protocol {}
77
78impl TcatGlobalSectionSpecification for SPro14Protocol {}
79
80impl TcatExtensionOperation for SPro14Protocol {}
81
82impl Tcd22xxSpecification for SPro14Protocol {
83 const INPUTS: &'static [Input] = &[
84 Input {
85 id: SrcBlkId::Ins0,
86 offset: 0,
87 count: 4,
88 label: None,
89 },
90 Input {
91 id: SrcBlkId::Aes,
92 offset: 6,
93 count: 2,
94 label: Some("S/PDIF"),
95 },
96 ];
97 const OUTPUTS: &'static [Output] = &[
98 Output {
99 id: DstBlkId::Ins0,
100 offset: 0,
101 count: 4,
102 label: None,
103 },
104 Output {
105 id: DstBlkId::Aes,
106 offset: 6,
107 count: 2,
108 label: Some("S/PDIF"),
109 },
110 ];
111 // NOTE: The first 2 entries in router section are used to display signal detection.
112 const FIXED: &'static [SrcBlk] = &[
113 SrcBlk {
114 id: SrcBlkId::Ins0,
115 ch: 0,
116 },
117 SrcBlk {
118 id: SrcBlkId::Ins0,
119 ch: 1,
120 },
121 ];
122}
123
124impl SaffireproSwNoticeOperation for SPro14Protocol {
125 const SW_NOTICE_OFFSET: usize = 0x000c;
126}
127
128impl SaffireproOutGroupSpecification for SPro14Protocol {
129 const OUT_GROUP_STATE_OFFSET: usize = 0x0010;
130
131 const ENTRY_COUNT: usize = 4;
132 const HAS_VOL_HWCTL: bool = false;
133
134 const SRC_NOTICE: u32 = 0x00000001;
135 const DIM_MUTE_NOTICE: u32 = 0x00000002;
136}
137
138impl SaffireproInputSpecification for SPro14Protocol {
139 const INPUT_PARAMS_OFFSET: usize = 0x005c;
140}