1 diff -ur zaptel-1.2.3.orig/zaptel.c zaptel-1.2.3/zaptel.c
2 --- zaptel-1.2.3.orig/zaptel.c 2005-12-17 03:04:05.000000000 +0100
3 +++ zaptel-1.2.3/zaptel.c 2006-01-31 09:28:29.000000000 +0100
4 @@ -4913,11 +4913,40 @@
5 *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc);
8 +#ifdef CONFIG_ZAPATA_BRI_DCHANS
9 + } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
11 + * Let's get this right, we want to transmit complete frames only.
12 + * The card driver will do the dirty HDLC work for us.
13 + * txb (transmit buffer) is supposed to be big enough to store one frame
14 + * we will make this as big as the D fifo (1KB or 2KB)
17 + /* there are 'left' bytes in the user buffer left to transmit */
18 + left = ms->writen[ms->outwritebuf] - ms->writeidx[ms->outwritebuf] - 2;
19 + if (left > ms->maxbytes2transmit) {
20 + memcpy(txb, buf + ms->writeidx[ms->outwritebuf], ms->maxbytes2transmit);
21 + ms->writeidx[ms->outwritebuf] += ms->maxbytes2transmit;
22 + txb += ms->maxbytes2transmit;
23 + ms->bytes2transmit = ms->maxbytes2transmit;
26 + memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
27 + ms->writeidx[ms->outwritebuf] += left + 2;
29 + ms->bytes2transmit = left;
35 memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
36 ms->writeidx[ms->outwritebuf]+=left;
39 +#if defined(CONFIG_ZAPATA_BRI_DCHANS)
40 + ms->bytes2transmit=ZT_CHUNKSIZE;
43 /* Check buffer status */
44 if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) {
45 @@ -4962,6 +4991,17 @@
46 /* Transmit a flag if this is an HDLC channel */
47 if (ms->flags & ZT_FLAG_HDLC)
48 fasthdlc_tx_frame_nocheck(&ms->txhdlc);
49 +#if defined(CONFIG_ZAPATA_BRI_DCHANS)
50 + if(ms->flags & ZT_FLAG_BRIDCHAN) {
51 + // if (ms->bytes2transmit > 0) {
53 + // ms->bytes2transmit -= 2;
56 +// printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit);
60 #ifdef CONFIG_ZAPATA_NET
61 if (ms->flags & ZT_FLAG_NETDEV)
62 netif_wake_queue(ztchan_to_dev(ms));
64 tasklet_schedule(&ms->ppp_calls);
69 } else if (ms->curtone && !(ms->flags & ZT_FLAG_PSEUDO)) {
70 left = ms->curtone->tonesamples - ms->tonep;
72 @@ -5018,6 +5058,10 @@
73 memset(txb, 0xFF, bytes);
76 +#if defined(CONFIG_ZAPATA_BRI_DCHANS)
77 + } else if(ms->flags & ZT_FLAG_BRIDCHAN) {
81 memset(txb, ZT_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */
83 @@ -5743,6 +5787,13 @@
86 int bytes = ZT_CHUNKSIZE;
87 +#if defined(CONFIG_ZAPATA_BRI_DCHANS)
88 + if (ms->flags & ZT_FLAG_BRIDCHAN) {
89 + bytes = ms->bytes2receive;
90 + if (bytes < 1) return;
91 +// printk(KERN_CRIT "bytes2receive %d\n",ms->bytes2receive);
96 #if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP)
97 @@ -5801,6 +5852,19 @@
101 +#ifdef CONFIG_ZAPATA_BRI_DCHANS
102 + } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
103 + memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
105 + ms->readidx[ms->inreadbuf] += left;
107 + if (ms->eofrx == 1) {
110 +// printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive);
111 + ms->bytes2receive = 0;
116 memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
117 diff -ur zaptel-1.2.3.orig/zaptel.h zaptel-1.2.3/zaptel.h
118 --- zaptel-1.2.3.orig/zaptel.h 2005-12-17 03:04:05.000000000 +0100
119 +++ zaptel-1.2.3/zaptel.h 2006-01-31 09:28:29.000000000 +0100
122 struct sk_buff_head ppp_rq;
124 +#ifdef CONFIG_ZAPATA_BRI_DCHANS
126 + int maxbytes2transmit; /* size of the tx buffer in the card driver */
127 + int bytes2transmit;
132 char name[40]; /* Name */
133 /* Specified by zaptel */
134 @@ -1068,7 +1075,7 @@
135 int txbufpolicy; /* Buffer policy */
136 int rxbufpolicy; /* Buffer policy */
137 int txdisable; /* Disable transmitter */
138 - int rxdisable; /* Disable receiver */
139 + int rxdisable; /* Disable receiver */
142 /* Tone zone stuff */
143 @@ -1231,6 +1238,10 @@
144 #define ZT_FLAG_T1PPP (1 << 15)
145 #define ZT_FLAG_SIGFREEZE (1 << 16) /* Freeze signalling */
147 +#if defined(CONFIG_ZAPATA_BRI_DCHANS)
148 +#define ZT_FLAG_BRIDCHAN (1 << 17)
153 void *pvt; /* Private stuff */
154 diff -ur zaptel-1.2.3.orig/zconfig.h zaptel-1.2.3/zconfig.h
155 --- zaptel-1.2.3.orig/zconfig.h 2005-11-29 19:42:08.000000000 +0100
156 +++ zaptel-1.2.3/zconfig.h 2006-01-31 09:28:29.000000000 +0100
159 /* #define FXSFLASH */
162 + * Uncomment the following for BRI D channels
165 +#define CONFIG_ZAPATA_BRI_DCHANS