summaryrefslogtreecommitdiff
path: root/pciradio.c
diff options
context:
space:
mode:
authorjim <jim@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-11-05 02:55:58 +0000
committerjim <jim@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-11-05 02:55:58 +0000
commit721c2d8b7dfcb7715ece631172ed0c3d915f5b91 (patch)
tree4df5348ceeade3fb3ee2577e8658f50b37a2a1ca /pciradio.c
parent7e99207e834bd395443af5f88453b0aea65d3315 (diff)
Fixed bugs in pciradio.c and ztcfg.c regarding pciradio stuff.
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@490 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'pciradio.c')
-rwxr-xr-xpciradio.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/pciradio.c b/pciradio.c
index 2ba8913..9ed9f85 100755
--- a/pciradio.c
+++ b/pciradio.c
@@ -157,6 +157,7 @@ struct pciradio {
int bursttime[NUM_CHANS];
int bursttimer[NUM_CHANS];
unsigned short present_code[NUM_CHANS];
+ unsigned short last_code[NUM_CHANS];
unsigned short rxcode[NUM_CHANS][NUM_CODES + 1];
unsigned short rxclass[NUM_CHANS][NUM_CODES + 1];
unsigned short txcode[NUM_CHANS][NUM_CODES + 1];;
@@ -629,12 +630,12 @@ unsigned short txcode;
}
/* get index for tx code. Will be 0 if not receiving a CT */
myindex = 0;
- if (ctrx && (rad->present_code[n])) myindex = rad->present_code[n];
+ if (rad->gotrx[n] && ctrx && (rad->present_code[n])) myindex = rad->present_code[n];
/* get actual tx code from array */
txcode = rad->txcode[n][myindex];
if (txcode & 0x8000) dcstx = 1; else if (txcode) cttx = 1;
if (rad->radmode[n] & RADMODE_NOENCODE) dcstx = cttx = 0;
- if (rad->bursttimer[n]) dcstx = cttx = 0;
+ if ((!rad->gottx[n]) || rad->bursttimer[n]) dcstx = cttx = 0;
saudio_ctrl = 0;
saudio_setup = 0;
if (dcstx && (!dcsrx)) /* if to transmit DCS */
@@ -828,6 +829,11 @@ static void pciradio_interrupt(int irq, void *dev_id, struct pt_regs *regs)
rad->gotrxtimer[x] = rad->debouncetime[x];
}
rad->gotrx[x] = gotrx;
+ if (rad->present_code[x] != rad->last_code[x])
+ {
+ _set_encdec(rad,x);
+ rad->last_code[x] = rad->present_code[x];
+ }
for(x = 0; x < rad->nchans; x++)
{
unsigned char mask = 1 << x;
@@ -883,7 +889,14 @@ static void pciradio_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (rad->gotrx[x] != rad->gotrx1[x])
{
if (rad->gotrx[x]) {
- if (debug) printk("Chan %d got rx (ctcss code %d)\n",x + 1,rad->present_code[x]);
+ if (debug)
+ {
+ if (rad->present_code[x])
+ printk("Chan %d got rx (ctcss code %d)\n",x + 1,
+ cttable_rx[rad->rxcode[x][rad->present_code[x]]].code);
+ else
+ printk("Chan %d got rx\n",x + 1);
+ }
zt_qevent_lock(&rad->chans[x], ZT_EVENT_RINGOFFHOOK);
} else {
if (debug) printk("Chan %d lost rx\n",x + 1);
@@ -1325,29 +1338,9 @@ int x;
byte1 = 0x3f;
byte2 = 0x3f;
mx828_command(rad,x, MX828_AUD_CTRL, &byte1, &byte2 );
- byte1 = 0x09;
- byte2 = 0xD8;
- mx828_command(rad,x, MX828_TX_TONE, &byte1, &byte2 );
- byte1 = 0x35;
- byte2 = 0xcb;
- mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
- byte1 = 0x47;
- byte2 = 0xc0;
- mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
-#if 0
- byte1 = 0x1e;
- byte2 = 0x88;
- mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
- byte1 = 0x23;
- byte2 = 0xd8;
- mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
- byte1 = 0x34;
- byte2 = 0xcb;
- mx828_command(rad,x, MX828_RX_TONE, &byte1, &byte2 );
-#endif
- byte1 = 0x80;
+ byte1 = 0;
mx828_command(rad,x, MX828_SAUDIO_SETUP, &byte1, &byte2 );
- byte1 = 0xe0;
+ byte1 = 0;
mx828_command(rad,x, MX828_SAUDIO_CTRL, &byte1, &byte2 );
byte1 = 0xc0;
mx828_command(rad,x, MX828_GEN_CTRL, &byte1, &byte2);
@@ -1451,7 +1444,7 @@ static int __devinit pciradio_init_one(struct pci_dev *pdev, const struct pci_de
rad->readdma = rad->writedma + ZT_MAX_CHUNKSIZE * 8; /* in bytes */
if (pciradio_initialize(rad)) {
- printk("pciradio: Unable to intialize FXS\n");
+ printk("pciradio: Unable to intialize\n");
/* Set Reset Low */
x=inb(rad->ioaddr + RAD_CNTL);
outb((~0x1)&x, rad->ioaddr + RAD_CNTL);