patch-2.2.11 linux/drivers/isdn/hisax/teleint.c
Next file: linux/drivers/isdn/hisax/teles0.c
Previous file: linux/drivers/isdn/hisax/tei.c
Back to the patch index
Back to the overall index
- Lines: 194
- Date:
Mon Aug 9 12:04:39 1999
- Orig file:
v2.2.10/linux/drivers/isdn/hisax/teleint.c
- Orig date:
Thu Nov 5 09:58:44 1998
diff -u --recursive --new-file v2.2.10/linux/drivers/isdn/hisax/teleint.c linux/drivers/isdn/hisax/teleint.c
@@ -1,11 +1,24 @@
-/* $Id: teleint.c,v 1.5 1998/02/02 13:40:47 keil Exp $
+/* $Id: teleint.c,v 1.9 1999/07/12 21:05:30 keil Exp $
* teleint.c low level stuff for TeleInt isdn cards
*
- * Author Karsten Keil (keil@temic-ech.spacenet.de)
+ * Author Karsten Keil (keil@isdn4linux.de)
*
*
* $Log: teleint.c,v $
+ * Revision 1.9 1999/07/12 21:05:30 keil
+ * fix race in IRQ handling
+ * added watchdog for lost IRQs
+ *
+ * Revision 1.8 1999/07/01 08:12:12 keil
+ * Common HiSax version for 2.0, 2.1, 2.2 and 2.3 kernel
+ *
+ * Revision 1.7 1998/11/15 23:55:26 keil
+ * changes from 2.0
+ *
+ * Revision 1.6 1998/04/15 16:45:31 keil
+ * new init code
+ *
* Revision 1.5 1998/02/02 13:40:47 keil
* fast io
*
@@ -32,7 +45,7 @@
extern const char *CardType[];
-const char *TeleInt_revision = "$Revision: 1.5 $";
+const char *TeleInt_revision = "$Revision: 1.9 $";
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
@@ -64,17 +77,20 @@
readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size)
{
register u_char ret;
- int max_delay = 2000;
+ register int max_delay = 20000;
+ register int i;
+
byteout(ale, off);
-
- ret = HFC_BUSY & bytein(ale);
- while (ret && --max_delay)
+ for (i = 0; i<size; i++) {
ret = HFC_BUSY & bytein(ale);
- if (!max_delay) {
- printk(KERN_WARNING "TeleInt Busy not inaktive\n");
- return;
+ while (ret && --max_delay)
+ ret = HFC_BUSY & bytein(ale);
+ if (!max_delay) {
+ printk(KERN_WARNING "TeleInt Busy not inaktive\n");
+ return;
+ }
+ data[i] = bytein(adr);
}
- insb(adr, data, size);
}
@@ -104,18 +120,21 @@
writefifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size)
{
register u_char ret;
- int max_delay = 2000;
-
+ register int max_delay = 20000;
+ register int i;
+
/* fifo write without cli because it's allready done */
byteout(ale, off);
- ret = HFC_BUSY & bytein(ale);
- while (ret && --max_delay)
+ for (i = 0; i<size; i++) {
ret = HFC_BUSY & bytein(ale);
- if (!max_delay) {
- printk(KERN_WARNING "TeleInt Busy not inaktive\n");
- return;
+ while (ret && --max_delay)
+ ret = HFC_BUSY & bytein(ale);
+ if (!max_delay) {
+ printk(KERN_WARNING "TeleInt Busy not inaktive\n");
+ return;
+ }
+ byteout(adr, data[i]);
}
- outsb(adr, data, size);
}
/* Interface functions */
@@ -157,11 +176,8 @@
cs->hw.hfc.cip = reg;
byteout(cs->hw.hfc.addr | 1, reg);
ret = bytein(cs->hw.hfc.addr);
- if (cs->debug & L1_DEB_HSCX_FIFO && (data != 2)) {
- char tmp[32];
- sprintf(tmp, "hfc RD %02x %02x", reg, ret);
- debugl1(cs, tmp);
- }
+ if (cs->debug & L1_DEB_HSCX_FIFO && (data != 2))
+ debugl1(cs, "hfc RD %02x %02x", reg, ret);
} else
ret = bytein(cs->hw.hfc.addr | 1);
return (ret);
@@ -174,18 +190,15 @@
cs->hw.hfc.cip = reg;
if (data)
byteout(cs->hw.hfc.addr, value);
- if (cs->debug & L1_DEB_HSCX_FIFO && (data != 2)) {
- char tmp[32];
- sprintf(tmp, "hfc W%c %02x %02x", data ? 'D' : 'C', reg, value);
- debugl1(cs, tmp);
- }
+ if (cs->debug & L1_DEB_HSCX_FIFO && (data != 2))
+ debugl1(cs, "hfc W%c %02x %02x", data ? 'D' : 'C', reg, value);
}
static void
TeleInt_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{
struct IsdnCardState *cs = dev_id;
- u_char val, stat = 0;
+ u_char val;
if (!cs) {
printk(KERN_WARNING "TeleInt: Spurious interrupt!\n");
@@ -193,20 +206,16 @@
}
val = readreg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_ISTA);
Start_ISAC:
- if (val) {
+ if (val)
isac_interrupt(cs, val);
- stat |= 2;
- }
val = readreg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_ISTA);
if (val) {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "ISAC IntStat after IntRoutine");
goto Start_ISAC;
}
- if (stat & 2) {
- writereg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_MASK, 0xFF);
- writereg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_MASK, 0x0);
- }
+ writereg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_MASK, 0xFF);
+ writereg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, ISAC_MASK, 0x0);
}
static void
@@ -246,11 +255,11 @@
save_flags(flags);
sti();
current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(3);
+ schedule_timeout((30*HZ)/1000);
cs->hw.hfc.cirm &= ~HFC_RESET;
byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm); /* Reset Off */
current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(1);
+ schedule_timeout((10*HZ)/1000);
restore_flags(flags);
}
@@ -264,13 +273,13 @@
case CARD_RELEASE:
release_io_TeleInt(cs);
return(0);
- case CARD_SETIRQ:
- return(request_irq(cs->irq, &TeleInt_interrupt,
- I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
inithfc(cs);
clear_pending_isac_ints(cs);
initisac(cs);
+ /* Reenable all IRQ */
+ cs->writeisac(cs, ISAC_MASK, 0);
+ cs->writeisac(cs, ISAC_CMDR, 0x41);
cs->hw.hfc.timer.expires = jiffies + 1;
add_timer(&cs->hw.hfc.timer);
return(0);
@@ -356,6 +365,7 @@
cs->BC_Read_Reg = &ReadHFC;
cs->BC_Write_Reg = &WriteHFC;
cs->cardmsg = &TeleInt_card_msg;
+ cs->irq_func = &TeleInt_interrupt;
ISACVersion(cs, "TeleInt:");
return (1);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)