firewire_bebob_protocols/presonus/
fp10.rs

1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (c) 2021 Takashi Sakamoto
3
4//! Protocol implementation for Firepod/FP10.
5//!
6//! The module includes structure, enumeration, and trait and its implementation for protocol
7//! defined by PreSonus for Firepod/FP10.
8//!
9//! ## Diagram of internal signal flow
10//!
11//! ```text
12//! analog-input-1/2 -----+-----------> stream-output-1/2
13//! analog-input-3/4 -----|-+---------> stream-output-3/4
14//! analog-input-5/6 -----|-|-+-------> stream-output-5/6
15//! analog-input-7/8 -----|-|-|-+-----> stream-output-7/8
16//! digital-input-1/2 ----|-|-|-|-----> stream-output-9/10
17//!                       v v v v
18//!                     ++=======++
19//!                     || 10x2  ||
20//!                     || mixer ||
21//!                     ++=======++
22//!                        ^   |
23//! stream-input-1/2 ------+   +------> analog-output-1/2
24//! stream-input-3/4 -----------------> analog-output-3/4
25//! stream-input-5/6 -----------------> analog-output-5/6
26//! stream-input-7/8 -----------------> analog-output-7/8
27//! stream-input-9/10 ----------------> digital-output-1/2
28//! ```
29
30use super::*;
31
32/// The protocol implementation for media and sampling clock of Firepod/FP10.
33#[derive(Default, Debug)]
34pub struct Fp10ClkProtocol;
35
36impl MediaClockFrequencyOperation for Fp10ClkProtocol {
37    const FREQ_LIST: &'static [u32] = &[44100, 48000, 88200, 96000];
38}
39
40impl SamplingClockSourceOperation for Fp10ClkProtocol {
41    const DST: SignalAddr = SignalAddr::Subunit(SignalSubunitAddr {
42        subunit: MUSIC_SUBUNIT_0,
43        plug_id: 0x07,
44    });
45
46    const SRC_LIST: &'static [SignalAddr] = &[
47        // Internal.
48        SignalAddr::Subunit(SignalSubunitAddr {
49            subunit: MUSIC_SUBUNIT_0,
50            plug_id: 0x07,
51        }),
52        // S/PDIF
53        SignalAddr::Unit(SignalUnitAddr::Ext(0x01)),
54    ];
55}
56
57/// The protocol implementation for physical output.
58#[derive(Default, Debug)]
59pub struct Fp10PhysOutputProtocol;
60
61impl AvcAudioFeatureSpecification for Fp10PhysOutputProtocol {
62    const ENTRIES: &'static [(u8, AudioCh)] = &[
63        (0x01, AudioCh::Each(0)),
64        (0x01, AudioCh::Each(1)),
65        (0x02, AudioCh::Each(0)),
66        (0x02, AudioCh::Each(1)),
67        (0x03, AudioCh::Each(0)),
68        (0x03, AudioCh::Each(1)),
69        (0x04, AudioCh::Each(0)),
70        (0x04, AudioCh::Each(1)),
71    ];
72}
73
74impl AvcLevelOperation for Fp10PhysOutputProtocol {}
75
76impl AvcLrBalanceOperation for Fp10PhysOutputProtocol {}
77
78impl AvcMuteOperation for Fp10PhysOutputProtocol {}