summaryrefslogtreecommitdiff
path: root/ztcfg.c
diff options
context:
space:
mode:
authorjdixon <jdixon@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-06-08 03:13:26 +0000
committerjdixon <jdixon@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-06-08 03:13:26 +0000
commitd9cb775ec511c48066fe6c55ba7169ce1e986886 (patch)
tree8efb59dd730677650aa62d8cfe352b0e7eb49a50 /ztcfg.c
parent2bb5dbf3f891ab4df75214429262f5b588c7ebbb (diff)
Added support for QRV radio daughterboard (in wctdm24xxp) and fixed compile
warning in pciradio. git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1108 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'ztcfg.c')
-rw-r--r--ztcfg.c203
1 files changed, 149 insertions, 54 deletions
diff --git a/ztcfg.c b/ztcfg.c
index 660f28e..230ec8d 100644
--- a/ztcfg.c
+++ b/ztcfg.c
@@ -56,6 +56,7 @@ static char *filename=CONFIG_FILENAME;
int rxtones[NUM_TONES + 1],rxtags[NUM_TONES + 1],txtones[NUM_TONES + 1];
int bursttime = 0, debouncetime = 0, invertcor = 0, exttone = 0, corthresh = 0;
+int txgain = 0, rxgain = 0, deemp = 0, preemp = 0;
int corthreshes[] = {3125,6250,9375,12500,15625,18750,21875,25000,0} ;
@@ -177,6 +178,10 @@ static void clear_fields()
debouncetime = 0;
invertcor = 0;
exttone = 0;
+ txgain = 0;
+ rxgain = 0;
+ deemp = 0;
+ preemp = 0;
}
static int error(char *fmt, ...)
@@ -783,6 +788,86 @@ int burst_time(char *keyword, char *args)
return 0;
}
+int tx_gain(char *keyword, char *args)
+{
+ static char *realargs[10];
+ int argc;
+ int res;
+ int val;
+ argc = res = parseargs(args, realargs, 1, ',');
+ if (res != 1) {
+ error("Incorrect number of arguments to 'txgain' (should be <value>)\n");
+ }
+ res = sscanf(realargs[0], "%d", &val);
+ if (res != 1) {
+ error("Invalid value '%s', should be a number > 0.\n", realargs[0]);
+ }
+
+ txgain = val;
+ return 0;
+}
+
+int rx_gain(char *keyword, char *args)
+{
+ static char *realargs[10];
+ int argc;
+ int res;
+ int val;
+ argc = res = parseargs(args, realargs, 1, ',');
+ if (res != 1) {
+ error("Incorrect number of arguments to 'rxgain' (should be <value>)\n");
+ }
+ res = sscanf(realargs[0], "%d", &val);
+ if (res != 1) {
+ error("Invalid value '%s', should be a number > 0.\n", realargs[0]);
+ }
+
+ rxgain = val;
+ return 0;
+}
+
+int de_emp(char *keyword, char *args)
+{
+ static char *realargs[10];
+ int argc;
+ int res;
+ int val;
+ argc = res = parseargs(args, realargs, 1, ',');
+ if (res != 1) {
+ error("Incorrect number of arguments to 'de-emp' (should be <value>)\n");
+ }
+ res = sscanf(realargs[0], "%d", &val);
+ if ((res == 1) && (val < 1))
+ res = -1;
+ if (res != 1) {
+ error("Invalid value '%s', should be a number > 0.\n", realargs[0]);
+ }
+
+ deemp = val;
+ return 0;
+}
+
+int pre_emp(char *keyword, char *args)
+{
+ static char *realargs[10];
+ int argc;
+ int res;
+ int val;
+ argc = res = parseargs(args, realargs, 1, ',');
+ if (res != 1) {
+ error("Incorrect number of arguments to 'pre_emp' (should be <value>)\n");
+ }
+ res = sscanf(realargs[0], "%d", &val);
+ if ((res == 1) && (val < 1))
+ res = -1;
+ if (res != 1) {
+ error("Invalid value '%s', should be a number > 0.\n", realargs[0]);
+ }
+
+ preemp = val;
+ return 0;
+}
+
int invert_cor(char *keyword, char *args)
{
static char *realargs[10];
@@ -934,55 +1019,57 @@ static int rad_chanconfig(char *keyword, char *args)
if (chans[x]) {
p.radpar = ZT_RADPAR_NUMTONES;
if (ind_ioctl(x,fd,ZT_RADIO_GETPARAM,&p) == -1)
- error("Cannot get number of tones for channel %d\n",x);
- n = p.data;
- p.radpar = ZT_RADPAR_INITTONE;
- if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
- error("Cannot init tones for channel %d\n",x);
- if (!rxtones[0]) for(i = 1; i <= n; i++)
+ n = 0; else n = p.data;
+ if (n)
{
- if (rxtones[i])
- {
- p.radpar = ZT_RADPAR_RXTONE;
- p.index = i;
- p.data = rxtones[i];
- if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
- error("Cannot set rxtone on channel %d\n",x);
- }
- if (rxtags[i])
+ p.radpar = ZT_RADPAR_INITTONE;
+ if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
+ error("Cannot init tones for channel %d\n",x);
+ if (!rxtones[0]) for(i = 1; i <= n; i++)
{
- p.radpar = ZT_RADPAR_RXTONECLASS;
- p.index = i;
- p.data = rxtags[i];
- if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
- error("Cannot set rxtag on channel %d\n",x);
+ if (rxtones[i])
+ {
+ p.radpar = ZT_RADPAR_RXTONE;
+ p.index = i;
+ p.data = rxtones[i];
+ if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
+ error("Cannot set rxtone on channel %d\n",x);
+ }
+ if (rxtags[i])
+ {
+ p.radpar = ZT_RADPAR_RXTONECLASS;
+ p.index = i;
+ p.data = rxtags[i];
+ if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
+ error("Cannot set rxtag on channel %d\n",x);
+ }
+ if (txtones[i])
+ {
+ p.radpar = ZT_RADPAR_TXTONE;
+ p.index = i;
+ p.data = txtones[i];
+ if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
+ error("Cannot set txtone on channel %d\n",x);
+ }
+ } else { /* if we may have DCS receive */
+ if (rxtones[0])
+ {
+ p.radpar = ZT_RADPAR_RXTONE;
+ p.index = 0;
+ p.data = rxtones[0];
+ if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
+ error("Cannot set DCS rxtone on channel %d\n",x);
+ }
}
- if (txtones[i])
+ if (txtones[0])
{
p.radpar = ZT_RADPAR_TXTONE;
- p.index = i;
- p.data = txtones[i];
- if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
- error("Cannot set txtone on channel %d\n",x);
- }
- } else { /* if we may have DCS receive */
- if (rxtones[0])
- {
- p.radpar = ZT_RADPAR_RXTONE;
p.index = 0;
- p.data = rxtones[0];
+ p.data = txtones[0];
if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
- error("Cannot set DCS rxtone on channel %d\n",x);
+ error("Cannot set default txtone on channel %d\n",x);
}
}
- if (txtones[0])
- {
- p.radpar = ZT_RADPAR_TXTONE;
- p.index = 0;
- p.data = txtones[0];
- if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
- error("Cannot set default txtone on channel %d\n",x);
- }
if (debouncetime)
{
p.radpar = ZT_RADPAR_DEBOUNCETIME;
@@ -997,20 +1084,24 @@ static int rad_chanconfig(char *keyword, char *args)
if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
error("Cannot set bursttime on channel %d\n",x);
}
- if (invertcor)
- {
- p.radpar = ZT_RADPAR_INVERTCOR;
- p.data = invertcor;
- if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
- error("Cannot set invertcor on channel %d\n",x);
- }
- if (exttone)
- {
- p.radpar = ZT_RADPAR_EXTRXTONE;
- p.data = exttone;
- if (ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p) == -1)
- error("Cannot set exttone on channel %d\n",x);
- }
+ p.radpar = ZT_RADPAR_DEEMP;
+ p.data = deemp;
+ ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p);
+ p.radpar = ZT_RADPAR_PREEMP;
+ p.data = preemp;
+ ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p);
+ p.radpar = ZT_RADPAR_TXGAIN;
+ p.data = txgain;
+ ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p);
+ p.radpar = ZT_RADPAR_RXGAIN;
+ p.data = rxgain;
+ ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p);
+ p.radpar = ZT_RADPAR_INVERTCOR;
+ p.data = invertcor;
+ ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p);
+ p.radpar = ZT_RADPAR_EXTRXTONE;
+ p.data = exttone;
+ ind_ioctl(x,fd,ZT_RADIO_SETPARAM,&p);
if (corthresh)
{
p.radpar = ZT_RADPAR_CORTHRESH;
@@ -1120,6 +1211,10 @@ static struct handler {
{ "exttone", ext_tone },
{ "invertcor", invert_cor },
{ "corthresh", cor_thresh },
+ { "rxgain", rx_gain },
+ { "txgain", tx_gain },
+ { "deemp", de_emp },
+ { "preemp", pre_emp },
{ "channel", rad_chanconfig },
{ "channels", rad_chanconfig },
};