]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/zaptel.patch
GeƤndert:
[ipfire-2.x.git] / src / patches / zaptel.patch
CommitLineData
5f892677
MT
1Only in zaptel-1.2.5: version.h
2Only in zaptel-1.2.5: zaptel
3diff -ur zaptel-1.2.5.orig/zaptel.c zaptel-1.2.5/zaptel.c
4--- zaptel-1.2.5.orig/zaptel.c 2005-12-17 03:04:05.000000000 +0100
5+++ zaptel-1.2.5/zaptel.c 2006-04-10 10:39:37.000000000 +0200
5e69ef1a
MT
6@@ -4913,11 +4913,40 @@
7 *(txb++) = fasthdlc_tx_run_nocheck(&ms->txhdlc);
8 }
9 bytes -= left;
10+#ifdef CONFIG_ZAPATA_BRI_DCHANS
11+ } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
12+ /*
13+ * Let's get this right, we want to transmit complete frames only.
14+ * The card driver will do the dirty HDLC work for us.
15+ * txb (transmit buffer) is supposed to be big enough to store one frame
16+ * we will make this as big as the D fifo (1KB or 2KB)
17+ */
18+
19+ /* there are 'left' bytes in the user buffer left to transmit */
20+ left = ms->writen[ms->outwritebuf] - ms->writeidx[ms->outwritebuf] - 2;
21+ if (left > ms->maxbytes2transmit) {
22+ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], ms->maxbytes2transmit);
23+ ms->writeidx[ms->outwritebuf] += ms->maxbytes2transmit;
24+ txb += ms->maxbytes2transmit;
25+ ms->bytes2transmit = ms->maxbytes2transmit;
26+ ms->eoftx = 0;
27+ } else {
28+ memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
29+ ms->writeidx[ms->outwritebuf] += left + 2;
30+ txb += left;
31+ ms->bytes2transmit = left;
32+ ms->eoftx = 1;
33+ }
34+ bytes = 0;
35+#endif
36 } else {
37 memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
38 ms->writeidx[ms->outwritebuf]+=left;
39 txb += left;
40 bytes -= left;
41+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
42+ ms->bytes2transmit=ZT_CHUNKSIZE;
43+#endif
44 }
45 /* Check buffer status */
46 if (ms->writeidx[ms->outwritebuf] >= ms->writen[ms->outwritebuf]) {
47@@ -4962,6 +4991,17 @@
48 /* Transmit a flag if this is an HDLC channel */
49 if (ms->flags & ZT_FLAG_HDLC)
50 fasthdlc_tx_frame_nocheck(&ms->txhdlc);
51+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
52+ if(ms->flags & ZT_FLAG_BRIDCHAN) {
53+ // if (ms->bytes2transmit > 0) {
54+ // txb += 2;
55+ // ms->bytes2transmit -= 2;
56+ bytes=0;
57+ ms->eoftx = 1;
58+// printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit);
59+ // }
60+ }
61+#endif
62 #ifdef CONFIG_ZAPATA_NET
63 if (ms->flags & ZT_FLAG_NETDEV)
64 netif_wake_queue(ztchan_to_dev(ms));
65@@ -4972,7 +5012,7 @@
66 tasklet_schedule(&ms->ppp_calls);
67 }
68 #endif
69- }
70+ }
71 } else if (ms->curtone && !(ms->flags & ZT_FLAG_PSEUDO)) {
72 left = ms->curtone->tonesamples - ms->tonep;
73 if (left > bytes)
74@@ -5018,6 +5058,10 @@
75 memset(txb, 0xFF, bytes);
76 }
77 bytes = 0;
78+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
79+ } else if(ms->flags & ZT_FLAG_BRIDCHAN) {
80+ bytes = 0;
81+#endif
82 } else {
83 memset(txb, ZT_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */
84 bytes = 0;
85@@ -5743,6 +5787,13 @@
86 int left, x;
87
88 int bytes = ZT_CHUNKSIZE;
89+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
90+ if (ms->flags & ZT_FLAG_BRIDCHAN) {
91+ bytes = ms->bytes2receive;
92+ if (bytes < 1) return;
93+// printk(KERN_CRIT "bytes2receive %d\n",ms->bytes2receive);
94+ }
95+#endif
96
97 while(bytes) {
98 #if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP)
99@@ -5801,6 +5852,19 @@
100 }
101 }
102 }
103+#ifdef CONFIG_ZAPATA_BRI_DCHANS
104+ } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
105+ memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
106+ rxb += left;
107+ ms->readidx[ms->inreadbuf] += left;
108+ bytes -= left;
109+ if (ms->eofrx == 1) {
110+ eof=1;
111+ }
112+// printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive);
113+ ms->bytes2receive = 0;
114+ ms->eofrx = 0;
115+#endif
116 } else {
117 /* Not HDLC */
118 memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
5f892677
MT
119diff -ur zaptel-1.2.5.orig/zaptel.h zaptel-1.2.5/zaptel.h
120--- zaptel-1.2.5.orig/zaptel.h 2005-12-17 03:04:05.000000000 +0100
121+++ zaptel-1.2.5/zaptel.h 2006-04-10 10:39:37.000000000 +0200
5e69ef1a
MT
122@@ -994,6 +994,13 @@
123 int do_ppp_error;
124 struct sk_buff_head ppp_rq;
125 #endif
126+#ifdef CONFIG_ZAPATA_BRI_DCHANS
127+ int bytes2receive;
128+ int maxbytes2transmit; /* size of the tx buffer in the card driver */
129+ int bytes2transmit;
130+ int eofrx;
131+ int eoftx;
132+#endif
133 spinlock_t lock;
134 char name[40]; /* Name */
135 /* Specified by zaptel */
136@@ -1068,7 +1075,7 @@
137 int txbufpolicy; /* Buffer policy */
138 int rxbufpolicy; /* Buffer policy */
139 int txdisable; /* Disable transmitter */
140- int rxdisable; /* Disable receiver */
141+ int rxdisable; /* Disable receiver */
142
143
144 /* Tone zone stuff */
145@@ -1231,6 +1238,10 @@
146 #define ZT_FLAG_T1PPP (1 << 15)
147 #define ZT_FLAG_SIGFREEZE (1 << 16) /* Freeze signalling */
148
149+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
150+#define ZT_FLAG_BRIDCHAN (1 << 17)
151+#endif
152+
153 struct zt_span {
154 spinlock_t lock;
155 void *pvt; /* Private stuff */
5f892677
MT
156diff -ur zaptel-1.2.5.orig/zconfig.h zaptel-1.2.5/zconfig.h
157--- zaptel-1.2.5.orig/zconfig.h 2005-11-29 19:42:08.000000000 +0100
158+++ zaptel-1.2.5/zconfig.h 2006-04-10 10:39:37.000000000 +0200
5e69ef1a
MT
159@@ -152,4 +152,10 @@
160 */
161 /* #define FXSFLASH */
162
163+/*
164+ * Uncomment the following for BRI D channels
165+ *
166+ */
167+#define CONFIG_ZAPATA_BRI_DCHANS
168+
169 #endif