• Home
  • Raw
  • Download

Lines Matching +full:multi +full:- +full:tt

20  * There are 3 different solutions: -1 = software, 0 = hardware-crossconnect
21 * 1-n = hardware-conference. The n will give the conference number.
39 * - Crossconnecting or even conference, if more than two members are together.
40 * - Force mixing of transmit data with other crossconnect/conference members.
41 * - Echo generation to benchmark the delay of audio processing.
42 * - Use hardware to minimize cpu load, disable FIFO load and minimize delay.
43 * - Dejittering and clock generation.
48 * RX-Buffer
51 * ----------------+-------------+-------------------
53 * The rx-buffer is a ring buffer used to store the received data for each
56 * The transmit-clock (R) will read the buffer.
57 * If the clock overruns the write-pointer, we will have a buffer underrun.
58 * If the write pointer always has a certain distance from the transmit-
63 * TX-Buffer
66 * -----------------+--------+-----------------------
68 * The tx-buffer is a ring buffer to queue the transmit data from user space
82 * - has multiple clocks.
83 * - has no usable clock due to jitter or packet loss (VoIP).
89 * - If a member joins, its rx_buff is set to silence and change read pointer
103 * Changing rx-volume is done before the data is crossconnected. The tx-volume
108 * the card. It will replace the tx-data from the user space.
112 * Disable rx-data:
119 * used if not forbidden by control command. Disabling rx-data provides
120 * absolutely traffic free audio processing. (except for the quick 1-frame
134 * debugging of multi party conference,
141 /*#define CMX_DELAY_DEBUG * gives rx-buffer delay overview */
142 /*#define CMX_TX_DEBUG * massive read/write on tx-buffer with content */
165 printk(KERN_DEBUG "-----Current DSP\n"); in dsp_cmx_debug()
168 odsp->name, odsp->echo.hardware, odsp->echo.software, in dsp_cmx_debug()
169 odsp->tx_mix); in dsp_cmx_debug()
170 if (odsp->conf) in dsp_cmx_debug()
171 printk(" (Conf %d)", odsp->conf->id); in dsp_cmx_debug()
176 printk(KERN_DEBUG "-----Current Conf:\n"); in dsp_cmx_debug()
178 printk(KERN_DEBUG "* Conf %d (%p)\n", conf->id, conf); in dsp_cmx_debug()
179 list_for_each_entry(member, &conf->mlist, list) { in dsp_cmx_debug()
181 " - member = %s (slot_tx %d, bank_tx %d, " in dsp_cmx_debug()
184 member->dsp->name, member->dsp->pcm_slot_tx, in dsp_cmx_debug()
185 member->dsp->pcm_bank_tx, member->dsp->pcm_slot_rx, in dsp_cmx_debug()
186 member->dsp->pcm_bank_rx, member->dsp->hfc_conf, in dsp_cmx_debug()
187 member->dsp->tx_data, member->dsp->rx_is_off, in dsp_cmx_debug()
188 (member->dsp == dsp) ? " *this*" : ""); in dsp_cmx_debug()
191 printk(KERN_DEBUG "-----end\n"); in dsp_cmx_debug()
209 if (conf->id == id) in dsp_cmx_search_conf()
226 return -EINVAL; in dsp_cmx_add_conf_member()
228 if (dsp->member) { in dsp_cmx_add_conf_member()
231 return -EINVAL; in dsp_cmx_add_conf_member()
234 if (dsp->conf) { in dsp_cmx_add_conf_member()
237 return -EINVAL; in dsp_cmx_add_conf_member()
243 return -ENOMEM; in dsp_cmx_add_conf_member()
245 member->dsp = dsp; in dsp_cmx_add_conf_member()
247 memset(dsp->rx_buff, dsp_silence, sizeof(dsp->rx_buff)); in dsp_cmx_add_conf_member()
248 dsp->rx_init = 1; /* rx_W and rx_R will be adjusted on first frame */ in dsp_cmx_add_conf_member()
249 dsp->rx_W = 0; in dsp_cmx_add_conf_member()
250 dsp->rx_R = 0; in dsp_cmx_add_conf_member()
252 list_add_tail(&member->list, &conf->mlist); in dsp_cmx_add_conf_member()
254 dsp->conf = conf; in dsp_cmx_add_conf_member()
255 dsp->member = member; in dsp_cmx_add_conf_member()
272 return -EINVAL; in dsp_cmx_del_conf_member()
275 if (!dsp->conf) { in dsp_cmx_del_conf_member()
278 return -EINVAL; in dsp_cmx_del_conf_member()
281 if (list_empty(&dsp->conf->mlist)) { in dsp_cmx_del_conf_member()
284 return -EINVAL; in dsp_cmx_del_conf_member()
288 list_for_each_entry(member, &dsp->conf->mlist, list) { in dsp_cmx_del_conf_member()
289 if (member->dsp == dsp) { in dsp_cmx_del_conf_member()
290 list_del(&member->list); in dsp_cmx_del_conf_member()
291 dsp->conf = NULL; in dsp_cmx_del_conf_member()
292 dsp->member = NULL; in dsp_cmx_del_conf_member()
301 return -EINVAL; in dsp_cmx_del_conf_member()
324 INIT_LIST_HEAD(&conf->mlist); in dsp_cmx_new_conf()
325 conf->id = id; in dsp_cmx_new_conf()
327 list_add_tail(&conf->list, &conf_ilist); in dsp_cmx_new_conf()
342 return -EINVAL; in dsp_cmx_del_conf()
345 if (!list_empty(&conf->mlist)) { in dsp_cmx_del_conf()
348 return -EINVAL; in dsp_cmx_del_conf()
350 list_del(&conf->list); in dsp_cmx_del_conf()
370 if (dsp->ch.peer) in dsp_cmx_hw_message()
371 dsp->ch.peer->ctrl(dsp->ch.peer, CONTROL_CHANNEL, &cq); in dsp_cmx_hw_message()
391 int same_hfc = -1, same_pcm = -1, current_conf = -1, in dsp_cmx_hardware()
400 __func__, dsp->name); in dsp_cmx_hardware()
403 if (dsp->hfc_conf >= 0) { in dsp_cmx_hardware()
408 dsp->name, dsp->hfc_conf); in dsp_cmx_hardware()
411 dsp->hfc_conf = -1; in dsp_cmx_hardware()
414 if (dsp->features.pcm_banks < 1) in dsp_cmx_hardware()
416 if (!dsp->echo.software && !dsp->echo.hardware) { in dsp_cmx_hardware()
418 if (dsp->pcm_slot_tx >= 0 || dsp->pcm_slot_rx >= 0) { in dsp_cmx_hardware()
423 __func__, dsp->name, in dsp_cmx_hardware()
424 dsp->pcm_slot_tx, dsp->pcm_slot_rx); in dsp_cmx_hardware()
427 dsp->pcm_slot_tx = -1; in dsp_cmx_hardware()
428 dsp->pcm_bank_tx = -1; in dsp_cmx_hardware()
429 dsp->pcm_slot_rx = -1; in dsp_cmx_hardware()
430 dsp->pcm_bank_rx = -1; in dsp_cmx_hardware()
435 dsp->echo.software = dsp->tx_data; in dsp_cmx_hardware()
436 dsp->echo.hardware = 0; in dsp_cmx_hardware()
438 if (dsp->pcm_slot_tx >= 0 && dsp->pcm_slot_rx < 0 && in dsp_cmx_hardware()
439 dsp->pcm_bank_tx == 2 && dsp->pcm_bank_rx == 2) { in dsp_cmx_hardware()
440 dsp->echo.hardware = 1; in dsp_cmx_hardware()
444 if (dsp->pcm_slot_tx >= 0) { in dsp_cmx_hardware()
445 dsp->pcm_slot_rx = dsp->pcm_slot_tx; in dsp_cmx_hardware()
446 dsp->pcm_bank_tx = 2; /* 2 means loop */ in dsp_cmx_hardware()
447 dsp->pcm_bank_rx = 2; in dsp_cmx_hardware()
451 __func__, dsp->name, in dsp_cmx_hardware()
452 dsp->pcm_slot_tx); in dsp_cmx_hardware()
454 dsp->pcm_slot_tx, 2, dsp->pcm_slot_rx, 2); in dsp_cmx_hardware()
455 dsp->echo.hardware = 1; in dsp_cmx_hardware()
459 dsp->pcm_slot_tx = -1; in dsp_cmx_hardware()
460 dsp->pcm_slot_rx = -1; in dsp_cmx_hardware()
463 if (finddsp->features.pcm_id == dsp->features.pcm_id) { in dsp_cmx_hardware()
464 if (finddsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
465 finddsp->pcm_slot_rx < sizeof(freeslots)) in dsp_cmx_hardware()
466 freeslots[finddsp->pcm_slot_rx] = 0; in dsp_cmx_hardware()
467 if (finddsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
468 finddsp->pcm_slot_tx < sizeof(freeslots)) in dsp_cmx_hardware()
469 freeslots[finddsp->pcm_slot_tx] = 0; in dsp_cmx_hardware()
473 ii = dsp->features.pcm_slots; in dsp_cmx_hardware()
485 dsp->echo.software = 1; in dsp_cmx_hardware()
489 dsp->pcm_slot_tx = i; in dsp_cmx_hardware()
490 dsp->pcm_slot_rx = i; in dsp_cmx_hardware()
491 dsp->pcm_bank_tx = 2; /* loop */ in dsp_cmx_hardware()
492 dsp->pcm_bank_rx = 2; in dsp_cmx_hardware()
496 __func__, dsp->name, dsp->pcm_slot_tx); in dsp_cmx_hardware()
498 dsp->pcm_slot_tx, 2, dsp->pcm_slot_rx, 2); in dsp_cmx_hardware()
499 dsp->echo.hardware = 1; in dsp_cmx_hardware()
506 __func__, conf->id); in dsp_cmx_hardware()
508 if (list_empty(&conf->mlist)) { in dsp_cmx_hardware()
513 member = list_entry(conf->mlist.next, struct dsp_conf_member, list); in dsp_cmx_hardware()
514 same_hfc = member->dsp->features.hfc_id; in dsp_cmx_hardware()
515 same_pcm = member->dsp->features.pcm_id; in dsp_cmx_hardware()
517 list_for_each_entry(member, &conf->mlist, list) { in dsp_cmx_hardware()
519 if (member->dsp->tx_mix) { in dsp_cmx_hardware()
524 member->dsp->name); in dsp_cmx_hardware()
526 list_for_each_entry(member, &conf->mlist, list) { in dsp_cmx_hardware()
527 dsp = member->dsp; in dsp_cmx_hardware()
529 if (dsp->hfc_conf >= 0) { in dsp_cmx_hardware()
536 dsp->name, in dsp_cmx_hardware()
537 dsp->hfc_conf); in dsp_cmx_hardware()
541 dsp->hfc_conf = -1; in dsp_cmx_hardware()
544 if (dsp->pcm_slot_tx >= 0 || in dsp_cmx_hardware()
545 dsp->pcm_slot_rx >= 0) { in dsp_cmx_hardware()
552 dsp->name, in dsp_cmx_hardware()
553 dsp->pcm_slot_tx, in dsp_cmx_hardware()
554 dsp->pcm_slot_rx); in dsp_cmx_hardware()
558 dsp->pcm_slot_tx = -1; in dsp_cmx_hardware()
559 dsp->pcm_bank_tx = -1; in dsp_cmx_hardware()
560 dsp->pcm_slot_rx = -1; in dsp_cmx_hardware()
561 dsp->pcm_bank_rx = -1; in dsp_cmx_hardware()
564 conf->hardware = 0; in dsp_cmx_hardware()
565 conf->software = 1; in dsp_cmx_hardware()
569 if (member->dsp->echo.hardware || member->dsp->echo.software) { in dsp_cmx_hardware()
574 member->dsp->name); in dsp_cmx_hardware()
578 if (member->dsp->tx_mix) { in dsp_cmx_hardware()
583 __func__, member->dsp->name); in dsp_cmx_hardware()
587 if (member->dsp->tx_volume) { in dsp_cmx_hardware()
592 __func__, member->dsp->name); in dsp_cmx_hardware()
595 if (member->dsp->rx_volume) { in dsp_cmx_hardware()
600 __func__, member->dsp->name); in dsp_cmx_hardware()
603 /* check if tx-data turned on */ in dsp_cmx_hardware()
604 if (member->dsp->tx_data) { in dsp_cmx_hardware()
608 __func__, member->dsp->name); in dsp_cmx_hardware()
612 if (member->dsp->pipeline.inuse) { in dsp_cmx_hardware()
617 member->dsp->name); in dsp_cmx_hardware()
621 if (member->dsp->bf_enable) { in dsp_cmx_hardware()
625 __func__, member->dsp->name); in dsp_cmx_hardware()
629 if (member->dsp->features.pcm_id < 0) { in dsp_cmx_hardware()
634 __func__, member->dsp->name); in dsp_cmx_hardware()
638 if (member->dsp->features.pcm_id != same_pcm) { in dsp_cmx_hardware()
644 __func__, member->dsp->name); in dsp_cmx_hardware()
648 if (same_hfc != member->dsp->features.hfc_id) in dsp_cmx_hardware()
649 same_hfc = -1; in dsp_cmx_hardware()
651 if (current_conf < 0 && member->dsp->hfc_conf >= 0) in dsp_cmx_hardware()
652 current_conf = member->dsp->hfc_conf; in dsp_cmx_hardware()
654 if (member->dsp->hfc_conf < 0) in dsp_cmx_hardware()
669 "because dsp is alone\n", __func__, conf->id); in dsp_cmx_hardware()
670 conf->hardware = 0; in dsp_cmx_hardware()
671 conf->software = 0; in dsp_cmx_hardware()
672 member = list_entry(conf->mlist.next, struct dsp_conf_member, in dsp_cmx_hardware()
674 dsp = member->dsp; in dsp_cmx_hardware()
686 member = list_entry(conf->mlist.next, struct dsp_conf_member, in dsp_cmx_hardware()
688 nextm = list_entry(member->list.next, struct dsp_conf_member, in dsp_cmx_hardware()
691 if (member->dsp->hfc_conf >= 0) { in dsp_cmx_hardware()
696 __func__, member->dsp->name, in dsp_cmx_hardware()
697 member->dsp->hfc_conf); in dsp_cmx_hardware()
698 dsp_cmx_hw_message(member->dsp, in dsp_cmx_hardware()
700 member->dsp->hfc_conf = -1; in dsp_cmx_hardware()
702 if (nextm->dsp->hfc_conf >= 0) { in dsp_cmx_hardware()
707 __func__, nextm->dsp->name, in dsp_cmx_hardware()
708 nextm->dsp->hfc_conf); in dsp_cmx_hardware()
709 dsp_cmx_hw_message(nextm->dsp, in dsp_cmx_hardware()
711 nextm->dsp->hfc_conf = -1; in dsp_cmx_hardware()
714 if (member->dsp->features.pcm_banks > 1 && in dsp_cmx_hardware()
715 nextm->dsp->features.pcm_banks > 1 && in dsp_cmx_hardware()
716 member->dsp->features.hfc_id != in dsp_cmx_hardware()
717 nextm->dsp->features.hfc_id) { in dsp_cmx_hardware()
719 if (member->dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
720 member->dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
721 nextm->dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
722 nextm->dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
723 nextm->dsp->pcm_slot_tx == in dsp_cmx_hardware()
724 member->dsp->pcm_slot_rx && in dsp_cmx_hardware()
725 nextm->dsp->pcm_slot_rx == in dsp_cmx_hardware()
726 member->dsp->pcm_slot_tx && in dsp_cmx_hardware()
727 nextm->dsp->pcm_slot_tx == in dsp_cmx_hardware()
728 member->dsp->pcm_slot_tx && in dsp_cmx_hardware()
729 member->dsp->pcm_bank_tx != in dsp_cmx_hardware()
730 member->dsp->pcm_bank_rx && in dsp_cmx_hardware()
731 nextm->dsp->pcm_bank_tx != in dsp_cmx_hardware()
732 nextm->dsp->pcm_bank_rx) { in dsp_cmx_hardware()
740 member->dsp->name, in dsp_cmx_hardware()
741 nextm->dsp->name, in dsp_cmx_hardware()
742 member->dsp->pcm_slot_tx, in dsp_cmx_hardware()
743 member->dsp->pcm_bank_tx, in dsp_cmx_hardware()
744 member->dsp->pcm_bank_rx); in dsp_cmx_hardware()
745 conf->hardware = 1; in dsp_cmx_hardware()
746 conf->software = tx_data; in dsp_cmx_hardware()
752 if (dsp != member->dsp && in dsp_cmx_hardware()
753 dsp != nextm->dsp && in dsp_cmx_hardware()
754 member->dsp->features.pcm_id == in dsp_cmx_hardware()
755 dsp->features.pcm_id) { in dsp_cmx_hardware()
756 if (dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
757 dsp->pcm_slot_rx < in dsp_cmx_hardware()
759 freeslots[dsp->pcm_slot_rx] = 0; in dsp_cmx_hardware()
760 if (dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
761 dsp->pcm_slot_tx < in dsp_cmx_hardware()
763 freeslots[dsp->pcm_slot_tx] = 0; in dsp_cmx_hardware()
767 ii = member->dsp->features.pcm_slots; in dsp_cmx_hardware()
778 member->dsp->name, in dsp_cmx_hardware()
779 nextm->dsp->name); in dsp_cmx_hardware()
784 member->dsp->pcm_slot_tx = i; in dsp_cmx_hardware()
785 member->dsp->pcm_slot_rx = i; in dsp_cmx_hardware()
786 nextm->dsp->pcm_slot_tx = i; in dsp_cmx_hardware()
787 nextm->dsp->pcm_slot_rx = i; in dsp_cmx_hardware()
788 member->dsp->pcm_bank_rx = 0; in dsp_cmx_hardware()
789 member->dsp->pcm_bank_tx = 1; in dsp_cmx_hardware()
790 nextm->dsp->pcm_bank_rx = 1; in dsp_cmx_hardware()
791 nextm->dsp->pcm_bank_tx = 0; in dsp_cmx_hardware()
798 member->dsp->name, in dsp_cmx_hardware()
799 nextm->dsp->name, in dsp_cmx_hardware()
800 member->dsp->pcm_slot_tx); in dsp_cmx_hardware()
801 dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
802 member->dsp->pcm_slot_tx, member->dsp->pcm_bank_tx, in dsp_cmx_hardware()
803 member->dsp->pcm_slot_rx, member->dsp->pcm_bank_rx); in dsp_cmx_hardware()
804 dsp_cmx_hw_message(nextm->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
805 nextm->dsp->pcm_slot_tx, nextm->dsp->pcm_bank_tx, in dsp_cmx_hardware()
806 nextm->dsp->pcm_slot_rx, nextm->dsp->pcm_bank_rx); in dsp_cmx_hardware()
807 conf->hardware = 1; in dsp_cmx_hardware()
808 conf->software = tx_data; in dsp_cmx_hardware()
813 if (member->dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
814 member->dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
815 nextm->dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
816 nextm->dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
817 nextm->dsp->pcm_slot_tx == in dsp_cmx_hardware()
818 member->dsp->pcm_slot_rx && in dsp_cmx_hardware()
819 nextm->dsp->pcm_slot_rx == in dsp_cmx_hardware()
820 member->dsp->pcm_slot_tx && in dsp_cmx_hardware()
821 member->dsp->pcm_slot_tx != in dsp_cmx_hardware()
822 member->dsp->pcm_slot_rx && in dsp_cmx_hardware()
823 member->dsp->pcm_bank_tx == 0 && in dsp_cmx_hardware()
824 member->dsp->pcm_bank_rx == 0 && in dsp_cmx_hardware()
825 nextm->dsp->pcm_bank_tx == 0 && in dsp_cmx_hardware()
826 nextm->dsp->pcm_bank_rx == 0) { in dsp_cmx_hardware()
833 member->dsp->name, in dsp_cmx_hardware()
834 nextm->dsp->name, in dsp_cmx_hardware()
835 member->dsp->pcm_slot_tx, in dsp_cmx_hardware()
836 member->dsp->pcm_slot_rx); in dsp_cmx_hardware()
837 conf->hardware = 1; in dsp_cmx_hardware()
838 conf->software = tx_data; in dsp_cmx_hardware()
844 if (dsp != member->dsp && in dsp_cmx_hardware()
845 dsp != nextm->dsp && in dsp_cmx_hardware()
846 member->dsp->features.pcm_id == in dsp_cmx_hardware()
847 dsp->features.pcm_id) { in dsp_cmx_hardware()
848 if (dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
849 dsp->pcm_slot_rx < in dsp_cmx_hardware()
851 freeslots[dsp->pcm_slot_rx] = 0; in dsp_cmx_hardware()
852 if (dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
853 dsp->pcm_slot_tx < in dsp_cmx_hardware()
855 freeslots[dsp->pcm_slot_tx] = 0; in dsp_cmx_hardware()
859 ii = member->dsp->features.pcm_slots; in dsp_cmx_hardware()
870 member->dsp->name, in dsp_cmx_hardware()
871 nextm->dsp->name); in dsp_cmx_hardware()
887 member->dsp->name, in dsp_cmx_hardware()
888 nextm->dsp->name); in dsp_cmx_hardware()
893 member->dsp->pcm_slot_tx = i1; in dsp_cmx_hardware()
894 member->dsp->pcm_slot_rx = i2; in dsp_cmx_hardware()
895 nextm->dsp->pcm_slot_tx = i2; in dsp_cmx_hardware()
896 nextm->dsp->pcm_slot_rx = i1; in dsp_cmx_hardware()
897 member->dsp->pcm_bank_rx = 0; in dsp_cmx_hardware()
898 member->dsp->pcm_bank_tx = 0; in dsp_cmx_hardware()
899 nextm->dsp->pcm_bank_rx = 0; in dsp_cmx_hardware()
900 nextm->dsp->pcm_bank_tx = 0; in dsp_cmx_hardware()
907 member->dsp->name, in dsp_cmx_hardware()
908 nextm->dsp->name, in dsp_cmx_hardware()
909 member->dsp->pcm_slot_tx, in dsp_cmx_hardware()
910 member->dsp->pcm_slot_rx); in dsp_cmx_hardware()
911 dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
912 member->dsp->pcm_slot_tx, member->dsp->pcm_bank_tx, in dsp_cmx_hardware()
913 member->dsp->pcm_slot_rx, member->dsp->pcm_bank_rx); in dsp_cmx_hardware()
914 dsp_cmx_hw_message(nextm->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
915 nextm->dsp->pcm_slot_tx, nextm->dsp->pcm_bank_tx, in dsp_cmx_hardware()
916 nextm->dsp->pcm_slot_rx, nextm->dsp->pcm_bank_rx); in dsp_cmx_hardware()
917 conf->hardware = 1; in dsp_cmx_hardware()
918 conf->software = tx_data; in dsp_cmx_hardware()
935 __func__, conf->id); in dsp_cmx_hardware()
943 conf->hardware = 1; in dsp_cmx_hardware()
944 conf->software = tx_data; in dsp_cmx_hardware()
953 list_for_each_entry(member, &conf->mlist, list) { in dsp_cmx_hardware()
956 if (!member->dsp->features.hfc_conf) in dsp_cmx_hardware()
959 if (member->dsp->hdlc) in dsp_cmx_hardware()
962 if (member->dsp->hfc_conf == current_conf) in dsp_cmx_hardware()
972 dsp != member->dsp && in dsp_cmx_hardware()
974 member->dsp->features.pcm_id == in dsp_cmx_hardware()
975 dsp->features.pcm_id) { in dsp_cmx_hardware()
977 if (dsp->pcm_slot_tx >= 0 && in dsp_cmx_hardware()
978 dsp->pcm_slot_tx < in dsp_cmx_hardware()
980 freeslots[dsp->pcm_slot_tx] = 0; in dsp_cmx_hardware()
981 if (dsp->pcm_slot_rx >= 0 && in dsp_cmx_hardware()
982 dsp->pcm_slot_rx < in dsp_cmx_hardware()
984 freeslots[dsp->pcm_slot_rx] = 0; in dsp_cmx_hardware()
988 ii = member->dsp->features.pcm_slots; in dsp_cmx_hardware()
1000 __func__, conf->id); in dsp_cmx_hardware()
1007 member->dsp->name, current_conf, i); in dsp_cmx_hardware()
1009 member->dsp->pcm_slot_tx = i; in dsp_cmx_hardware()
1010 member->dsp->pcm_slot_rx = i; in dsp_cmx_hardware()
1011 member->dsp->pcm_bank_tx = 2; /* loop */ in dsp_cmx_hardware()
1012 member->dsp->pcm_bank_rx = 2; in dsp_cmx_hardware()
1013 member->dsp->hfc_conf = current_conf; in dsp_cmx_hardware()
1014 dsp_cmx_hw_message(member->dsp, MISDN_CTRL_HFC_PCM_CONN, in dsp_cmx_hardware()
1016 dsp_cmx_hw_message(member->dsp, in dsp_cmx_hardware()
1019 conf->hardware = 1; in dsp_cmx_hardware()
1020 conf->software = tx_data; in dsp_cmx_hardware()
1030 if (dsp->features.hfc_id == same_hfc && in dsp_cmx_hardware()
1032 dsp->hfc_conf >= 0 && in dsp_cmx_hardware()
1034 dsp->hfc_conf < 8) in dsp_cmx_hardware()
1035 freeunits[dsp->hfc_conf] = 0; in dsp_cmx_hardware()
1050 __func__, conf->id); in dsp_cmx_hardware()
1071 if (dsp->conf_id == conf_id) in dsp_cmx_conf()
1075 if (dsp->conf_id) { in dsp_cmx_conf()
1078 dsp->conf->id); in dsp_cmx_conf()
1080 conf = dsp->conf; in dsp_cmx_conf()
1084 dsp->conf_id = 0; in dsp_cmx_conf()
1090 if (list_empty(&conf->mlist)) { in dsp_cmx_conf()
1119 return -EINVAL; in dsp_cmx_conf()
1120 } else if (!list_empty(&conf->mlist)) { in dsp_cmx_conf()
1121 member = list_entry(conf->mlist.next, struct dsp_conf_member, in dsp_cmx_conf()
1123 if (dsp->hdlc && !member->dsp->hdlc) { in dsp_cmx_conf()
1127 return -EINVAL; in dsp_cmx_conf()
1129 if (!dsp->hdlc && member->dsp->hdlc) { in dsp_cmx_conf()
1133 return -EINVAL; in dsp_cmx_conf()
1140 dsp->conf_id = conf_id; in dsp_cmx_conf()
1143 if (list_empty(&conf->mlist)) { in dsp_cmx_conf()
1163 char bar[] = "--------------------------------------------------|"; in showdelay()
1173 printk(KERN_DEBUG "DELAY (%s) %3d >%s\n", dsp->name, delay, in showdelay()
1174 sdelay > 50 ? "..." : bar + 50 - sdelay); in showdelay()
1185 int len = skb->len; in dsp_cmx_receive()
1203 * initialize pointers if not already - in dsp_cmx_receive()
1206 if (dsp->rx_init) { in dsp_cmx_receive()
1207 dsp->rx_init = 0; in dsp_cmx_receive()
1208 if (dsp->features.unordered) { in dsp_cmx_receive()
1209 dsp->rx_R = (hh->id & CMX_BUFF_MASK); in dsp_cmx_receive()
1210 if (dsp->cmx_delay) in dsp_cmx_receive()
1211 dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) in dsp_cmx_receive()
1214 dsp->rx_W = (dsp->rx_R + (dsp_poll >> 1)) in dsp_cmx_receive()
1217 dsp->rx_R = 0; in dsp_cmx_receive()
1218 if (dsp->cmx_delay) in dsp_cmx_receive()
1219 dsp->rx_W = dsp->cmx_delay; in dsp_cmx_receive()
1221 dsp->rx_W = dsp_poll >> 1; in dsp_cmx_receive()
1225 if (dsp->features.unordered) { in dsp_cmx_receive()
1226 dsp->rx_W = (hh->id & CMX_BUFF_MASK); in dsp_cmx_receive()
1227 /* printk(KERN_DEBUG "%s %08x\n", dsp->name, hh->id); */ in dsp_cmx_receive()
1233 if (((dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK) >= CMX_BUFF_HALF) { in dsp_cmx_receive()
1238 "(inst %s)\n", (u_long)dsp, dsp->name); in dsp_cmx_receive()
1240 if (dsp->features.unordered) { in dsp_cmx_receive()
1241 dsp->rx_R = (hh->id & CMX_BUFF_MASK); in dsp_cmx_receive()
1242 if (dsp->cmx_delay) in dsp_cmx_receive()
1243 dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) in dsp_cmx_receive()
1246 dsp->rx_W = (dsp->rx_R + (dsp_poll >> 1)) in dsp_cmx_receive()
1249 dsp->rx_R = 0; in dsp_cmx_receive()
1250 if (dsp->cmx_delay) in dsp_cmx_receive()
1251 dsp->rx_W = dsp->cmx_delay; in dsp_cmx_receive()
1253 dsp->rx_W = dsp_poll >> 1; in dsp_cmx_receive()
1255 memset(dsp->rx_buff, dsp_silence, sizeof(dsp->rx_buff)); in dsp_cmx_receive()
1258 if (dsp->cmx_delay) in dsp_cmx_receive()
1259 if (((dsp->rx_W - dsp->rx_R) & CMX_BUFF_MASK) >= in dsp_cmx_receive()
1260 (dsp->cmx_delay << 1)) { in dsp_cmx_receive()
1266 (u_long)dsp, dsp->name); in dsp_cmx_receive()
1268 if (dsp->features.unordered) { in dsp_cmx_receive()
1269 dsp->rx_R = (hh->id & CMX_BUFF_MASK); in dsp_cmx_receive()
1270 dsp->rx_W = (dsp->rx_R + dsp->cmx_delay) in dsp_cmx_receive()
1273 dsp->rx_R = 0; in dsp_cmx_receive()
1274 dsp->rx_W = dsp->cmx_delay; in dsp_cmx_receive()
1276 memset(dsp->rx_buff, dsp_silence, sizeof(dsp->rx_buff)); in dsp_cmx_receive()
1283 (u_long)dsp, dsp->rx_R, dsp->rx_W, len, dsp->name); in dsp_cmx_receive()
1287 p = skb->data; in dsp_cmx_receive()
1288 d = dsp->rx_buff; in dsp_cmx_receive()
1289 w = dsp->rx_W; in dsp_cmx_receive()
1297 /* increase write-pointer */ in dsp_cmx_receive()
1298 dsp->rx_W = ((dsp->rx_W + len) & CMX_BUFF_MASK); in dsp_cmx_receive()
1300 showdelay(dsp, len, (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK); in dsp_cmx_receive()
1311 struct dsp_conf *conf = dsp->conf;
1316 int r, rr, t, tt, o_r, o_rr; local
1322 if (!dsp->b_active) { /* if not active */
1323 dsp->last_tx = 0;
1326 if (((dsp->conf && dsp->conf->hardware) || /* hardware conf */
1327 dsp->echo.hardware) && /* OR hardware echo */
1328 dsp->tx_R == dsp->tx_W && /* AND no tx-data */
1329 !(dsp->tone.tone && dsp->tone.software)) { /* AND not soft tones */
1330 if (!dsp->tx_data) { /* no tx_data for user space required */
1331 dsp->last_tx = 0;
1334 if (dsp->conf && dsp->conf->software && dsp->conf->hardware)
1336 if (dsp->echo.software && dsp->echo.hardware)
1343 members, dsp->name, conf, dsp->rx_R, dsp->rx_W);
1347 if (dsp->cmx_delay && !dsp->last_tx) {
1362 hh->prim = PH_DATA_REQ;
1363 hh->id = 0;
1364 dsp->last_tx = 1;
1368 p = dsp->tx_buff; /* transmit data */
1369 q = dsp->rx_buff; /* received data */
1371 t = dsp->tx_R; /* tx-pointers */
1372 tt = dsp->tx_W;
1373 r = dsp->rx_R; /* rx-pointers */
1382 /* PROCESS TONES/TX-DATA ONLY */
1383 if (dsp->tone.tone && dsp->tone.software) {
1384 /* -> copy tone */
1386 dsp->tx_R = 0; /* clear tx buffer */
1387 dsp->tx_W = 0;
1390 /* if we have tx-data but do not use mixing */
1391 if (!dsp->tx_mix && t != tt) {
1392 /* -> send tx-data and continue when not enough */
1394 sprintf(debugbuf, "TX sending (%04x-%04x)%p: ", t, tt, p);
1396 while (r != rr && t != tt) {
1407 dsp->tx_R = t;
1420 /* -> if echo is NOT enabled */
1421 if (!dsp->echo.software) {
1422 /* -> send tx-data if available or use 0-volume */
1423 while (r != rr && t != tt) {
1432 memset(d, dsp_silence, (rr - r) & CMX_BUFF_MASK);
1434 /* -> if echo is enabled */
1437 * -> mix tx-data with echo if available,
1440 while (r != rr && t != tt) {
1450 dsp->tx_R = t;
1460 other = (list_entry(conf->mlist.next,
1461 struct dsp_conf_member, list))->dsp;
1463 other = (list_entry(conf->mlist.prev,
1464 struct dsp_conf_member, list))->dsp;
1465 o_q = other->rx_buff; /* received data */
1466 o_rr = (other->rx_R + len) & CMX_BUFF_MASK;
1467 /* end of rx-pointer */
1468 o_r = (o_rr - rr + r) & CMX_BUFF_MASK;
1469 /* start rx-pointer at current read position*/
1470 /* -> if echo is NOT enabled */
1471 if (!dsp->echo.software) {
1473 * -> copy other member's rx-data,
1474 * if tx-data is available, mix
1476 while (o_r != o_rr && t != tt) {
1485 /* -> if echo is enabled */
1488 * -> mix other member's rx-data with echo,
1489 * if tx-data is available, mix
1491 while (r != rr && t != tt) {
1495 if (sample < -32768)
1496 sample = -32768;
1500 /* tx-data + rx_data + echo */
1511 dsp->tx_R = t;
1515 /* -> if echo is NOT enabled */
1516 if (!dsp->echo.software) {
1518 * -> subtract rx-data from conf-data,
1519 * if tx-data is available, mix
1521 while (r != rr && t != tt) {
1522 sample = dsp_audio_law_to_s32[p[t]] + *c++ -
1524 if (sample < -32768)
1525 sample = -32768;
1529 /* conf-rx+tx */
1534 sample = *c++ - dsp_audio_law_to_s32[q[r]];
1535 if (sample < -32768)
1536 sample = -32768;
1540 /* conf-rx */
1543 /* -> if echo is enabled */
1546 * -> encode conf-data, if tx-data
1549 while (r != rr && t != tt) {
1551 if (sample < -32768)
1552 sample = -32768;
1562 if (sample < -32768)
1563 sample = -32768;
1571 dsp->tx_R = t;
1576 * send tx-data if enabled - don't filter,
1579 if (dsp->tx_data) {
1581 hh->prim = DL_DATA_REQ;
1582 hh->id = 0;
1584 skb_queue_tail(&dsp->sendq, nskb);
1585 schedule_work(&dsp->workq);
1596 thh->prim = DL_DATA_REQ;
1597 thh->id = 0;
1598 skb_put_data(txskb, nskb->data + preload, len);
1600 skb_queue_tail(&dsp->sendq, txskb);
1607 if (dsp->tx_volume)
1608 dsp_change_volume(nskb, dsp->tx_volume);
1610 if (dsp->pipeline.inuse)
1611 dsp_pipeline_process_tx(&dsp->pipeline, nskb->data,
1612 nskb->len);
1614 if (dsp->bf_enable)
1615 dsp_bf_encrypt(dsp, nskb->data, nskb->len);
1617 skb_queue_tail(&dsp->sendq, nskb);
1618 schedule_work(&dsp->workq);
1651 length = count - dsp_count;
1663 jittercount -= 8000;
1669 if (dsp->hdlc)
1671 conf = dsp->conf;
1675 members = count_list_member(&conf->mlist);
1677 if (conf->software && members > 1)
1679 if (conf->software && members > 2)
1690 * potential null-pointer-bug
1698 members = count_list_member(&conf->mlist);
1700 if (conf->software && members > 1) {
1702 if (conf->software && members > 2) {
1705 member = list_entry(conf->mlist.next,
1707 if (member->dsp->hdlc)
1711 list_for_each_entry(member, &conf->mlist, list) {
1712 dsp = member->dsp;
1715 q = dsp->rx_buff;
1716 r = dsp->rx_R;
1726 list_for_each_entry(member, &conf->mlist, list) {
1728 dsp_cmx_send_member(member->dsp, length,
1734 /* delete rx-data, increment buffers, change pointers */
1736 if (dsp->hdlc)
1738 p = dsp->rx_buff;
1739 q = dsp->tx_buff;
1740 r = dsp->rx_R;
1742 if (!dsp->rx_is_off) {
1744 /* delete rx-data */
1749 /* increment rx-buffer pointer */
1750 dsp->rx_R = r; /* write incremented read pointer */
1754 delay = (dsp->rx_W-dsp->rx_R) & CMX_BUFF_MASK;
1758 if (delay < dsp->rx_delay[0])
1759 dsp->rx_delay[0] = delay;
1761 delay = (dsp->tx_W-dsp->tx_R) & CMX_BUFF_MASK;
1765 if (delay < dsp->tx_delay[0])
1766 dsp->tx_delay[0] = delay;
1769 delay = dsp->rx_delay[0];
1772 if (delay > dsp->rx_delay[i])
1773 delay = dsp->rx_delay[i];
1781 if (delay > dsp_poll && !dsp->cmx_delay) {
1787 dsp->name);
1788 r = dsp->rx_R;
1789 rr = (r + delay - (dsp_poll >> 1))
1791 /* delete rx-data */
1796 /* increment rx-buffer pointer */
1797 dsp->rx_R = r;
1801 delay = dsp->tx_delay[0];
1804 if (delay > dsp->tx_delay[i])
1805 delay = dsp->tx_delay[i];
1812 if (delay > dsp_poll && dsp->tx_dejitter) {
1818 dsp->name);
1819 r = dsp->tx_R;
1820 rr = (r + delay - (dsp_poll >> 1))
1822 /* delete tx-data */
1827 /* increment rx-buffer pointer */
1828 dsp->tx_R = r;
1832 i = MAX_SECONDS_JITTER_CHECK - 1;
1834 dsp->rx_delay[i] = dsp->rx_delay[i - 1];
1835 dsp->tx_delay[i] = dsp->tx_delay[i - 1];
1836 i--;
1838 dsp->tx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
1839 dsp->rx_delay[0] = CMX_BUFF_HALF; /* (infinite) delay */
1844 if ((s32)(dsp_spl_jiffies + dsp_tics-jiffies) <= 0)
1864 int space; /* todo: , l = skb->len; */
1870 w = dsp->tx_W;
1871 ww = dsp->tx_R;
1872 p = dsp->tx_buff;
1873 d = skb->data;
1874 space = (ww - w - 1) & CMX_BUFF_MASK;
1875 /* write-pointer should not overrun nor reach read pointer */
1876 if (space < skb->len) {
1878 ww = (ww - 1) & CMX_BUFF_MASK; /* end one byte prior tx_R */
1880 printk(KERN_DEBUG "%s: TX overflow space=%d skb->len="
1882 skb->len, w, ww);
1885 ww = (w + skb->len) & CMX_BUFF_MASK;
1886 dsp->tx_W = ww;
1890 "cmx_transmit(dsp=%lx) %d bytes to 0x%x-0x%x. %s\n",
1891 (u_long)dsp, (ww - w) & CMX_BUFF_MASK, w, ww, dsp->name);
1894 /* copy transmit data to tx-buffer */
1896 sprintf(debugbuf, "TX getting (%04x-%04x)%p: ", w, ww, p);
1923 if (!dsp->b_active)
1927 if (skb->len < 1)
1931 if (!dsp->conf) {
1933 if (dsp->echo.software) {
1937 hh->prim = PH_DATA_REQ;
1938 hh->id = 0;
1939 skb_queue_tail(&dsp->sendq, nskb);
1940 schedule_work(&dsp->workq);
1946 if (dsp->conf->hardware)
1948 list_for_each_entry(member, &dsp->conf->mlist, list) {
1949 if (dsp->echo.software || member->dsp != dsp) {
1953 hh->prim = PH_DATA_REQ;
1954 hh->id = 0;
1955 skb_queue_tail(&member->dsp->sendq, nskb);
1956 schedule_work(&member->dsp->workq);