sound/firewire/tascam/tascam-stream.c
Source file repositories/reference/linux-study-clean/sound/firewire/tascam/tascam-stream.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/tascam/tascam-stream.c- Extension
.c- Size
- 13166 bytes
- Lines
- 552
- Domain
- Driver Families
- Bucket
- sound/firewire
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.htascam.h
Detected Declarations
function Copyrightfunction set_clockfunction snd_tscm_stream_get_ratefunction snd_tscm_stream_get_clockfunction enable_data_channelsfunction set_stream_formatsfunction finish_sessionfunction begin_sessionfunction keep_resourcesfunction init_streamfunction destroy_streamfunction snd_tscm_stream_init_duplexfunction snd_tscm_stream_update_duplexfunction snd_tscm_stream_destroy_duplexfunction snd_tscm_stream_reserve_duplexfunction snd_tscm_stream_start_duplexfunction snd_tscm_stream_stop_duplexfunction snd_tscm_stream_lock_changedfunction snd_tscm_stream_lock_tryfunction snd_tscm_stream_lock_release
Annotated Snippet
if ((rate % 44100) == 0) {
data |= 0x00000100;
/* Multiplier. */
if (rate / 44100 == 2)
data |= 0x00008000;
} else if ((rate % 48000) == 0) {
data |= 0x00000200;
/* Multiplier. */
if (rate / 48000 == 2)
data |= 0x00008000;
} else {
return -EAGAIN;
}
}
if (clock != INT_MAX) {
data &= 0x0000ff00;
data |= clock + 1;
}
reg = cpu_to_be32(data);
err = snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST,
TSCM_ADDR_BASE + TSCM_OFFSET_CLOCK_STATUS,
®, sizeof(reg), 0);
if (err < 0)
return err;
if (data & 0x00008000)
reg = cpu_to_be32(0x0000001a);
else
reg = cpu_to_be32(0x0000000d);
return snd_fw_transaction(tscm->unit, TCODE_WRITE_QUADLET_REQUEST,
TSCM_ADDR_BASE + TSCM_OFFSET_MULTIPLEX_MODE,
®, sizeof(reg), 0);
}
int snd_tscm_stream_get_rate(struct snd_tscm *tscm, unsigned int *rate)
{
u32 data;
int err;
err = get_clock(tscm, &data);
if (err < 0)
return err;
data = (data & 0xff000000) >> 24;
/* Check base rate. */
if ((data & 0x0f) == 0x01)
*rate = 44100;
else if ((data & 0x0f) == 0x02)
*rate = 48000;
else
return -EAGAIN;
/* Check multiplier. */
if ((data & 0xf0) == 0x80)
*rate *= 2;
else if ((data & 0xf0) != 0x00)
return -EAGAIN;
return err;
}
int snd_tscm_stream_get_clock(struct snd_tscm *tscm, enum snd_tscm_clock *clock)
{
u32 data;
int err;
err = get_clock(tscm, &data);
if (err < 0)
return err;
*clock = ((data & 0x00ff0000) >> 16) - 1;
if (*clock < 0 || *clock > SND_TSCM_CLOCK_ADAT)
return -EIO;
return 0;
}
static int enable_data_channels(struct snd_tscm *tscm)
{
__be32 reg;
u32 data;
unsigned int i;
int err;
data = 0;
Annotation
- Immediate include surface: `linux/delay.h`, `tascam.h`.
- Detected declarations: `function Copyright`, `function set_clock`, `function snd_tscm_stream_get_rate`, `function snd_tscm_stream_get_clock`, `function enable_data_channels`, `function set_stream_formats`, `function finish_session`, `function begin_session`, `function keep_resources`, `function init_stream`.
- Atlas domain: Driver Families / sound/firewire.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.