sound/pci/emu10k1/emuproc.c

Source file repositories/reference/linux-study-clean/sound/pci/emu10k1/emuproc.c

File Facts

System
Linux kernel
Corpus path
sound/pci/emu10k1/emuproc.c
Extension
.c
Size
25235 bytes
Lines
727
Domain
Driver Families
Bucket
sound/pci
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 emu10k1_reg_entry {
	unsigned short base, size;
	const char *name;
};

static const struct emu10k1_reg_entry sblive_reg_entries[] = {
	{    0, 0x10, "FXBUS" },
	{ 0x10, 0x10, "EXTIN" },
	{ 0x20, 0x10, "EXTOUT" },
	{ 0x30, 0x10, "FXBUS2" },
	{ 0x40, 0x20, NULL },  // Constants
	{ 0x100, 0x100, "GPR" },
	{ 0x200, 0x80, "ITRAM_DATA" },
	{ 0x280, 0x20, "ETRAM_DATA" },
	{ 0x300, 0x80, "ITRAM_ADDR" },
	{ 0x380, 0x20, "ETRAM_ADDR" },
	{ 0x400, 0, NULL }
};

static const struct emu10k1_reg_entry audigy_reg_entries[] = {
	{    0, 0x40, "FXBUS" },
	{ 0x40, 0x10, "EXTIN" },
	{ 0x50, 0x10, "P16VIN" },
	{ 0x60, 0x20, "EXTOUT" },
	{ 0x80, 0x20, "FXBUS2" },
	{ 0xa0, 0x10, "EMU32OUTH" },
	{ 0xb0, 0x10, "EMU32OUTL" },
	{ 0xc0, 0x20, NULL },  // Constants
	// This can't be quite right - overlap.
	//{ 0x100, 0xc0, "ITRAM_CTL" },
	//{ 0x1c0, 0x40, "ETRAM_CTL" },
	{ 0x160, 0x20, "A3_EMU32IN" },
	{ 0x1e0, 0x20, "A3_EMU32OUT" },
	{ 0x200, 0xc0, "ITRAM_DATA" },
	{ 0x2c0, 0x40, "ETRAM_DATA" },
	{ 0x300, 0xc0, "ITRAM_ADDR" },
	{ 0x3c0, 0x40, "ETRAM_ADDR" },
	{ 0x400, 0x200, "GPR" },
	{ 0x600, 0, NULL }
};

static const char * const emu10k1_const_entries[] = {
	"C_00000000",
	"C_00000001",
	"C_00000002",
	"C_00000003",
	"C_00000004",
	"C_00000008",
	"C_00000010",
	"C_00000020",
	"C_00000100",
	"C_00010000",
	"C_00000800",
	"C_10000000",
	"C_20000000",
	"C_40000000",
	"C_80000000",
	"C_7fffffff",
	"C_ffffffff",
	"C_fffffffe",
	"C_c0000000",
	"C_4f1bbcdc",
	"C_5a7ef9db",
	"C_00100000",
	"GPR_ACCU",
	"GPR_COND",
	"GPR_NOISE0",
	"GPR_NOISE1",
	"GPR_IRQ",
	"GPR_DBAC",
	"GPR_DBACE",
	"???",
};

static int disasm_emu10k1_reg(char *buffer,
			      const struct emu10k1_reg_entry *entries,
			      unsigned reg, const char *pfx)
{
	for (int i = 0; ; i++) {
		unsigned base = entries[i].base;
		unsigned size = entries[i].size;
		if (!size)
			return sprintf(buffer, "%s0x%03x", pfx, reg);
		if (reg >= base && reg < base + size) {
			const char *name = entries[i].name;
			reg -= base;
			if (name)
				return sprintf(buffer, "%s%s(%u)", pfx, name, reg);
			return sprintf(buffer, "%s%s", pfx, emu10k1_const_entries[reg]);
		}

Annotation

Implementation Notes