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.

Dependency Surface

Detected Declarations

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

Implementation Notes