sound/firewire/tascam/amdtp-tascam.c
Source file repositories/reference/linux-study-clean/sound/firewire/tascam/amdtp-tascam.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/tascam/amdtp-tascam.c- Extension
.c- Size
- 6312 bytes
- Lines
- 253
- 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
sound/pcm.htascam.h
Detected Declarations
struct amdtp_tscmfunction amdtp_tscm_set_parametersfunction write_pcm_s32function read_pcm_s32function write_pcm_silencefunction amdtp_tscm_add_pcm_hw_constraintsfunction read_status_messagesfunction scoped_guardfunction process_ir_ctx_payloadsfunction process_it_ctx_payloadsfunction amdtp_tscm_init
Annotated Snippet
struct amdtp_tscm {
unsigned int pcm_channels;
};
int amdtp_tscm_set_parameters(struct amdtp_stream *s, unsigned int rate)
{
struct amdtp_tscm *p = s->protocol;
unsigned int data_channels;
if (amdtp_stream_running(s))
return -EBUSY;
data_channels = p->pcm_channels;
/* Packets in in-stream have extra 2 data channels. */
if (s->direction == AMDTP_IN_STREAM)
data_channels += 2;
return amdtp_stream_set_parameters(s, rate, data_channels, 1);
}
static void write_pcm_s32(struct amdtp_stream *s, struct snd_pcm_substream *pcm,
__be32 *buffer, unsigned int frames,
unsigned int pcm_frames)
{
struct amdtp_tscm *p = s->protocol;
unsigned int channels = p->pcm_channels;
struct snd_pcm_runtime *runtime = pcm->runtime;
unsigned int pcm_buffer_pointer;
int remaining_frames;
const u32 *src;
int i, c;
pcm_buffer_pointer = s->pcm_buffer_pointer + pcm_frames;
pcm_buffer_pointer %= runtime->buffer_size;
src = (void *)runtime->dma_area +
frames_to_bytes(runtime, pcm_buffer_pointer);
remaining_frames = runtime->buffer_size - pcm_buffer_pointer;
for (i = 0; i < frames; ++i) {
for (c = 0; c < channels; ++c) {
buffer[c] = cpu_to_be32(*src);
src++;
}
buffer += s->data_block_quadlets;
if (--remaining_frames == 0)
src = (void *)runtime->dma_area;
}
}
static void read_pcm_s32(struct amdtp_stream *s, struct snd_pcm_substream *pcm,
__be32 *buffer, unsigned int frames,
unsigned int pcm_frames)
{
struct amdtp_tscm *p = s->protocol;
unsigned int channels = p->pcm_channels;
struct snd_pcm_runtime *runtime = pcm->runtime;
unsigned int pcm_buffer_pointer;
int remaining_frames;
u32 *dst;
int i, c;
pcm_buffer_pointer = s->pcm_buffer_pointer + pcm_frames;
pcm_buffer_pointer %= runtime->buffer_size;
dst = (void *)runtime->dma_area +
frames_to_bytes(runtime, pcm_buffer_pointer);
remaining_frames = runtime->buffer_size - pcm_buffer_pointer;
/* The first data channel is for event counter. */
buffer += 1;
for (i = 0; i < frames; ++i) {
for (c = 0; c < channels; ++c) {
*dst = be32_to_cpu(buffer[c]);
dst++;
}
buffer += s->data_block_quadlets;
if (--remaining_frames == 0)
dst = (void *)runtime->dma_area;
}
}
static void write_pcm_silence(struct amdtp_stream *s, __be32 *buffer,
unsigned int data_blocks)
{
struct amdtp_tscm *p = s->protocol;
unsigned int channels, i, c;
Annotation
- Immediate include surface: `sound/pcm.h`, `tascam.h`.
- Detected declarations: `struct amdtp_tscm`, `function amdtp_tscm_set_parameters`, `function write_pcm_s32`, `function read_pcm_s32`, `function write_pcm_silence`, `function amdtp_tscm_add_pcm_hw_constraints`, `function read_status_messages`, `function scoped_guard`, `function process_ir_ctx_payloads`, `function process_it_ctx_payloads`.
- 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.