SOURCES: zaptel-bristuff.patch - updated; from debian; includes so...
arekm
arekm at pld-linux.org
Sat Feb 9 18:19:45 CET 2008
Author: arekm Date: Sat Feb 9 17:19:45 2008 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- updated; from debian; includes some extra drivers
---- Files affected:
SOURCES:
zaptel-bristuff.patch (1.2 -> 1.3)
---- Diffs:
================================================================
Index: SOURCES/zaptel-bristuff.patch
diff -u SOURCES/zaptel-bristuff.patch:1.2 SOURCES/zaptel-bristuff.patch:1.3
--- SOURCES/zaptel-bristuff.patch:1.2 Sat Feb 9 15:28:10 2008
+++ SOURCES/zaptel-bristuff.patch Sat Feb 9 18:19:40 2008
@@ -1,360 +1,18318 @@
-diff -burN zaptel-1.4.5.1.orig/Makefile zaptel-1.4.5.1/Makefile
---- zaptel-1.4.5.1.orig/Makefile 2007-12-04 09:47:55.000000000 +0100
-+++ zaptel-1.4.5.1/Makefile 2007-12-04 10:02:46.000000000 +0100
-@@ -255,7 +255,7 @@
-
- UTILSO = $(UTILS:%=%.o)
-
--BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest ztscan
-+BINS:=fxotune fxstest sethdlc-new ztcfg ztdiag ztmonitor ztspeed zttest ztscan ztpty
- ifeq (1,$(PBX_LIBNEWT))
- BINS+=zttool
+diff -urN zaptel-1.4.8.org/cwain/cwain.c zaptel-1.4.8/cwain/cwain.c
+--- zaptel-1.4.8.org/cwain/cwain.c 1970-01-01 01:00:00.000000000 +0100
++++ zaptel-1.4.8/cwain/cwain.c 2008-02-09 17:56:18.498299056 +0100
+@@ -0,0 +1,2206 @@
++/*
++ * cwain.c - Zaptel driver for the Junghanns.NET E1 card
++ *
++ * c.w.a.i.n. == card without an interesting name
++ *
++ * single/double E1 board
++ *
++ * Copyright (C) 2004, 2005, 2006, 2007 Junghanns.NET GmbH
++ *
++ * Klaus-Peter Junghanns <kpj at junghanns.net>
++ *
++ * This program is free software and may be modified and
++ * distributed under the terms of the GNU Public License.
++ *
++ */
++#include <linux/kernel.h>
++#include <linux/module.h>
++#include <linux/pci.h>
++#include <linux/init.h>
++#include <linux/interrupt.h>
++#include <zaptel.h>
++#include "cwain.h"
++
++#ifdef LINUX26
++#include <linux/moduleparam.h>
++#endif
++
++#if CONFIG_PCI
++
++static int ports=-1; /* autodetect */
++static int debug=0;
++static int hw_hdlc=1;
++static int hdlcnet=0;
++static int pwm0 = 0x50; /* TX level */
++static int pwm1 = 0x50; /* RX level */
++static int dacs = 1; /* 0 = no dacs, 1 = oncard dacs */
++static int require_ext_clock = 0;
++static struct zt_cwain *cwain_span_list = NULL;
++static int cwain_span_count = 0;
++static struct zt_cwain_card *cwain_card_list = NULL;
++static int cwain_card_count = 0;
++static struct pci_dev *multi_cwain = NULL;
++static spinlock_t cwain_span_registerlock = SPIN_LOCK_UNLOCKED;
++static spinlock_t cwain_card_registerlock = SPIN_LOCK_UNLOCKED;
++
++static int ztcwain_shutdown(struct zt_span *span);
++
++int cwain_waitbusy(struct zt_cwain *cwaintmp) {
++ int x=1000;
++ while (x-- && (cwain_inb(cwaintmp,cwain_R_STATUS) & 1));
++ if (x < 0) {
++ printk(KERN_CRIT "cwain: really busy waiting!\n");
++ return -1;
++ } else {
++ if ((x < 990) && (cwaintmp->ticks > 500)) {
++ printk(KERN_CRIT "cwain: waited %d\n", 1000 - x);
++ }
++ return 0;
++ }
++}
++
++void cwain_unregister_zap_span(struct zt_cwain *cwainspan) {
++ if (!cwainspan) {
++ printk(KERN_INFO "cwain: shutting down NULL span!\n");
++ return;
++ }
++ if(cwainspan->span.flags & ZT_FLAG_RUNNING) {
++ ztcwain_shutdown(&cwainspan->span);
++ if (debug)
++ printk(KERN_INFO "cwain: shutdown span %d.\n",cwainspan->cardno);
++ }
++ if(cwainspan->span.flags & ZT_FLAG_REGISTERED) {
++ zt_unregister(&cwainspan->span);
++ if (debug)
++ printk(KERN_INFO "cwain: unregistered span %d.\n",cwainspan->cardno);
++ }
++}
++
++void cwain_shutdown_span(struct zt_cwain *cwainspan) {
++
++ if (!cwainspan) {
++ printk(KERN_INFO "cwain: shutting down NULL span!\n");
++ return;
++ }
++
++ if (cwainspan->pci_io == NULL) {
++ return;
++ }
++
++ if (debug)
++ printk(KERN_INFO "cwain: shutting down span %d (cardID %d) at %p.\n",cwainspan->cardno,cwainspan->cardID,cwainspan->pci_io);
++
++ // turn off irqs
++
++ // softreset
++ cwain_outb(cwainspan,cwain_R_CIRM,0x8);
++ cwain_outb(cwainspan,cwain_R_CIRM,0x0);
++ cwain_waitbusy(cwainspan);
++
++ cwain_outb(cwainspan,cwain_R_IRQMSK_MISC, 0);
++ cwain_outb(cwainspan,cwain_R_IRQ_CTRL, 0);
++
++ pci_write_config_word(cwainspan->pcidev, PCI_COMMAND, 0); // disable memio
++
++ if (cwainspan->pcidev != NULL) {
++ pci_disable_device(cwainspan->pcidev);
++ cwainspan->pcidev = NULL;
++ }
++
++}
++
++void cwain_shutdown_card(struct zt_cwain_card *cwaintmp) {
++ unsigned long flags = 0;
++ int i = 0;
++
++ if (!cwaintmp) {
++ printk(KERN_INFO "cwain: shutting down NULL card!\n");
++ return;
++ }
++
++ spin_lock_irqsave(&cwaintmp->lock,flags);
++
++ // turn off irqs
++ cwain_outb(cwaintmp->span[0],cwain_R_IRQ_CTRL, 0);
++ cwain_outb(cwaintmp->span[0],cwain_R_IRQMSK_MISC, 0);
++
++ spin_unlock_irqrestore(&cwaintmp->lock,flags);
++
++ for (i=0;i<cwaintmp->spans;i++) {
++ cwain_unregister_zap_span(cwaintmp->span[i]);
++ }
++
++
++ for (i=0;i<cwaintmp->spans;i++) {
++ release_region(cwaintmp->span[i]->ioport, 8);
++ cwaintmp->span[i]->ioport = 0;
++ iounmap((void *) cwaintmp->span[i]->pci_io);
++ cwaintmp->span[i]->pci_io = NULL;
++ release_mem_region((unsigned long)cwaintmp->span[i]->pci_io_phys, 256);
++ }
++
++ if (cwaintmp->spans == 2) {
++ free_irq(cwaintmp->span[1]->irq,cwaintmp);
++ }
++ free_irq(cwaintmp->irq,cwaintmp);
++}
++
++void cwain_doLEDs(struct zt_cwain *cwaintmp) {
++ /*
++ O1 O3 (red)
++ O2 O4 (green)
++ */
++ if (!(cwaintmp->span.flags & ZT_FLAG_RUNNING)) {
++ return;
++ }
++ if ((cwaintmp->type == 0xb553) || (cwaintmp->type == 0xb554)) {
++ /* sync status */
++ if (((cwaintmp->sync_sta & 0x07) == 0x07) && cwaintmp->sync) {
++ cwaintmp->leds[0] = 1;
++ cwaintmp->leds[1] = 0;
++ } else {
++ cwaintmp->leds[0] = 0;
++ cwaintmp->leds[1] = 1;
++ }
++ /* multiframe alignment */
++ if ((cwaintmp->sync_sta & 0x20) == 0x20) {
++ cwaintmp->leds[2] = 1;
++ cwaintmp->leds[3] = 0;
++ } else {
++ if ((cwaintmp->span.lineconfig & ZT_CONFIG_CRC4) && cwaintmp->sync) {
++ /* CRC4 requested */
++ cwaintmp->leds[2] = 0;
++ cwaintmp->leds[3] = 1;
++ } else {
++ /* no CRC4, disable 3 and 4 */
++ cwaintmp->leds[2] = 1;
++ cwaintmp->leds[3] = 1;
++ }
++ }
++ cwain_outb(cwaintmp,cwain_R_GPIO_OUT1,(cwaintmp->leds[0] | (cwaintmp->leds[1] << 1) | (cwaintmp->leds[2] << 2) | (cwaintmp->leds[3] << 3)));
++ }
++}
++
++void cwain_reset_pcm(struct zt_cwain *cwaintmp, int master, int int_clock) {
++ /* PCM reset */
++ cwain_outb(cwaintmp,cwain_R_CIRM,0x20);
++ cwain_outb(cwaintmp,cwain_R_CIRM,0x0);
++ cwain_waitbusy(cwaintmp);
++
++ if (master) {
++ cwain_outb(cwaintmp,cwain_R_PCM_MD0, 0x91);
++ cwain_outb(cwaintmp,cwain_R_PCM_MD1, 0x20);
++ if (int_clock) {
++ cwain_outb(cwaintmp,cwain_R_PCM_MD0, 0xA1);
++ cwain_outb(cwaintmp,cwain_R_PCM_MD2, 0x04);
++ } else {
++ cwain_outb(cwaintmp,cwain_R_PCM_MD0, 0xA1);
++ cwain_outb(cwaintmp,cwain_R_PCM_MD2, 0x00);
++ }
++ } else {
++ cwain_outb(cwaintmp,cwain_R_PCM_MD0, 0x90);
++ cwain_outb(cwaintmp,cwain_R_PCM_MD1, 0x20);
++ }
++}
++
++void cwain_reset_span(struct zt_cwain *cwaintmp) {
++
++ pci_write_config_word(cwaintmp->pcidev, PCI_COMMAND, PCI_COMMAND_MEMORY | PCI_COMMAND_IO); // enable memio
++
++ cwain_reset_pcm(cwaintmp,0,0);
++
++ /* E1 reset */
++ cwain_outb(cwaintmp,cwain_R_CIRM,0x40);
++ cwain_outb(cwaintmp,cwain_R_CIRM,0x0);
++ cwain_waitbusy(cwaintmp);
++
++ /* soft reset */
++ cwain_outb(cwaintmp,cwain_R_CIRM,0x10);
++ cwain_outb(cwaintmp,cwain_R_CIRM,0x0);
++ cwain_waitbusy(cwaintmp);
++
++ /* 128 byte B chans, 4096 byte D chans */
++ if (hdlcnet) {
++ cwain_outb(cwaintmp,cwain_R_FIFO_MD,0x3E);
++ } else {
++ cwain_outb(cwaintmp,cwain_R_FIFO_MD,0x36);
++ }
++
++
++ cwain_outb(cwaintmp,cwain_R_BRG_PCM_CFG,0x0);
++ cwain_outb(cwaintmp,cwain_R_CTRL,0x0);
++
++ /* no blinky blink */
++ cwain_outb(cwaintmp,cwain_R_GPIO_SEL,0x20 | 0x10);
++ cwain_outb(cwaintmp,cwain_R_GPIO_EN1,0x0f);
++ cwain_outb(cwaintmp,cwain_R_GPIO_OUT1,0x0f);
++
++ /* IRQs off */
++ cwain_outb(cwaintmp,cwain_R_IRQMSK_MISC,0x0);
++ cwain_outb(cwaintmp,cwain_R_IRQ_CTRL,0x0);
++
++ cwaintmp->leds[0] = 1;
++ cwaintmp->leds[1] = 1;
++ cwaintmp->leds[2] = 1;
++ cwaintmp->leds[3] = 1;
++
++ cwaintmp->ticks = 0;
++ cwaintmp->clicks = 0;
++}
++
++struct zt_cwain_card *cwain_get_card(unsigned int pcibus) {
++ struct zt_cwain_card *cwaintmp = cwain_card_list;
++ spin_lock(&cwain_card_registerlock);
++ while (cwaintmp) {
++ if (cwaintmp->pcibus == pcibus) {
++ break;
++ }
++ cwaintmp = cwaintmp->next;
++ }
++ spin_unlock(&cwain_card_registerlock);
++ return cwaintmp;
++}
++
++
++void cwain_register_card(struct zt_cwain_card *cwaincard) {
++ spin_lock(&cwain_card_registerlock);
++ if (cwaincard != NULL) {
++ cwaincard->prev = NULL;
++ cwaincard->next = cwain_card_list;
++ if (cwain_card_list) {
++ cwain_card_list->prev = cwaincard;
++ }
++ cwain_card_list = cwaincard;
++ cwain_card_count++;
++ } else {
++ printk(KERN_INFO "cwain: trying to register NULL card.\n");
++ }
++ spin_unlock(&cwain_card_registerlock);
++}
++
++int cwain_register_span(struct zt_cwain *cwainspan) {
++ struct zt_cwain_card *cwaintmp;
++ spin_lock(&cwain_span_registerlock);
++ if (cwainspan != NULL) {
++ cwainspan->prev = NULL;
++ cwainspan->next = cwain_span_list;
++ if (cwain_span_list) {
++ cwain_span_list->prev = cwainspan;
++ }
++ cwain_span_list = cwainspan;
++ cwainspan->cardno = ++cwain_span_count;
++ } else {
++ printk(KERN_INFO "cwain: trying to register NULL span.\n");
++ }
++ spin_unlock(&cwain_span_registerlock);
++
++ if (cwainspan->type == 0xb553) {
++ cwaintmp = kmalloc(sizeof(struct zt_cwain_card),GFP_KERNEL);
++ if (!cwaintmp) {
++ printk(KERN_WARNING "cwain: unable to kmalloc!\n");
++ return -1;
++ }
++ memset(cwaintmp, 0x0, sizeof(struct zt_cwain_card));
++
++ spin_lock_init(&cwaintmp->lock);
++ cwaintmp->pcibus = cwainspan->pcibus;
++ cwaintmp->span[0] = cwainspan;
++ cwaintmp->syncs[0] = -1;
++ cwaintmp->spans = 1;
++ cwaintmp->cardID = cwainspan->cardID;
++ cwain_register_card(cwaintmp);
++ printk(KERN_INFO
++ "cwain: Junghanns.NET singleE1 PCI ISDN card configured at mem %lx IRQ %d HZ %d CardID %d\n",
++ (unsigned long) cwainspan->pci_io,
++ cwaintmp->span[0]->irq, HZ, cwainspan->cardID);
++ } else {
++ cwaintmp = cwain_get_card(cwainspan->pcibus);
++ if (!cwaintmp) {
++ cwaintmp = kmalloc(sizeof(struct zt_cwain_card),GFP_KERNEL);
++ if (!cwaintmp) {
++ printk(KERN_WARNING "cwain: unable to kmalloc!\n");
++ return -1;
++ }
++ memset(cwaintmp, 0x0, sizeof(struct zt_cwain_card));
++
++ spin_lock_init(&cwaintmp->lock);
++ cwaintmp->pcibus = cwainspan->pcibus;
++ cwaintmp->spans = cwainspan->type - 46419;
++ cwaintmp->span[0] = cwainspan;
++ cwaintmp->cardID = cwainspan->cardID;
++ cwaintmp->syncs[0] = -1;
++ cwain_register_card(cwaintmp);
++ } else {
++ cwaintmp->spans = cwainspan->type - 46418;
++ if (cwainspan->cardID < cwaintmp->cardID) {
++ cwaintmp->cardID = cwainspan->cardID;
++ cwaintmp->span[1] = cwaintmp->span[0];
++ cwaintmp->syncs[1] = cwaintmp->syncs[0];
++ cwaintmp->span[0] = cwainspan;
++ } else {
++ cwaintmp->span[1] = cwainspan;
++ cwaintmp->syncs[1] = -1;
++ }
++ printk(KERN_INFO
++ "cwain: Junghanns.NET doubleE1 PCI ISDN card configured at mem (%lx / %lx) IRQ %d HZ %d CardID (%d / %d) bus %#x\n",
++ (unsigned long) cwaintmp->span[0]->pci_io, (unsigned long) cwaintmp->span[1]->pci_io,
++ cwaintmp->span[0]->irq, HZ, cwaintmp->span[0]->cardID, cwaintmp->span[1]->cardID, cwaintmp->pcibus);
++ }
++ }
++ return 0;
++}
++
++static void cwain_dfifo_check(struct zt_cwain *cwaintmp) {
++ unsigned short z1=1,z2=1;
++ unsigned short oz1=0,oz2=0;
++ unsigned char f1=1,f2=1;
++ unsigned char of1=0,of2=0;
++ int space = 0;
++ int len;
++ int chan;
++ int fifo = 0x1f;
++ unsigned long flags;
++ int frames = 0;
++
++ if (hdlcnet) {
++ chan = 0;
++ } else {
++ chan = 15;
++ }
++
++
++ /* calculate how much data we can allow zaptel to transmit */
++ spin_lock_irqsave(&cwaintmp->lock,flags);
++ /* select tx fifo */
++
++ cwain_outb(cwaintmp,cwain_R_FIFO, fifo << 1);
++ cwain_waitbusy(cwaintmp);
++
++ while ((oz1 != z1) && (oz2 != z2)) {
++ oz1 = z1;
++ oz2 = z2;
++ z1 = cwain_inw(cwaintmp,cwain_A_Z1) & 0xfff;
++ z2 = cwain_inw(cwaintmp,cwain_A_Z2) & 0xfff;
++ }
++
++ len = z1-(z2 & 0xfff);
++ if (len < 0) {
++ len += cwain_DFIFO_SIZE;
++ }
++ space = cwain_DFIFO_SIZE - len;
++
++ if (((debug > 2) && (space < cwain_DFIFO_SIZE)) || (space == 0)) {
++ printk(KERN_INFO "cwain: card %d TX fifo %d space now %d\n", cwaintmp->cardno, fifo, space);
++ }
++ cwaintmp->chans[chan].maxbytes2transmit = space;
++
++
++ /* calculate how many frames are in the receive fifo */
++
++ /* select rx fifo */
++ cwain_outb(cwaintmp,cwain_R_FIFO,(fifo << 1) | 1);
++ cwain_waitbusy(cwaintmp);
++
++ while ((of1 != f1) && (of2 != f2)) {
++ of1 = f1;
++ of2 = f2;
++ f1 = cwain_inb(cwaintmp,cwain_A_F1) & 0xf;
++ f2 = cwain_inb(cwaintmp,cwain_A_F2) & 0xf;
++ }
++
++ frames = f1 - f2;
++ if (frames < 0) {
++ frames += cwain_DFIFO_FRAMES;
++ }
++ cwaintmp->drx = frames;
++
++ spin_unlock_irqrestore(&cwaintmp->lock,flags);
++
++ if ((frames > 0) && (debug > 3))
++ printk(KERN_INFO "\ncwain: %d frames in RX fifo\n", frames);
++}
++
++static int cwain_dfifo_tx(struct zt_cwain *cwaintmp) {
++ int chan;
++ int x=0;
++ char fifo = 0;
++ unsigned long flags = 0;
++
++ fifo = 0x1F;
++
++ if (hdlcnet) {
++ chan = 0;
++ } else {
++ chan = 15;
++ }
++
++ if (cwaintmp->chans[chan].bytes2transmit < 1) {
++ return 0;
++ } else {
++ spin_lock_irqsave(&cwaintmp->lock,flags);
++ /* select fifo */
++ cwain_outb(cwaintmp,cwain_R_FIFO,fifo << 1);
++ cwain_waitbusy(cwaintmp);
++
++ if (((debug > 3 ) && hdlcnet) || ((!hdlcnet) && (debug > 3)))
++ printk(KERN_INFO "cwain: card %d TX [ ", cwaintmp->cardno);
++ /* copy frame to fifo */
++ for (x=0;x<cwaintmp->chans[chan].bytes2transmit;x++) {
++ if (((debug > 3 ) && hdlcnet) || ((!hdlcnet) && (debug > 3)))
++ printk("%#x ",cwaintmp->dtxbuf[x]);
++ cwain_outb(cwaintmp,cwain_A_FIFO_DATA0,cwaintmp->dtxbuf[x]);
++ }
++ if (((debug > 3 ) && hdlcnet) || ((!hdlcnet) && (debug > 3)))
++ printk("]\n");
++ if (((debug > 2 ) && hdlcnet) || ((!hdlcnet) && (debug > 3)))
++ printk(KERN_INFO "ztx %d bytes\n",cwaintmp->chans[chan].bytes2transmit);
++
++ if (cwaintmp->chans[chan].eoftx == 1) {
++ /* transmit HDLC frame */
++ cwain_outb(cwaintmp,cwain_R_INC_RES_FIFO,0x1);
++ cwain_waitbusy(cwaintmp);
++ if ((debug > 3 ) && hdlcnet)
++ printk(KERN_INFO "cwain: TX flag\n");
++ }
++ spin_unlock_irqrestore(&cwaintmp->lock,flags);
++ }
++ return 0;
++}
++
++static int cwain_fifo_tx(struct zt_cwain *cwaintmp, char fifo) {
++ int chan,f;
++ unsigned long flags = 0;
++
++ if (hw_hdlc) {
++ if (fifo <= 14) {
++ chan = fifo;
++ } else {
++ chan = fifo + 1;
++ }
++ } else {
++ chan = fifo;
++ }
++
++ if (dacs && (cwaintmp->ts_rx[chan] > -1)) {
++ /* dont transmit when we receive from the pcm bus */
++ return 0;
++ }
++
++ spin_lock_irqsave(&cwaintmp->lock,flags);
++ /* select fifo */
++ cwain_outb(cwaintmp,cwain_R_FIFO,0x80 | (fifo << 1));
++ cwain_waitbusy(cwaintmp);
++
++ for (f=0; f < (cwain_FRAME_SIZE/4); f++) {
++ cwain_outdw(cwaintmp,cwain_A_FIFO_DATA0,*((unsigned int *) &cwaintmp->ftxbuf[chan][f * 4]));
++ }
++ spin_unlock_irqrestore(&cwaintmp->lock,flags);
++ return 0;
++}
++
++static int cwain_dfifo_rx(struct zt_cwain *cwaintmp) {
++ int chan;
++ unsigned char data,stat;
++ int len,i = 0;
++ unsigned short z1=1,z2=1;
++ unsigned short oz1=0,oz2=0;
++ char fifo = 0;
++ unsigned long flags = 0;
++
++ fifo = 0x1F;
++ if (hdlcnet) {
++ chan = 0;
++ } else {
++ chan = 15;
++ }
++
++ spin_lock_irqsave(&cwaintmp->lock,flags);
++ /* select fifo */
++ cwain_outb(cwaintmp,cwain_R_FIFO,(fifo << 1) | 1);
++ cwain_waitbusy(cwaintmp);
++
++ while ((oz1 != z1) && (oz2 != z2)) {
++ oz1 = z1;
++ oz2 = z2;
++ z1 = cwain_inw(cwaintmp,cwain_A_Z1) & 0xfff;
++ z2 = cwain_inw(cwaintmp,cwain_A_Z2) & 0xfff;
++ }
++
++ len = z1-(z2 & 0xfff);
++ if (len < 0) {
++ len += cwain_DFIFO_SIZE;
++ }
++
++ if (len > cwain_DFIFO_SIZE) {
++ printk(KERN_INFO "\ncwain: buffer overflow in D channel RX!\n");
++ cwaintmp->chans[chan].bytes2receive = 0;
++ cwaintmp->chans[chan].eofrx = 0;
++ } else {
++ if ((((debug > 3 ) && hdlcnet) || ((!hdlcnet) && (debug > 3))) && (cwaintmp->sync))
++ printk(KERN_INFO "cwain: card %d RX [ ", cwaintmp->cardno);
++ for (i=0; i<len; i++) {
++ data = cwain_inb(cwaintmp,cwain_A_FIFO_DATA0);
++ cwaintmp->drxbuf[i] = data;
++ if ((((debug > 3 ) && hdlcnet) || ((!hdlcnet) && (debug > 3))) && (cwaintmp->sync))
++ printk("%#x ",data);
++ }
++ if ((((debug > 3 ) && hdlcnet) || ((!hdlcnet) && (debug > 3))) && (cwaintmp->sync))
++ printk("] %d bytes\n", i);
++ cwaintmp->chans[chan].bytes2receive = i;
++ cwaintmp->chans[chan].eofrx = 1;
++ }
++
++ stat = cwain_inb(cwaintmp,cwain_A_FIFO_DATA0);
++ if (stat != 0x0) {
++ // bad CRC, skip it
++ if (cwaintmp->sync) {
++ printk(KERN_INFO "cwain: BAD CRC for hdlc frame on card %d (cardID %d) stat %#x len %d\n",cwaintmp->cardno, cwaintmp->cardID, stat, i);
++ }
++ cwaintmp->chans[chan].bytes2receive = 0;
++ cwaintmp->chans[chan].eofrx = 0;
++// zt_qevent_nolock(&cwaintmp->chans[chan], ZT_EVENT_BADFCS);
++ }
++ cwain_outb(cwaintmp,cwain_R_INC_RES_FIFO,0x1);
++ cwain_waitbusy(cwaintmp);
++
++ /* frame received */
++ cwaintmp->drx--;
++ if (!cwaintmp->sync) {
++ cwaintmp->chans[chan].bytes2receive = 0;
++ cwaintmp->chans[chan].eofrx = 0;
++ stat = 0xff;
++ }
++ spin_unlock_irqrestore(&cwaintmp->lock,flags);
++ if (stat == 0) {
++ return 1;
++ } else {
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/zaptel-bristuff.patch?r1=1.2&r2=1.3&f=u
More information about the pld-cvs-commit
mailing list