From 5401b056582c8f9747fa1d48e8ab0fca98e1be5d Mon Sep 17 00:00:00 2001 From: markster Date: Sun, 20 Jan 2002 17:48:38 +0000 Subject: Version 0.1.6 from FTP git-svn-id: http://svn.digium.com/svn/zaptel/trunk@49 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- torisa.c | 63 +++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'torisa.c') diff --git a/torisa.c b/torisa.c index 71182d7..53b529e 100755 --- a/torisa.c +++ b/torisa.c @@ -694,7 +694,7 @@ static int txerrors; static void torisa_intr(int irq, void *dev_id, struct pt_regs *regs) { static unsigned int passno = 0, mysynccnt = 0, lastsyncsrc = -1; - int n, n1, i, j, k, x, mysyncsrc; + int n, n1, i, j, k, x, mysyncsrc, oldn; static unsigned short rxword[33],txword[33]; unsigned char txc, rxc, c; unsigned char abits, bbits, cbits, dbits; @@ -732,11 +732,33 @@ static void torisa_intr(int irq, void *dev_id, struct pt_regs *regs) setctlreg(clockvals[syncsrc] | OUTBIT); /* clear 16 bit mode */ - /* Calculate the transmit, go thru all the chans */ - for(n1 = 0; n1 < channels_per_span; n1++) - { + /* Calculate the transmit, and receive go thru all the chans */ + oldn = -1; + for(n1 = 0; n1 < channels_per_span; n1++) { n = chseq[n1]; txword[n] = 0; + if (n < oldn) { + /* We've circled around. + Now we increment the passno and stuff */ + if ((passno % ZT_CHUNKSIZE) == (ZT_CHUNKSIZE - 1)) { + /* Swap buffers */ + for (x = 0;x < (channels_per_span * 2);x++) { + chans[x].readchunk = readdata[curread][x]; + chans[x].writechunk = writedata[curread][x]; + } + /* Lets work with the others now which presumably have been filled */ + curread = 1 - curread; + if (!taskletpending) { + taskletpending = 1; + taskletsched++; + tasklet_hi_schedule(&torisa_tlet); + } else { + txerrors++; + } + } + passno++; + } + oldn = n; /* go thru both spans */ for(j = 0; j < 2; j++) { @@ -744,21 +766,13 @@ static void torisa_intr(int irq, void *dev_id, struct pt_regs *regs) leaving with txc being character to transmit */ txc = writedata[curread][j * channels_per_span + n-1][passno % ZT_CHUNKSIZE]; txword[n] |= txc << (j * 8); - } - } - /* do the receive for all chans, both spans */ - for(n1 = 0; n1 < channels_per_span; n1++) - { - n = chseq[n1]; - /* go thru both spans */ - for(j = 0; j <= 1; j++) - { + /* receive side */ i = n + (j * channels_per_span); /* calc chan number */ rxc = (rxword[n] >> (j * 8)) & 0xff; readdata[curread][j * channels_per_span + n - 1][passno % ZT_CHUNKSIZE] = rxc; } - } + } i = passno & 511; /* if an E1 card, do rx signalling for it */ @@ -960,24 +974,6 @@ static void torisa_intr(int irq, void *dev_id, struct pt_regs *regs) /* update sync src info */ spans[0].syncsrc = spans[1].syncsrc = syncsrc; /* If this is the last pass, then prepare the next set */ - if ((passno % ZT_CHUNKSIZE) == (ZT_CHUNKSIZE - 1)) { - /* Swap buffers */ - for (x = 0;x < (channels_per_span * 2);x++) { - chans[x].readchunk = readdata[curread][x]; - chans[x].writechunk = writedata[curread][x]; - } - /* Lets work with the others now which presumably have been filled */ - curread = 1 - curread; - if (!taskletpending) { - taskletpending = 1; - taskletsched++; - tasklet_hi_schedule(&torisa_tlet); - } else { - txerrors++; - } - - } - passno++; /* clear outbit, restore interrupt enable */ setctlreg(clockvals[syncsrc] | INTENA); } @@ -1103,6 +1099,9 @@ static void __exit tor_exit(void) MODULE_AUTHOR("Mark Spencer "); MODULE_DESCRIPTION("Tormenta ISA Zapata Telephony Driver"); +#ifdef MODULE_LICENSE +MODULE_LICENSE("GPL"); +#endif MODULE_PARM(prefmaster, "i"); MODULE_PARM(base, "i"); MODULE_PARM(irq, "i"); -- cgit v1.2.3