summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-05-04 03:20:08 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-05-04 03:20:08 +0000
commit89e2d0efedc95e1717c37c57a0cef6316a21b4cd (patch)
tree8f04d4b10ce3ef10f289d6fa1f12ae8d7a556980
parentf7d84bc12d8ecf566ba67545344573ffd0954e54 (diff)
Add RBS support to DACS (bug #1451)
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@384 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rwxr-xr-xwct4xxp.c2
-rwxr-xr-xzaptel.c22
-rwxr-xr-xzaptel.conf.sample4
-rwxr-xr-xzaptel.h5
-rwxr-xr-xztcfg.c17
5 files changed, 40 insertions, 10 deletions
diff --git a/wct4xxp.c b/wct4xxp.c
index b02a471..70bb126 100755
--- a/wct4xxp.c
+++ b/wct4xxp.c
@@ -583,7 +583,7 @@ static void init_spans(struct t4 *wc)
struct zt_chan *mychans = wc->chans[x] + y;
sprintf(mychans->name, "TE4/%d/%d/%d", wc->num, x + 1, y + 1);
mychans->sigcap = ZT_SIG_EM | ZT_SIG_CLEAR | ZT_SIG_FXSLS | ZT_SIG_FXSGS | ZT_SIG_FXSKS |
- ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | ZT_SIG_EM_E1;
+ ZT_SIG_FXOLS | ZT_SIG_FXOGS | ZT_SIG_FXOKS | ZT_SIG_CAS | ZT_SIG_EM_E1 | ZT_SIG_DACS_RBS;
c = (x * wc->spans[x].channels) + y;
mychans->pvt = wc;
mychans->chanpos = y + 1;
diff --git a/zaptel.c b/zaptel.c
index 69c4af5..f57fe01 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -422,6 +422,8 @@ static char *sigstr(int sig)
return "CAS";
case ZT_SIG_DACS:
return "DACS";
+ case ZT_SIG_DACS_RBS:
+ return "DACS+RBS";
case ZT_SIG_SF:
return "SF (ToneOnly)";
case ZT_SIG_NONE:
@@ -906,7 +908,7 @@ static void close_channel(struct zt_chan *chan)
oldconf = chan->confna;
/* initialize conference variables */
chan->_confn = 0;
- if ((chan->sig & ZT_SIG_DACS) != ZT_SIG_DACS) {
+ if ((chan->sig & __ZT_SIG_DACS) != __ZT_SIG_DACS) {
chan->confna = 0;
chan->confmode = 0;
}
@@ -1970,7 +1972,7 @@ static int initialize_channel(struct zt_chan *chan)
chan->iomask = 0;
/* release conference resource if any */
if (chan->confna) zt_check_conf(chan->confna);
- if ((chan->sig & ZT_SIG_DACS) != ZT_SIG_DACS) {
+ if ((chan->sig & __ZT_SIG_DACS) != __ZT_SIG_DACS) {
chan->confna = 0;
chan->confmode = 0;
}
@@ -2085,7 +2087,7 @@ 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)
+ else if ((chans[unit]->sig & __ZT_SIG_DACS) == __ZT_SIG_DACS)
res = -EBUSY;
else {
/* Assume everything is going to be okay */
@@ -2929,7 +2931,7 @@ 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) {
+ } else if ((ch.sigtype & __ZT_SIG_DACS) == __ZT_SIG_DACS) {
newmaster = chans[ch.chan];
if ((ch.idlebits < 1) || (ch.idlebits >= ZT_MAX_CHANNELS))
return -EINVAL;
@@ -3003,7 +3005,7 @@ 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) {
+ 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;
@@ -5766,6 +5768,16 @@ int zt_transmit(struct zt_span *span)
__zt_real_transmit(&span->chans[x]);
}
}
+ if (span->chans[x].sig == ZT_SIG_DACS_RBS) {
+ if (chans[span->chans[x].confna]) {
+ /* Just set bits for our destination */
+ if (span->chans[x].txsig != chans[span->chans[x].confna]->rxsig) {
+ span->chans[x].txsig = chans[span->chans[x].confna]->rxsig;
+ span->rbsbits(&span->chans[x], chans[span->chans[x].confna]->rxsig);
+ }
+ }
+ }
+
}
spin_unlock_irqrestore(&span->chans[x].lock, flags);
}
diff --git a/zaptel.conf.sample b/zaptel.conf.sample
index 35a4539..71d3aea 100755
--- a/zaptel.conf.sample
+++ b/zaptel.conf.sample
@@ -87,6 +87,9 @@
# sethdlc (available separately).
# "dacs" : The zaptel driver cross connects the channels starting at
# the channel number listed at the end, after a colon
+# "dacsrbs" : The zaptel driver cross connects the channels starting at
+# the channel number listed at the end, after a colon and
+# also performs the DACSing of RBS bits
#
# The channel list is a comma-separated list of channels or ranges, for
# example:
@@ -113,6 +116,7 @@
#clear=47
#fcshdlc=48
#dacs=1-24:48
+#dacsrbs=1-24:48
#
# Finally, you can preload some tone zones, to prevent them from getting
# overwritten by other users (if you allow non-root users to open /dev/zap/*
diff --git a/zaptel.h b/zaptel.h
index 9e2350e..76a92d7 100755
--- a/zaptel.h
+++ b/zaptel.h
@@ -93,6 +93,8 @@
/* The following are all variations on clear channel */
+#define __ZT_SIG_DACS (1 << 16)
+
#define ZT_SIG_CLEAR (1 << 7) /* Clear channel */
#define ZT_SIG_HDLCRAW ((1 << 8) | ZT_SIG_CLEAR) /* Raw unchecked HDLC */
#define ZT_SIG_HDLCFCS ((1 << 9) | ZT_SIG_HDLCRAW) /* HDLC with FCS calculation */
@@ -100,8 +102,9 @@
#define ZT_SIG_SLAVE (1 << 11) /* Slave to another channel */
#define ZT_SIG_SF (1 << 14) /* Single Freq. tone only, no sig bits */
#define ZT_SIG_CAS (1 << 15) /* Just get bits */
-#define ZT_SIG_DACS ((1 << 16) | ZT_SIG_CLEAR) /* Cross connect */
+#define ZT_SIG_DACS (__ZT_SIG_DACS | ZT_SIG_CLEAR) /* Cross connect */
#define ZT_SIG_EM_E1 (1 << 17) /* E1 E&M Variation */
+#define ZT_SIG_DACS_RBS ((1 << 18) | __ZT_SIG_DACS) /* Cross connect w/ RBS */
/* tone flag values */
#define ZT_REVERSE_RXTONE 1 /* reverse polarity rx tone logic */
diff --git a/ztcfg.c b/ztcfg.c
index 13160e9..8005c3f 100755
--- a/ztcfg.c
+++ b/ztcfg.c
@@ -376,7 +376,7 @@ static int chanconfig(char *keyword, char *args)
bzero(chans, sizeof(chans));
strtok(args, ":");
idle = strtok(NULL, ":");
- if (!strcasecmp(keyword, "dacs")) {
+ if (!strcasecmp(keyword, "dacs") || !strcasecmp(keyword, "dacsrbs")) {
res = parse_channel(idle, &dacschan);
}
if (!res)
@@ -389,7 +389,7 @@ static int chanconfig(char *keyword, char *args)
error("Channel %d already configured as '%s' at line %d\n", x, sig[x], slineno[x]);
continue;
}
- if (!strcasecmp(keyword, "dacs") && slineno[dacschan]) {
+ if ((!strcasecmp(keyword, "dacs") || !strcasecmp(keyword, "dacsrbs")) && slineno[dacschan]) {
error("DACS Destination channel %d already configured as '%s' at line %d\n", dacschan, sig[dacschan], slineno[dacschan]);
continue;
} else {
@@ -439,6 +439,16 @@ static int chanconfig(char *keyword, char *args)
cc[dacschan].sigtype = ZT_SIG_DACS;
sig[dacschan] = "DACS";
dacschan++;
+ } else if (!strcasecmp(keyword, "dacsrbs")) {
+ /* Setup channel for monitor */
+ cc[x].idlebits = dacschan;
+ cc[x].sigtype = ZT_SIG_DACS_RBS;
+ sig[x] = "DACS w/ RBS";
+ /* Setup inverse */
+ cc[dacschan].idlebits = x;
+ cc[dacschan].sigtype = ZT_SIG_DACS_RBS;
+ sig[dacschan] = "DACS w/ RBS";
+ dacschan++;
} else if (!strcasecmp(keyword, "unused")) {
sig[x] = "Unused";
cc[x].sigtype = 0;
@@ -574,7 +584,7 @@ static void printconfig()
if ((cc[x].sigtype != ZT_SIG_SLAVE) && (cc[x].sigtype)) {
configs++;
ps = 0;
- if (cc[x].sigtype == ZT_SIG_DACS)
+ if ((cc[x].sigtype & __ZT_SIG_DACS) == __ZT_SIG_DACS)
printf("Channel %02d %s to %02d", x, sig[x], cc[x].idlebits);
else {
printf("Channel %02d: %s (%s)", x, sig[x], laws[cc[x].deflaw]);
@@ -620,6 +630,7 @@ static struct handler {
{ "unused", chanconfig },
{ "cas", chanconfig },
{ "dacs", chanconfig },
+ { "dacsrbs", chanconfig },
{ "user", chanconfig },
{ "alaw", setlaw },
{ "mulaw", setlaw },