sound/isa/wavefront/wavefront_synth.c
Source file repositories/reference/linux-study-clean/sound/isa/wavefront/wavefront_synth.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/wavefront/wavefront_synth.c- Extension
.c- Size
- 56425 bytes
- Lines
- 2321
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/interrupt.hlinux/init.hlinux/delay.hlinux/time.hlinux/wait.hlinux/sched/signal.hlinux/firmware.hlinux/moduleparam.hlinux/slab.hlinux/module.hsound/core.hsound/snd_wavefront.hsound/initval.h
Detected Declarations
struct wavefront_commandfunction wavefront_errorstrfunction wavefront_get_commandfunction wavefront_statusfunction wavefront_sleepfunction wavefront_waitfunction wavefront_readfunction wavefront_writefunction snd_wavefront_cmdfunction wavefront_send_multisamplefunction munge_int32function demunge_int32function munge_buffunction demunge_buffunction wavefront_delete_samplefunction wavefront_get_sample_statusfunction wavefront_get_patch_statusfunction wavefront_get_program_statusfunction wavefront_send_patchfunction wavefront_send_programfunction wavefront_freememfunction wavefront_send_samplefunction wavefront_send_aliasfunction wavefront_send_multisamplefunction wavefront_fetch_multisamplefunction wavefront_send_drumfunction wavefront_find_free_samplefunction wavefront_find_free_patchfunction wavefront_load_patchfunction process_sample_hdrfunction wavefront_synth_controlfunction wavefront_restore_midi_statefunction snd_wavefront_resume_synthfunction snd_wavefront_synth_openfunction snd_wavefront_synth_releasefunction snd_wavefront_synth_ioctlfunction snd_wavefront_internal_interruptfunction wavefront_waitfunction scoped_guardfunction Enablefunction wavefront_should_cause_interruptfunction wavefront_reset_to_cleanlinessfunction wavefront_download_firmwarefunction snd_wavefront_cache_firmwarefunction wavefront_do_resetfunction snd_wavefront_startfunction wavefront_reset_to_cleanlinessfunction snd_wavefront_detect
Annotated Snippet
struct wavefront_command {
int cmd;
char *action;
unsigned int read_cnt;
unsigned int write_cnt;
int need_ack;
};
static struct {
int errno;
const char *errstr;
} wavefront_errors[] = {
{ 0x01, "Bad sample number" },
{ 0x02, "Out of sample memory" },
{ 0x03, "Bad patch number" },
{ 0x04, "Error in number of voices" },
{ 0x06, "Sample load already in progress" },
{ 0x0B, "No sample load request pending" },
{ 0x0E, "Bad MIDI channel number" },
{ 0x10, "Download Record Error" },
{ 0x80, "Success" },
{ 0x0 }
};
#define NEEDS_ACK 1
static struct wavefront_command wavefront_commands[] = {
{ WFC_SET_SYNTHVOL, "set synthesizer volume", 0, 1, NEEDS_ACK },
{ WFC_GET_SYNTHVOL, "get synthesizer volume", 1, 0, 0},
{ WFC_SET_NVOICES, "set number of voices", 0, 1, NEEDS_ACK },
{ WFC_GET_NVOICES, "get number of voices", 1, 0, 0 },
{ WFC_SET_TUNING, "set synthesizer tuning", 0, 2, NEEDS_ACK },
{ WFC_GET_TUNING, "get synthesizer tuning", 2, 0, 0 },
{ WFC_DISABLE_CHANNEL, "disable synth channel", 0, 1, NEEDS_ACK },
{ WFC_ENABLE_CHANNEL, "enable synth channel", 0, 1, NEEDS_ACK },
{ WFC_GET_CHANNEL_STATUS, "get synth channel status", 3, 0, 0 },
{ WFC_MISYNTH_OFF, "disable midi-in to synth", 0, 0, NEEDS_ACK },
{ WFC_MISYNTH_ON, "enable midi-in to synth", 0, 0, NEEDS_ACK },
{ WFC_VMIDI_ON, "enable virtual midi mode", 0, 0, NEEDS_ACK },
{ WFC_VMIDI_OFF, "disable virtual midi mode", 0, 0, NEEDS_ACK },
{ WFC_MIDI_STATUS, "report midi status", 1, 0, 0 },
{ WFC_FIRMWARE_VERSION, "report firmware version", 2, 0, 0 },
{ WFC_HARDWARE_VERSION, "report hardware version", 2, 0, 0 },
{ WFC_GET_NSAMPLES, "report number of samples", 2, 0, 0 },
{ WFC_INSTOUT_LEVELS, "report instantaneous output levels", 7, 0, 0 },
{ WFC_PEAKOUT_LEVELS, "report peak output levels", 7, 0, 0 },
{ WFC_DOWNLOAD_SAMPLE, "download sample",
0, WF_SAMPLE_BYTES, NEEDS_ACK },
{ WFC_DOWNLOAD_BLOCK, "download block", 0, 0, NEEDS_ACK},
{ WFC_DOWNLOAD_SAMPLE_HEADER, "download sample header",
0, WF_SAMPLE_HDR_BYTES, NEEDS_ACK },
{ WFC_UPLOAD_SAMPLE_HEADER, "upload sample header", 13, 2, 0 },
/* This command requires a variable number of bytes to be written.
There is a hack in snd_wavefront_cmd() to support this. The actual
count is passed in as the read buffer ptr, cast appropriately.
Ugh.
*/
{ WFC_DOWNLOAD_MULTISAMPLE, "download multisample", 0, 0, NEEDS_ACK },
/* This one is a hack as well. We just read the first byte of the
response, don't fetch an ACK, and leave the rest to the
calling function. Ugly, ugly, ugly.
*/
{ WFC_UPLOAD_MULTISAMPLE, "upload multisample", 2, 1, 0 },
{ WFC_DOWNLOAD_SAMPLE_ALIAS, "download sample alias",
0, WF_ALIAS_BYTES, NEEDS_ACK },
{ WFC_UPLOAD_SAMPLE_ALIAS, "upload sample alias", WF_ALIAS_BYTES, 2, 0},
{ WFC_DELETE_SAMPLE, "delete sample", 0, 2, NEEDS_ACK },
{ WFC_IDENTIFY_SAMPLE_TYPE, "identify sample type", 5, 2, 0 },
{ WFC_UPLOAD_SAMPLE_PARAMS, "upload sample parameters" },
{ WFC_REPORT_FREE_MEMORY, "report free memory", 4, 0, 0 },
{ WFC_DOWNLOAD_PATCH, "download patch", 0, 134, NEEDS_ACK },
{ WFC_UPLOAD_PATCH, "upload patch", 132, 2, 0 },
{ WFC_DOWNLOAD_PROGRAM, "download program", 0, 33, NEEDS_ACK },
{ WFC_UPLOAD_PROGRAM, "upload program", 32, 1, 0 },
{ WFC_DOWNLOAD_EDRUM_PROGRAM, "download enhanced drum program", 0, 9,
NEEDS_ACK},
{ WFC_UPLOAD_EDRUM_PROGRAM, "upload enhanced drum program", 8, 1, 0},
{ WFC_SET_EDRUM_CHANNEL, "set enhanced drum program channel",
0, 1, NEEDS_ACK },
{ WFC_DISABLE_DRUM_PROGRAM, "disable drum program", 0, 1, NEEDS_ACK },
{ WFC_REPORT_CHANNEL_PROGRAMS, "report channel program numbers",
32, 0, 0 },
{ WFC_NOOP, "the no-op command", 0, 0, NEEDS_ACK },
{ 0x00 }
};
Annotation
- Immediate include surface: `linux/io.h`, `linux/interrupt.h`, `linux/init.h`, `linux/delay.h`, `linux/time.h`, `linux/wait.h`, `linux/sched/signal.h`, `linux/firmware.h`.
- Detected declarations: `struct wavefront_command`, `function wavefront_errorstr`, `function wavefront_get_command`, `function wavefront_status`, `function wavefront_sleep`, `function wavefront_wait`, `function wavefront_read`, `function wavefront_write`, `function snd_wavefront_cmd`, `function wavefront_send_multisample`.
- 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.