1
# Translate the D channels to a standard channel data.
2
# The HFC chipset provides us the D channel as data, but
3
# Zaptel expects it as a standard channel with 1000 samples
6
Index: zaptel-1.2.22/kernel/zaptel.h
7
===================================================================
8
--- zaptel-1.2.22.orig/kernel/zaptel.h 2007-12-04 10:40:30.000000000 +0100
9
+++ zaptel-1.2.22/kernel/zaptel.h 2007-12-04 14:35:14.545043151 +0100
10
@@ -1056,6 +1056,13 @@
12
struct sk_buff_head ppp_rq;
14
+#ifdef CONFIG_ZAPATA_BRI_DCHANS
16
+ int maxbytes2transmit; /* size of the tx buffer in the card driver */
22
char name[40]; /* Name */
23
/* Specified by zaptel */
24
@@ -1294,6 +1301,10 @@
25
#define ZT_FLAG_T1PPP (1 << 15)
26
#define ZT_FLAG_SIGFREEZE (1 << 16) /* Freeze signalling */
28
+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
29
+#define ZT_FLAG_BRIDCHAN (1 << 20)
34
void *pvt; /* Private stuff */
35
Index: zaptel-1.2.22/kernel/zconfig.h
36
===================================================================
37
--- zaptel-1.2.22.orig/kernel/zconfig.h 2007-12-04 10:40:29.000000000 +0100
38
+++ zaptel-1.2.22/kernel/zconfig.h 2007-12-04 14:35:01.329541263 +0100
41
/* #define FXSFLASH */
44
+ * Uncomment the following for BRI D channels
47
+#define CONFIG_ZAPATA_BRI_DCHANS
50
Index: zaptel-1.2.22/kernel/zaptel-base.c
51
===================================================================
52
--- zaptel-1.2.22.orig/kernel/zaptel-base.c 2007-12-04 10:40:31.000000000 +0100
53
+++ zaptel-1.2.22/kernel/zaptel-base.c 2007-12-04 14:35:14.553042850 +0100
54
@@ -5226,11 +5255,40 @@
55
*(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc);
58
+#ifdef CONFIG_ZAPATA_BRI_DCHANS
59
+ } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
61
+ * Let's get this right, we want to transmit complete frames only.
62
+ * The card driver will do the dirty HDLC work for us.
63
+ * txb (transmit buffer) is supposed to be big enough to store one frame
64
+ * we will make this as big as the D fifo (1KB or 2KB)
67
+ /* there are 'left' bytes in the user buffer left to transmit */
68
+ left = ms->writen[ms->outwritebuf] - ms->writeidx[ms->outwritebuf] - 2;
69
+ if (left > ms->maxbytes2transmit) {
70
+ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], ms->maxbytes2transmit);
71
+ ms->writeidx[ms->outwritebuf] += ms->maxbytes2transmit;
72
+ txb += ms->maxbytes2transmit;
73
+ ms->bytes2transmit = ms->maxbytes2transmit;
76
+ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
77
+ ms->writeidx[ms->outwritebuf] += left + 2;
79
+ ms->bytes2transmit = left;
85
memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
86
ms->writeidx[ms->outwritebuf]+=left;
89
+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
90
+ ms->bytes2transmit=ZT_CHUNKSIZE;
93
/* Check buffer status */
94
if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) {
95
@@ -5275,6 +5333,17 @@
96
/* Transmit a flag if this is an HDLC channel */
97
if (ms->flags & ZT_FLAG_HDLC)
98
fasthdlc_tx_frame_nocheck(&ms->txhdlc);
99
+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
100
+ if(ms->flags & ZT_FLAG_BRIDCHAN) {
101
+ // if (ms->bytes2transmit > 0) {
103
+ // ms->bytes2transmit -= 2;
106
+// printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit);
110
#ifdef CONFIG_ZAPATA_NET
111
if (ms->flags & ZT_FLAG_NETDEV)
112
netif_wake_queue(ztchan_to_dev(ms));
113
@@ -5335,6 +5404,12 @@
114
memset(txb, 0xFF, bytes);
117
+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
118
+ } else if(ms->flags & ZT_FLAG_BRIDCHAN) {
119
+ ms->bytes2transmit = 0;
124
memset(txb, ZT_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */
126
@@ -6153,6 +6228,14 @@
130
+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
131
+ if (ms->flags & ZT_FLAG_BRIDCHAN) {
132
+ bytes = ms->bytes2receive;
133
+ if (bytes < 1) return;
134
+// printk(KERN_CRIT "bytes2receive %d\n",ms->bytes2receive);
139
#if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP)
141
@@ -6210,6 +6293,19 @@
145
+#ifdef CONFIG_ZAPATA_BRI_DCHANS
146
+ } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
147
+ memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
149
+ ms->readidx[ms->inreadbuf] += left;
151
+ if (ms->eofrx == 1) {
154
+// printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive);
155
+ ms->bytes2receive = 0;
160
memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);