sound/pci/emu10k1/emu10k1_callback.c
Source file repositories/reference/linux-study-clean/sound/pci/emu10k1/emu10k1_callback.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/emu10k1/emu10k1_callback.c- Extension
.c- Size
- 12382 bytes
- Lines
- 523
- Domain
- Driver Families
- Bucket
- sound/pci
- 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/export.hemu10k1_synth_local.hsound/asoundef.h
Detected Declarations
struct best_voicefunction snd_emu10k1_ops_setupfunction snd_emu10k1_synth_get_voicefunction voicefunction terminate_voicefunction free_voicefunction update_voicefunction lookup_voicesfunction get_voicefunction start_voicefunction trigger_voicefunction make_fmmodfunction make_fm2frq2function get_pitch_shift
Annotated Snippet
struct best_voice {
unsigned int time;
int voice;
};
/*
* prototypes
*/
static void lookup_voices(struct snd_emux *emux, struct snd_emu10k1 *hw,
struct best_voice *best, int active_only);
static struct snd_emux_voice *get_voice(struct snd_emux *emux,
struct snd_emux_port *port);
static int start_voice(struct snd_emux_voice *vp);
static void trigger_voice(struct snd_emux_voice *vp);
static void release_voice(struct snd_emux_voice *vp);
static void update_voice(struct snd_emux_voice *vp, int update);
static void terminate_voice(struct snd_emux_voice *vp);
static void free_voice(struct snd_emux_voice *vp);
static u32 make_fmmod(struct snd_emux_voice *vp);
static u32 make_fm2frq2(struct snd_emux_voice *vp);
static int get_pitch_shift(struct snd_emux *emu);
/*
* Ensure a value is between two points
* macro evaluates its args more than once, so changed to upper-case.
*/
#define LIMITVALUE(x, a, b) do { if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b); } while (0)
#define LIMITMAX(x, a) do {if ((x) > (a)) (x) = (a); } while (0)
/*
* set up operators
*/
static const struct snd_emux_operators emu10k1_ops = {
.owner = THIS_MODULE,
.get_voice = get_voice,
.prepare = start_voice,
.trigger = trigger_voice,
.release = release_voice,
.update = update_voice,
.terminate = terminate_voice,
.free_voice = free_voice,
.sample_new = snd_emu10k1_sample_new,
.sample_free = snd_emu10k1_sample_free,
.get_pitch_shift = get_pitch_shift,
};
void
snd_emu10k1_ops_setup(struct snd_emux *emux)
{
emux->ops = emu10k1_ops;
}
/*
* get more voice for pcm
*
* terminate most inactive voice and give it as a pcm voice.
*
* voice_lock is already held.
*/
int
snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw)
{
struct snd_emux *emu;
struct snd_emux_voice *vp;
struct best_voice best[V_END];
int i;
emu = hw->synth;
lookup_voices(emu, hw, best, 1); /* no OFF voices */
for (i = 0; i < V_END; i++) {
if (best[i].voice >= 0) {
int ch;
vp = &emu->voices[best[i].voice];
ch = vp->ch;
if (ch < 0) {
/*
dev_warn(emu->card->dev,
"synth_get_voice: ch < 0 (%d) ??", i);
*/
continue;
}
vp->emu->num_voices--;
vp->ch = -1;
vp->state = SNDRV_EMUX_ST_OFF;
return ch;
}
}
Annotation
- Immediate include surface: `linux/export.h`, `emu10k1_synth_local.h`, `sound/asoundef.h`.
- Detected declarations: `struct best_voice`, `function snd_emu10k1_ops_setup`, `function snd_emu10k1_synth_get_voice`, `function voice`, `function terminate_voice`, `function free_voice`, `function update_voice`, `function lookup_voices`, `function get_voice`, `function start_voice`.
- Atlas domain: Driver Families / sound/pci.
- 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.