aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs46xx/dsp_spos.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/cs46xx/dsp_spos.c')
-rw-r--r--sound/pci/cs46xx/dsp_spos.c264
1 files changed, 141 insertions, 123 deletions
diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c
index b66304fc4e4a..ac98917a1475 100644
--- a/sound/pci/cs46xx/dsp_spos.c
+++ b/sound/pci/cs46xx/dsp_spos.c
@@ -37,9 +37,10 @@
37#include "cs46xx_lib.h" 37#include "cs46xx_lib.h"
38#include "dsp_spos.h" 38#include "dsp_spos.h"
39 39
40static int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entry); 40static int cs46xx_dsp_async_init (struct snd_cs46xx *chip,
41 struct dsp_scb_descriptor * fg_entry);
41 42
42static wide_opcode_t wide_opcodes[] = { 43static enum wide_opcode wide_opcodes[] = {
43 WIDE_FOR_BEGIN_LOOP, 44 WIDE_FOR_BEGIN_LOOP,
44 WIDE_FOR_BEGIN_LOOP2, 45 WIDE_FOR_BEGIN_LOOP2,
45 WIDE_COND_GOTO_ADDR, 46 WIDE_COND_GOTO_ADDR,
@@ -54,12 +55,13 @@ static wide_opcode_t wide_opcodes[] = {
54 WIDE_TBEQ_NCOND_CALL1_ADDR 55 WIDE_TBEQ_NCOND_CALL1_ADDR
55}; 56};
56 57
57static int shadow_and_reallocate_code (cs46xx_t * chip,u32 * data,u32 size, u32 overlay_begin_address) 58static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32 size,
59 u32 overlay_begin_address)
58{ 60{
59 unsigned int i = 0, j, nreallocated = 0; 61 unsigned int i = 0, j, nreallocated = 0;
60 u32 hival,loval,address; 62 u32 hival,loval,address;
61 u32 mop_operands,mop_type,wide_op; 63 u32 mop_operands,mop_type,wide_op;
62 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 64 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
63 65
64 snd_assert( ((size % 2) == 0), return -EINVAL); 66 snd_assert( ((size % 2) == 0), return -EINVAL);
65 67
@@ -114,7 +116,7 @@ static int shadow_and_reallocate_code (cs46xx_t * chip,u32 * data,u32 size, u32
114 return nreallocated; 116 return nreallocated;
115} 117}
116 118
117static segment_desc_t * get_segment_desc (dsp_module_desc_t * module, int seg_type) 119static struct dsp_segment_desc * get_segment_desc (struct dsp_module_desc * module, int seg_type)
118{ 120{
119 int i; 121 int i;
120 for (i = 0;i < module->nsegments; ++i) { 122 for (i = 0;i < module->nsegments; ++i) {
@@ -126,7 +128,7 @@ static segment_desc_t * get_segment_desc (dsp_module_desc_t * module, int seg_ty
126 return NULL; 128 return NULL;
127}; 129};
128 130
129static int find_free_symbol_index (dsp_spos_instance_t * ins) 131static int find_free_symbol_index (struct dsp_spos_instance * ins)
130{ 132{
131 int index = ins->symbol_table.nsymbols,i; 133 int index = ins->symbol_table.nsymbols,i;
132 134
@@ -140,10 +142,10 @@ static int find_free_symbol_index (dsp_spos_instance_t * ins)
140 return index; 142 return index;
141} 143}
142 144
143static int add_symbols (cs46xx_t * chip, dsp_module_desc_t * module) 145static int add_symbols (struct snd_cs46xx * chip, struct dsp_module_desc * module)
144{ 146{
145 int i; 147 int i;
146 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 148 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
147 149
148 if (module->symbol_table.nsymbols > 0) { 150 if (module->symbol_table.nsymbols > 0) {
149 if (!strcmp(module->symbol_table.symbols[0].symbol_name, "OVERLAYBEGINADDRESS") && 151 if (!strcmp(module->symbol_table.symbols[0].symbol_name, "OVERLAYBEGINADDRESS") &&
@@ -181,10 +183,11 @@ static int add_symbols (cs46xx_t * chip, dsp_module_desc_t * module)
181 return 0; 183 return 0;
182} 184}
183 185
184static symbol_entry_t * add_symbol (cs46xx_t * chip, char * symbol_name, u32 address, int type) 186static struct dsp_symbol_entry *
187add_symbol (struct snd_cs46xx * chip, char * symbol_name, u32 address, int type)
185{ 188{
186 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 189 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
187 symbol_entry_t * symbol = NULL; 190 struct dsp_symbol_entry * symbol = NULL;
188 int index; 191 int index;
189 192
190 if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) { 193 if (ins->symbol_table.nsymbols == (DSP_MAX_SYMBOLS - 1)) {
@@ -217,17 +220,17 @@ static symbol_entry_t * add_symbol (cs46xx_t * chip, char * symbol_name, u32 add
217 return symbol; 220 return symbol;
218} 221}
219 222
220dsp_spos_instance_t * cs46xx_dsp_spos_create (cs46xx_t * chip) 223struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip)
221{ 224{
222 dsp_spos_instance_t * ins = kmalloc(sizeof(dsp_spos_instance_t), GFP_KERNEL); 225 struct dsp_spos_instance * ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL);
223 226
224 if (ins == NULL) 227 if (ins == NULL)
225 return NULL; 228 return NULL;
226 memset(ins, 0, sizeof(*ins));
227 229
228 /* better to use vmalloc for this big table */ 230 /* better to use vmalloc for this big table */
229 ins->symbol_table.nsymbols = 0; 231 ins->symbol_table.nsymbols = 0;
230 ins->symbol_table.symbols = vmalloc(sizeof(symbol_entry_t) * DSP_MAX_SYMBOLS); 232 ins->symbol_table.symbols = vmalloc(sizeof(struct dsp_symbol_entry) *
233 DSP_MAX_SYMBOLS);
231 ins->symbol_table.highest_frag_index = 0; 234 ins->symbol_table.highest_frag_index = 0;
232 235
233 if (ins->symbol_table.symbols == NULL) { 236 if (ins->symbol_table.symbols == NULL) {
@@ -248,7 +251,7 @@ dsp_spos_instance_t * cs46xx_dsp_spos_create (cs46xx_t * chip)
248 ins->ntask = 0; 251 ins->ntask = 0;
249 252
250 ins->nmodules = 0; 253 ins->nmodules = 0;
251 ins->modules = kmalloc(sizeof(dsp_module_desc_t) * DSP_MAX_MODULES, GFP_KERNEL); 254 ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL);
252 255
253 if (ins->modules == NULL) { 256 if (ins->modules == NULL) {
254 cs46xx_dsp_spos_destroy(chip); 257 cs46xx_dsp_spos_destroy(chip);
@@ -277,10 +280,10 @@ dsp_spos_instance_t * cs46xx_dsp_spos_create (cs46xx_t * chip)
277 return ins; 280 return ins;
278} 281}
279 282
280void cs46xx_dsp_spos_destroy (cs46xx_t * chip) 283void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
281{ 284{
282 int i; 285 int i;
283 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 286 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
284 287
285 snd_assert(ins != NULL, return); 288 snd_assert(ins != NULL, return);
286 289
@@ -298,12 +301,12 @@ void cs46xx_dsp_spos_destroy (cs46xx_t * chip)
298 up(&chip->spos_mutex); 301 up(&chip->spos_mutex);
299} 302}
300 303
301int cs46xx_dsp_load_module (cs46xx_t * chip, dsp_module_desc_t * module) 304int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module)
302{ 305{
303 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 306 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
304 segment_desc_t * code = get_segment_desc (module,SEGTYPE_SP_PROGRAM); 307 struct dsp_segment_desc * code = get_segment_desc (module,SEGTYPE_SP_PROGRAM);
305 segment_desc_t * parameter = get_segment_desc (module,SEGTYPE_SP_PARAMETER); 308 struct dsp_segment_desc * parameter = get_segment_desc (module,SEGTYPE_SP_PARAMETER);
306 segment_desc_t * sample = get_segment_desc (module,SEGTYPE_SP_SAMPLE); 309 struct dsp_segment_desc * sample = get_segment_desc (module,SEGTYPE_SP_SAMPLE);
307 u32 doffset, dsize; 310 u32 doffset, dsize;
308 311
309 if (ins->nmodules == DSP_MAX_MODULES - 1) { 312 if (ins->nmodules == DSP_MAX_MODULES - 1) {
@@ -410,10 +413,11 @@ int cs46xx_dsp_load_module (cs46xx_t * chip, dsp_module_desc_t * module)
410 return 0; 413 return 0;
411} 414}
412 415
413symbol_entry_t * cs46xx_dsp_lookup_symbol (cs46xx_t * chip, char * symbol_name, int symbol_type) 416struct dsp_symbol_entry *
417cs46xx_dsp_lookup_symbol (struct snd_cs46xx * chip, char * symbol_name, int symbol_type)
414{ 418{
415 int i; 419 int i;
416 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 420 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
417 421
418 for ( i = 0; i < ins->symbol_table.nsymbols; ++i ) { 422 for ( i = 0; i < ins->symbol_table.nsymbols; ++i ) {
419 423
@@ -435,10 +439,11 @@ symbol_entry_t * cs46xx_dsp_lookup_symbol (cs46xx_t * chip, char * symbol_name,
435} 439}
436 440
437 441
438static symbol_entry_t * cs46xx_dsp_lookup_symbol_addr (cs46xx_t * chip, u32 address, int symbol_type) 442static struct dsp_symbol_entry *
443cs46xx_dsp_lookup_symbol_addr (struct snd_cs46xx * chip, u32 address, int symbol_type)
439{ 444{
440 int i; 445 int i;
441 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 446 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
442 447
443 for ( i = 0; i < ins->symbol_table.nsymbols; ++i ) { 448 for ( i = 0; i < ins->symbol_table.nsymbols; ++i ) {
444 449
@@ -456,10 +461,11 @@ static symbol_entry_t * cs46xx_dsp_lookup_symbol_addr (cs46xx_t * chip, u32 addr
456} 461}
457 462
458 463
459static void cs46xx_dsp_proc_symbol_table_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) 464static void cs46xx_dsp_proc_symbol_table_read (struct snd_info_entry *entry,
465 struct snd_info_buffer *buffer)
460{ 466{
461 cs46xx_t *chip = entry->private_data; 467 struct snd_cs46xx *chip = entry->private_data;
462 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 468 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
463 int i; 469 int i;
464 470
465 snd_iprintf(buffer, "SYMBOLS:\n"); 471 snd_iprintf(buffer, "SYMBOLS:\n");
@@ -483,10 +489,11 @@ static void cs46xx_dsp_proc_symbol_table_read (snd_info_entry_t *entry, snd_info
483} 489}
484 490
485 491
486static void cs46xx_dsp_proc_modules_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) 492static void cs46xx_dsp_proc_modules_read (struct snd_info_entry *entry,
493 struct snd_info_buffer *buffer)
487{ 494{
488 cs46xx_t *chip = entry->private_data; 495 struct snd_cs46xx *chip = entry->private_data;
489 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 496 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
490 int i,j; 497 int i,j;
491 498
492 down(&chip->spos_mutex); 499 down(&chip->spos_mutex);
@@ -497,7 +504,7 @@ static void cs46xx_dsp_proc_modules_read (snd_info_entry_t *entry, snd_info_buff
497 snd_iprintf(buffer, " %d fixups\n", ins->modules[i].nfixups); 504 snd_iprintf(buffer, " %d fixups\n", ins->modules[i].nfixups);
498 505
499 for (j = 0; j < ins->modules[i].nsegments; ++ j) { 506 for (j = 0; j < ins->modules[i].nsegments; ++ j) {
500 segment_desc_t * desc = (ins->modules[i].segments + j); 507 struct dsp_segment_desc * desc = (ins->modules[i].segments + j);
501 snd_iprintf(buffer, " segment %02x offset %08x size %08x\n", 508 snd_iprintf(buffer, " segment %02x offset %08x size %08x\n",
502 desc->segment_type,desc->offset, desc->size); 509 desc->segment_type,desc->offset, desc->size);
503 } 510 }
@@ -505,11 +512,12 @@ static void cs46xx_dsp_proc_modules_read (snd_info_entry_t *entry, snd_info_buff
505 up(&chip->spos_mutex); 512 up(&chip->spos_mutex);
506} 513}
507 514
508static void cs46xx_dsp_proc_task_tree_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) 515static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry,
516 struct snd_info_buffer *buffer)
509{ 517{
510 cs46xx_t *chip = entry->private_data; 518 struct snd_cs46xx *chip = entry->private_data;
511 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 519 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
512 int i,j,col; 520 int i, j, col;
513 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; 521 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET;
514 522
515 down(&chip->spos_mutex); 523 down(&chip->spos_mutex);
@@ -532,10 +540,11 @@ static void cs46xx_dsp_proc_task_tree_read (snd_info_entry_t *entry, snd_info_bu
532 up(&chip->spos_mutex); 540 up(&chip->spos_mutex);
533} 541}
534 542
535static void cs46xx_dsp_proc_scb_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) 543static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry,
544 struct snd_info_buffer *buffer)
536{ 545{
537 cs46xx_t *chip = entry->private_data; 546 struct snd_cs46xx *chip = entry->private_data;
538 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 547 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
539 int i; 548 int i;
540 549
541 down(&chip->spos_mutex); 550 down(&chip->spos_mutex);
@@ -564,13 +573,14 @@ static void cs46xx_dsp_proc_scb_read (snd_info_entry_t *entry, snd_info_buffer_t
564 up(&chip->spos_mutex); 573 up(&chip->spos_mutex);
565} 574}
566 575
567static void cs46xx_dsp_proc_parameter_dump_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) 576static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry,
577 struct snd_info_buffer *buffer)
568{ 578{
569 cs46xx_t *chip = entry->private_data; 579 struct snd_cs46xx *chip = entry->private_data;
570 /*dsp_spos_instance_t * ins = chip->dsp_spos_instance; */ 580 /*struct dsp_spos_instance * ins = chip->dsp_spos_instance; */
571 unsigned int i,col = 0; 581 unsigned int i, col = 0;
572 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; 582 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET;
573 symbol_entry_t * symbol; 583 struct dsp_symbol_entry * symbol;
574 584
575 for (i = 0;i < DSP_PARAMETER_BYTE_SIZE; i += sizeof(u32),col ++) { 585 for (i = 0;i < DSP_PARAMETER_BYTE_SIZE; i += sizeof(u32),col ++) {
576 if (col == 4) { 586 if (col == 4) {
@@ -591,9 +601,10 @@ static void cs46xx_dsp_proc_parameter_dump_read (snd_info_entry_t *entry, snd_in
591 } 601 }
592} 602}
593 603
594static void cs46xx_dsp_proc_sample_dump_read (snd_info_entry_t *entry, snd_info_buffer_t * buffer) 604static void cs46xx_dsp_proc_sample_dump_read (struct snd_info_entry *entry,
605 struct snd_info_buffer *buffer)
595{ 606{
596 cs46xx_t *chip = entry->private_data; 607 struct snd_cs46xx *chip = entry->private_data;
597 int i,col = 0; 608 int i,col = 0;
598 void __iomem *dst = chip->region.idx[2].remap_addr; 609 void __iomem *dst = chip->region.idx[2].remap_addr;
599 610
@@ -738,10 +749,10 @@ static void cs46xx_dsp_proc_sample_dump_read (snd_info_entry_t *entry, snd_info_
738 snd_iprintf(buffer,"\n"); 749 snd_iprintf(buffer,"\n");
739} 750}
740 751
741int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *chip) 752int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip)
742{ 753{
743 snd_info_entry_t *entry; 754 struct snd_info_entry *entry;
744 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 755 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
745 int i; 756 int i;
746 757
747 ins->snd_card = card; 758 ins->snd_card = card;
@@ -852,9 +863,9 @@ int cs46xx_dsp_proc_init (snd_card_t * card, cs46xx_t *chip)
852 return 0; 863 return 0;
853} 864}
854 865
855int cs46xx_dsp_proc_done (cs46xx_t *chip) 866int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
856{ 867{
857 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 868 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
858 int i; 869 int i;
859 870
860 if (ins->proc_sym_info_entry) { 871 if (ins->proc_sym_info_entry) {
@@ -903,7 +914,8 @@ int cs46xx_dsp_proc_done (cs46xx_t *chip)
903} 914}
904 915
905static int debug_tree; 916static int debug_tree;
906static void _dsp_create_task_tree (cs46xx_t *chip,u32 * task_data, u32 dest, int size) 917static void _dsp_create_task_tree (struct snd_cs46xx *chip, u32 * task_data,
918 u32 dest, int size)
907{ 919{
908 void __iomem *spdst = chip->region.idx[1].remap_addr + 920 void __iomem *spdst = chip->region.idx[1].remap_addr +
909 DSP_PARAMETER_BYTE_OFFSET + dest * sizeof(u32); 921 DSP_PARAMETER_BYTE_OFFSET + dest * sizeof(u32);
@@ -917,7 +929,7 @@ static void _dsp_create_task_tree (cs46xx_t *chip,u32 * task_data, u32 dest, in
917} 929}
918 930
919static int debug_scb; 931static int debug_scb;
920static void _dsp_create_scb (cs46xx_t *chip,u32 * scb_data, u32 dest) 932static void _dsp_create_scb (struct snd_cs46xx *chip, u32 * scb_data, u32 dest)
921{ 933{
922 void __iomem *spdst = chip->region.idx[1].remap_addr + 934 void __iomem *spdst = chip->region.idx[1].remap_addr +
923 DSP_PARAMETER_BYTE_OFFSET + dest * sizeof(u32); 935 DSP_PARAMETER_BYTE_OFFSET + dest * sizeof(u32);
@@ -930,7 +942,7 @@ static void _dsp_create_scb (cs46xx_t *chip,u32 * scb_data, u32 dest)
930 } 942 }
931} 943}
932 944
933static int find_free_scb_index (dsp_spos_instance_t * ins) 945static int find_free_scb_index (struct dsp_spos_instance * ins)
934{ 946{
935 int index = ins->nscb, i; 947 int index = ins->nscb, i;
936 948
@@ -944,10 +956,10 @@ static int find_free_scb_index (dsp_spos_instance_t * ins)
944 return index; 956 return index;
945} 957}
946 958
947static dsp_scb_descriptor_t * _map_scb (cs46xx_t *chip,char * name,u32 dest) 959static struct dsp_scb_descriptor * _map_scb (struct snd_cs46xx *chip, char * name, u32 dest)
948{ 960{
949 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 961 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
950 dsp_scb_descriptor_t * desc = NULL; 962 struct dsp_scb_descriptor * desc = NULL;
951 int index; 963 int index;
952 964
953 if (ins->nscb == DSP_MAX_SCB_DESC - 1) { 965 if (ins->nscb == DSP_MAX_SCB_DESC - 1) {
@@ -977,10 +989,11 @@ static dsp_scb_descriptor_t * _map_scb (cs46xx_t *chip,char * name,u32 dest)
977 return desc; 989 return desc;
978} 990}
979 991
980static dsp_task_descriptor_t * _map_task_tree (cs46xx_t *chip,char * name,u32 dest,u32 size) 992static struct dsp_task_descriptor *
993_map_task_tree (struct snd_cs46xx *chip, char * name, u32 dest, u32 size)
981{ 994{
982 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 995 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
983 dsp_task_descriptor_t * desc = NULL; 996 struct dsp_task_descriptor * desc = NULL;
984 997
985 if (ins->ntask == DSP_MAX_TASK_DESC - 1) { 998 if (ins->ntask == DSP_MAX_TASK_DESC - 1) {
986 snd_printk(KERN_ERR "dsp_spos: got no place for other TASK\n"); 999 snd_printk(KERN_ERR "dsp_spos: got no place for other TASK\n");
@@ -1000,9 +1013,10 @@ static dsp_task_descriptor_t * _map_task_tree (cs46xx_t *chip,char * name,u32 de
1000 return desc; 1013 return desc;
1001} 1014}
1002 1015
1003dsp_scb_descriptor_t * cs46xx_dsp_create_scb (cs46xx_t *chip,char * name, u32 * scb_data,u32 dest) 1016struct dsp_scb_descriptor *
1017cs46xx_dsp_create_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u32 dest)
1004{ 1018{
1005 dsp_scb_descriptor_t * desc; 1019 struct dsp_scb_descriptor * desc;
1006 1020
1007 desc = _map_scb (chip,name,dest); 1021 desc = _map_scb (chip,name,dest);
1008 if (desc) { 1022 if (desc) {
@@ -1015,9 +1029,11 @@ dsp_scb_descriptor_t * cs46xx_dsp_create_scb (cs46xx_t *chip,char * name, u32 *
1015} 1029}
1016 1030
1017 1031
1018static dsp_task_descriptor_t * cs46xx_dsp_create_task_tree (cs46xx_t *chip,char * name, u32 * task_data,u32 dest,int size) 1032static struct dsp_task_descriptor *
1033cs46xx_dsp_create_task_tree (struct snd_cs46xx *chip, char * name, u32 * task_data,
1034 u32 dest, int size)
1019{ 1035{
1020 dsp_task_descriptor_t * desc; 1036 struct dsp_task_descriptor * desc;
1021 1037
1022 desc = _map_task_tree (chip,name,dest,size); 1038 desc = _map_task_tree (chip,name,dest,size);
1023 if (desc) { 1039 if (desc) {
@@ -1029,31 +1045,31 @@ static dsp_task_descriptor_t * cs46xx_dsp_create_task_tree (cs46xx_t *chip,char
1029 return desc; 1045 return desc;
1030} 1046}
1031 1047
1032int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip) 1048int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip)
1033{ 1049{
1034 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1050 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1035 symbol_entry_t * fg_task_tree_header_code; 1051 struct dsp_symbol_entry * fg_task_tree_header_code;
1036 symbol_entry_t * task_tree_header_code; 1052 struct dsp_symbol_entry * task_tree_header_code;
1037 symbol_entry_t * task_tree_thread; 1053 struct dsp_symbol_entry * task_tree_thread;
1038 symbol_entry_t * null_algorithm; 1054 struct dsp_symbol_entry * null_algorithm;
1039 symbol_entry_t * magic_snoop_task; 1055 struct dsp_symbol_entry * magic_snoop_task;
1040 1056
1041 dsp_scb_descriptor_t * timing_master_scb; 1057 struct dsp_scb_descriptor * timing_master_scb;
1042 dsp_scb_descriptor_t * codec_out_scb; 1058 struct dsp_scb_descriptor * codec_out_scb;
1043 dsp_scb_descriptor_t * codec_in_scb; 1059 struct dsp_scb_descriptor * codec_in_scb;
1044 dsp_scb_descriptor_t * src_task_scb; 1060 struct dsp_scb_descriptor * src_task_scb;
1045 dsp_scb_descriptor_t * master_mix_scb; 1061 struct dsp_scb_descriptor * master_mix_scb;
1046 dsp_scb_descriptor_t * rear_mix_scb; 1062 struct dsp_scb_descriptor * rear_mix_scb;
1047 dsp_scb_descriptor_t * record_mix_scb; 1063 struct dsp_scb_descriptor * record_mix_scb;
1048 dsp_scb_descriptor_t * write_back_scb; 1064 struct dsp_scb_descriptor * write_back_scb;
1049 dsp_scb_descriptor_t * vari_decimate_scb; 1065 struct dsp_scb_descriptor * vari_decimate_scb;
1050 dsp_scb_descriptor_t * rear_codec_out_scb; 1066 struct dsp_scb_descriptor * rear_codec_out_scb;
1051 dsp_scb_descriptor_t * clfe_codec_out_scb; 1067 struct dsp_scb_descriptor * clfe_codec_out_scb;
1052 dsp_scb_descriptor_t * magic_snoop_scb; 1068 struct dsp_scb_descriptor * magic_snoop_scb;
1053 1069
1054 int fifo_addr,fifo_span,valid_slots; 1070 int fifo_addr, fifo_span, valid_slots;
1055 1071
1056 static spos_control_block_t sposcb = { 1072 static struct dsp_spos_control_block sposcb = {
1057 /* 0 */ HFG_TREE_SCB,HFG_STACK, 1073 /* 0 */ HFG_TREE_SCB,HFG_STACK,
1058 /* 1 */ SPOSCB_ADDR,BG_TREE_SCB_ADDR, 1074 /* 1 */ SPOSCB_ADDR,BG_TREE_SCB_ADDR,
1059 /* 2 */ DSP_SPOS_DC,0, 1075 /* 2 */ DSP_SPOS_DC,0,
@@ -1106,7 +1122,7 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip)
1106 1122
1107 { 1123 {
1108 /* create the null SCB */ 1124 /* create the null SCB */
1109 static generic_scb_t null_scb = { 1125 static struct dsp_generic_scb null_scb = {
1110 { 0, 0, 0, 0 }, 1126 { 0, 0, 0, 0 },
1111 { 0, 0, 0, 0, 0 }, 1127 { 0, 0, 0, 0, 0 },
1112 NULL_SCB_ADDR, NULL_SCB_ADDR, 1128 NULL_SCB_ADDR, NULL_SCB_ADDR,
@@ -1128,7 +1144,7 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip)
1128 1144
1129 { 1145 {
1130 /* setup foreground task tree */ 1146 /* setup foreground task tree */
1131 static task_tree_control_block_t fg_task_tree_hdr = { 1147 static struct dsp_task_tree_control_block fg_task_tree_hdr = {
1132 { FG_TASK_HEADER_ADDR | (DSP_SPOS_DC << 0x10), 1148 { FG_TASK_HEADER_ADDR | (DSP_SPOS_DC << 0x10),
1133 DSP_SPOS_DC_DC, 1149 DSP_SPOS_DC_DC,
1134 DSP_SPOS_DC_DC, 1150 DSP_SPOS_DC_DC,
@@ -1204,7 +1220,7 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip)
1204 1220
1205 { 1221 {
1206 /* setup foreground task tree */ 1222 /* setup foreground task tree */
1207 static task_tree_control_block_t bg_task_tree_hdr = { 1223 static struct dsp_task_tree_control_block bg_task_tree_hdr = {
1208 { DSP_SPOS_DC_DC, 1224 { DSP_SPOS_DC_DC,
1209 DSP_SPOS_DC_DC, 1225 DSP_SPOS_DC_DC,
1210 DSP_SPOS_DC_DC, 1226 DSP_SPOS_DC_DC,
@@ -1313,7 +1329,7 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip)
1313 if (!write_back_scb) goto _fail_end; 1329 if (!write_back_scb) goto _fail_end;
1314 1330
1315 { 1331 {
1316 static mix2_ostream_spb_t mix2_ostream_spb = { 1332 static struct dsp_mix2_ostream_spb mix2_ostream_spb = {
1317 0x00020000, 1333 0x00020000,
1318 0x0000ffff 1334 0x0000ffff
1319 }; 1335 };
@@ -1448,13 +1464,14 @@ int cs46xx_dsp_scb_and_task_init (cs46xx_t *chip)
1448 return -EINVAL; 1464 return -EINVAL;
1449} 1465}
1450 1466
1451static int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entry) 1467static int cs46xx_dsp_async_init (struct snd_cs46xx *chip,
1468 struct dsp_scb_descriptor * fg_entry)
1452{ 1469{
1453 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1470 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1454 symbol_entry_t * s16_async_codec_input_task; 1471 struct dsp_symbol_entry * s16_async_codec_input_task;
1455 symbol_entry_t * spdifo_task; 1472 struct dsp_symbol_entry * spdifo_task;
1456 symbol_entry_t * spdifi_task; 1473 struct dsp_symbol_entry * spdifi_task;
1457 dsp_scb_descriptor_t * spdifi_scb_desc,* spdifo_scb_desc,* async_codec_scb_desc; 1474 struct dsp_scb_descriptor * spdifi_scb_desc, * spdifo_scb_desc, * async_codec_scb_desc;
1458 1475
1459 s16_async_codec_input_task = cs46xx_dsp_lookup_symbol(chip, "S16_ASYNCCODECINPUTTASK", SYMBOL_CODE); 1476 s16_async_codec_input_task = cs46xx_dsp_lookup_symbol(chip, "S16_ASYNCCODECINPUTTASK", SYMBOL_CODE);
1460 if (s16_async_codec_input_task == NULL) { 1477 if (s16_async_codec_input_task == NULL) {
@@ -1475,7 +1492,7 @@ static int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entr
1475 1492
1476 { 1493 {
1477 /* 0xBC0 */ 1494 /* 0xBC0 */
1478 spdifoscb_t spdifo_scb = { 1495 struct dsp_spdifoscb spdifo_scb = {
1479 /* 0 */ DSP_SPOS_UUUU, 1496 /* 0 */ DSP_SPOS_UUUU,
1480 { 1497 {
1481 /* 1 */ 0xb0, 1498 /* 1 */ 0xb0,
@@ -1504,7 +1521,7 @@ static int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entr
1504 }; 1521 };
1505 1522
1506 /* 0xBB0 */ 1523 /* 0xBB0 */
1507 spdifiscb_t spdifi_scb = { 1524 struct dsp_spdifiscb spdifi_scb = {
1508 /* 0 */ DSP_SPOS_UULO,DSP_SPOS_UUHI, 1525 /* 0 */ DSP_SPOS_UULO,DSP_SPOS_UUHI,
1509 /* 1 */ 0, 1526 /* 1 */ 0,
1510 /* 2 */ 0, 1527 /* 2 */ 0,
@@ -1529,7 +1546,7 @@ static int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entr
1529 }; 1546 };
1530 1547
1531 /* 0xBA0 */ 1548 /* 0xBA0 */
1532 async_codec_input_scb_t async_codec_input_scb = { 1549 struct dsp_async_codec_input_scb async_codec_input_scb = {
1533 /* 0 */ DSP_SPOS_UUUU, 1550 /* 0 */ DSP_SPOS_UUUU,
1534 /* 1 */ 0, 1551 /* 1 */ 0,
1535 /* 2 */ 0, 1552 /* 2 */ 0,
@@ -1620,9 +1637,9 @@ static int cs46xx_dsp_async_init (cs46xx_t *chip, dsp_scb_descriptor_t * fg_entr
1620} 1637}
1621 1638
1622 1639
1623static void cs46xx_dsp_disable_spdif_hw (cs46xx_t *chip) 1640static void cs46xx_dsp_disable_spdif_hw (struct snd_cs46xx *chip)
1624{ 1641{
1625 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1642 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1626 1643
1627 /* set SPDIF output FIFO slot */ 1644 /* set SPDIF output FIFO slot */
1628 snd_cs46xx_pokeBA0(chip, BA0_ASER_FADDR, 0); 1645 snd_cs46xx_pokeBA0(chip, BA0_ASER_FADDR, 0);
@@ -1641,9 +1658,9 @@ static void cs46xx_dsp_disable_spdif_hw (cs46xx_t *chip)
1641 ins->spdif_status_out &= ~DSP_SPDIF_STATUS_HW_ENABLED; 1658 ins->spdif_status_out &= ~DSP_SPDIF_STATUS_HW_ENABLED;
1642} 1659}
1643 1660
1644int cs46xx_dsp_enable_spdif_hw (cs46xx_t *chip) 1661int cs46xx_dsp_enable_spdif_hw (struct snd_cs46xx *chip)
1645{ 1662{
1646 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1663 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1647 1664
1648 /* if hw-ctrl already enabled, turn off to reset logic ... */ 1665 /* if hw-ctrl already enabled, turn off to reset logic ... */
1649 cs46xx_dsp_disable_spdif_hw (chip); 1666 cs46xx_dsp_disable_spdif_hw (chip);
@@ -1664,9 +1681,9 @@ int cs46xx_dsp_enable_spdif_hw (cs46xx_t *chip)
1664 return 0; 1681 return 0;
1665} 1682}
1666 1683
1667int cs46xx_dsp_enable_spdif_in (cs46xx_t *chip) 1684int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
1668{ 1685{
1669 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1686 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1670 1687
1671 /* turn on amplifier */ 1688 /* turn on amplifier */
1672 chip->active_ctrl(chip, 1); 1689 chip->active_ctrl(chip, 1);
@@ -1724,9 +1741,9 @@ int cs46xx_dsp_enable_spdif_in (cs46xx_t *chip)
1724 return 0; 1741 return 0;
1725} 1742}
1726 1743
1727int cs46xx_dsp_disable_spdif_in (cs46xx_t *chip) 1744int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
1728{ 1745{
1729 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1746 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1730 1747
1731 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL); 1748 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL);
1732 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1749 snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
@@ -1750,9 +1767,9 @@ int cs46xx_dsp_disable_spdif_in (cs46xx_t *chip)
1750 return 0; 1767 return 0;
1751} 1768}
1752 1769
1753int cs46xx_dsp_enable_pcm_capture (cs46xx_t *chip) 1770int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip)
1754{ 1771{
1755 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1772 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1756 1773
1757 snd_assert (ins->pcm_input == NULL,return -EINVAL); 1774 snd_assert (ins->pcm_input == NULL,return -EINVAL);
1758 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL); 1775 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL);
@@ -1765,9 +1782,9 @@ int cs46xx_dsp_enable_pcm_capture (cs46xx_t *chip)
1765 return 0; 1782 return 0;
1766} 1783}
1767 1784
1768int cs46xx_dsp_disable_pcm_capture (cs46xx_t *chip) 1785int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
1769{ 1786{
1770 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1787 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1771 1788
1772 snd_assert (ins->pcm_input != NULL,return -EINVAL); 1789 snd_assert (ins->pcm_input != NULL,return -EINVAL);
1773 1790
@@ -1779,9 +1796,9 @@ int cs46xx_dsp_disable_pcm_capture (cs46xx_t *chip)
1779 return 0; 1796 return 0;
1780} 1797}
1781 1798
1782int cs46xx_dsp_enable_adc_capture (cs46xx_t *chip) 1799int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip)
1783{ 1800{
1784 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1801 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1785 1802
1786 snd_assert (ins->adc_input == NULL,return -EINVAL); 1803 snd_assert (ins->adc_input == NULL,return -EINVAL);
1787 snd_assert (ins->codec_in_scb != NULL,return -EINVAL); 1804 snd_assert (ins->codec_in_scb != NULL,return -EINVAL);
@@ -1794,9 +1811,9 @@ int cs46xx_dsp_enable_adc_capture (cs46xx_t *chip)
1794 return 0; 1811 return 0;
1795} 1812}
1796 1813
1797int cs46xx_dsp_disable_adc_capture (cs46xx_t *chip) 1814int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
1798{ 1815{
1799 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1816 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1800 1817
1801 snd_assert (ins->adc_input != NULL,return -EINVAL); 1818 snd_assert (ins->adc_input != NULL,return -EINVAL);
1802 1819
@@ -1808,7 +1825,7 @@ int cs46xx_dsp_disable_adc_capture (cs46xx_t *chip)
1808 return 0; 1825 return 0;
1809} 1826}
1810 1827
1811int cs46xx_poke_via_dsp (cs46xx_t *chip,u32 address,u32 data) 1828int cs46xx_poke_via_dsp (struct snd_cs46xx *chip, u32 address, u32 data)
1812{ 1829{
1813 u32 temp; 1830 u32 temp;
1814 int i; 1831 int i;
@@ -1845,10 +1862,10 @@ int cs46xx_poke_via_dsp (cs46xx_t *chip,u32 address,u32 data)
1845 return 0; 1862 return 0;
1846} 1863}
1847 1864
1848int cs46xx_dsp_set_dac_volume (cs46xx_t * chip,u16 left,u16 right) 1865int cs46xx_dsp_set_dac_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1849{ 1866{
1850 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1867 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1851 dsp_scb_descriptor_t * scb; 1868 struct dsp_scb_descriptor * scb;
1852 1869
1853 down(&chip->spos_mutex); 1870 down(&chip->spos_mutex);
1854 1871
@@ -1874,8 +1891,9 @@ int cs46xx_dsp_set_dac_volume (cs46xx_t * chip,u16 left,u16 right)
1874 return 0; 1891 return 0;
1875} 1892}
1876 1893
1877int cs46xx_dsp_set_iec958_volume (cs46xx_t * chip,u16 left,u16 right) { 1894int cs46xx_dsp_set_iec958_volume (struct snd_cs46xx * chip, u16 left, u16 right)
1878 dsp_spos_instance_t * ins = chip->dsp_spos_instance; 1895{
1896 struct dsp_spos_instance * ins = chip->dsp_spos_instance;
1879 1897
1880 down(&chip->spos_mutex); 1898 down(&chip->spos_mutex);
1881 1899