Lines Matching full:dsp
132 #include "dsp.h"
148 dsp_cmx_debug(struct dsp *dsp) in dsp_cmx_debug() argument
152 struct dsp *odsp; in dsp_cmx_debug()
154 printk(KERN_DEBUG "-----Current DSP\n"); in dsp_cmx_debug()
161 if (dsp == odsp) in dsp_cmx_debug()
173 member->dsp->name, member->dsp->pcm_slot_tx, in dsp_cmx_debug()
174 member->dsp->pcm_bank_tx, member->dsp->pcm_slot_rx, in dsp_cmx_debug()
175 member->dsp->pcm_bank_rx, member->dsp->hfc_conf, in dsp_cmx_debug()
176 member->dsp->tx_data, member->dsp->rx_is_off, in dsp_cmx_debug()
177 (member->dsp == dsp) ? " *this*" : ""); in dsp_cmx_debug()
209 dsp_cmx_add_conf_member(struct dsp *dsp, struct dsp_conf *conf) in dsp_cmx_add_conf_member() argument
213 if (!conf || !dsp) { in dsp_cmx_add_conf_member()
214 printk(KERN_WARNING "%s: conf or dsp is 0.\n", __func__); in dsp_cmx_add_conf_member()
217 if (dsp->member) { in dsp_cmx_add_conf_member()
218 printk(KERN_WARNING "%s: dsp is already member in a conf.\n", in dsp_cmx_add_conf_member()
223 if (dsp->conf) { in dsp_cmx_add_conf_member()
224 printk(KERN_WARNING "%s: dsp is already in a conf.\n", in dsp_cmx_add_conf_member()
234 member->dsp = dsp; in dsp_cmx_add_conf_member()
236 memset(dsp->rx_buff, dsp_silence, sizeof(dsp->rx_buff)); in dsp_cmx_add_conf_member()
237 dsp->rx_init = 1; /* rx_W and rx_R will be adjusted on first frame */ in dsp_cmx_add_conf_member()
238 dsp->rx_W = 0; in dsp_cmx_add_conf_member()
239 dsp->rx_R = 0; in dsp_cmx_add_conf_member()
243 dsp->conf = conf; in dsp_cmx_add_conf_member()
244 dsp->member = member; in dsp_cmx_add_conf_member()
254 dsp_cmx_del_conf_member(struct dsp *dsp) in dsp_cmx_del_conf_member() argument
258 if (!dsp) { in dsp_cmx_del_conf_member()
259 printk(KERN_WARNING "%s: dsp is 0.\n", in dsp_cmx_del_conf_member()
264 if (!dsp->conf) { in dsp_cmx_del_conf_member()
265 printk(KERN_WARNING "%s: dsp is not in a conf.\n", in dsp_cmx_del_conf_member()
270 if (list_empty(&dsp->conf->mlist)) { in dsp_cmx_del_conf_member()
271 printk(KERN_WARNING "%s: dsp has linked an empty conf.\n", in dsp_cmx_del_conf_member()
277 list_for_each_entry(member, &dsp->conf->mlist, list) { in dsp_cmx_del_conf_member()
278 if (member->dsp == dsp) { in dsp_cmx_del_conf_member()
280 dsp->conf = NULL; in dsp_cmx_del_conf_member()
281 dsp->member = NULL; in dsp_cmx_del_conf_member()
287 "%s: dsp is not present in its own conf_member list.\n", in dsp_cmx_del_conf_member()
350 dsp_cmx_hw_message(struct dsp *dsp, u32 message, u32 param1, u32 param2, in dsp_cmx_hw_message() argument
359 if (dsp->ch.peer) in dsp_cmx_hw_message()
360 dsp->ch.peer->ctrl(dsp->ch.peer, CONTROL_CHANNEL, &cq); in dsp_cmx_hw_message()
367 * either a conference or a dsp instance can be given
368 * if only dsp instance is given, the instance is not associated with a conf
369 * and therefore removed. if a conference is given, the dsp is expected to
373 dsp_cmx_hardware(struct dsp_conf *conf, struct dsp *dsp) in dsp_cmx_hardware() argument
376 struct dsp *finddsp; in dsp_cmx_hardware()
383 /* dsp gets updated (no conf) */ in dsp_cmx_hardware()
385 if (!dsp) in dsp_cmx_hardware()
388 printk(KERN_DEBUG "%s checking dsp %s\n", in dsp_cmx_hardware()
389 __func__, dsp->name); in dsp_cmx_hardware()
392 if (dsp->hfc_conf >= 0) { in dsp_cmx_hardware()
396 "because dsp is split\n", __func__, in dsp_cmx_hardware()
397 dsp->name, dsp->hfc_conf); in dsp_cmx_hardware()
398 dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_CONF_SPLIT, in dsp_cmx_hardware()
400 dsp->hfc_conf = -1; in dsp_cmx_hardware()
403 if (dsp->features.pcm_banks < 1) in dsp_cmx_hardware()
405 if (!dsp->echo.software && !dsp->echo.hardware) { in dsp_cmx_hardware()
407 if (dsp->pcm_slot_tx >= 0 || dsp->pcm_slot_rx >= 0) { in dsp_cmx_hardware()
411 " dsp is split (no echo)\n", in dsp_cmx_hardware()
412 __func__, dsp->name, in dsp_cmx_hardware()
413 dsp->pcm_slot_tx, dsp->pcm_slot_rx); in dsp_cmx_hardware()
414 dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_DISC, in dsp_cmx_hardware()
416 dsp->pcm_slot_tx = -1; in dsp_cmx_hardware()
417 dsp->pcm_bank_tx = -1; in dsp_cmx_hardware()
418 dsp->pcm_slot_rx = -1; in dsp_cmx_hardware()
419 dsp->pcm_bank_rx = -1; in dsp_cmx_hardware()
424 dsp->echo.software = dsp->tx_data; in dsp_cmx_hardware()
425 dsp->echo.hardware = 0; in dsp_cmx_hardware()
427 if (dsp->pcm_slot_tx >= 0 && dsp->pcm_slot_rx < 0 && in dsp_cmx_hardware()
428 dsp->pcm_bank_tx == 2 && dsp->pcm_bank_rx == 2) { in dsp_cmx_hardware()
429 dsp->echo.hardware = 1; in dsp_cmx_hardware()
433 if (dsp->pcm_slot_tx >= 0) { in dsp_cmx_hardware()
434 dsp->pcm_slot_rx = dsp->pcm_slot_tx; in dsp_cmx_hardware()
435 dsp->pcm_bank_tx = 2; /* 2 means loop */ in dsp_cmx_hardware()
436 dsp->pcm_bank_rx = 2; in dsp_cmx_hardware()
440 __func__, dsp->name, in dsp_cmx_hardware()
441 dsp->pcm_slot_tx); in dsp_cmx_hardware()
442 dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
443 dsp->pcm_slot_tx, 2, dsp->pcm_slot_rx, 2); in dsp_cmx_hardware()
444 dsp->echo.hardware = 1; in dsp_cmx_hardware()
448 dsp->pcm_slot_tx = -1; in dsp_cmx_hardware()
449 dsp->pcm_slot_rx = -1; in dsp_cmx_hardware()
452 if (finddsp->features.pcm_id == dsp->features.pcm_id) { in dsp_cmx_hardware()
462 ii = dsp->features.pcm_slots; in dsp_cmx_hardware()
474 dsp->echo.software = 1; in dsp_cmx_hardware()
478 dsp->pcm_slot_tx = i; in dsp_cmx_hardware()
479 dsp->pcm_slot_rx = i; in dsp_cmx_hardware()
480 dsp->pcm_bank_tx = 2; /* loop */ in dsp_cmx_hardware()
481 dsp->pcm_bank_rx = 2; in dsp_cmx_hardware()
485 __func__, dsp->name, dsp->pcm_slot_tx); in dsp_cmx_hardware()
486 dsp_cmx_hw_message(dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
487 dsp->pcm_slot_tx, 2, dsp->pcm_slot_rx, 2); in dsp_cmx_hardware()
488 dsp->echo.hardware = 1; in dsp_cmx_hardware()
503 same_hfc = member->dsp->features.hfc_id; in dsp_cmx_hardware()
504 same_pcm = member->dsp->features.pcm_id; in dsp_cmx_hardware()
508 if (member->dsp->tx_mix) { in dsp_cmx_hardware()
511 "%s dsp %s cannot form a conf, because " in dsp_cmx_hardware()
513 member->dsp->name); in dsp_cmx_hardware()
516 dsp = member->dsp; in dsp_cmx_hardware()
518 if (dsp->hfc_conf >= 0) { in dsp_cmx_hardware()
525 dsp->name, in dsp_cmx_hardware()
526 dsp->hfc_conf); in dsp_cmx_hardware()
527 dsp_cmx_hw_message(dsp, in dsp_cmx_hardware()
530 dsp->hfc_conf = -1; in dsp_cmx_hardware()
533 if (dsp->pcm_slot_tx >= 0 || in dsp_cmx_hardware()
534 dsp->pcm_slot_rx >= 0) { in dsp_cmx_hardware()
541 dsp->name, in dsp_cmx_hardware()
542 dsp->pcm_slot_tx, in dsp_cmx_hardware()
543 dsp->pcm_slot_rx); in dsp_cmx_hardware()
544 dsp_cmx_hw_message(dsp, in dsp_cmx_hardware()
547 dsp->pcm_slot_tx = -1; in dsp_cmx_hardware()
548 dsp->pcm_bank_tx = -1; in dsp_cmx_hardware()
549 dsp->pcm_slot_rx = -1; in dsp_cmx_hardware()
550 dsp->pcm_bank_rx = -1; in dsp_cmx_hardware()
558 if (member->dsp->echo.hardware || member->dsp->echo.software) { in dsp_cmx_hardware()
561 "%s dsp %s cannot form a conf, because " in dsp_cmx_hardware()
563 member->dsp->name); in dsp_cmx_hardware()
567 if (member->dsp->tx_mix) { in dsp_cmx_hardware()
570 "%s dsp %s cannot form a conf, because " in dsp_cmx_hardware()
572 __func__, member->dsp->name); in dsp_cmx_hardware()
576 if (member->dsp->tx_volume) { in dsp_cmx_hardware()
579 "%s dsp %s cannot form a conf, because " in dsp_cmx_hardware()
581 __func__, member->dsp->name); in dsp_cmx_hardware()
584 if (member->dsp->rx_volume) { in dsp_cmx_hardware()
587 "%s dsp %s cannot form a conf, because " in dsp_cmx_hardware()
589 __func__, member->dsp->name); in dsp_cmx_hardware()
593 if (member->dsp->tx_data) { in dsp_cmx_hardware()
596 "%s dsp %s tx_data is turned on\n", in dsp_cmx_hardware()
597 __func__, member->dsp->name); in dsp_cmx_hardware()
601 if (member->dsp->pipeline.inuse) { in dsp_cmx_hardware()
604 "%s dsp %s cannot form a conf, because " in dsp_cmx_hardware()
606 member->dsp->name); in dsp_cmx_hardware()
610 if (member->dsp->bf_enable) { in dsp_cmx_hardware()
612 printk(KERN_DEBUG "%s dsp %s cannot form a " in dsp_cmx_hardware()
614 __func__, member->dsp->name); in dsp_cmx_hardware()
618 if (member->dsp->features.pcm_id < 0) { in dsp_cmx_hardware()
621 "%s dsp %s cannot form a conf, because " in dsp_cmx_hardware()
622 "dsp has no PCM bus\n", in dsp_cmx_hardware()
623 __func__, member->dsp->name); in dsp_cmx_hardware()
627 if (member->dsp->features.pcm_id != same_pcm) { in dsp_cmx_hardware()
630 "%s dsp %s cannot form a conf, because " in dsp_cmx_hardware()
631 "dsp is on a different PCM bus than the " in dsp_cmx_hardware()
632 "first dsp\n", in dsp_cmx_hardware()
633 __func__, member->dsp->name); in dsp_cmx_hardware()
637 if (same_hfc != member->dsp->features.hfc_id) in dsp_cmx_hardware()
640 if (current_conf < 0 && member->dsp->hfc_conf >= 0) in dsp_cmx_hardware()
641 current_conf = member->dsp->hfc_conf; in dsp_cmx_hardware()
643 if (member->dsp->hfc_conf < 0) in dsp_cmx_hardware()
658 "because dsp is alone\n", __func__, conf->id); in dsp_cmx_hardware()
663 dsp = member->dsp; in dsp_cmx_hardware()
680 if (member->dsp->hfc_conf >= 0) { in dsp_cmx_hardware()
685 __func__, member->dsp->name, in dsp_cmx_hardware()
686 member->dsp->hfc_conf); in dsp_cmx_hardware()
687 dsp_cmx_hw_message(member->dsp, in dsp_cmx_hardware()
689 member->dsp->hfc_conf = -1; in dsp_cmx_hardware()
691 if (nextm->dsp->hfc_conf >= 0) { in dsp_cmx_hardware()
696 __func__, nextm->dsp->name, in dsp_cmx_hardware()
697 nextm->dsp->hfc_conf); in dsp_cmx_hardware()
698 dsp_cmx_hw_message(nextm->dsp, in dsp_cmx_hardware()
700 nextm->dsp->hfc_conf = -1; in dsp_cmx_hardware()
703 if (member->dsp->features.pcm_banks > 1 && in dsp_cmx_hardware()
704 nextm->dsp->features.pcm_banks > 1 && in dsp_cmx_hardware()
705 member->dsp->features.hfc_id != in dsp_cmx_hardware()
706 nextm->dsp->features.hfc_id) { in dsp_cmx_hardware()
708 if (member->dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
709 member->dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
710 nextm->dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
711 nextm->dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
712 nextm->dsp->pcm_slot_tx == in dsp_cmx_hardware()
713 member->dsp->pcm_slot_rx && in dsp_cmx_hardware()
714 nextm->dsp->pcm_slot_rx == in dsp_cmx_hardware()
715 member->dsp->pcm_slot_tx && in dsp_cmx_hardware()
716 nextm->dsp->pcm_slot_tx == in dsp_cmx_hardware()
717 member->dsp->pcm_slot_tx && in dsp_cmx_hardware()
718 member->dsp->pcm_bank_tx != in dsp_cmx_hardware()
719 member->dsp->pcm_bank_rx && in dsp_cmx_hardware()
720 nextm->dsp->pcm_bank_tx != in dsp_cmx_hardware()
721 nextm->dsp->pcm_bank_rx) { in dsp_cmx_hardware()
725 "%s dsp %s & %s stay joined on " in dsp_cmx_hardware()
729 member->dsp->name, in dsp_cmx_hardware()
730 nextm->dsp->name, in dsp_cmx_hardware()
731 member->dsp->pcm_slot_tx, in dsp_cmx_hardware()
732 member->dsp->pcm_bank_tx, in dsp_cmx_hardware()
733 member->dsp->pcm_bank_rx); in dsp_cmx_hardware()
740 list_for_each_entry(dsp, &dsp_ilist, list) { in dsp_cmx_hardware()
741 if (dsp != member->dsp && in dsp_cmx_hardware()
742 dsp != nextm->dsp && in dsp_cmx_hardware()
743 member->dsp->features.pcm_id == in dsp_cmx_hardware()
744 dsp->features.pcm_id) { in dsp_cmx_hardware()
745 if (dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
746 dsp->pcm_slot_rx < in dsp_cmx_hardware()
748 freeslots[dsp->pcm_slot_rx] = 0; in dsp_cmx_hardware()
749 if (dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
750 dsp->pcm_slot_tx < in dsp_cmx_hardware()
752 freeslots[dsp->pcm_slot_tx] = 0; in dsp_cmx_hardware()
756 ii = member->dsp->features.pcm_slots; in dsp_cmx_hardware()
767 member->dsp->name, in dsp_cmx_hardware()
768 nextm->dsp->name); in dsp_cmx_hardware()
773 member->dsp->pcm_slot_tx = i; in dsp_cmx_hardware()
774 member->dsp->pcm_slot_rx = i; in dsp_cmx_hardware()
775 nextm->dsp->pcm_slot_tx = i; in dsp_cmx_hardware()
776 nextm->dsp->pcm_slot_rx = i; in dsp_cmx_hardware()
777 member->dsp->pcm_bank_rx = 0; in dsp_cmx_hardware()
778 member->dsp->pcm_bank_tx = 1; in dsp_cmx_hardware()
779 nextm->dsp->pcm_bank_rx = 1; in dsp_cmx_hardware()
780 nextm->dsp->pcm_bank_tx = 0; in dsp_cmx_hardware()
787 member->dsp->name, in dsp_cmx_hardware()
788 nextm->dsp->name, in dsp_cmx_hardware()
789 member->dsp->pcm_slot_tx); in dsp_cmx_hardware()
790 dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
791 member->dsp->pcm_slot_tx, member->dsp->pcm_bank_tx, in dsp_cmx_hardware()
792 member->dsp->pcm_slot_rx, member->dsp->pcm_bank_rx); in dsp_cmx_hardware()
793 dsp_cmx_hw_message(nextm->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
794 nextm->dsp->pcm_slot_tx, nextm->dsp->pcm_bank_tx, in dsp_cmx_hardware()
795 nextm->dsp->pcm_slot_rx, nextm->dsp->pcm_bank_rx); in dsp_cmx_hardware()
802 if (member->dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
803 member->dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
804 nextm->dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
805 nextm->dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
806 nextm->dsp->pcm_slot_tx == in dsp_cmx_hardware()
807 member->dsp->pcm_slot_rx && in dsp_cmx_hardware()
808 nextm->dsp->pcm_slot_rx == in dsp_cmx_hardware()
809 member->dsp->pcm_slot_tx && in dsp_cmx_hardware()
810 member->dsp->pcm_slot_tx != in dsp_cmx_hardware()
811 member->dsp->pcm_slot_rx && in dsp_cmx_hardware()
812 member->dsp->pcm_bank_tx == 0 && in dsp_cmx_hardware()
813 member->dsp->pcm_bank_rx == 0 && in dsp_cmx_hardware()
814 nextm->dsp->pcm_bank_tx == 0 && in dsp_cmx_hardware()
815 nextm->dsp->pcm_bank_rx == 0) { in dsp_cmx_hardware()
819 "%s dsp %s & %s stay joined on PCM " in dsp_cmx_hardware()
822 member->dsp->name, in dsp_cmx_hardware()
823 nextm->dsp->name, in dsp_cmx_hardware()
824 member->dsp->pcm_slot_tx, in dsp_cmx_hardware()
825 member->dsp->pcm_slot_rx); in dsp_cmx_hardware()
832 list_for_each_entry(dsp, &dsp_ilist, list) { in dsp_cmx_hardware()
833 if (dsp != member->dsp && in dsp_cmx_hardware()
834 dsp != nextm->dsp && in dsp_cmx_hardware()
835 member->dsp->features.pcm_id == in dsp_cmx_hardware()
836 dsp->features.pcm_id) { in dsp_cmx_hardware()
837 if (dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
838 dsp->pcm_slot_rx < in dsp_cmx_hardware()
840 freeslots[dsp->pcm_slot_rx] = 0; in dsp_cmx_hardware()
841 if (dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
842 dsp->pcm_slot_tx < in dsp_cmx_hardware()
844 freeslots[dsp->pcm_slot_tx] = 0; in dsp_cmx_hardware()
848 ii = member->dsp->features.pcm_slots; in dsp_cmx_hardware()
859 member->dsp->name, in dsp_cmx_hardware()
860 nextm->dsp->name); in dsp_cmx_hardware()
876 member->dsp->name, in dsp_cmx_hardware()
877 nextm->dsp->name); in dsp_cmx_hardware()
882 member->dsp->pcm_slot_tx = i1; in dsp_cmx_hardware()
883 member->dsp->pcm_slot_rx = i2; in dsp_cmx_hardware()
884 nextm->dsp->pcm_slot_tx = i2; in dsp_cmx_hardware()
885 nextm->dsp->pcm_slot_rx = i1; in dsp_cmx_hardware()
886 member->dsp->pcm_bank_rx = 0; in dsp_cmx_hardware()
887 member->dsp->pcm_bank_tx = 0; in dsp_cmx_hardware()
888 nextm->dsp->pcm_bank_rx = 0; in dsp_cmx_hardware()
889 nextm->dsp->pcm_bank_tx = 0; in dsp_cmx_hardware()
896 member->dsp->name, in dsp_cmx_hardware()
897 nextm->dsp->name, in dsp_cmx_hardware()
898 member->dsp->pcm_slot_tx, in dsp_cmx_hardware()
899 member->dsp->pcm_slot_rx); in dsp_cmx_hardware()
900 dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
901 member->dsp->pcm_slot_tx, member->dsp->pcm_bank_tx, in dsp_cmx_hardware()
902 member->dsp->pcm_slot_rx, member->dsp->pcm_bank_rx); in dsp_cmx_hardware()
903 dsp_cmx_hw_message(nextm->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
904 nextm->dsp->pcm_slot_tx, nextm->dsp->pcm_bank_tx, in dsp_cmx_hardware()
905 nextm->dsp->pcm_slot_rx, nextm->dsp->pcm_bank_rx); in dsp_cmx_hardware()
945 if (!member->dsp->features.hfc_conf) in dsp_cmx_hardware()
948 if (member->dsp->hdlc) in dsp_cmx_hardware()
951 if (member->dsp->hfc_conf == current_conf) in dsp_cmx_hardware()
955 list_for_each_entry(dsp, &dsp_ilist, list) { in dsp_cmx_hardware()
961 dsp != member->dsp && in dsp_cmx_hardware()
962 /* dsp must be on the same PCM */ in dsp_cmx_hardware()
963 member->dsp->features.pcm_id == in dsp_cmx_hardware()
964 dsp->features.pcm_id) { in dsp_cmx_hardware()
965 /* dsp must be on a slot */ in dsp_cmx_hardware()
966 if (dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
967 dsp->pcm_slot_tx < in dsp_cmx_hardware()
969 freeslots[dsp->pcm_slot_tx] = 0; in dsp_cmx_hardware()
970 if (dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
971 dsp->pcm_slot_rx < in dsp_cmx_hardware()
973 freeslots[dsp->pcm_slot_rx] = 0; in dsp_cmx_hardware()
977 ii = member->dsp->features.pcm_slots; in dsp_cmx_hardware()
994 "%s changing dsp %s to HW conference " in dsp_cmx_hardware()
996 member->dsp->name, current_conf, i); in dsp_cmx_hardware()
998 member->dsp->pcm_slot_tx = i; in dsp_cmx_hardware()
999 member->dsp->pcm_slot_rx = i; in dsp_cmx_hardware()
1000 member->dsp->pcm_bank_tx = 2; /* loop */ in dsp_cmx_hardware()
1001 member->dsp->pcm_bank_rx = 2; in dsp_cmx_hardware()
1002 member->dsp->hfc_conf = current_conf; in dsp_cmx_hardware()
1003 dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
1005 dsp_cmx_hw_message(member->dsp, in dsp_cmx_hardware()
1017 list_for_each_entry(dsp, &dsp_ilist, list) { in dsp_cmx_hardware()
1018 /* dsp must be on the same chip */ in dsp_cmx_hardware()
1019 if (dsp->features.hfc_id == same_hfc && in dsp_cmx_hardware()
1020 /* dsp must have joined a HW conference */ in dsp_cmx_hardware()
1021 dsp->hfc_conf >= 0 && in dsp_cmx_hardware()
1023 dsp->hfc_conf < 8) in dsp_cmx_hardware()
1024 freeunits[dsp->hfc_conf] = 0; in dsp_cmx_hardware()
1053 dsp_cmx_conf(struct dsp *dsp, u32 conf_id) in dsp_cmx_conf() argument
1060 if (dsp->conf_id == conf_id) in dsp_cmx_conf()
1064 if (dsp->conf_id) { in dsp_cmx_conf()
1067 dsp->conf->id); in dsp_cmx_conf()
1069 conf = dsp->conf; in dsp_cmx_conf()
1070 err = dsp_cmx_del_conf_member(dsp); in dsp_cmx_conf()
1073 dsp->conf_id = 0; in dsp_cmx_conf()
1076 dsp_cmx_hardware(NULL, dsp); in dsp_cmx_conf()
1112 if (dsp->hdlc && !member->dsp->hdlc) { in dsp_cmx_conf()
1118 if (!dsp->hdlc && member->dsp->hdlc) { in dsp_cmx_conf()
1126 err = dsp_cmx_add_conf_member(dsp, conf); in dsp_cmx_conf()
1129 dsp->conf_id = conf_id; in dsp_cmx_conf()
1137 dsp_cmx_hardware(NULL, dsp); in dsp_cmx_conf()
1150 showdelay(struct dsp *dsp, int samples, int delay) in showdelay() argument
1162 printk(KERN_DEBUG "DELAY (%s) %3d >%s\n", dsp->name, delay, in showdelay()
1171 dsp_cmx_receive(struct dsp *dsp, struct sk_buff *skb) in dsp_cmx_receive() argument
1195 if (dsp->rx_init) { in dsp_cmx_receive()
1196 dsp->rx_init = 0; in dsp_cmx_receive()
1197 if (dsp->features.unordered) { in dsp_cmx_receive()
1198 dsp->rx_R = (hh->id & CMX_BUFF_MASK); in dsp_cmx_receive()
1199 if (dsp->cmx_delay) in dsp_cmx_receive()
1200 dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) in dsp_cmx_receive()
1203 dsp->rx_W = (dsp->rx_R + (dsp_poll >> 1)) in dsp_cmx_receive()
1206 dsp->rx_R = 0; in dsp_cmx_receive()
1207 if (dsp->cmx_delay) in dsp_cmx_receive()
1208 dsp->rx_W = dsp->cmx_delay; in dsp_cmx_receive()
1210 dsp->rx_W = dsp_poll >> 1; in dsp_cmx_receive()
1214 if (dsp->features.unordered) { in dsp_cmx_receive()
1215 dsp->rx_W = (hh->id & CMX_BUFF_MASK); in dsp_cmx_receive()
1216 /* printk(KERN_DEBUG "%s %08x\n", dsp->name, hh->id); */ in dsp_cmx_receive()
1222 if (((dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK) >= CMX_BUFF_HALF) { in dsp_cmx_receive()
1225 "cmx_receive(dsp=%lx): UNDERRUN (or overrun the " in dsp_cmx_receive()
1227 "(inst %s)\n", (u_long)dsp, dsp->name); in dsp_cmx_receive()
1229 if (dsp->features.unordered) { in dsp_cmx_receive()
1230 dsp->rx_R = (hh->id & CMX_BUFF_MASK); in dsp_cmx_receive()
1231 if (dsp->cmx_delay) in dsp_cmx_receive()
1232 dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) in dsp_cmx_receive()
1235 dsp->rx_W = (dsp->rx_R + (dsp_poll >> 1)) in dsp_cmx_receive()
1238 dsp->rx_R = 0; in dsp_cmx_receive()
1239 if (dsp->cmx_delay) in dsp_cmx_receive()
1240 dsp->rx_W = dsp->cmx_delay; in dsp_cmx_receive()
1242 dsp->rx_W = dsp_poll >> 1; in dsp_cmx_receive()
1244 memset(dsp->rx_buff, dsp_silence, sizeof(dsp->rx_buff)); in dsp_cmx_receive()
1247 if (dsp->cmx_delay) in dsp_cmx_receive()
1248 if (((dsp->rx_W - dsp->rx_R) & CMX_BUFF_MASK) >= in dsp_cmx_receive()
1249 (dsp->cmx_delay << 1)) { in dsp_cmx_receive()
1252 "cmx_receive(dsp=%lx): OVERRUN (because " in dsp_cmx_receive()
1255 (u_long)dsp, dsp->name); in dsp_cmx_receive()
1257 if (dsp->features.unordered) { in dsp_cmx_receive()
1258 dsp->rx_R = (hh->id & CMX_BUFF_MASK); in dsp_cmx_receive()
1259 dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) in dsp_cmx_receive()
1262 dsp->rx_R = 0; in dsp_cmx_receive()
1263 dsp->rx_W = dsp->cmx_delay; in dsp_cmx_receive()
1265 memset(dsp->rx_buff, dsp_silence, sizeof(dsp->rx_buff)); in dsp_cmx_receive()
1271 "cmx_receive(dsp=%lx): rx_R(dsp)=%05x rx_W(dsp)=%05x len=%d %s\n", in dsp_cmx_receive()
1272 (u_long)dsp, dsp->rx_R, dsp->rx_W, len, dsp->name); in dsp_cmx_receive()
1277 d = dsp->rx_buff; in dsp_cmx_receive()
1278 w = dsp->rx_W; in dsp_cmx_receive()
1287 dsp->rx_W = ((dsp->rx_W + len) & CMX_BUFF_MASK); in dsp_cmx_receive()
1289 showdelay(dsp, len, (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK); in dsp_cmx_receive()
1298 dsp_cmx_send_member(struct dsp *dsp, int len, s32 *c, int members) argument
1300 struct dsp_conf *conf = dsp->conf;
1301 struct dsp *member, *other;
1311 if (!dsp->b_active) { /* if not active */
1312 dsp->last_tx = 0;
1315 if (((dsp->conf && dsp->conf->hardware) || /* hardware conf */
1316 dsp->echo.hardware) && /* OR hardware echo */
1317 dsp->tx_R == dsp->tx_W && /* AND no tx-data */
1318 !(dsp->tone.tone && dsp->tone.software)) { /* AND not soft tones */
1319 if (!dsp->tx_data) { /* no tx_data for user space required */
1320 dsp->last_tx = 0;
1323 if (dsp->conf && dsp->conf->software && dsp->conf->hardware)
1325 if (dsp->echo.software && dsp->echo.hardware)
1331 "SEND members=%d dsp=%s, conf=%p, rx_R=%05x rx_W=%05x\n",
1332 members, dsp->name, conf, dsp->rx_R, dsp->rx_W);
1336 if (dsp->cmx_delay && !dsp->last_tx) {
1353 dsp->last_tx = 1;
1356 member = dsp;
1357 p = dsp->tx_buff; /* transmit data */
1358 q = dsp->rx_buff; /* received data */
1360 t = dsp->tx_R; /* tx-pointers */
1361 tt = dsp->tx_W;
1362 r = dsp->rx_R; /* rx-pointers */
1372 if (dsp->tone.tone && dsp->tone.software) {
1374 dsp_tone_copy(dsp, d, len);
1375 dsp->tx_R = 0; /* clear tx buffer */
1376 dsp->tx_W = 0;
1380 if (!dsp->tx_mix && t != tt) {
1396 dsp->tx_R = t;
1410 if (!dsp->echo.software) {
1439 dsp->tx_R = t;
1450 struct dsp_conf_member, list))->dsp;
1453 struct dsp_conf_member, list))->dsp;
1460 if (!dsp->echo.software) {
1500 dsp->tx_R = t;
1505 if (!dsp->echo.software) {
1560 dsp->tx_R = t;
1568 if (dsp->tx_data) {
1573 skb_queue_tail(&dsp->sendq, nskb);
1574 schedule_work(&dsp->workq);
1589 skb_queue_tail(&dsp->sendq, txskb);
1596 if (dsp->tx_volume)
1597 dsp_change_volume(nskb, dsp->tx_volume);
1599 if (dsp->pipeline.inuse)
1600 dsp_pipeline_process_tx(&dsp->pipeline, nskb->data,
1603 if (dsp->bf_enable)
1604 dsp_bf_encrypt(dsp, nskb->data, nskb->len);
1606 skb_queue_tail(&dsp->sendq, nskb);
1607 schedule_work(&dsp->workq);
1621 struct dsp *dsp; local
1657 list_for_each_entry(dsp, &dsp_ilist, list) {
1658 if (dsp->hdlc)
1660 conf = dsp->conf;
1675 dsp_cmx_send_member(dsp, length, mixbuffer, members);
1696 if (member->dsp->hdlc)
1701 dsp = member->dsp;
1704 q = dsp->rx_buff;
1705 r = dsp->rx_R;
1717 dsp_cmx_send_member(member->dsp, length,
1724 list_for_each_entry(dsp, &dsp_ilist, list) {
1725 if (dsp->hdlc)
1727 p = dsp->rx_buff;
1728 q = dsp->tx_buff;
1729 r = dsp->rx_R;
1731 if (!dsp->rx_is_off) {
1739 dsp->rx_R = r; /* write incremented read pointer */
1743 delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK;
1747 if (delay < dsp->rx_delay[0])
1748 dsp->rx_delay[0] = delay;
1750 delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK;
1754 if (delay < dsp->tx_delay[0])
1755 dsp->tx_delay[0] = delay;
1758 delay = dsp->rx_delay[0];
1761 if (delay > dsp->rx_delay[i])
1762 delay = dsp->rx_delay[i];
1770 if (delay > dsp_poll && !dsp->cmx_delay) {
1774 " dsp %s are now removed.\n",
1776 dsp->name);
1777 r = dsp->rx_R;
1786 dsp->rx_R = r;
1790 delay = dsp->tx_delay[0];
1793 if (delay > dsp->tx_delay[i])
1794 delay = dsp->tx_delay[i];
1801 if (delay > dsp_poll && dsp->tx_dejitter) {
1805 " dsp %s are now removed.\n",
1807 dsp->name);
1808 r = dsp->tx_R;
1817 dsp->tx_R = r;
1823 dsp->rx_delay[i] = dsp->rx_delay[i - 1];
1824 dsp->tx_delay[i] = dsp->tx_delay[i - 1];
1827 dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
1828 dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
1846 * audio data is transmitted from upper layer to the dsp
1849 dsp_cmx_transmit(struct dsp *dsp, struct sk_buff *skb) argument
1859 w = dsp->tx_W;
1860 ww = dsp->tx_R;
1861 p = dsp->tx_buff;
1875 dsp->tx_W = ww;
1879 "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n",
1880 (u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name);
1905 dsp_cmx_hdlc(struct dsp *dsp, struct sk_buff *skb) argument
1912 if (!dsp->b_active)
1920 if (!dsp->conf) {
1922 if (dsp->echo.software) {
1928 skb_queue_tail(&dsp->sendq, nskb);
1929 schedule_work(&dsp->workq);
1935 if (dsp->conf->hardware)
1937 list_for_each_entry(member, &dsp->conf->mlist, list) {
1938 if (dsp->echo.software || member->dsp != dsp) {
1944 skb_queue_tail(&member->dsp->sendq, nskb);
1945 schedule_work(&member->dsp->workq);