summaryrefslogtreecommitdiff
path: root/drivers/dahdi/tor2.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2008-05-21 16:44:40 +0000
committerKevin P. Fleming <kpfleming@digium.com>2008-05-21 16:44:40 +0000
commit66d8715a0fbf6eae202c27853ba616bcf754d0c7 (patch)
tree335a9397e48be117e3396f0d317aa3570ec502b7 /drivers/dahdi/tor2.c
parent0a64510aaa673ebafc3fdf4143f6e8e24252d9ef (diff)
replace ZT_ with DAHDI_, zt_ with dahdi_
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@4320 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/tor2.c')
-rw-r--r--drivers/dahdi/tor2.c262
1 files changed, 131 insertions, 131 deletions
diff --git a/drivers/dahdi/tor2.c b/drivers/dahdi/tor2.c
index e12dfa8..2863363 100644
--- a/drivers/dahdi/tor2.c
+++ b/drivers/dahdi/tor2.c
@@ -101,9 +101,9 @@ struct tor2 {
unsigned long xilinx8_region; /* 8 bit Region allocated to Xilinx */
unsigned long xilinx8_len; /* Length of 8 bit Xilinx region */
volatile unsigned char *mem8; /* Virtual representation of 8 bit Xilinx memory area */
- struct zt_span spans[SPANS_PER_CARD]; /* Spans */
+ struct dahdi_span spans[SPANS_PER_CARD]; /* Spans */
struct tor2_span tspans[SPANS_PER_CARD]; /* Span data */
- struct zt_chan *chans[SPANS_PER_CARD]; /* Pointers to blocks of 24(30/31) contiguous zt_chans for each span */
+ struct dahdi_chan *chans[SPANS_PER_CARD]; /* Pointers to blocks of 24(30/31) contiguous dahdi_chans for each span */
struct tor2_chan tchans[32 * SPANS_PER_CARD]; /* Channel user data */
unsigned char txsigs[SPANS_PER_CARD][16]; /* Copy of tx sig registers */
int loopupcnt[SPANS_PER_CARD]; /* loop up code counter */
@@ -111,8 +111,8 @@ struct tor2 {
int spansstarted; /* number of spans started */
spinlock_t lock; /* lock context */
unsigned char leds; /* copy of LED register */
- unsigned char ec_chunk1[SPANS_PER_CARD][32][ZT_CHUNKSIZE]; /* first EC chunk buffer */
- unsigned char ec_chunk2[SPANS_PER_CARD][32][ZT_CHUNKSIZE]; /* second EC chunk buffer */
+ unsigned char ec_chunk1[SPANS_PER_CARD][32][DAHDI_CHUNKSIZE]; /* first EC chunk buffer */
+ unsigned char ec_chunk2[SPANS_PER_CARD][32][DAHDI_CHUNKSIZE]; /* second EC chunk buffer */
#ifdef ENABLE_TASKLETS
int taskletrun;
int taskletsched;
@@ -181,11 +181,11 @@ static int highestorder;
static int timingcable;
static void set_clear(struct tor2 *tor);
-static int tor2_startup(struct zt_span *span);
-static int tor2_shutdown(struct zt_span *span);
-static int tor2_rbsbits(struct zt_chan *chan, int bits);
-static int tor2_maint(struct zt_span *span, int cmd);
-static int tor2_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data);
+static int tor2_startup(struct dahdi_span *span);
+static int tor2_shutdown(struct dahdi_span *span);
+static int tor2_rbsbits(struct dahdi_chan *chan, int bits);
+static int tor2_maint(struct dahdi_span *span, int cmd);
+static int tor2_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data);
ZAP_IRQ_HANDLER(tor2_intr);
/* translations of data channels for 24 channels in a 32 bit PCM highway */
@@ -197,7 +197,7 @@ unsigned datxlt_e1[] = {
1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,
25,26,27,28,29,30,31 };
-static int tor2_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
+static int tor2_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
{
int i;
struct tor2_span *p = span->pvt;
@@ -221,19 +221,19 @@ static int tor2_spanconfig(struct zt_span *span, struct zt_lineconfig *lc)
p->tor->psyncs[lc->sync - 1] = p->span + 1;
}
/* If we're already running, then go ahead and apply the changes */
- if (span->flags & ZT_FLAG_RUNNING)
+ if (span->flags & DAHDI_FLAG_RUNNING)
return tor2_startup(span);
return 0;
}
-static int tor2_chanconfig(struct zt_chan *chan, int sigtype)
+static int tor2_chanconfig(struct dahdi_chan *chan, int sigtype)
{
int alreadyrunning;
unsigned long flags;
struct tor2_chan *p = chan->pvt;
- alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING;
+ alreadyrunning = chan->span->flags & DAHDI_FLAG_RUNNING;
if (debug) {
if (alreadyrunning)
printk("Tor2: Reconfigured channel %d (%s) sigtype %d\n", chan->channo, chan->name, sigtype);
@@ -249,7 +249,7 @@ static int tor2_chanconfig(struct zt_chan *chan, int sigtype)
return 0;
}
-static int tor2_open(struct zt_chan *chan)
+static int tor2_open(struct dahdi_chan *chan)
{
#ifndef LINUX26
MOD_INC_USE_COUNT;
@@ -257,7 +257,7 @@ static int tor2_open(struct zt_chan *chan)
return 0;
}
-static int tor2_close(struct zt_chan *chan)
+static int tor2_close(struct dahdi_chan *chan)
{
#ifndef LINUX26
MOD_DEC_USE_COUNT;
@@ -287,27 +287,27 @@ static void init_spans(struct tor2 *tor)
tor->spans[x].close = tor2_close;
if (tor->cardtype == TYPE_T1) {
tor->spans[x].channels = 24;
- tor->spans[x].deflaw = ZT_LAW_MULAW;
- tor->spans[x].linecompat = ZT_CONFIG_AMI | ZT_CONFIG_B8ZS | ZT_CONFIG_D4 | ZT_CONFIG_ESF;
+ tor->spans[x].deflaw = DAHDI_LAW_MULAW;
+ tor->spans[x].linecompat = DAHDI_CONFIG_AMI | DAHDI_CONFIG_B8ZS | DAHDI_CONFIG_D4 | DAHDI_CONFIG_ESF;
tor->spans[x].spantype = "T1";
} else {
tor->spans[x].channels = 31;
- tor->spans[x].deflaw = ZT_LAW_ALAW;
- tor->spans[x].linecompat = ZT_CONFIG_HDB3 | ZT_CONFIG_CCS | ZT_CONFIG_CRC4;
+ tor->spans[x].deflaw = DAHDI_LAW_ALAW;
+ tor->spans[x].linecompat = DAHDI_CONFIG_HDB3 | DAHDI_CONFIG_CCS | DAHDI_CONFIG_CRC4;
tor->spans[x].spantype = "E1";
}
tor->spans[x].chans = tor->chans[x];
- tor->spans[x].flags = ZT_FLAG_RBS;
+ tor->spans[x].flags = DAHDI_FLAG_RBS;
tor->spans[x].ioctl = tor2_ioctl;
tor->spans[x].pvt = &tor->tspans[x];
tor->tspans[x].tor = tor;
tor->tspans[x].span = x;
init_waitqueue_head(&tor->spans[x].maintq);
for (y=0;y<tor->spans[x].channels;y++) {
- struct zt_chan *mychans = tor->chans[x] + y;
+ struct dahdi_chan *mychans = tor->chans[x] + y;
sprintf(mychans->name, "Tor2/%d/%d/%d", tor->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_SF | ZT_SIG_EM_E1;
+ mychans->sigcap = DAHDI_SIG_EM | DAHDI_SIG_CLEAR | DAHDI_SIG_FXSLS | DAHDI_SIG_FXSGS | DAHDI_SIG_FXSKS |
+ DAHDI_SIG_FXOLS | DAHDI_SIG_FXOGS | DAHDI_SIG_FXOKS | DAHDI_SIG_CAS | DAHDI_SIG_SF | DAHDI_SIG_EM_E1;
c = (x * tor->spans[x].channels) + y;
mychans->pvt = &tor->tchans[c];
mychans->chanpos = y + 1;
@@ -319,29 +319,29 @@ static void init_spans(struct tor2 *tor)
static int __devinit tor2_launch(struct tor2 *tor)
{
- if (tor->spans[0].flags & ZT_FLAG_REGISTERED)
+ if (tor->spans[0].flags & DAHDI_FLAG_REGISTERED)
return 0;
printk("Tor2: Launching card: %d\n", tor->order);
- if (zt_register(&tor->spans[0], 0)) {
+ if (dahdi_register(&tor->spans[0], 0)) {
printk(KERN_ERR "Unable to register span %s\n", tor->spans[0].name);
return -1;
}
- if (zt_register(&tor->spans[1], 0)) {
+ if (dahdi_register(&tor->spans[1], 0)) {
printk(KERN_ERR "Unable to register span %s\n", tor->spans[1].name);
- zt_unregister(&tor->spans[0]);
+ dahdi_unregister(&tor->spans[0]);
return -1;
}
- if (zt_register(&tor->spans[2], 0)) {
+ if (dahdi_register(&tor->spans[2], 0)) {
printk(KERN_ERR "Unable to register span %s\n", tor->spans[2].name);
- zt_unregister(&tor->spans[0]);
- zt_unregister(&tor->spans[1]);
+ dahdi_unregister(&tor->spans[0]);
+ dahdi_unregister(&tor->spans[1]);
return -1;
}
- if (zt_register(&tor->spans[3], 0)) {
+ if (dahdi_register(&tor->spans[3], 0)) {
printk(KERN_ERR "Unable to register span %s\n", tor->spans[3].name);
- zt_unregister(&tor->spans[0]);
- zt_unregister(&tor->spans[1]);
- zt_unregister(&tor->spans[2]);
+ dahdi_unregister(&tor->spans[0]);
+ dahdi_unregister(&tor->spans[1]);
+ dahdi_unregister(&tor->spans[2]);
return -1;
}
tor->plx[INTCSR] = cpu_to_le16(PLX_INTENA); /* enable PLX interrupt */
@@ -368,10 +368,10 @@ static int __devinit tor2_probe(struct pci_dev *pdev, const struct pci_device_id
memset(tor,0,sizeof(struct tor2));
spin_lock_init(&tor->lock);
for (x = 0; x < SPANS_PER_CARD; x++) {
- tor->chans[x] = kmalloc(sizeof(struct zt_chan) * 31,GFP_KERNEL);
+ tor->chans[x] = kmalloc(sizeof(struct dahdi_chan) * 31,GFP_KERNEL);
if (!tor->chans[x])
return -ENOMEM;
- memset(tor->chans[x],0,sizeof(struct zt_chan) * 31);
+ memset(tor->chans[x],0,sizeof(struct dahdi_chan) * 31);
}
/* Load the resources */
tor->pci = pdev;
@@ -603,14 +603,14 @@ static void __devexit tor2_remove(struct pci_dev *pdev)
tor->mem8[LEDREG] = 0;
tor->plx[INTCSR] = cpu_to_le16(0);
free_irq(tor->irq, tor);
- if (tor->spans[0].flags & ZT_FLAG_REGISTERED)
- zt_unregister(&tor->spans[0]);
- if (tor->spans[1].flags & ZT_FLAG_REGISTERED)
- zt_unregister(&tor->spans[1]);
- if (tor->spans[2].flags & ZT_FLAG_REGISTERED)
- zt_unregister(&tor->spans[2]);
- if (tor->spans[3].flags & ZT_FLAG_REGISTERED)
- zt_unregister(&tor->spans[3]);
+ if (tor->spans[0].flags & DAHDI_FLAG_REGISTERED)
+ dahdi_unregister(&tor->spans[0]);
+ if (tor->spans[1].flags & DAHDI_FLAG_REGISTERED)
+ dahdi_unregister(&tor->spans[1]);
+ if (tor->spans[2].flags & DAHDI_FLAG_REGISTERED)
+ dahdi_unregister(&tor->spans[2]);
+ if (tor->spans[3].flags & DAHDI_FLAG_REGISTERED)
+ dahdi_unregister(&tor->spans[3]);
release_mem_region(tor->plx_region, tor->plx_len);
release_mem_region(tor->xilinx32_region, tor->xilinx32_len);
release_mem_region(tor->xilinx8_region, tor->xilinx8_len);
@@ -656,7 +656,7 @@ static void set_clear(struct tor2 *tor)
for (s = 0; s < SPANS_PER_CARD; s++) {
for (i = 0; i < 24; i++) {
j = (i/8);
- if (tor->spans[s].chans[i].flags & ZT_FLAG_CLEAR)
+ if (tor->spans[s].chans[i].flags & DAHDI_FLAG_CLEAR)
val |= 1 << (i % 8);
if ((i % 8)==7) {
@@ -673,7 +673,7 @@ static void set_clear(struct tor2 *tor)
}
-static int tor2_rbsbits(struct zt_chan *chan, int bits)
+static int tor2_rbsbits(struct dahdi_chan *chan, int bits)
{
u_char m,c;
int k,n,b;
@@ -704,7 +704,7 @@ static int tor2_rbsbits(struct zt_chan *chan, int bits)
c = p->tor->txsigs[k][b];
c &= ~m; /* clear mask bit */
/* set mask bit, if bit is to be set */
- if (bits & ZT_ABIT) c |= m;
+ if (bits & DAHDI_ABIT) c |= m;
p->tor->txsigs[k][b] = c;
spin_lock_irqsave(&p->tor->lock, flags);
t1out(p->tor,k + 1,0x70 + b,c);
@@ -713,7 +713,7 @@ static int tor2_rbsbits(struct zt_chan *chan, int bits)
c = p->tor->txsigs[k][b];
c &= ~m; /* clear mask bit */
/* set mask bit, if bit is to be set */
- if (bits & ZT_BBIT) c |= m;
+ if (bits & DAHDI_BBIT) c |= m;
/* save new signalling values */
p->tor->txsigs[k][b] = c;
/* output them into the chip */
@@ -723,7 +723,7 @@ static int tor2_rbsbits(struct zt_chan *chan, int bits)
c = p->tor->txsigs[k][b];
c &= ~m; /* clear mask bit */
/* set mask bit, if bit is to be set */
- if (bits & ZT_CBIT) c |= m;
+ if (bits & DAHDI_CBIT) c |= m;
/* save new signalling values */
p->tor->txsigs[k][b] = c;
/* output them into the chip */
@@ -733,7 +733,7 @@ static int tor2_rbsbits(struct zt_chan *chan, int bits)
c = p->tor->txsigs[k][b];
c &= ~m; /* clear mask bit */
/* set mask bit, if bit is to be set */
- if (bits & ZT_DBIT) c |= m;
+ if (bits & DAHDI_DBIT) c |= m;
/* save new signalling values */
p->tor->txsigs[k][b] = c;
/* output them into the chip */
@@ -742,7 +742,7 @@ static int tor2_rbsbits(struct zt_chan *chan, int bits)
return 0;
}
-static int tor2_shutdown(struct zt_span *span)
+static int tor2_shutdown(struct dahdi_span *span)
{
int i;
int tspan;
@@ -757,9 +757,9 @@ static int tor2_shutdown(struct zt_span *span)
}
spin_lock_irqsave(&p->tor->lock, flags);
- wasrunning = span->flags & ZT_FLAG_RUNNING;
+ wasrunning = span->flags & DAHDI_FLAG_RUNNING;
- span->flags &= ~ZT_FLAG_RUNNING;
+ span->flags &= ~DAHDI_FLAG_RUNNING;
/* Zero out all registers */
if (p->tor->cardtype == TYPE_E1) {
for (i = 0; i < 192; i++)
@@ -771,10 +771,10 @@ static int tor2_shutdown(struct zt_span *span)
if (wasrunning)
p->tor->spansstarted--;
spin_unlock_irqrestore(&p->tor->lock, flags);
- if (!(p->tor->spans[0].flags & ZT_FLAG_RUNNING) &&
- !(p->tor->spans[1].flags & ZT_FLAG_RUNNING) &&
- !(p->tor->spans[2].flags & ZT_FLAG_RUNNING) &&
- !(p->tor->spans[3].flags & ZT_FLAG_RUNNING))
+ if (!(p->tor->spans[0].flags & DAHDI_FLAG_RUNNING) &&
+ !(p->tor->spans[1].flags & DAHDI_FLAG_RUNNING) &&
+ !(p->tor->spans[2].flags & DAHDI_FLAG_RUNNING) &&
+ !(p->tor->spans[3].flags & DAHDI_FLAG_RUNNING))
/* No longer in use, disable interrupts */
p->tor->mem8[CTLREG] = 0;
if (debug)
@@ -783,7 +783,7 @@ static int tor2_shutdown(struct zt_span *span)
}
-static int tor2_startup(struct zt_span *span)
+static int tor2_startup(struct dahdi_span *span)
{
unsigned long endjif;
int i;
@@ -803,15 +803,15 @@ static int tor2_startup(struct zt_span *span)
spin_lock_irqsave(&p->tor->lock, flags);
- alreadyrunning = span->flags & ZT_FLAG_RUNNING;
+ alreadyrunning = span->flags & DAHDI_FLAG_RUNNING;
/* initialize the start value for the entire chunk of last ec buffer */
for (i = 0; i < span->channels; i++)
{
memset(p->tor->ec_chunk1[p->span][i],
- ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE);
+ DAHDI_LIN2X(0,&span->chans[i]),DAHDI_CHUNKSIZE);
memset(p->tor->ec_chunk2[p->span][i],
- ZT_LIN2X(0,&span->chans[i]),ZT_CHUNKSIZE);
+ DAHDI_LIN2X(0,&span->chans[i]),DAHDI_CHUNKSIZE);
}
/* Force re-evaluation of the timing source */
if (timingcable)
@@ -848,18 +848,18 @@ static int tor2_startup(struct zt_span *span)
crcing = "";
tcr1 = 9; /* base TCR1 value: TSis mode */
tcr2 = 0;
- if (span->lineconfig & ZT_CONFIG_CCS) {
+ if (span->lineconfig & DAHDI_CONFIG_CCS) {
ccr1 |= 8; /* CCR1: Rx Sig mode: CCS */
coding = "CCS";
} else {
tcr1 |= 0x20;
coding = "CAS";
}
- if (span->lineconfig & ZT_CONFIG_HDB3) {
+ if (span->lineconfig & DAHDI_CONFIG_HDB3) {
ccr1 |= 0x44; /* CCR1: TX and RX HDB3 */
framing = "HDB3";
} else framing = "AMI";
- if (span->lineconfig & ZT_CONFIG_CRC4) {
+ if (span->lineconfig & DAHDI_CONFIG_CRC4) {
ccr1 |= 0x11; /* CCR1: TX and TX CRC4 */
tcr2 |= 0x02; /* TCR2: CRC4 bit auto */
crcing = "/CRC4";
@@ -884,7 +884,7 @@ static int tor2_startup(struct zt_span *span)
t1out(p->tor,tspan,0x1b,0x9a); /* CCR3: set also ESR */
t1out(p->tor,tspan,0x1b,0x82); /* CCR3: TSCLKM only now */
- span->flags |= ZT_FLAG_RUNNING;
+ span->flags |= DAHDI_FLAG_RUNNING;
p->tor->spansstarted++;
/* enable interrupts */
@@ -937,9 +937,9 @@ static int tor2_startup(struct zt_span *span)
}
/* Enable F bits pattern */
i = 0x20;
- if (span->lineconfig & ZT_CONFIG_ESF)
+ if (span->lineconfig & DAHDI_CONFIG_ESF)
i = 0x88;
- if (span->lineconfig & ZT_CONFIG_B8ZS)
+ if (span->lineconfig & DAHDI_CONFIG_B8ZS)
i |= 0x44;
t1out(p->tor,tspan, 0x38, i);
if (i & 0x80)
@@ -969,7 +969,7 @@ static int tor2_startup(struct zt_span *span)
t1out(p->tor,tspan,0x0a,0x30); /* LIRST back to normal, Resetting elastic stores */
- span->flags |= ZT_FLAG_RUNNING;
+ span->flags |= DAHDI_FLAG_RUNNING;
p->tor->spansstarted++;
/* enable interrupts */
@@ -982,9 +982,9 @@ static int tor2_startup(struct zt_span *span)
if (debug) {
if (alreadyrunning)
- printk("Tor2: Reconfigured span %d (%s/%s) LBO: %s\n", span->spanno, coding, framing, zt_lboname(span->txlevel));
+ printk("Tor2: Reconfigured span %d (%s/%s) LBO: %s\n", span->spanno, coding, framing, dahdi_lboname(span->txlevel));
else
- printk("Tor2: Startup span %d (%s/%s) LBO: %s\n", span->spanno, coding, framing, zt_lboname(span->txlevel));
+ printk("Tor2: Startup span %d (%s/%s) LBO: %s\n", span->spanno, coding, framing, dahdi_lboname(span->txlevel));
}
}
if (p->tor->syncs[0] == span->spanno) printk("SPAN %d: Primary Sync Source\n",span->spanno);
@@ -994,7 +994,7 @@ static int tor2_startup(struct zt_span *span)
return 0;
}
-static int tor2_maint(struct zt_span *span, int cmd)
+static int tor2_maint(struct dahdi_span *span, int cmd)
{
struct tor2_span *p = span->pvt;
@@ -1003,18 +1003,18 @@ static int tor2_maint(struct zt_span *span, int cmd)
if (p->tor->cardtype == TYPE_E1)
{
switch(cmd) {
- case ZT_MAINT_NONE:
+ case DAHDI_MAINT_NONE:
t1out(p->tor,tspan,0xa8,0); /* no loops */
break;
- case ZT_MAINT_LOCALLOOP:
+ case DAHDI_MAINT_LOCALLOOP:
t1out(p->tor,tspan,0xa8,0x40); /* local loop */
break;
- case ZT_MAINT_REMOTELOOP:
+ case DAHDI_MAINT_REMOTELOOP:
t1out(p->tor,tspan,0xa8,0x80); /* remote loop */
break;
- case ZT_MAINT_LOOPUP:
- case ZT_MAINT_LOOPDOWN:
- case ZT_MAINT_LOOPSTOP:
+ case DAHDI_MAINT_LOOPUP:
+ case DAHDI_MAINT_LOOPDOWN:
+ case DAHDI_MAINT_LOOPSTOP:
return -ENOSYS;
default:
printk("Tor2: Unknown maint command: %d\n", cmd);
@@ -1023,29 +1023,29 @@ static int tor2_maint(struct zt_span *span, int cmd)
return 0;
}
switch(cmd) {
- case ZT_MAINT_NONE:
+ case DAHDI_MAINT_NONE:
t1out(p->tor,tspan,0x19,(japan ? 0x80 : 0x00)); /* no local loop */
t1out(p->tor,tspan,0x0a,0); /* no remote loop */
break;
- case ZT_MAINT_LOCALLOOP:
+ case DAHDI_MAINT_LOCALLOOP:
t1out(p->tor,tspan,0x19,0x40 | (japan ? 0x80 : 0x00)); /* local loop */
t1out(p->tor,tspan,0x0a,0); /* no remote loop */
break;
- case ZT_MAINT_REMOTELOOP:
+ case DAHDI_MAINT_REMOTELOOP:
t1out(p->tor,tspan,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */
t1out(p->tor,tspan,0x0a,0x40); /* remote loop */
break;
- case ZT_MAINT_LOOPUP:
+ case DAHDI_MAINT_LOOPUP:
t1out(p->tor,tspan,0x30,2); /* send loopup code */
t1out(p->tor,tspan,0x12,0x22); /* send loopup code */
t1out(p->tor,tspan,0x13,0x80); /* send loopup code */
break;
- case ZT_MAINT_LOOPDOWN:
+ case DAHDI_MAINT_LOOPDOWN:
t1out(p->tor,tspan,0x30,2); /* send loopdown code */
t1out(p->tor,tspan,0x12,0x62); /* send loopdown code */
t1out(p->tor,tspan,0x13,0x90); /* send loopdown code */
break;
- case ZT_MAINT_LOOPSTOP:
+ case DAHDI_MAINT_LOOPSTOP:
t1out(p->tor,tspan,0x30,0); /* stop sending loopup code */
break;
default:
@@ -1059,26 +1059,26 @@ static inline void tor2_run(struct tor2 *tor)
{
int x,y;
for (x = 0; x < SPANS_PER_CARD; x++) {
- if (tor->spans[x].flags & ZT_FLAG_RUNNING) {
+ if (tor->spans[x].flags & DAHDI_FLAG_RUNNING) {
/* since the Tormenta 2 PCI is double-buffered, you
need to delay the transmit data 2 entire chunks so
that the transmit will be in sync with the receive */
for (y=0;y<tor->spans[x].channels;y++) {
- zt_ec_chunk(&tor->spans[x].chans[y],
+ dahdi_ec_chunk(&tor->spans[x].chans[y],
tor->spans[x].chans[y].readchunk,
tor->ec_chunk2[x][y]);
memcpy(tor->ec_chunk2[x][y],tor->ec_chunk1[x][y],
- ZT_CHUNKSIZE);
+ DAHDI_CHUNKSIZE);
memcpy(tor->ec_chunk1[x][y],
tor->spans[x].chans[y].writechunk,
- ZT_CHUNKSIZE);
+ DAHDI_CHUNKSIZE);
}
- zt_receive(&tor->spans[x]);
+ dahdi_receive(&tor->spans[x]);
}
}
for (x = 0; x < SPANS_PER_CARD; x++) {
- if (tor->spans[x].flags & ZT_FLAG_RUNNING)
- zt_transmit(&tor->spans[x]);
+ if (tor->spans[x].flags & DAHDI_FLAG_RUNNING)
+ dahdi_transmit(&tor->spans[x]);
}
}
@@ -1127,8 +1127,8 @@ static int tor2_findsync(struct tor2 *tor)
if (cards[x]->syncpos[i]) {
nonzero = 1;
if ((cards[x]->syncpos[i] == p) &&
- !(cards[x]->spans[i].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_LOOPBACK)) &&
- (cards[x]->spans[i].flags & ZT_FLAG_RUNNING)) {
+ !(cards[x]->spans[i].alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE | DAHDI_ALARM_LOOPBACK)) &&
+ (cards[x]->spans[i].flags & DAHDI_FLAG_RUNNING)) {
/* This makes a good sync source */
newsyncsrc = cards[x]->spans[i].spanno;
newsyncnum = x;
@@ -1213,7 +1213,7 @@ ZAP_IRQ_HANDLER(tor2_intr)
/* do the transmit output */
for (n = 0; n < tor->spans[0].channels; n++) {
- for (i = 0; i < ZT_CHUNKSIZE; i++) {
+ for (i = 0; i < DAHDI_CHUNKSIZE; i++) {
/* span 1 */
txword = tor->spans[0].chans[n].writechunk[i] << 24;
/* span 2 */
@@ -1233,7 +1233,7 @@ ZAP_IRQ_HANDLER(tor2_intr)
/* Do the receive input */
for (n = 0; n < tor->spans[0].channels; n++) {
- for (i = 0; i < ZT_CHUNKSIZE; i++) {
+ for (i = 0; i < DAHDI_CHUNKSIZE; i++) {
/* read from */
#ifdef FIXTHISFOR64
rxword = tor->mem32[tor->datxlt[n] + (32 * i)];
@@ -1260,14 +1260,14 @@ ZAP_IRQ_HANDLER(tor2_intr)
rxc = c & 15;
if (rxc != tor->spans[k - 1].chans[j + 16].rxsig) {
/* Check for changes in received bits */
- if (!(tor->spans[k - 1].chans[j + 16].sig & ZT_SIG_CLEAR))
- zt_rbsbits(&tor->spans[k - 1].chans[j + 16], rxc);
+ if (!(tor->spans[k - 1].chans[j + 16].sig & DAHDI_SIG_CLEAR))
+ dahdi_rbsbits(&tor->spans[k - 1].chans[j + 16], rxc);
}
rxc = c >> 4;
if (rxc != tor->spans[k - 1].chans[j].rxsig) {
/* Check for changes in received bits */
- if (!(tor->spans[k - 1].chans[j].sig & ZT_SIG_CLEAR))
- zt_rbsbits(&tor->spans[k - 1].chans[j], rxc);
+ if (!(tor->spans[k - 1].chans[j].sig & DAHDI_SIG_CLEAR))
+ dahdi_rbsbits(&tor->spans[k - 1].chans[j], rxc);
}
}
}
@@ -1283,12 +1283,12 @@ ZAP_IRQ_HANDLER(tor2_intr)
/* Get channel number */
i = (n * 8) + j;
rxc = 0;
- if (abits & (1 << j)) rxc |= ZT_ABIT;
- if (bbits & (1 << j)) rxc |= ZT_BBIT;
+ if (abits & (1 << j)) rxc |= DAHDI_ABIT;
+ if (bbits & (1 << j)) rxc |= DAHDI_BBIT;
if (tor->spans[k].chans[i].rxsig != rxc) {
/* Check for changes in received bits */
- if (!(tor->spans[k].chans[i].sig & ZT_SIG_CLEAR)) {
- zt_rbsbits(&tor->spans[k].chans[i], rxc);
+ if (!(tor->spans[k].chans[i].sig & DAHDI_SIG_CLEAR)) {
+ dahdi_rbsbits(&tor->spans[k].chans[i], rxc);
}
}
}
@@ -1299,12 +1299,12 @@ ZAP_IRQ_HANDLER(tor2_intr)
if (tor->alarmtimer[i]) {
if (!--tor->alarmtimer[i]) {
/* clear recover status */
- tor->spans[i].alarms &= ~ZT_ALARM_RECOVER;
+ tor->spans[i].alarms &= ~DAHDI_ALARM_RECOVER;
if (tor->cardtype == TYPE_E1)
t1out(tor,i + 1,0x21,0x5f); /* turn off yel */
else
t1out(tor,i + 1,0x35,0x10); /* turn off yel */
- zt_alarm_notify(&tor->spans[i]); /* let them know */
+ dahdi_alarm_notify(&tor->spans[i]); /* let them know */
}
}
}
@@ -1324,11 +1324,11 @@ ZAP_IRQ_HANDLER(tor2_intr)
{
/* set into remote loop, if not there already */
if ((tor->loopupcnt[i]++ > 80) &&
- (tor->spans[i].maintstat != ZT_MAINT_REMOTELOOP))
+ (tor->spans[i].maintstat != DAHDI_MAINT_REMOTELOOP))
{
t1out(tor,i + 1,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */
t1out(tor,i + 1,0x0a,0x40); /* remote loop */
- tor->spans[i].maintstat = ZT_MAINT_REMOTELOOP;
+ tor->spans[i].maintstat = DAHDI_MAINT_REMOTELOOP;
}
} else tor->loopupcnt[i] = 0;
/* detect the code, only if we are not sending one */
@@ -1336,55 +1336,55 @@ ZAP_IRQ_HANDLER(tor2_intr)
{
/* if in remote loop, get out of it */
if ((tor->loopdowncnt[i]++ > 80) &&
- (tor->spans[i].maintstat == ZT_MAINT_REMOTELOOP))
+ (tor->spans[i].maintstat == DAHDI_MAINT_REMOTELOOP))
{
t1out(tor,i + 1,0x1e,(japan ? 0x80 : 0x00)); /* no local loop */
t1out(tor,i + 1,0x0a,0); /* no remote loop */
- tor->spans[i].maintstat = ZT_MAINT_NONE;
+ tor->spans[i].maintstat = DAHDI_MAINT_NONE;
}
} else tor->loopdowncnt[i] = 0;
if (c & 3) /* if red alarm */
{
- j |= ZT_ALARM_RED;
+ j |= DAHDI_ALARM_RED;
}
if (c & 8) /* if blue alarm */
{
- j |= ZT_ALARM_BLUE;
+ j |= DAHDI_ALARM_BLUE;
}
} else { /* its an E1 card */
t1out(tor,i + 1,6,0xff);
c = t1in(tor,i + 1,6); /* get the status */
if (c & 9) /* if red alarm */
{
- j |= ZT_ALARM_RED;
+ j |= DAHDI_ALARM_RED;
}
if (c & 2) /* if blue alarm */
{
- j |= ZT_ALARM_BLUE;
+ j |= DAHDI_ALARM_BLUE;
}
}
/* only consider previous carrier alarm state */
- tor->spans[i].alarms &= (ZT_ALARM_RED | ZT_ALARM_BLUE | ZT_ALARM_NOTOPEN);
+ tor->spans[i].alarms &= (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE | DAHDI_ALARM_NOTOPEN);
n = 1; /* set to 1 so will not be in yellow alarm if we dont
care about open channels */
/* if to have yellow alarm if nothing open */
- if (tor->spans[i].lineconfig & ZT_CONFIG_NOTOPEN)
+ if (tor->spans[i].lineconfig & DAHDI_CONFIG_NOTOPEN)
{
/* go thru all chans, and count # open */
for (n = 0,k = 0; k < tor->spans[i].channels; k++)
{
- if (((tor->chans[i] + k)->flags & ZT_FLAG_OPEN) ||
- ((tor->chans[i] + k)->flags & ZT_FLAG_NETDEV)) n++;
+ if (((tor->chans[i] + k)->flags & DAHDI_FLAG_OPEN) ||
+ ((tor->chans[i] + k)->flags & DAHDI_FLAG_NETDEV)) n++;
}
/* if none open, set alarm condition */
- if (!n) j |= ZT_ALARM_NOTOPEN;
+ if (!n) j |= DAHDI_ALARM_NOTOPEN;
}
/* if no more alarms, and we had some */
if ((!j) && tor->spans[i].alarms)
{
- tor->alarmtimer[i] = ZT_ALARMSETTLE_TIME;
+ tor->alarmtimer[i] = DAHDI_ALARMSETTLE_TIME;
}
- if (tor->alarmtimer[i]) j |= ZT_ALARM_RECOVER;
+ if (tor->alarmtimer[i]) j |= DAHDI_ALARM_RECOVER;
/* if going into alarm state, set yellow alarm */
if ((j) && (!tor->spans[i].alarms)) {
if (tor->cardtype == TYPE_E1)
@@ -1393,19 +1393,19 @@ ZAP_IRQ_HANDLER(tor2_intr)
t1out(tor,i + 1,0x35,0x11);
}
if (c & 4) /* if yellow alarm */
- j |= ZT_ALARM_YELLOW;
- if (tor->spans[i].maintstat || tor->spans[i].mainttimer) j |= ZT_ALARM_LOOPBACK;
+ j |= DAHDI_ALARM_YELLOW;
+ if (tor->spans[i].maintstat || tor->spans[i].mainttimer) j |= DAHDI_ALARM_LOOPBACK;
tor->spans[i].alarms = j;
c = (LEDRED | LEDGREEN) << (2 * i);
tor->leds &= ~c; /* mask out bits for this span */
/* light LED's if span configured and running */
- if (tor->spans[i].flags & ZT_FLAG_RUNNING) {
- if (j & ZT_ALARM_RED) tor->leds |= LEDRED << (2 * i);
- else if (j & ZT_ALARM_YELLOW) tor->leds |= (LEDRED | LEDGREEN) << (2 * i);
+ if (tor->spans[i].flags & DAHDI_FLAG_RUNNING) {
+ if (j & DAHDI_ALARM_RED) tor->leds |= LEDRED << (2 * i);
+ else if (j & DAHDI_ALARM_YELLOW) tor->leds |= (LEDRED | LEDGREEN) << (2 * i);
else tor->leds |= LEDGREEN << (2 * i);
}
tor->mem8[LEDREG] = tor->leds;
- zt_alarm_notify(&tor->spans[i]);
+ dahdi_alarm_notify(&tor->spans[i]);
}
if (!(tor->passno % 1000)) /* even second boundary */
{
@@ -1416,7 +1416,7 @@ ZAP_IRQ_HANDLER(tor2_intr)
{
/* add this second's BPV count to total one */
tor->spans[i - 1].bpvcount += t1in(tor,i,1) + (t1in(tor,i,0) << 8);
- if (tor->spans[i - 1].lineconfig & ZT_CONFIG_CRC4)
+ if (tor->spans[i - 1].lineconfig & DAHDI_CONFIG_CRC4)
{
tor->spans[i - 1].crc4count += t1in(tor,i,3) + ((t1in(tor,i,2) & 3) << 8);
tor->spans[i - 1].ebitcount += t1in(tor,i,5) + ((t1in(tor,i,4) & 3) << 8);
@@ -1438,8 +1438,8 @@ ZAP_IRQ_HANDLER(tor2_intr)
if (tor->psyncs[0])
{
/* if no alarms, use it */
- if (!(tor->spans[tor->psyncs[0] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE |
- ZT_ALARM_LOOPBACK))) {
+ if (!(tor->spans[tor->psyncs[0] - 1].alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE |
+ DAHDI_ALARM_LOOPBACK))) {
tor->syncsrc = tor->psyncs[0];
syncsrc = tor->syncs[0];
}
@@ -1449,8 +1449,8 @@ ZAP_IRQ_HANDLER(tor2_intr)
/* if we dont have one yet, and there is one specified at this level, see if we can use it */
if ((!tor->syncsrc) && (tor->psyncs[i])) {
/* if no alarms, use it */
- if (!(tor->spans[tor->psyncs[i] - 1].alarms & (ZT_ALARM_RED | ZT_ALARM_BLUE |
- ZT_ALARM_LOOPBACK))) {
+ if (!(tor->spans[tor->psyncs[i] - 1].alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE |
+ DAHDI_ALARM_LOOPBACK))) {
tor->syncsrc = tor->psyncs[i];
syncsrc = tor->syncs[i];
}
@@ -1490,7 +1490,7 @@ ZAP_IRQ_HANDLER(tor2_intr)
}
-static int tor2_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data)
+static int tor2_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long data)
{
switch(cmd) {
default: