sound/isa/sb/emu8000_patch.c
Source file repositories/reference/linux-study-clean/sound/isa/sb/emu8000_patch.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/sb/emu8000_patch.c- Extension
.c- Size
- 6486 bytes
- Lines
- 279
- Domain
- Driver Families
- Bucket
- sound/isa
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
emu8000_local.hlinux/sched/signal.hlinux/uaccess.hlinux/moduleparam.h
Detected Declarations
function snd_emu8000_open_dmafunction snd_emu8000_close_dmafunction read_wordfunction snd_emu8000_write_waitfunction wordsfunction snd_emu8000_sample_newfunction snd_emu8000_sample_freefunction snd_emu8000_sample_reset
Annotated Snippet
if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_BIDIR_LOOP) {
sp->v.loopend += looplen;
} else {
sp->v.loopstart += looplen;
sp->v.loopend += looplen;
}
sp->v.end += looplen;
}
}
/* if no blank loop is attached in the sample, add it */
if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_NO_BLANK) {
for (i = 0; i < BLANK_LOOP_SIZE; i++) {
write_word(emu, &dram_offset, 0);
}
if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_SINGLESHOT) {
sp->v.loopstart = sp->v.end + BLANK_LOOP_START;
sp->v.loopend = sp->v.end + BLANK_LOOP_END;
}
}
/* add dram offset */
sp->v.start += dram_start;
sp->v.end += dram_start;
sp->v.loopstart += dram_start;
sp->v.loopend += dram_start;
snd_emu8000_close_dma(emu);
snd_emu8000_init_fm(emu);
return 0;
}
/*
* free a sample block
*/
int
snd_emu8000_sample_free(struct snd_emux *rec, struct snd_sf_sample *sp,
struct snd_util_memhdr *hdr)
{
if (sp->block) {
snd_util_mem_free(hdr, sp->block);
sp->block = NULL;
}
return 0;
}
/*
* sample_reset callback - terminate voices
*/
void
snd_emu8000_sample_reset(struct snd_emux *rec)
{
snd_emux_terminate_all(rec);
}
Annotation
- Immediate include surface: `emu8000_local.h`, `linux/sched/signal.h`, `linux/uaccess.h`, `linux/moduleparam.h`.
- Detected declarations: `function snd_emu8000_open_dma`, `function snd_emu8000_close_dma`, `function read_word`, `function snd_emu8000_write_wait`, `function words`, `function snd_emu8000_sample_new`, `function snd_emu8000_sample_free`, `function snd_emu8000_sample_reset`.
- Atlas domain: Driver Families / sound/isa.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.