diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2003-10-30 23:17:02 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2003-10-30 23:17:02 +0000 |
commit | 5de5efa71b183106b059157e4024d1e7bb434857 (patch) | |
tree | f7206ab483b5077b0f9faca16c017e0cd2eab18c /zaptel.c | |
parent | 3e29b66d03ecccd8ce6c4f95d75a47afc603aa23 (diff) |
Add DACS functionality to zaptel for cross connecting channels
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@262 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rwxr-xr-x | zaptel.c | 39 |
1 files changed, 32 insertions, 7 deletions
@@ -398,6 +398,8 @@ static char *sigstr(int sig) return "Slave"; case ZT_SIG_CAS: return "CAS"; + case ZT_SIG_DACS: + return "DACS"; case ZT_SIG_SF: return "SF (ToneOnly)"; case ZT_SIG_NONE: @@ -882,8 +884,10 @@ static void close_channel(struct zt_chan *chan) oldconf = chan->confna; /* initialize conference variables */ chan->_confn = 0; - chan->confna = 0; - chan->confmode = 0; + if ((chan->sig & ZT_SIG_DACS) != ZT_SIG_DACS) { + chan->confna = 0; + chan->confmode = 0; + } chan->confmute = 0; /* release conference resource, if any to release */ if (oldconf) zt_check_conf(oldconf); @@ -1848,9 +1852,11 @@ static int initialize_channel(struct zt_chan *chan) chan->iomask = 0; /* release conference resource if any */ if (chan->confna) zt_check_conf(chan->confna); - chan->confna = 0; + if ((chan->sig & ZT_SIG_DACS) != ZT_SIG_DACS) { + chan->confna = 0; + chan->confmode = 0; + } chan->_confn = 0; - chan->confmode = 0; memset(chan->conflast, 0, sizeof(chan->conflast)); memset(chan->conflast1, 0, sizeof(chan->conflast1)); memset(chan->conflast2, 0, sizeof(chan->conflast2)); @@ -1957,6 +1963,8 @@ static int zt_specchan_open(struct inode *inode, struct file *file, int unit, in res = -EBUSY; else if (chans[unit]->master != chans[unit]) res = -EBUSY; + else if (chans[unit]->sig == ZT_SIG_DACS) + res = -EBUSY; else { /* Assume everything is going to be okay */ res = initialize_channel(chans[unit]); @@ -2744,6 +2752,12 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd return -EINVAL; ch.sigtype = chans[ch.master]->sig; newmaster = chans[ch.master]; + } else if (ch.sigtype == ZT_SIG_DACS) { + newmaster = chans[ch.chan]; + if ((ch.idlebits < 1) || (ch.idlebits >= ZT_MAX_CHANNELS)) + return -EINVAL; + if (!chans[ch.idlebits]) + return -EINVAL; } else { newmaster = chans[ch.chan]; } @@ -2771,7 +2785,7 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd /* If they support clear channel, then they support the HDLC and such through us. */ if (sigcap & ZT_SIG_CLEAR) - sigcap |= (ZT_SIG_HDLCRAW | ZT_SIG_HDLCFCS | ZT_SIG_HDLCNET); + sigcap |= (ZT_SIG_HDLCRAW | ZT_SIG_HDLCFCS | ZT_SIG_HDLCNET | ZT_SIG_DACS); if ((sigcap & ch.sigtype) != ch.sigtype) res = -EINVAL; @@ -2812,6 +2826,11 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd /* Clear FCS flag */ chans[ch.chan]->flags &= ~ZT_FLAG_FCS; } + if ((ch.sigtype & ZT_SIG_DACS) == ZT_SIG_DACS) { + /* Setup conference properly */ + chans[ch.chan]->confmode = ZT_CONF_DIGITALMON; + chans[ch.chan]->confna = ch.idlebits; + } chans[ch.chan]->master = newmaster; /* Note new slave if we are not our own master */ if (newmaster != chans[ch.chan]) { @@ -4262,6 +4281,12 @@ static inline void __zt_process_getaudio_chunk(struct zt_chan *ss, unsigned char txb[x] = ZT_LIN2X(getlin[x], ms); break; case ZT_CONF_DIGITALMON: + { static int blah = 0; + if (blah++ < 64) { + printk("Got here channel %d, from %d\n", + ms->channo, ms->confna); + } + } /* Real digital monitoring, but still echo cancel if desired */ if (chans[ms->confna]->flags & ZT_FLAG_PSEUDO) { if (ms->ec) { @@ -5386,7 +5411,7 @@ static void __zt_transmit_chunk(struct zt_chan *chan, unsigned char *buf) buf = silly; __zt_getbuf_chunk(chan, buf); - if (chan->flags & ZT_FLAG_AUDIO) { + if ((chan->flags & ZT_FLAG_AUDIO) || (chan->confmode)) { #ifdef CONFIG_ZAPTEL_MMX zt_kernel_fpu_begin(); #endif @@ -5463,7 +5488,7 @@ static void __zt_receive_chunk(struct zt_chan *chan, unsigned char *buf) memset(waste, ZT_LIN2X(0, chan), sizeof(waste)); buf = waste; } - if (chan->flags & ZT_FLAG_AUDIO) { + if ((chan->flags & ZT_FLAG_AUDIO) || (chan->confmode)) { #ifdef CONFIG_ZAPTEL_MMX zt_kernel_fpu_begin(); #endif |