include/sound/sb.h

Source file repositories/reference/linux-study-clean/include/sound/sb.h

File Facts

System
Linux kernel
Corpus path
include/sound/sb.h
Extension
.h
Size
10681 bytes
Lines
364
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct snd_sb {
	unsigned long port;		/* base port of DSP chip */
	struct resource *res_port;
	unsigned long mpu_port;		/* MPU port for SB DSP 4.0+ */
	int irq;			/* IRQ number of DSP chip */
	int dma8;			/* 8-bit DMA */
	int dma16;			/* 16-bit DMA */
	unsigned short version;		/* version of DSP chip */
	enum sb_hw_type hardware;	/* see to SB_HW_XXXX */

	unsigned long alt_port;		/* alternate port (ALS4000) */
	struct pci_dev *pci;		/* ALS4000 */

	unsigned int open;		/* see to SB_OPEN_XXXX for sb8 */
					/* also SNDRV_SB_CSP_MODE_XXX for sb16_csp */
	unsigned int mode;		/* current mode of stream */
	unsigned int force_mode16;	/* force 16-bit mode of streams */
	unsigned int locked_rate;	/* sb16 duplex */
	unsigned int playback_format;
	unsigned int capture_format;
	struct timer_list midi_timer;
	unsigned int p_dma_size;
	unsigned int p_period_size;
	unsigned int c_dma_size;
	unsigned int c_period_size;

	spinlock_t mixer_lock;

	char name[32];

	void *csp; /* used only when CONFIG_SND_SB16_CSP is set */

	struct snd_card *card;
	struct snd_pcm *pcm;
	struct snd_pcm_substream *playback_substream;
	struct snd_pcm_substream *capture_substream;

	struct snd_rawmidi *rmidi;
	struct snd_rawmidi_substream *midi_substream_input;
	struct snd_rawmidi_substream *midi_substream_output;
	irq_handler_t rmidi_callback;

	spinlock_t reg_lock;
	spinlock_t open_lock;
	spinlock_t midi_input_lock;

	struct snd_info_entry *proc_entry;

#ifdef CONFIG_PM
	unsigned char saved_regs[0x20];
#endif
};

/* I/O ports */

#define SBP(chip, x)		((chip)->port + s_b_SB_##x)
#define SBP1(port, x)		((port) + s_b_SB_##x)

#define s_b_SB_RESET		0x6
#define s_b_SB_READ		0xa
#define s_b_SB_WRITE		0xc
#define s_b_SB_COMMAND		0xc
#define s_b_SB_STATUS		0xc
#define s_b_SB_DATA_AVAIL	0xe
#define s_b_SB_DATA_AVAIL_16 	0xf
#define s_b_SB_MIXER_ADDR	0x4
#define s_b_SB_MIXER_DATA	0x5
#define s_b_SB_OPL3_LEFT	0x0
#define s_b_SB_OPL3_RIGHT	0x2
#define s_b_SB_OPL3_BOTH	0x8

#define SB_DSP_OUTPUT		0x14
#define SB_DSP_INPUT		0x24
#define SB_DSP_BLOCK_SIZE	0x48
#define SB_DSP_HI_OUTPUT	0x91
#define SB_DSP_HI_INPUT		0x99
#define SB_DSP_LO_OUTPUT_AUTO	0x1c
#define SB_DSP_LO_INPUT_AUTO	0x2c
#define SB_DSP_HI_OUTPUT_AUTO	0x90
#define SB_DSP_HI_INPUT_AUTO	0x98
#define SB_DSP_IMMED_INT	0xf2
#define SB_DSP_GET_VERSION	0xe1
#define SB_DSP_SPEAKER_ON	0xd1
#define SB_DSP_SPEAKER_OFF	0xd3
#define SB_DSP_DMA8_OFF		0xd0
#define SB_DSP_DMA8_ON		0xd4
#define SB_DSP_DMA8_EXIT	0xda
#define SB_DSP_DMA16_OFF	0xd5
#define SB_DSP_DMA16_ON		0xd6
#define SB_DSP_DMA16_EXIT	0xd9

Annotation

Implementation Notes