sound/pci/cs46xx/dsp_spos.c
Source file repositories/reference/linux-study-clean/sound/pci/cs46xx/dsp_spos.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/cs46xx/dsp_spos.c- Extension
.c- Size
- 53794 bytes
- Lines
- 1966
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/delay.hlinux/pm.hlinux/init.hlinux/slab.hlinux/vmalloc.hlinux/mutex.hsound/core.hsound/control.hsound/info.hsound/asoundef.hcs46xx.hcs46xx_lib.hdsp_spos.h
Detected Declarations
function shadow_and_reallocate_codefunction get_segment_descfunction find_free_symbol_indexfunction add_symbolsfunction add_symbolfunction cs46xx_dsp_spos_destroyfunction dsp_load_parameterfunction dsp_load_samplefunction cs46xx_dsp_load_modulefunction cs46xx_dsp_lookup_symbolfunction cs46xx_dsp_lookup_symbol_addrfunction cs46xx_dsp_proc_symbol_table_readfunction cs46xx_dsp_proc_modules_readfunction cs46xx_dsp_proc_task_tree_readfunction cs46xx_dsp_proc_scb_readfunction cs46xx_dsp_proc_parameter_dump_readfunction cs46xx_dsp_proc_sample_dump_readfunction cs46xx_dsp_proc_initfunction cs46xx_dsp_proc_donefunction scoped_guardfunction _dsp_create_task_treefunction _dsp_create_scbfunction find_free_scb_indexfunction _map_scbfunction _map_task_treefunction cs46xx_dsp_create_scbfunction cs46xx_dsp_create_task_treefunction cs46xx_dsp_scb_and_task_initfunction cs46xx_dsp_async_initfunction cs46xx_dsp_disable_spdif_hwfunction cs46xx_dsp_enable_spdif_hwfunction cs46xx_dsp_enable_spdif_infunction cs46xx_dsp_disable_spdif_infunction scoped_guardfunction cs46xx_dsp_enable_pcm_capturefunction cs46xx_dsp_disable_pcm_capturefunction cs46xx_dsp_enable_adc_capturefunction cs46xx_dsp_disable_adc_capturefunction cs46xx_poke_via_dspfunction cs46xx_dsp_set_dac_volumefunction cs46xx_dsp_set_iec958_volumefunction cs46xx_dsp_resume
Annotated Snippet
if (ins->code.offset > 0) {
mop_operands = (hival >> 6) & 0x03fff;
mop_type = mop_operands >> 10;
/* check for wide type instruction */
if (mop_type == 0 &&
(mop_operands & WIDE_LADD_INSTR_MASK) == 0 &&
(mop_operands & WIDE_INSTR_MASK) != 0) {
wide_op = loval & 0x7f;
for (j = 0;j < ARRAY_SIZE(wide_opcodes); ++j) {
if (wide_opcodes[j] == wide_op) {
/* need to reallocate instruction */
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop[1]: %05x:%05x addr %04x\n",
hival, loval, address);
if ( !(address & 0x8000) ) {
address += (ins->code.offset / 2) - overlay_begin_address;
} else {
dev_dbg(chip->card->dev,
"handle_wideop[1]: ROM symbol not reallocated\n");
}
hival &= 0xFF000;
loval &= 0x07FFF;
hival |= ( (address >> 5) & 0x00FFF);
loval |= ( (address << 15) & 0xF8000);
address = (hival & 0x00FFF) << 5;
address |= loval >> 15;
dev_dbg(chip->card->dev,
"handle_wideop:[2] %05x:%05x addr %04x\n",
hival, loval, address);
nreallocated++;
} /* wide_opcodes[j] == wide_op */
} /* for */
} /* mod_type == 0 ... */
} /* ins->code.offset > 0 */
ins->code.data[ins->code.size++] = loval;
ins->code.data[ins->code.size++] = hival;
}
dev_dbg(chip->card->dev,
"dsp_spos: %d instructions reallocated\n", nreallocated);
return nreallocated;
}
static struct dsp_segment_desc * get_segment_desc (struct dsp_module_desc * module, int seg_type)
{
int i;
for (i = 0;i < module->nsegments; ++i) {
if (module->segments[i].segment_type == seg_type) {
return (module->segments + i);
}
}
return NULL;
};
static int find_free_symbol_index (struct dsp_spos_instance * ins)
{
int index = ins->symbol_table.nsymbols,i;
for (i = ins->symbol_table.highest_frag_index; i < ins->symbol_table.nsymbols; ++i) {
if (ins->symbol_table.symbols[i].deleted) {
index = i;
break;
}
}
return index;
}
static int add_symbols (struct snd_cs46xx * chip, struct dsp_module_desc * module)
{
int i;
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
if (module->symbol_table.nsymbols > 0) {
if (!strcmp(module->symbol_table.symbols[0].symbol_name, "OVERLAYBEGINADDRESS") &&
module->symbol_table.symbols[0].symbol_type == SYMBOL_CONSTANT ) {
module->overlay_begin_address = module->symbol_table.symbols[0].address;
}
}
Annotation
- Immediate include surface: `linux/io.h`, `linux/delay.h`, `linux/pm.h`, `linux/init.h`, `linux/slab.h`, `linux/vmalloc.h`, `linux/mutex.h`, `sound/core.h`.
- Detected declarations: `function shadow_and_reallocate_code`, `function get_segment_desc`, `function find_free_symbol_index`, `function add_symbols`, `function add_symbol`, `function cs46xx_dsp_spos_destroy`, `function dsp_load_parameter`, `function dsp_load_sample`, `function cs46xx_dsp_load_module`, `function cs46xx_dsp_lookup_symbol`.
- Atlas domain: Driver Families / sound/pci.
- 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.