include/sound/rawmidi.h
Source file repositories/reference/linux-study-clean/include/sound/rawmidi.h
File Facts
- System
- Linux kernel
- Corpus path
include/sound/rawmidi.h- Extension
.h- Size
- 6519 bytes
- Lines
- 204
- 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/asound.hlinux/interrupt.hlinux/spinlock.hlinux/wait.hlinux/mutex.hlinux/workqueue.hlinux/device.hsound/seq_device.hsound/info.h
Detected Declarations
struct snd_rawmidistruct snd_rawmidi_substreamstruct snd_seq_port_infostruct pidstruct snd_rawmidi_opsstruct snd_rawmidi_global_opsstruct snd_rawmidi_runtimestruct snd_rawmidi_substreamstruct snd_rawmidi_filestruct snd_rawmidi_strstruct snd_rawmidifunction snd_rawmidi_tie_devices
Annotated Snippet
struct snd_rawmidi_ops {
int (*open) (struct snd_rawmidi_substream * substream);
int (*close) (struct snd_rawmidi_substream * substream);
void (*trigger) (struct snd_rawmidi_substream * substream, int up);
void (*drain) (struct snd_rawmidi_substream * substream);
};
struct snd_rawmidi_global_ops {
int (*dev_register) (struct snd_rawmidi * rmidi);
int (*dev_unregister) (struct snd_rawmidi * rmidi);
void (*get_port_info)(struct snd_rawmidi *rmidi, int number,
struct snd_seq_port_info *info);
long (*ioctl)(struct snd_rawmidi *rmidi, unsigned int cmd,
void __user *argp);
void (*proc_read)(struct snd_info_entry *entry,
struct snd_info_buffer *buf);
};
struct snd_rawmidi_runtime {
struct snd_rawmidi_substream *substream;
unsigned int drain: 1, /* drain stage */
oss: 1; /* OSS compatible mode */
/* midi stream buffer */
unsigned char *buffer; /* buffer for MIDI data */
size_t buffer_size; /* size of buffer */
size_t appl_ptr; /* application pointer */
size_t hw_ptr; /* hardware pointer */
size_t avail_min; /* min avail for wakeup */
size_t avail; /* max used buffer for wakeup */
size_t xruns; /* over/underruns counter */
size_t align; /* alignment (0 = byte stream, 3 = UMP) */
int buffer_ref; /* buffer reference count */
/* misc */
wait_queue_head_t sleep;
/* event handler (new bytes, input only) */
void (*event)(struct snd_rawmidi_substream *substream);
/* defers calls to event [input] or ops->trigger [output] */
struct work_struct event_work;
/* private data */
void *private_data;
void (*private_free)(struct snd_rawmidi_substream *substream);
};
struct snd_rawmidi_substream {
struct list_head list; /* list of all substream for given stream */
int stream; /* direction */
int number; /* substream number */
bool opened; /* open flag */
bool append; /* append flag (merge more streams) */
bool active_sensing; /* send active sensing when close */
unsigned int framing; /* whether to frame input data */
unsigned int clock_type; /* clock source to use for input framing */
int use_count; /* use counter (for output) */
bool inactive; /* inactive substream (for UMP legacy) */
size_t bytes;
spinlock_t lock;
struct snd_rawmidi *rmidi;
struct snd_rawmidi_str *pstr;
char name[32];
struct snd_rawmidi_runtime *runtime;
struct pid *pid;
/* hardware layer */
const struct snd_rawmidi_ops *ops;
};
struct snd_rawmidi_file {
struct snd_rawmidi *rmidi;
struct snd_rawmidi_substream *input;
struct snd_rawmidi_substream *output;
unsigned int user_pversion; /* supported protocol version */
};
struct snd_rawmidi_str {
unsigned int substream_count;
unsigned int substream_opened;
struct list_head substreams;
};
struct snd_rawmidi {
struct snd_card *card;
struct list_head list;
unsigned int device; /* device number */
unsigned int info_flags; /* SNDRV_RAWMIDI_INFO_XXXX */
unsigned int tied_device;
char id[64];
char name[80];
#ifdef CONFIG_SND_OSSEMUL
int ossreg;
#endif
Annotation
- Immediate include surface: `sound/asound.h`, `linux/interrupt.h`, `linux/spinlock.h`, `linux/wait.h`, `linux/mutex.h`, `linux/workqueue.h`, `linux/device.h`, `sound/seq_device.h`.
- Detected declarations: `struct snd_rawmidi`, `struct snd_rawmidi_substream`, `struct snd_seq_port_info`, `struct pid`, `struct snd_rawmidi_ops`, `struct snd_rawmidi_global_ops`, `struct snd_rawmidi_runtime`, `struct snd_rawmidi_substream`, `struct snd_rawmidi_file`, `struct snd_rawmidi_str`.
- 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.