~ubuntu-branches/ubuntu/quantal/zaptel/quantal

« back to all changes in this revision

Viewing changes to debian/patches/bri_dchan

  • Committer: Bazaar Package Importer
  • Author(s): Tzafrir Cohen
  • Date: 2008-08-28 22:58:23 UTC
  • mfrom: (11.1.11 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080828225823-r8bdunirm8hmc76m
Tags: 1:1.4.11~dfsg-2
* Patch xpp_fxs_power: Fixed an issue with hook detection of the Astribank
  FXS module.
* Don't fail init.d script if fxotune fails. This may happen if running it
  when Asterisk is already running.
* Bump standards version to 3.8.0.0 .
* Ignore false lintian warning ("m-a a-i" has "a a").
* Patch xpp_fxo_cid_always: do always pass PCM if that's what the user
  asked.
* Patch vzaphfc_proc_root_dir: fix vzaphfc on 2.6.26.
* Patch wcte12xp_flags: Proper time for irq save flags.
* Patch headers_2627: Fix location of semaphore.h for 2.6.27 .
* Patch xpp_fxs_dtmf_leak: Don't play DTMFs to the wrong channel.
* Patch wctdm_fix_alarm: Fix sending channel alarms.
* Patch device_class_2626: Fix building 2.6.26 (Closes: #493397).
* Using dh_lintian for lintian overrides, hence requiring debhelper 6.0.7.
* Lintian: we know we have direct changes. Too bad we're half-upstream :-(
* Fix doc-base section names. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
4
# per second.
 
5
 
 
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 @@
 
11
        int do_ppp_error;
 
12
        struct sk_buff_head ppp_rq;
 
13
 #endif
 
14
+#ifdef CONFIG_ZAPATA_BRI_DCHANS
 
15
+       int bytes2receive;
 
16
+       int maxbytes2transmit; /* size of the tx buffer in the card driver */
 
17
+       int bytes2transmit;
 
18
+       int eofrx;
 
19
+       int eoftx;
 
20
+#endif
 
21
        spinlock_t lock;
 
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 */
 
27
 
 
28
+#if defined(CONFIG_ZAPATA_BRI_DCHANS)
 
29
+#define ZT_FLAG_BRIDCHAN               (1 << 20)
 
30
+#endif
 
31
+
 
32
 struct zt_span {
 
33
        spinlock_t lock;
 
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
 
39
@@ -166,4 +166,10 @@
 
40
  */
 
41
 /* #define FXSFLASH */
 
42
 
 
43
+/*
 
44
+ * Uncomment the following for BRI D channels
 
45
+ *
 
46
+ */
 
47
+#define CONFIG_ZAPATA_BRI_DCHANS
 
48
+
 
49
 #endif
 
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);
 
56
                                }
 
57
                                bytes -= left;
 
58
+#ifdef CONFIG_ZAPATA_BRI_DCHANS
 
59
+                       } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
 
60
+                           /*
 
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)
 
65
+                            */
 
66
+
 
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;
 
74
+                               ms->eoftx = 0;
 
75
+                           } else {
 
76
+                               memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
 
77
+                               ms->writeidx[ms->outwritebuf] += left + 2;
 
78
+                               txb += left + 2;
 
79
+                               ms->bytes2transmit = left;
 
80
+                               ms->eoftx = 1;
 
81
+                           }
 
82
+                           bytes = 0;
 
83
+#endif
 
84
                        } else {
 
85
                                memcpy(txb, buf + ms->writeidx[ms->outwritebuf], left);
 
86
                                ms->writeidx[ms->outwritebuf]+=left;
 
87
                                txb += left;
 
88
                                bytes -= left;
 
89
+#if defined(CONFIG_ZAPATA_BRI_DCHANS)  
 
90
+                               ms->bytes2transmit=ZT_CHUNKSIZE;
 
91
+#endif
 
92
                        }
 
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) {
 
102
+                                       // txb += 2;
 
103
+                                       // ms->bytes2transmit -= 2;
 
104
+                                       bytes=0;
 
105
+                                       ms->eoftx = 1;
 
106
+//                                     printk(KERN_CRIT "zaptel EOF(%d) bytes2transmit %d\n",ms->eoftx,ms->bytes2transmit);
 
107
+                       //          }
 
108
+                               }
 
109
+#endif
 
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);
 
115
                        }
 
116
                        bytes = 0;
 
117
+#if defined(CONFIG_ZAPATA_BRI_DCHANS)  
 
118
+               } else if(ms->flags & ZT_FLAG_BRIDCHAN) { 
 
119
+                   ms->bytes2transmit = 0;
 
120
+                   ms->eoftx = 0;
 
121
+                   bytes = 0;
 
122
+#endif
 
123
                } else {
 
124
                        memset(txb, ZT_LIN2X(0, ms), bytes);    /* Lastly we use silence on telephony channels */
 
125
                        bytes = 0;
 
126
@@ -6153,6 +6228,14 @@
 
127
        int res;
 
128
        int left, x;
 
129
 
 
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);
 
135
+       }
 
136
+#endif
 
137
+
 
138
        while(bytes) {
 
139
 #if defined(CONFIG_ZAPATA_NET)  || defined(CONFIG_ZAPATA_PPP)
 
140
                skb = NULL;
 
141
@@ -6210,6 +6293,19 @@
 
142
                                                }
 
143
                                        }
 
144
                                }
 
145
+#ifdef CONFIG_ZAPATA_BRI_DCHANS
 
146
+                       } else if (ms->flags & ZT_FLAG_BRIDCHAN) {
 
147
+                           memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);
 
148
+                           rxb += left;
 
149
+                           ms->readidx[ms->inreadbuf] += left;
 
150
+                           bytes -= left;
 
151
+                           if (ms->eofrx == 1) {
 
152
+                               eof=1;
 
153
+                           }
 
154
+//                         printk(KERN_CRIT "receiving %d bytes\n",ms->bytes2receive);
 
155
+                           ms->bytes2receive = 0;
 
156
+                           ms->eofrx = 0;
 
157
+#endif
 
158
                        } else {
 
159
                                /* Not HDLC */
 
160
                                memcpy(buf + ms->readidx[ms->inreadbuf], rxb, left);