19 static const char *TeleInt_revision =
"$Revision: 1.16.2.5 $";
21 #define byteout(addr, val) outb(val, addr)
22 #define bytein(addr) inb(addr)
32 while (ret && --max_delay)
46 register int max_delay = 20000;
50 for (i = 0; i <
size; i++) {
52 while (ret && --max_delay)
71 while (ret && --max_delay)
81 writefifo(
unsigned int ale,
unsigned int adr,
u_char off,
u_char *data,
int size)
84 register int max_delay = 20000;
88 for (i = 0; i <
size; i++) {
90 while (ret && --max_delay)
106 return (
readreg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, offset));
113 writereg(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, offset, value);
117 ReadISACfifo(
struct IsdnCardState *cs,
u_char *data,
int size)
120 readfifo(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, 0, data, size);
124 WriteISACfifo(
struct IsdnCardState *cs,
u_char *data,
int size)
127 writefifo(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, 0, data, size);
131 ReadHFC(
struct IsdnCardState *cs,
int data,
u_char reg)
136 cs->hw.hfc.cip =
reg;
137 byteout(cs->hw.hfc.addr | 1, reg);
138 ret =
bytein(cs->hw.hfc.addr);
139 if (cs->debug & L1_DEB_HSCX_FIFO && (data != 2))
140 debugl1(cs,
"hfc RD %02x %02x", reg, ret);
142 ret =
bytein(cs->hw.hfc.addr | 1);
149 byteout(cs->hw.hfc.addr | 1, reg);
150 cs->hw.hfc.cip =
reg;
152 byteout(cs->hw.hfc.addr, value);
153 if (cs->debug & L1_DEB_HSCX_FIFO && (data != 2))
154 debugl1(cs,
"hfc W%c %02x %02x", data ?
'D' :
'C', reg, value);
158 TeleInt_interrupt(
int intno,
void *
dev_id)
160 struct IsdnCardState *cs =
dev_id;
171 if (cs->debug & L1_DEB_ISAC)
172 debugl1(cs,
"ISAC IntStat after IntRoutine");
177 spin_unlock_irqrestore(&cs->lock, flags);
182 TeleInt_Timer(
struct IsdnCardState *cs)
188 if (cs->bcs[0].mode) {
192 if (cs->bcs[1].mode) {
196 spin_unlock_irqrestore(&cs->lock, flags);
205 release_io_TeleInt(
struct IsdnCardState *cs)
214 reset_TeleInt(
struct IsdnCardState *cs)
218 byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm);
221 byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm);
226 TeleInt_card_msg(
struct IsdnCardState *cs,
int mt,
void *
arg)
235 spin_unlock_irqrestore(&cs->lock, flags);
238 release_io_TeleInt(cs);
249 spin_unlock_irqrestore(&cs->lock, flags);
265 struct IsdnCardState *cs = card->
cs;
268 strcpy(tmp, TeleInt_revision);
273 cs->hw.hfc.addr = card->
para[1] & 0x3fe;
274 cs->irq = card->
para[0];
276 cs->hw.hfc.isac_spcr = 0x00;
279 cs->bcs[0].hw.hfc.send =
NULL;
280 cs->bcs[1].hw.hfc.send =
NULL;
281 cs->hw.hfc.fifosize = 7 * 1024 + 512;
282 cs->hw.hfc.timer.function = (
void *) TeleInt_Timer;
283 cs->hw.hfc.timer.data = (
long) cs;
287 "HiSax: TeleInt config port %x-%x already in use\n",
289 cs->hw.hfc.addr + 2);
293 byteout(cs->hw.hfc.addr, cs->hw.hfc.addr & 0xff);
294 byteout(cs->hw.hfc.addr | 1, ((cs->hw.hfc.addr & 0x300) >> 8) | 0x54);
316 release_io_TeleInt(cs);
319 byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm);
320 byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.ctmt);
323 cs->hw.hfc.addr, cs->irq);
328 cs->readisacfifo = &ReadISACfifo;
329 cs->writeisacfifo = &WriteISACfifo;
330 cs->BC_Read_Reg = &ReadHFC;
331 cs->BC_Write_Reg = &WriteHFC;
332 cs->cardmsg = &TeleInt_card_msg;
333 cs->irq_func = &TeleInt_interrupt;