sound/oss/dmasound/dmasound.h
Source file repositories/reference/linux-study-clean/sound/oss/dmasound/dmasound.h
File Facts
- System
- Linux kernel
- Corpus path
sound/oss/dmasound/dmasound.h- Extension
.h- Size
- 7872 bytes
- Lines
- 254
- Domain
- Driver Families
- Bucket
- sound/oss
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.h
Detected Declarations
struct sound_settingsstruct sound_queuefunction ioctl_returnfunction dmasound_set_volumefunction dmasound_set_bassfunction dmasound_set_treblefunction dmasound_set_gain
Annotated Snippet
struct sound_settings {
MACHINE mach; /* machine dependent things */
SETTINGS hard; /* hardware settings */
SETTINGS soft; /* software settings */
SETTINGS dsp; /* /dev/dsp default settings */
TRANS *trans_write; /* supported translations */
int volume_left; /* volume (range is machine dependent) */
int volume_right;
int bass; /* tone (range is machine dependent) */
int treble;
int gain;
int minDev; /* minor device number currently open */
spinlock_t lock;
};
extern struct sound_settings dmasound;
#ifdef HAS_8BIT_TABLES
extern char dmasound_ulaw2dma8[];
extern char dmasound_alaw2dma8[];
#endif
/*
* Mid level stuff
*/
static inline int dmasound_set_volume(int volume)
{
return dmasound.mach.setVolume(volume);
}
static inline int dmasound_set_bass(int bass)
{
return dmasound.mach.setBass ? dmasound.mach.setBass(bass) : 50;
}
static inline int dmasound_set_treble(int treble)
{
return dmasound.mach.setTreble ? dmasound.mach.setTreble(treble) : 50;
}
static inline int dmasound_set_gain(int gain)
{
return dmasound.mach.setGain ? dmasound.mach.setGain(gain) : 100;
}
/*
* Sound queue stuff, the heart of the driver
*/
struct sound_queue {
/* buffers allocated for this queue */
int numBufs; /* real limits on what the user can have */
int bufSize; /* in bytes */
char **buffers;
/* current parameters */
int locked ; /* params cannot be modified when != 0 */
int user_frags ; /* user requests this many */
int user_frag_size ; /* of this size */
int max_count; /* actual # fragments <= numBufs */
int block_size; /* internal block size in bytes */
int max_active; /* in-use fragments <= max_count */
/* it shouldn't be necessary to declare any of these volatile */
int front, rear, count;
int rear_size;
/*
* The use of the playing field depends on the hardware
*
* Atari, PMac: The number of frames that are loaded/playing
*
* Amiga: Bit 0 is set: a frame is loaded
* Bit 1 is set: a frame is playing
*/
int active;
wait_queue_head_t action_queue, open_queue, sync_queue;
int non_blocking;
int busy, syncing, xruns, died;
};
#define WAKE_UP(queue) (wake_up_interruptible(&queue))
extern struct sound_queue dmasound_write_sq;
#define write_sq dmasound_write_sq
extern int dmasound_catchRadius;
#define catchRadius dmasound_catchRadius
Annotation
- Immediate include surface: `linux/types.h`.
- Detected declarations: `struct sound_settings`, `struct sound_queue`, `function ioctl_return`, `function dmasound_set_volume`, `function dmasound_set_bass`, `function dmasound_set_treble`, `function dmasound_set_gain`.
- Atlas domain: Driver Families / sound/oss.
- 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.