sound/isa/sb/emu8000_callback.c
Source file repositories/reference/linux-study-clean/sound/isa/sb/emu8000_callback.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/sb/emu8000_callback.c- Extension
.c- Size
- 12894 bytes
- Lines
- 535
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
emu8000_local.hlinux/export.hsound/asoundef.h
Detected Declarations
struct bestfunction snd_emu8000_ops_setupfunction release_voicefunction terminate_voicefunction update_voicefunction channelfunction start_voicefunction trigger_voicefunction reset_voicefunction set_pitchfunction set_volumefunction set_panfunction set_fmmodfunction set_tremfreqfunction set_fm2frq2function set_filterQfunction snd_emu8000_tweak_voicefunction sysexfunction oss_ioctlfunction load_fx
Annotated Snippet
struct best {
unsigned int time;
int voice;
} best[END];
struct best *bp;
hw = emu->hw;
for (i = 0; i < END; i++) {
best[i].time = (unsigned int)(-1); /* XXX MAX_?INT really */
best[i].voice = -1;
}
/*
* Go through them all and get a best one to use.
*/
for (i = 0; i < emu->max_voices; i++) {
int state, val;
vp = &emu->voices[i];
state = vp->state;
if (state == SNDRV_EMUX_ST_OFF)
bp = best + OFF;
else if (state == SNDRV_EMUX_ST_RELEASED ||
state == SNDRV_EMUX_ST_PENDING) {
bp = best + RELEASED;
val = (EMU8000_CVCF_READ(hw, vp->ch) >> 16) & 0xffff;
if (! val)
bp = best + OFF;
}
else if (state & SNDRV_EMUX_ST_ON)
bp = best + PLAYING;
else
continue;
/* check if sample is finished playing (non-looping only) */
if (state != SNDRV_EMUX_ST_OFF &&
(vp->reg.sample_mode & SNDRV_SFNT_SAMPLE_SINGLESHOT)) {
val = EMU8000_CCCA_READ(hw, vp->ch) & 0xffffff;
if (val >= vp->reg.loopstart)
bp = best + OFF;
}
if (vp->time < bp->time) {
bp->time = vp->time;
bp->voice = i;
}
}
for (i = 0; i < END; i++) {
if (best[i].voice >= 0) {
vp = &emu->voices[best[i].voice];
vp->ch = best[i].voice;
return vp;
}
}
/* not found */
return NULL;
}
/*
*/
static int
start_voice(struct snd_emux_voice *vp)
{
unsigned int temp;
int ch;
int addr;
struct snd_midi_channel *chan;
struct snd_emu8000 *hw;
hw = vp->hw;
ch = vp->ch;
chan = vp->chan;
/* channel to be silent and idle */
EMU8000_DCYSUSV_WRITE(hw, ch, 0x0080);
EMU8000_VTFT_WRITE(hw, ch, 0x0000FFFF);
EMU8000_CVCF_WRITE(hw, ch, 0x0000FFFF);
EMU8000_PTRX_WRITE(hw, ch, 0);
EMU8000_CPF_WRITE(hw, ch, 0);
/* set pitch offset */
set_pitch(hw, vp);
/* set envelope parameters */
EMU8000_ENVVAL_WRITE(hw, ch, vp->reg.parm.moddelay);
EMU8000_ATKHLD_WRITE(hw, ch, vp->reg.parm.modatkhld);
Annotation
- Immediate include surface: `emu8000_local.h`, `linux/export.h`, `sound/asoundef.h`.
- Detected declarations: `struct best`, `function snd_emu8000_ops_setup`, `function release_voice`, `function terminate_voice`, `function update_voice`, `function channel`, `function start_voice`, `function trigger_voice`, `function reset_voice`, `function set_pitch`.
- Atlas domain: Driver Families / sound/isa.
- 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.