firewire_bebob_protocols/
roland.rs

1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (c) 2021 Takashi Sakamoto
3
4//! Protocol implementation for Roland Edirol FA series.
5//!
6//! The module includes structure, enumeration, and trait and its implementation for protocol
7//! defined by Roland for Edirol FA series.
8//!
9//! DM1000 is used for Roland FA-66.
10//!
11//! ## Diagram of internal signal flow for FA-66
12//!
13//! ```text
14//! analog-input-1/2  ----------+--------------> stream-output-1/2
15//! analog-input-3/4  ----------|-+------------> stream-output-3/4
16//! digital-input-1/2 ----------|-|-+----------> stream-output-5/6
17//!                             | | |
18//!                             v v v
19//!                          ++=======++
20//! stream-input-1/2 ------> || 8 x 2 ||
21//!                          || mixer ||-------> analog-output-1/2
22//!                          ++=======++
23//! stream-input-3/4 --------------------------> analog-output-3/4
24//! stream-input-5/6 --------------------------> digital-output-1/2
25//! ```
26//!
27//! The protocol implementation for Roland FA-66 was written with firmware version below:
28//!
29//! ```sh
30//! $ cargo run --bin bco-bootloader-info -- /dev/fw1
31//! protocol:
32//!   version: 1
33//! bootloader:
34//!   timestamp: 2004-11-26T04:06:23+0000
35//!   version: 0.0.0
36//! hardware:
37//!   GUID: 0x00c3216f0040ab00
38//!   model ID: 0x000002
39//!   revision: 0.0.1
40//! software:
41//!   timestamp: 2004-11-26T02:44:31+0000
42//!   ID: 0x00010049
43//!   revision: 0.0.256
44//! image:
45//!   base address: 0x20080000
46//!   maximum size: 0x180000
47//! ```
48
49use super::*;
50
51/// The protocol implementation for media and sampling clock. They are not configurable by
52/// software.
53#[derive(Default, Debug)]
54pub struct FaClkProtocol;
55
56impl MediaClockFrequencyOperation for FaClkProtocol {
57    const FREQ_LIST: &'static [u32] = &[44100, 48000, 96000, 192000];
58}
59
60impl SamplingClockSourceOperation for FaClkProtocol {
61    const DST: SignalAddr = SignalAddr::Subunit(SignalSubunitAddr {
62        subunit: MUSIC_SUBUNIT_0,
63        plug_id: 0x05,
64    });
65
66    const SRC_LIST: &'static [SignalAddr] = &[SignalAddr::Subunit(SignalSubunitAddr {
67        subunit: MUSIC_SUBUNIT_0,
68        plug_id: 0x05,
69    })];
70}
71
72// NOTE: Mute function in Feature control of audio function block has no effect.
73
74/// The protocol implementation for physical input of FA-66. Any operation is effective when
75/// enabling hardware switch with 'SOFT CTRL'.
76#[derive(Default, Debug)]
77pub struct Fa66MixerAnalogSourceProtocol;
78
79impl AvcAudioFeatureSpecification for Fa66MixerAnalogSourceProtocol {
80    const ENTRIES: &'static [(u8, AudioCh)] = &[
81        (0x01, AudioCh::Each(0)),
82        (0x01, AudioCh::Each(1)),
83        (0x02, AudioCh::Each(0)),
84        (0x02, AudioCh::Each(1)),
85        (0x03, AudioCh::Each(0)),
86        (0x03, AudioCh::Each(1)),
87    ];
88}
89
90impl AvcLevelOperation for Fa66MixerAnalogSourceProtocol {}
91
92impl AvcLrBalanceOperation for Fa66MixerAnalogSourceProtocol {}
93
94/// The protocol implementation for physical input of FA-101. Any operation is effective when
95/// enabling hardware switch with 'SOFT CTRL'.
96#[derive(Default, Debug)]
97pub struct Fa101MixerAnalogSourceProtocol;
98
99impl AvcAudioFeatureSpecification for Fa101MixerAnalogSourceProtocol {
100    const ENTRIES: &'static [(u8, AudioCh)] = &[
101        (0x01, AudioCh::Each(0)),
102        (0x01, AudioCh::Each(1)),
103        (0x02, AudioCh::Each(0)),
104        (0x02, AudioCh::Each(1)),
105        (0x03, AudioCh::Each(0)),
106        (0x03, AudioCh::Each(1)),
107        (0x04, AudioCh::Each(0)),
108        (0x04, AudioCh::Each(1)),
109        (0x05, AudioCh::Each(0)),
110        (0x05, AudioCh::Each(1)),
111    ];
112}
113
114impl AvcLevelOperation for Fa101MixerAnalogSourceProtocol {}
115
116impl AvcLrBalanceOperation for Fa101MixerAnalogSourceProtocol {}