]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/asterisk-1.2.4-zaptel-bristuff-0.3.0-PRE-1l.patch
HinzugefĆ¼gt:
[ipfire-2.x.git] / src / patches / asterisk-1.2.4-zaptel-bristuff-0.3.0-PRE-1l.patch
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);
6 }
7 bytes -= left;
8 +#ifdef CONFIG_ZAPATA_BRI_DCHANS
9 + } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
10 + /*
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)
15 + */
16 +
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;
24 + ms->eoftx = 0;
25 + } else {
26 + memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
27 + ms->writeidx[ms->outwritebuf] += left + 2;
28 + txb += left;
29 + ms->bytes2transmit = left;
30 + ms->eoftx = 1;
31 + }
32 + bytes = 0;
33 +#endif
34 } else {
35 memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
36 ms->writeidx[ms->outwritebuf]+=left;
37 txb += left;
38 bytes -= left;
39 +#if defined(CONFIG_ZAPATA_BRI_DCHANS)
40 + ms->bytes2transmit=ZT_CHUNKSIZE;
41 +#endif
42 }
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) {
52 + // txb += 2;
53 + // ms->bytes2transmit -= 2;
54 + bytes=0;
55 + ms->eoftx = 1;
56 +// printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit);
57 + // }
58 + }
59 +#endif
60 #ifdef CONFIG_ZAPATA_NET
61 if (ms->flags & ZT_FLAG_NETDEV)
62 netif_wake_queue(ztchan_to_dev(ms));
63 @@ -4972,7 +5012,7 @@
64 tasklet_schedule(&ms->ppp_calls);
65 }
66 #endif
67 - }
68 + }
69 } else if (ms->curtone && !(ms->flags & ZT_FLAG_PSEUDO)) {
70 left = ms->curtone->tonesamples - ms->tonep;
71 if (left > bytes)
72 @@ -5018,6 +5058,10 @@
73 memset(txb, 0xFF, bytes);
74 }
75 bytes = 0;
76 +#if defined(CONFIG_ZAPATA_BRI_DCHANS)
77 + } else if(ms->flags & ZT_FLAG_BRIDCHAN) {
78 + bytes = 0;
79 +#endif
80 } else {
81 memset(txb, ZT_LIN2X(0, ms), bytes); /* Lastly we use silence on telephony channels */
82 bytes = 0;
83 @@ -5743,6 +5787,13 @@
84 int left, x;
85
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);
92 + }
93 +#endif
94
95 while(bytes) {
96 #if defined(CONFIG_ZAPATA_NET) || defined(CONFIG_ZAPATA_PPP)
97 @@ -5801,6 +5852,19 @@
98 }
99 }
100 }
101 +#ifdef CONFIG_ZAPATA_BRI_DCHANS
102 + } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
103 + memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
104 + rxb += left;
105 + ms->readidx[ms->inreadbuf] += left;
106 + bytes -= left;
107 + if (ms->eofrx == 1) {
108 + eof=1;
109 + }
110 +// printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive);
111 + ms->bytes2receive = 0;
112 + ms->eofrx = 0;
113 +#endif
114 } else {
115 /* Not HDLC */
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
120 @@ -994,6 +994,13 @@
121 int do_ppp_error;
122 struct sk_buff_head ppp_rq;
123 #endif
124 +#ifdef CONFIG_ZAPATA_BRI_DCHANS
125 + int bytes2receive;
126 + int maxbytes2transmit; /* size of the tx buffer in the card driver */
127 + int bytes2transmit;
128 + int eofrx;
129 + int eoftx;
130 +#endif
131 spinlock_t lock;
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 */
140
141
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 */
146
147 +#if defined(CONFIG_ZAPATA_BRI_DCHANS)
148 +#define ZT_FLAG_BRIDCHAN (1 << 17)
149 +#endif
150 +
151 struct zt_span {
152 spinlock_t lock;
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
157 @@ -152,4 +152,10 @@
158 */
159 /* #define FXSFLASH */
160
161 +/*
162 + * Uncomment the following for BRI D channels
163 + *
164 + */
165 +#define CONFIG_ZAPATA_BRI_DCHANS
166 +
167 #endif