160 #include <linux/module.h>
165 static const char *mISDN_dsp_revision =
"2.0";
170 static int dtmfthreshold = 100;
190 dsp_rx_off_member(
struct dsp *
dsp)
195 memset(&cq, 0,
sizeof(cq));
204 else if (dsp->
dtmf.software)
207 else if (dsp->
echo.software)
210 else if (dsp->
conf && dsp->
conf->software)
234 __func__, dsp->
name, rx_off);
237 dsp_rx_off(
struct dsp *
dsp)
246 dsp_rx_off_member(dsp);
251 dsp_rx_off_member(member->
dsp);
257 dsp_fill_empty(
struct dsp *dsp)
261 memset(&cq, 0,
sizeof(cq));
279 __func__, dsp->
name);
291 if (skb->
len <
sizeof(
int))
293 cont = *((
int *)skb->
data);
294 len = skb->
len -
sizeof(
int);
295 data = skb->
data +
sizeof(
int);
305 if (len ==
sizeof(
int)) {
308 "to %d\n", *((
int *)data));
309 dsp->
dtmf.treshold = (*(
int *)data) * 10000;
311 dsp->
dtmf.enable = 1;
322 dsp->
dtmf.enable = 0;
323 dsp->
dtmf.hardware = 0;
324 dsp->
dtmf.software = 0;
327 if (len <
sizeof(
int)) {
331 if (*((
u32 *)data) == 0)
335 __func__, *((
u32 *)data));
357 if (len <
sizeof(
int)) {
363 __func__, *((
int *)skb->
data));
364 ret =
dsp_tone(dsp, *((
int *)data));
392 if (len <
sizeof(
int)) {
409 if (len <
sizeof(
int)) {
422 dsp->
echo.software = 1;
431 dsp->
echo.software = 0;
432 dsp->
echo.hardware = 0;
443 "space\n", __func__);
450 "user space\n", __func__);
461 "tx-data with conf mebers\n", __func__);
475 "tx-data with conf mebers\n", __func__);
506 if (len <
sizeof(
int)) {
518 "compensate jitter (%d samples)\n",
530 "compensate jitter\n", __func__);
540 "buffer\n", __func__);
550 "dejittering\n", __func__);
557 if (len > 0 && ((
char *)data)[len - 1]) {
559 "is not NULL terminated!\n", __func__);
565 len > 0 ? data :
NULL);
575 if (len < 4 || len > 56) {
581 "not shown)\n", __func__);
593 if (dsp->
up->send(dsp->
up, nskb))
626 get_features(
struct mISDNchannel *ch)
637 memset(&cq, 0,
sizeof(cq));
660 __func__, dsp->
name);
664 dsp_function(
struct mISDNchannel *ch,
struct sk_buff *skb)
672 hh = mISDN_HEAD_P(skb);
682 spin_unlock_irqrestore(&dsp_lock, flags);
695 __func__, dsp->
name);
701 spin_unlock_irqrestore(&dsp_lock, flags);
708 return dsp->
up->send(dsp->
up, skb);
725 if (dsp->
dtmf.software) {
730 if (dsp->
conf && dsp->
conf->software) {
735 spin_unlock_irqrestore(&dsp_lock, flags);
744 "(%c) to layer %s\n",
745 __func__, *digits, dsp->
name);
767 return dsp->
up->send(dsp->
up, skb);
772 "received: %x (len %d) %s\n", __func__,
776 if (!dsp->
dtmf.hardware) {
779 "coefficients from HFC\n",
790 "(%c) to layer %s\n",
791 __func__, *digits, dsp->
name);
808 if (skb->
len !=
sizeof(
int)) {
820 spin_unlock_irqrestore(&dsp_lock, flags);
825 "%s\n", __func__, hh->
id, dsp->
name);
833 __func__, dsp->
name);
846 spin_unlock_irqrestore(&dsp_lock, flags);
849 "confirm to user space. %s\n", __func__,
854 return dsp->
up->send(dsp->
up, skb);
860 __func__, dsp->
name);
867 spin_unlock_irqrestore(&dsp_lock, flags);
870 return dsp->
up->send(dsp->
up, skb);
889 spin_unlock_irqrestore(&dsp_lock, flags);
893 if (!dsp->
tone.tone) {
896 spin_unlock_irqrestore(&dsp_lock, flags);
901 ret = dsp_control_req(dsp, hh, skb);
902 spin_unlock_irqrestore(&dsp_lock, flags);
908 __func__, dsp->
name);
909 if (dsp->
dtmf.hardware || dsp->
dtmf.software)
918 return ch->recv(ch->peer, skb);
924 __func__, dsp->
name);
927 dsp->
tone.hardware = 0;
928 dsp->
tone.software = 0;
929 if (timer_pending(&dsp->
tone.tl))
935 spin_unlock_irqrestore(&dsp_lock, flags);
938 return ch->recv(ch->peer, skb);
952 dsp_ctrl(
struct mISDNchannel *ch,
u_int cmd,
void *
arg)
973 spin_unlock_irqrestore(&dsp_lock, flags);
977 if (timer_pending(&dsp->
tone.tl))
982 __func__, dsp->
name);
990 __func__, dsp->
name);
992 spin_unlock_irqrestore(&dsp_lock, flags);
1020 "no bug!\n", __func__, dsp->
name);
1025 hh = mISDN_HEAD_P(skb);
1029 if (dsp->
up->send(dsp->
up, skb))
1037 if (dsp->
ch.recv(dsp->
ch.peer, skb)) {
1048 dspcreate(
struct channel_req *crq)
1056 ndsp =
vzalloc(
sizeof(
struct dsp));
1066 skb_queue_head_init(&ndsp->
sendq);
1067 ndsp->
ch.send = dsp_function;
1068 ndsp->
ch.ctrl = dsp_ctrl;
1070 crq->ch = &ndsp->
ch;
1083 ndsp->
up->st->dev->id + 1, ndsp);
1097 if (dtmfthreshold < 20 || dtmfthreshold > 500)
1098 dtmfthreshold = 200;
1099 ndsp->
dtmf.treshold = dtmfthreshold * 10000;
1105 spin_unlock_irqrestore(&dsp_lock, flags);
1111 static struct Bprotocol
DSP = {
1118 static int __init dsp_init(
void)
1146 "samples (0,125 ms). It is not a multiple of "
1147 "%d HZ.\n",
poll, HZ);
1154 tics = (
poll *
HZ) / 8000;
1155 if (tics * 8000 ==
poll *
HZ) {
1166 "clock that equals exactly the duration of 8-256 "
1167 "samples. (Choose kernel clock speed like 100, 250, "
1172 printk(
KERN_INFO "mISDN_dsp: DSP clocks every %d samples. This equals "
1194 "error(%d)\n", err);
1216 static void __exit dsp_cleanup(
void)
1229 "all memory freed.\n");