include/sound/opl3.h
Source file repositories/reference/linux-study-clean/include/sound/opl3.h
File Facts
- System
- Linux kernel
- Corpus path
include/sound/opl3.h- Extension
.h- Size
- 11894 bytes
- Lines
- 376
- Domain
- Driver Families
- Bucket
- include/sound
- 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/core.hsound/hwdep.hsound/timer.hsound/seq_midi_emul.hsound/seq_oss.hsound/seq_oss_legacy.hsound/seq_device.hsound/asound_fm.h
Detected Declarations
struct snd_opl3struct fm_operatorstruct fm_instrumentstruct fm_patchstruct snd_opl3_voicestruct snd_opl3function snd_opl3_clear_patches
Annotated Snippet
struct fm_operator {
unsigned char am_vib;
unsigned char ksl_level;
unsigned char attack_decay;
unsigned char sustain_release;
unsigned char wave_select;
} __packed;
/* Instrument data */
struct fm_instrument {
struct fm_operator op[4];
unsigned char feedback_connection[2];
unsigned char echo_delay;
unsigned char echo_atten;
unsigned char chorus_spread;
unsigned char trnsps;
unsigned char fix_dur;
unsigned char modes;
unsigned char fix_key;
};
/* type */
#define FM_PATCH_OPL2 0x01 /* OPL2 2 operators FM instrument */
#define FM_PATCH_OPL3 0x02 /* OPL3 4 operators FM instrument */
/* Instrument record */
struct fm_patch {
unsigned char prog;
unsigned char bank;
unsigned char type;
struct fm_instrument inst;
char name[24];
struct fm_patch *next;
};
/*
* A structure to keep track of each hardware voice
*/
struct snd_opl3_voice {
int state; /* status */
#define SNDRV_OPL3_ST_OFF 0 /* Not playing */
#define SNDRV_OPL3_ST_ON_2OP 1 /* 2op voice is allocated */
#define SNDRV_OPL3_ST_ON_4OP 2 /* 4op voice is allocated */
#define SNDRV_OPL3_ST_NOT_AVAIL -1 /* voice is not available */
unsigned int time; /* An allocation time */
unsigned char note; /* Note currently assigned to this voice */
unsigned long note_off; /* note-off time */
int note_off_check; /* check note-off time */
unsigned char keyon_reg; /* KON register shadow */
struct snd_midi_channel *chan; /* Midi channel for this note */
};
struct snd_opl3 {
unsigned long l_port;
unsigned long r_port;
struct resource *res_l_port;
struct resource *res_r_port;
unsigned short hardware;
/* hardware access */
void (*command) (struct snd_opl3 * opl3, unsigned short cmd, unsigned char val);
unsigned short timer_enable;
int seq_dev_num; /* sequencer device number */
struct snd_timer *timer1;
struct snd_timer *timer2;
spinlock_t timer_lock;
void *private_data;
void (*private_free)(struct snd_opl3 *);
struct snd_hwdep *hwdep;
spinlock_t reg_lock;
struct snd_card *card; /* The card that this belongs to */
unsigned char fm_mode; /* OPL mode, see SNDRV_DM_FM_MODE_XXX */
unsigned char rhythm; /* percussion mode flag */
unsigned char max_voices; /* max number of voices */
#if IS_ENABLED(CONFIG_SND_SEQUENCER)
#define SNDRV_OPL3_MODE_SYNTH 0 /* OSS - voices allocated by application */
#define SNDRV_OPL3_MODE_SEQ 1 /* ALSA - driver handles voice allocation */
int synth_mode; /* synth mode */
int seq_client;
struct snd_seq_device *seq_dev; /* sequencer device */
struct snd_midi_channel_set * chset;
#if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS)
Annotation
- Immediate include surface: `sound/core.h`, `sound/hwdep.h`, `sound/timer.h`, `sound/seq_midi_emul.h`, `sound/seq_oss.h`, `sound/seq_oss_legacy.h`, `sound/seq_device.h`, `sound/asound_fm.h`.
- Detected declarations: `struct snd_opl3`, `struct fm_operator`, `struct fm_instrument`, `struct fm_patch`, `struct snd_opl3_voice`, `struct snd_opl3`, `function snd_opl3_clear_patches`.
- Atlas domain: Driver Families / include/sound.
- 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.