Idefisk
Tools
Tutorials
Reviews
VoIP Providers
Archives
AsteriskGuru Archives
Mailing List Archives
FAQ
Search
Memberlist
Usergroups
Register
Profile
Log in to check your private messages
Log in
[Asterisk-cvs] zaptel wcfxs.c,1.23,1.24
AsteriskGuru Archives Forum Index
->
Asterisk-CVS
View previous topic
::
View next topic
Author
Message
markster at lists.digium.
Guest
Posted: Sun Oct 05, 2003 7:26 pm
Post subject: [Asterisk-cvs] zaptel wcfxs.c,1.23,1.24
Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv7171
Modified Files:
wcfxs.c
Log Message:
First pass at eliminating excessive OHT usage
Index: wcfxs.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wcfxs.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- wcfxs.c 3 Oct 2003 19:22:20 -0000 1.23
+++ wcfxs.c 5 Oct 2003 19:27:13 -0000 1.24
@@ -132,6 +132,8 @@
#define RING_DEBOUNCE 64 /* Ringer Debounce (in ms) */
#define BATT_DEBOUNCE 8 /* Battery debounce (in ms) */
+#define OHT_TIMER 6000 /* How long after RING to retain OHT */
+
#define FLAG_DOUBLE_CLOCK (1 << 0)
#define NUM_CARDS 4
@@ -160,6 +162,7 @@
int debouncehook[NUM_CARDS];
int lastrxhook[NUM_CARDS];
int debounce[NUM_CARDS];
+ int ohttimer[NUM_CARDS];
int idletxhookstate[NUM_CARDS]; /* IDLE changing hook state */
int lasttxhook[NUM_CARDS];
@@ -252,51 +255,6 @@
static void wcfxs_reset_tdm(struct wcfxs *wc);
static void wcfxs_restart_dma(struct wcfxs *wc);
-static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
- struct wcfxs *wc = dev_id;
- unsigned char ints;
- int x;
-
- ints = inb(wc->ioaddr + WC_INTSTAT);
- outb(ints, wc->ioaddr + WC_INTSTAT);
-
- if (!ints)
- return;
-
- if (ints & 0x10) {
- /* Stop DMA, wait for watchdog */
- printk("FXS PCI Master abort\n");
- wcfxs_stop_dma(wc);
- return;
- }
-
- if (ints & 0x20) {
- printk("PCI Target abort\n");
- return;
- }
-
-
- if (ints & 0x0f) {
- wc->intcount++;
- x = wc->intcount % 4;
- if ((x < wc->cards) && (wc->cardflag & (1 << x))) {
- wcfxs_check_hook(wc, x);
- if (!(wc->intcount & 0xfc))
- wcfxs_recheck_sanity(wc, x);
- }
- if (!(wc->intcount % 10000)) {
- /* Accept an alarm once per 10 seconds */
- for (x=0;x<4;x++)
- if (wc->palarms[x])
- wc->palarms[x]--;
- }
- wcfxs_receiveprep(wc, ints);
- wcfxs_transmitprep(wc, ints);
- }
-
-}
-
static inline void write_8bits(struct wcfxs *wc, unsigned char bits)
{
/* Drop chip select */
@@ -513,6 +471,73 @@
return 0;
}
+static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+ struct wcfxs *wc = dev_id;
+ unsigned char ints;
+ int x;
+
+ ints = inb(wc->ioaddr + WC_INTSTAT);
+ outb(ints, wc->ioaddr + WC_INTSTAT);
+
+ if (!ints)
+ return;
+
+ if (ints & 0x10) {
+ /* Stop DMA, wait for watchdog */
+ printk("FXS PCI Master abort\n");
+ wcfxs_stop_dma(wc);
+ return;
+ }
+
+ if (ints & 0x20) {
+ printk("PCI Target abort\n");
+ return;
+ }
+
+ for (x=0;x<4;x++) {
+ if ((x < wc->cards) && (wc->cardflag & (1 << x))) {
+ if (wc->lasttxhook[x] == 0x4) {
+ /* RINGing, prepare for OHT */
+ wc->ohttimer[x] = OHT_TIMER;
+ wc->idletxhookstate[x] = 0x2; /* OHT mode when idle */
+ } else {
+ if (wc->ohttimer[x]) {
+ wc->ohttimer[x]-= ZT_CHUNKSIZE;
+ if (!wc->ohttimer[x]) {
+ wc->idletxhookstate[x] = 0x1; /* Switch to active */
+ if (wc->lasttxhook[x] == 0x2) {
+ /* Apply the change if appropriate */
+ wc->lasttxhook[x] = 0x1;
+ wcfxs_setreg(wc, x, 64, wc->lasttxhook[x]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (ints & 0x0f) {
+ wc->intcount++;
+ x = wc->intcount % 4;
+ if ((x < wc->cards) && (wc->cardflag & (1 << x))) {
+ wcfxs_check_hook(wc, x);
+ if (!(wc->intcount & 0xfc))
+ wcfxs_recheck_sanity(wc, x);
+ }
+ if (!(wc->intcount % 10000)) {
+ /* Accept an alarm once per 10 seconds */
+ for (x=0;x<4;x++)
+ if (wc->palarms[x])
+ wc->palarms[x]--;
+ }
+ wcfxs_receiveprep(wc, ints);
+ wcfxs_transmitprep(wc, ints);
+ }
+
+
+}
+
static int wcfxs_proslic_insane(struct wcfxs *wc, int card)
{
int blah,insane_report;
@@ -1025,14 +1050,11 @@
static int wcfxs_open(struct zt_chan *chan)
{
struct wcfxs *wc = chan->pvt;
- int x;
if (!(wc->cardflag & (1 << (chan->chanpos - 1))))
return -ENODEV;
if (wc->dead)
return -ENODEV;
wc->usecount++;
- for (x=0;x<wc->cards;x++)
- wc->idletxhookstate[x] = 2;
MOD_INC_USE_COUNT;
return 0;
}
Back to top
Display posts from previous:
All Posts
1 Day
7 Days
2 Weeks
1 Month
3 Months
6 Months
1 Year
Oldest First
Newest First
AsteriskGuru Archives Forum Index
->
Asterisk-CVS
All times are GMT
Page
1
of
1
Jump to:
Select a forum
Asterisk Mailing Lists
----------------
Asterisk-Users
Asterisk-Dev
Asterisk-CVS
Asterisk-Biz
Asterisk-Doc
Asterisk-BSD
Asterisk-Announce
Asterisk Call Centers
Asterisk-Video
Asterisk-Speech-Rec
Bristuff-Users
You
cannot
post new topics in this forum
You
cannot
reply to topics in this forum
You
cannot
edit your posts in this forum
You
cannot
delete your posts in this forum
You
cannot
vote in polls in this forum
Powered by
phpBB
© 2001, 2005 phpBB Group