📄 dsp_spos.c
字号:
snd_iprintf(buffer, "%04X <%02X> %s [%s]\n", ins->symbol_table.symbols[i].address, ins->symbol_table.symbols[i].symbol_type, ins->symbol_table.symbols[i].symbol_name, module_str); }}static void cs46xx_dsp_proc_modules_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer){ cs46xx_t *chip = entry->private_data; dsp_spos_instance_t * ins = chip->dsp_spos_instance; int i,j; down(&chip->spos_mutex); snd_iprintf(buffer, "MODULES:\n"); for ( i = 0; i < ins->nmodules; ++i ) { snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name); snd_iprintf(buffer, " %d symbols\n", ins->modules[i].symbol_table.nsymbols); snd_iprintf(buffer, " %d fixups\n", ins->modules[i].nfixups); for (j = 0; j < ins->modules[i].nsegments; ++ j) { segment_desc_t * desc = (ins->modules[i].segments + j); snd_iprintf(buffer, " segment %02x offset %08x size %08x\n", desc->segment_type,desc->offset, desc->size); } } up(&chip->spos_mutex);}static void cs46xx_dsp_proc_task_tree_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer){ cs46xx_t *chip = entry->private_data; dsp_spos_instance_t * ins = chip->dsp_spos_instance; int i,j,col; void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; down(&chip->spos_mutex); snd_iprintf(buffer, "TASK TREES:\n"); for ( i = 0; i < ins->ntask; ++i) { snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name); for (col = 0,j = 0;j < ins->tasks[i].size; j++,col++) { u32 val; if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } val = readl(dst + (ins->tasks[i].address + j) * sizeof(u32)); snd_iprintf(buffer,"%08x ",val); } } snd_iprintf(buffer,"\n"); up(&chip->spos_mutex);}static void cs46xx_dsp_proc_scb_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer){ cs46xx_t *chip = entry->private_data; dsp_spos_instance_t * ins = chip->dsp_spos_instance; int i; down(&chip->spos_mutex); snd_iprintf(buffer, "SCB's:\n"); for ( i = 0; i < ins->nscb; ++i) { if (ins->scbs[i].deleted) continue; snd_iprintf(buffer,"\n%04x %s:\n\n",ins->scbs[i].address,ins->scbs[i].scb_name); if (ins->scbs[i].parent_scb_ptr != NULL) { snd_iprintf(buffer,"parent [%s:%04x] ", ins->scbs[i].parent_scb_ptr->scb_name, ins->scbs[i].parent_scb_ptr->address); } else snd_iprintf(buffer,"parent [none] "); snd_iprintf(buffer,"sub_list_ptr [%s:%04x]\nnext_scb_ptr [%s:%04x] task_entry [%s:%04x]\n", ins->scbs[i].sub_list_ptr->scb_name, ins->scbs[i].sub_list_ptr->address, ins->scbs[i].next_scb_ptr->scb_name, ins->scbs[i].next_scb_ptr->address, ins->scbs[i].task_entry->symbol_name, ins->scbs[i].task_entry->address); } snd_iprintf(buffer,"\n"); up(&chip->spos_mutex);}static void cs46xx_dsp_proc_parameter_dump_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer){ cs46xx_t *chip = entry->private_data; /*dsp_spos_instance_t * ins = chip->dsp_spos_instance; */ unsigned int i,col = 0; void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; symbol_entry_t * symbol; for (i = 0;i < DSP_PARAMETER_BYTE_SIZE; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if ( (symbol = cs46xx_dsp_lookup_symbol_addr (chip,i / sizeof(u32), SYMBOL_PARAMETER)) != NULL) { col = 0; snd_iprintf (buffer,"\n%s:\n",symbol->symbol_name); } if (col == 0) { snd_iprintf(buffer, "%04X ", i / (unsigned int)sizeof(u32)); } snd_iprintf(buffer,"%08X ",readl(dst + i)); }}static void cs46xx_dsp_proc_sample_dump_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer){ cs46xx_t *chip = entry->private_data; int i,col = 0; void __iomem *dst = chip->region.idx[2].remap_addr; snd_iprintf(buffer,"PCMREADER:\n"); for (i = PCM_READER_BUF1;i < PCM_READER_BUF1 + 0x30; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); } snd_iprintf(buffer,"\nMIX_SAMPLE_BUF1:\n"); col = 0; for (i = MIX_SAMPLE_BUF1;i < MIX_SAMPLE_BUF1 + 0x40; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); } snd_iprintf(buffer,"\nSRC_TASK_SCB1:\n"); col = 0; for (i = 0x2480 ; i < 0x2480 + 0x40 ; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); } snd_iprintf(buffer,"\nSPDIFO_BUFFER:\n"); col = 0; for (i = SPDIFO_IP_OUTPUT_BUFFER1;i < SPDIFO_IP_OUTPUT_BUFFER1 + 0x30; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); } snd_iprintf(buffer,"\n...\n"); col = 0; for (i = SPDIFO_IP_OUTPUT_BUFFER1+0xD0;i < SPDIFO_IP_OUTPUT_BUFFER1 + 0x110; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); } snd_iprintf(buffer,"\nOUTPUT_SNOOP:\n"); col = 0; for (i = OUTPUT_SNOOP_BUFFER;i < OUTPUT_SNOOP_BUFFER + 0x40; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); } snd_iprintf(buffer,"\nCODEC_INPUT_BUF1: \n"); col = 0; for (i = CODEC_INPUT_BUF1;i < CODEC_INPUT_BUF1 + 0x40; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); }#if 0 snd_iprintf(buffer,"\nWRITE_BACK_BUF1: \n"); col = 0; for (i = WRITE_BACK_BUF1;i < WRITE_BACK_BUF1 + 0x40; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); }#endif snd_iprintf(buffer,"\nSPDIFI_IP_OUTPUT_BUFFER1: \n"); col = 0; for (i = SPDIFI_IP_OUTPUT_BUFFER1;i < SPDIFI_IP_OUTPUT_BUFFER1 + 0x80; i += sizeof(u32),col ++) { if (col == 4) { snd_iprintf(buffer,"\n"); col = 0; } if (col == 0) { snd_iprintf(buffer, "%04X ",i); } snd_iprintf(buffer,"%08X ",readl(dst + i)); } snd_iprintf(buffer,"\n");}int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *chip){ snd_info_entry_t *entry; dsp_spos_instance_t * ins = chip->dsp_spos_instance; int i; ins->snd_card = card; if ((entry = snd_info_create_card_entry(card, "dsp", card->proc_root)) != NULL) { entry->content = SNDRV_INFO_CONTENT_TEXT; entry->mode = S_IFDIR | S_IRUGO | S_IXUGO; entry->c.text.read_size = 512; if (snd_info_register(entry) < 0) { snd_info_free_entry(entry); entry = NULL; } } ins->proc_dsp_dir = entry; if (!ins->proc_dsp_dir) return -ENOMEM; if ((entry = snd_info_create_card_entry(card, "spos_symbols", ins->proc_dsp_dir)) != NULL) { entry->content = SNDRV_INFO_CONTENT_TEXT; entry->private_data = chip; entry->mode = S_IFREG | S_IRUGO | S_IWUSR; entry->c.text.read_size = 512; entry->c.text.read = cs46xx_dsp_proc_symbol_table_read; if (snd_info_register(entry) < 0) { snd_info_free_entry(entry); entry = NULL; } } ins->proc_sym_info_entry = entry; if ((entry = snd_info_create_card_entry(card, "spos_modules", ins->proc_dsp_dir)) != NULL) { entry->content = SNDRV_INFO_CONTENT_TEXT; entry->private_data = chip; entry->mode = S_IFREG | S_IRUGO | S_IWUSR; entry->c.text.read_size = 512; entry->c.text.read = cs46xx_dsp_proc_modules_read; if (snd_info_register(entry) < 0) { snd_info_free_entry(entry); entry = NULL; } } ins->proc_modules_info_entry = entry; if ((entry = snd_info_create_card_entry(card, "parameter", ins->proc_dsp_dir)) != NULL) { entry->content = SNDRV_INFO_CONTENT_TEXT; entry->private_data = chip; entry->mode = S_IFREG | S_IRUGO | S_IWUSR; entry->c.text.read_size = 512; entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read; if (snd_info_register(entry) < 0) { snd_info_free_entry(entry); entry = NULL; } } ins->proc_parameter_dump_info_entry = entry; if ((entry = snd_info_create_card_entry(card, "sample", ins->proc_dsp_dir)) != NULL) { entry->content = SNDRV_INFO_CONTENT_TEXT; entry->private_data = chip; entry->mode = S_IFREG | S_IRUGO | S_IWUSR; entry->c.text.read_size = 512; entry->c.text.read = cs46xx_dsp_proc_sample_dump_read; if (snd_info_register(entry) < 0) { snd_info_free_entry(entry); entry = NULL; } } ins->proc_sample_dump_info_entry = entry; if ((entry = snd_info_create_card_entry(card, "task_tree", ins->proc_dsp_dir)) != NULL) { entry->content = SNDRV_INFO_CONTENT_TEXT; entry->private_data = chip; entry->mode = S_IFREG | S_IRUGO | S_IWUSR; entry->c.text.read_size = 512; entry->c.text.read = cs46xx_dsp_proc_task_tree_read; if (snd_info_register(entry) < 0) { snd_info_free_entry(entry); entry = NULL; } } ins->proc_task_info_entry = entry; if ((entry = snd_info_create_card_entry(card, "scb_info", ins->proc_dsp_dir)) != NULL) { entry->content = SNDRV_INFO_CONTENT_TEXT; entry->private_data = chip; entry->mode = S_IFREG | S_IRUGO | S_IWUSR; entry->c.text.read_size = 1024; entry->c.text.read = cs46xx_dsp_proc_scb_read; if (snd_info_register(entry) < 0) { snd_info_free_entry(entry); entry = NULL; } } ins->proc_scb_info_entry = entry; down(&chip->spos_mutex); /* register/update SCB's entries on proc */ for (i = 0; i < ins->nscb; ++i) { if (ins->scbs[i].deleted) continue; cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i)); } up(&chip->spos_mutex); return 0;}int cs46xx_dsp_proc_done (cs46xx_t *chip){ dsp_spos_instance_t * ins = chip->dsp_spos_instance; int i; if (ins->proc_sym_info_entry) { snd_info_unregister(ins->proc_sym_info_entry); ins->proc_sym_info_entry = NULL; } if (ins->proc_modules_info_entry) { snd_info_unregister(ins->proc_modules_info_entry); ins->proc_modules_info_entry = NULL; } if (ins->proc_parameter_dump_info_entry) { snd_info_unregister(ins->proc_parameter_dump_info_entry); ins->proc_parameter_dump_info_entry = NULL; } if (ins->proc_sample_dump_info_entry) { snd_info_unregister(ins->proc_sample_dump_info_entry); ins->proc_sample_dump_info_entry = NULL; } if (ins->proc_scb_info_entry) { snd_info_unregister(ins->proc_scb_info_entry); ins->proc_scb_info_entry = NULL; } if (ins->proc_task_info_entry) { snd_info_unregister(ins->proc_task_info_entry); ins->proc_task_info_entry = NULL; } down(&chip->spos_mutex); for (i = 0; i < ins->nscb; ++i) { if (ins->scbs[i].deleted) continue; cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); } up(&chip->spos_mutex); if (ins->proc_dsp_dir) { snd_info_unregister (ins->proc_dsp_dir); ins->proc_dsp_dir = NULL; } return 0;}static int debug_tree;static void _dsp_create_task_tree (cs46xx_t *chip,u32 * task_data, u32 dest, int size){ void __iomem *spdst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET + dest * sizeof(u32); int i; for (i = 0; i < size; ++i) { if (debug_tree) printk ("addr %p, val %08x\n",spdst,task_data[i]); writel(task_data[i],spdst); spdst += sizeof(u32); }}static int debug_scb;static void _dsp_create_scb (cs46xx_t *chip,u32 * scb_data, u32 dest){ void __iomem *spdst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET + dest * sizeof(u32); int i; for (i = 0; i < 0x10; ++i) { if (debug_scb) printk ("addr %p, val %08x\n",spdst,scb_data[i]); writel(scb_data[i],spdst); spdst += sizeof(u32); }}static int find_free_scb_index (dsp_spos_instance_t * ins){ int index = ins->nscb, i; for (i = ins->scb_highest_frag_index; i < ins->nscb; ++i) { if (ins->scbs[i].deleted) { index = i; break; } } return index;}static dsp_scb_descriptor_t * _map_scb (cs46xx_t *chip,char * name,u32 dest){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -