1 /* $Id: isar.c,v 1.22.2.6 2004/02/11 13:21:34 keil Exp $
3 * isar.c ISAR (Siemens PSB 7110) specific routines
5 * Author Karsten Keil (keil@isdn4linux.de)
7 * This file is (c) under GNU General Public License
11 #include <linux/init.h>
15 #include <linux/interrupt.h>
17 #define DBG_LOADFIRM 0
18 #define DUMP_MBOXFRAME 2
24 const u_char faxmodulation
[] = {3,24,48,72,73,74,96,97,98,121,122,145,146};
25 static u_int modmask
= 0x1fff;
26 static int frm_extra_delay
= 2;
27 static int para_TOA
= 6;
28 const u_char
*FC1_CMD
[] = {"FAE", "FTS", "FRS", "FTM", "FRM", "FTH", "FRH", "CTRL" };
30 void isar_setup(struct IsdnCardState
*cs
);
31 static void isar_pump_cmd(struct BCState
*bcs
, u_char cmd
, u_char para
);
32 static void ll_deliver_faxstat(struct BCState
*bcs
, u_char status
);
35 waitforHIA(struct IsdnCardState
*cs
, int timeout
)
38 while ((cs
->BC_Read_Reg(cs
, 0, ISAR_HIA
) & 1) && timeout
) {
43 printk(KERN_WARNING
"HiSax: ISAR waitforHIA timeout\n");
49 sendmsg(struct IsdnCardState
*cs
, u_char his
, u_char creg
, u_char len
,
54 if (!waitforHIA(cs
, 4000))
57 if (cs
->debug
& L1_DEB_HSCX
)
58 debugl1(cs
, "sendmsg(%02x,%02x,%d)", his
, creg
, len
);
60 cs
->BC_Write_Reg(cs
, 0, ISAR_CTRL_H
, creg
);
61 cs
->BC_Write_Reg(cs
, 0, ISAR_CTRL_L
, len
);
62 cs
->BC_Write_Reg(cs
, 0, ISAR_WADR
, 0);
64 cs
->BC_Write_Reg(cs
, 1, ISAR_MBOX
, msg
[0]);
66 cs
->BC_Write_Reg(cs
, 2, ISAR_MBOX
, msg
[i
]);
68 if (cs
->debug
& L1_DEB_HSCX_FIFO
) {
74 t
+= sprintf(t
, "sendmbox cnt %d", len
);
75 QuickHex(t
, &msg
[len
-i
], (i
>64) ? 64:i
);
82 cs
->BC_Write_Reg(cs
, 1, ISAR_HIS
, his
);
83 waitforHIA(cs
, 10000);
87 /* Call only with IRQ disabled !!! */
89 rcv_mbox(struct IsdnCardState
*cs
, struct isar_reg
*ireg
, u_char
*msg
)
93 cs
->BC_Write_Reg(cs
, 1, ISAR_RADR
, 0);
94 if (msg
&& ireg
->clsb
) {
95 msg
[0] = cs
->BC_Read_Reg(cs
, 1, ISAR_MBOX
);
96 for (i
=1; i
< ireg
->clsb
; i
++)
97 msg
[i
] = cs
->BC_Read_Reg(cs
, 2, ISAR_MBOX
);
99 if (cs
->debug
& L1_DEB_HSCX_FIFO
) {
105 t
+= sprintf(t
, "rcv_mbox cnt %d", ireg
->clsb
);
106 QuickHex(t
, &msg
[ireg
->clsb
-i
], (i
>64) ? 64:i
);
113 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
116 /* Call only with IRQ disabled !!! */
118 get_irq_infos(struct IsdnCardState
*cs
, struct isar_reg
*ireg
)
120 ireg
->iis
= cs
->BC_Read_Reg(cs
, 1, ISAR_IIS
);
121 ireg
->cmsb
= cs
->BC_Read_Reg(cs
, 1, ISAR_CTRL_H
);
122 ireg
->clsb
= cs
->BC_Read_Reg(cs
, 1, ISAR_CTRL_L
);
124 if (cs
->debug
& L1_DEB_HSCX
)
125 debugl1(cs
, "irq_stat(%02x,%02x,%d)", ireg
->iis
, ireg
->cmsb
,
131 waitrecmsg(struct IsdnCardState
*cs
, u_char
*len
,
132 u_char
*msg
, int maxdelay
)
135 struct isar_reg
*ir
= cs
->bcs
[0].hw
.isar
.reg
;
138 while((!(cs
->BC_Read_Reg(cs
, 0, ISAR_IRQBIT
) & ISAR_IRQSTA
)) &&
139 (timeout
++ < maxdelay
))
141 if (timeout
>= maxdelay
) {
142 printk(KERN_WARNING
"isar recmsg IRQSTA timeout\n");
145 get_irq_infos(cs
, ir
);
146 rcv_mbox(cs
, ir
, msg
);
152 ISARVersion(struct IsdnCardState
*cs
, char *s
)
155 u_char msg
[] = ISAR_MSG_HWVER
;
161 cs
->cardmsg(cs
, CARD_RESET
, NULL
);
162 spin_lock_irqsave(&cs
->lock
, flags
);
163 /* disable ISAR IRQ */
164 cs
->BC_Write_Reg(cs
, 0, ISAR_IRQBIT
, 0);
166 cs
->debug
&= ~(L1_DEB_HSCX
| L1_DEB_HSCX_FIFO
);
167 if (!sendmsg(cs
, ISAR_HIS_VNR
, 0, 3, msg
)) {
168 spin_unlock_irqrestore(&cs
->lock
, flags
);
171 if (!waitrecmsg(cs
, &len
, tmp
, 100000)) {
172 spin_unlock_irqrestore(&cs
->lock
, flags
);
176 if (cs
->bcs
[0].hw
.isar
.reg
->iis
== ISAR_IIS_VNR
) {
179 printk(KERN_INFO
"%s ISAR version %d\n", s
, ver
);
184 spin_unlock_irqrestore(&cs
->lock
, flags
);
189 isar_load_firmware(struct IsdnCardState
*cs
, u_char __user
*buf
)
191 int ret
, size
, cnt
, debug
;
192 u_char len
, nom
, noc
;
193 u_short sadr
, left
, *sp
;
194 u_char __user
*p
= buf
;
195 u_char
*msg
, *tmpmsg
, *mp
, tmp
[64];
197 struct isar_reg
*ireg
= cs
->bcs
[0].hw
.isar
.reg
;
199 struct {u_short sadr
;
204 #define BLK_HEAD_SIZE 6
205 if (1 != (ret
= ISARVersion(cs
, "Testing"))) {
206 printk(KERN_ERR
"isar_load_firmware wrong isar version %d\n", ret
);
211 cs
->debug
&= ~(L1_DEB_HSCX
| L1_DEB_HSCX_FIFO
);
214 if ((ret
= copy_from_user(&size
, p
, sizeof(int)))) {
215 printk(KERN_ERR
"isar_load_firmware copy_from_user ret %d\n", ret
);
219 printk(KERN_DEBUG
"isar_load_firmware size: %d\n", size
);
221 /* disable ISAR IRQ */
222 cs
->BC_Write_Reg(cs
, 0, ISAR_IRQBIT
, 0);
223 if (!(msg
= kmalloc(256, GFP_KERNEL
))) {
224 printk(KERN_ERR
"isar_load_firmware no buffer\n");
227 if (!(tmpmsg
= kmalloc(256, GFP_KERNEL
))) {
228 printk(KERN_ERR
"isar_load_firmware no tmp buffer\n");
232 spin_lock_irqsave(&cs
->lock
, flags
);
233 /* disable ISAR IRQ */
234 cs
->BC_Write_Reg(cs
, 0, ISAR_IRQBIT
, 0);
235 spin_unlock_irqrestore(&cs
->lock
, flags
);
237 if ((ret
= copy_from_user(&blk_head
, p
, BLK_HEAD_SIZE
))) {
238 printk(KERN_ERR
"isar_load_firmware copy_from_user ret %d\n", ret
);
242 sadr
= (blk_head
.sadr
& 0xff)*256 + blk_head
.sadr
/256;
243 blk_head
.sadr
= sadr
;
244 sadr
= (blk_head
.len
& 0xff)*256 + blk_head
.len
/256;
246 sadr
= (blk_head
.d_key
& 0xff)*256 + blk_head
.d_key
/256;
247 blk_head
.d_key
= sadr
;
248 #endif /* __BIG_ENDIAN */
249 cnt
+= BLK_HEAD_SIZE
;
251 printk(KERN_DEBUG
"isar firmware block (%#x,%5d,%#x)\n",
252 blk_head
.sadr
, blk_head
.len
, blk_head
.d_key
& 0xff);
253 sadr
= blk_head
.sadr
;
255 spin_lock_irqsave(&cs
->lock
, flags
);
256 if (!sendmsg(cs
, ISAR_HIS_DKEY
, blk_head
.d_key
& 0xff, 0, NULL
)) {
257 printk(KERN_ERR
"isar sendmsg dkey failed\n");
258 ret
= 1;goto reterr_unlock
;
260 if (!waitrecmsg(cs
, &len
, tmp
, 100000)) {
261 printk(KERN_ERR
"isar waitrecmsg dkey failed\n");
262 ret
= 1;goto reterr_unlock
;
264 if ((ireg
->iis
!= ISAR_IIS_DKEY
) || ireg
->cmsb
|| len
) {
265 printk(KERN_ERR
"isar wrong dkey response (%x,%x,%x)\n",
266 ireg
->iis
, ireg
->cmsb
, len
);
267 ret
= 1;goto reterr_unlock
;
269 spin_unlock_irqrestore(&cs
->lock
, flags
);
281 if ((ret
= copy_from_user(tmpmsg
, p
, nom
))) {
282 printk(KERN_ERR
"isar_load_firmware copy_from_user ret %d\n", ret
);
288 sp
= (u_short
*)tmpmsg
;
290 printk(KERN_DEBUG
"isar: load %3d words at %04x left %d\n",
301 #endif /* __BIG_ENDIAN */
305 spin_lock_irqsave(&cs
->lock
, flags
);
306 if (!sendmsg(cs
, ISAR_HIS_FIRM
, 0, nom
, msg
)) {
307 printk(KERN_ERR
"isar sendmsg prog failed\n");
308 ret
= 1;goto reterr_unlock
;
310 if (!waitrecmsg(cs
, &len
, tmp
, 100000)) {
311 printk(KERN_ERR
"isar waitrecmsg prog failed\n");
312 ret
= 1;goto reterr_unlock
;
314 if ((ireg
->iis
!= ISAR_IIS_FIRM
) || ireg
->cmsb
|| len
) {
315 printk(KERN_ERR
"isar wrong prog response (%x,%x,%x)\n",
316 ireg
->iis
, ireg
->cmsb
, len
);
317 ret
= 1;goto reterr_unlock
;
319 spin_unlock_irqrestore(&cs
->lock
, flags
);
321 printk(KERN_DEBUG
"isar firmware block %5d words loaded\n",
331 spin_lock_irqsave(&cs
->lock
, flags
);
332 if (!sendmsg(cs
, ISAR_HIS_STDSP
, 0, 2, msg
)) {
333 printk(KERN_ERR
"isar sendmsg start dsp failed\n");
334 ret
= 1;goto reterr_unlock
;
336 if (!waitrecmsg(cs
, &len
, tmp
, 100000)) {
337 printk(KERN_ERR
"isar waitrecmsg start dsp failed\n");
338 ret
= 1;goto reterr_unlock
;
340 if ((ireg
->iis
!= ISAR_IIS_STDSP
) || ireg
->cmsb
|| len
) {
341 printk(KERN_ERR
"isar wrong start dsp response (%x,%x,%x)\n",
342 ireg
->iis
, ireg
->cmsb
, len
);
343 ret
= 1;goto reterr_unlock
;
345 printk(KERN_DEBUG
"isar start dsp success\n");
346 /* NORMAL mode entered */
347 /* Enable IRQs of ISAR */
348 cs
->BC_Write_Reg(cs
, 0, ISAR_IRQBIT
, ISAR_IRQSTA
);
349 spin_unlock_irqrestore(&cs
->lock
, flags
);
350 cnt
= 1000; /* max 1s */
351 while ((!ireg
->bstat
) && cnt
) {
356 printk(KERN_ERR
"isar no general status event received\n");
357 ret
= 1;goto reterror
;
359 printk(KERN_DEBUG
"isar general status event %x\n",
366 spin_lock_irqsave(&cs
->lock
, flags
);
368 if (!sendmsg(cs
, ISAR_HIS_DIAG
, ISAR_CTRL_STST
, 0, NULL
)) {
369 printk(KERN_ERR
"isar sendmsg self tst failed\n");
370 ret
= 1;goto reterr_unlock
;
372 cnt
= 10000; /* max 100 ms */
373 spin_unlock_irqrestore(&cs
->lock
, flags
);
374 while ((ireg
->iis
!= ISAR_IIS_DIAG
) && cnt
) {
380 printk(KERN_ERR
"isar no self tst response\n");
381 ret
= 1;goto reterror
;
383 if ((ireg
->cmsb
== ISAR_CTRL_STST
) && (ireg
->clsb
== 1)
384 && (ireg
->par
[0] == 0)) {
385 printk(KERN_DEBUG
"isar selftest OK\n");
387 printk(KERN_DEBUG
"isar selftest not OK %x/%x/%x\n",
388 ireg
->cmsb
, ireg
->clsb
, ireg
->par
[0]);
389 ret
= 1;goto reterror
;
391 spin_lock_irqsave(&cs
->lock
, flags
);
393 if (!sendmsg(cs
, ISAR_HIS_DIAG
, ISAR_CTRL_SWVER
, 0, NULL
)) {
394 printk(KERN_ERR
"isar RQST SVN failed\n");
395 ret
= 1;goto reterr_unlock
;
397 spin_unlock_irqrestore(&cs
->lock
, flags
);
398 cnt
= 30000; /* max 300 ms */
399 while ((ireg
->iis
!= ISAR_IIS_DIAG
) && cnt
) {
405 printk(KERN_ERR
"isar no SVN response\n");
406 ret
= 1;goto reterror
;
408 if ((ireg
->cmsb
== ISAR_CTRL_SWVER
) && (ireg
->clsb
== 1))
409 printk(KERN_DEBUG
"isar software version %#x\n",
412 printk(KERN_ERR
"isar wrong swver response (%x,%x) cnt(%d)\n",
413 ireg
->cmsb
, ireg
->clsb
, cnt
);
414 ret
= 1;goto reterror
;
417 spin_lock_irqsave(&cs
->lock
, flags
);
423 spin_unlock_irqrestore(&cs
->lock
, flags
);
427 /* disable ISAR IRQ */
428 cs
->BC_Write_Reg(cs
, 0, ISAR_IRQBIT
, 0);
434 extern void BChannel_bh(struct BCState
*);
435 #define B_LL_NOCARRIER 8
436 #define B_LL_CONNECT 9
440 isar_bh(struct BCState
*bcs
)
443 if (test_and_clear_bit(B_LL_NOCARRIER
, &bcs
->event
))
444 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_NOCARR
);
445 if (test_and_clear_bit(B_LL_CONNECT
, &bcs
->event
))
446 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
447 if (test_and_clear_bit(B_LL_OK
, &bcs
->event
))
448 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_OK
);
452 send_DLE_ETX(struct BCState
*bcs
)
454 u_char dleetx
[2] = {DLE
,ETX
};
457 if ((skb
= dev_alloc_skb(2))) {
458 memcpy(skb_put(skb
, 2), dleetx
, 2);
459 skb_queue_tail(&bcs
->rqueue
, skb
);
460 schedule_event(bcs
, B_RCVBUFREADY
);
462 printk(KERN_WARNING
"HiSax: skb out of memory\n");
467 dle_count(unsigned char *buf
, int len
)
478 insert_dle(unsigned char *dest
, unsigned char *src
, int count
) {
479 /* <DLE> in input stream have to be flagged as <DLE><DLE> */
488 isar_rcv_frame(struct IsdnCardState
*cs
, struct BCState
*bcs
)
492 struct isar_reg
*ireg
= bcs
->hw
.isar
.reg
;
495 debugl1(cs
, "isar zero len frame");
496 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
501 debugl1(cs
, "isar mode 0 spurious IIS_RDATA %x/%x/%x",
502 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
503 printk(KERN_WARNING
"isar mode 0 spurious IIS_RDATA %x/%x/%x\n",
504 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
505 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
509 if ((skb
= dev_alloc_skb(ireg
->clsb
))) {
510 rcv_mbox(cs
, ireg
, (u_char
*)skb_put(skb
, ireg
->clsb
));
511 skb_queue_tail(&bcs
->rqueue
, skb
);
512 schedule_event(bcs
, B_RCVBUFREADY
);
514 printk(KERN_WARNING
"HiSax: skb out of memory\n");
515 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
519 if ((bcs
->hw
.isar
.rcvidx
+ ireg
->clsb
) > HSCX_BUFMAX
) {
520 if (cs
->debug
& L1_DEB_WARN
)
521 debugl1(cs
, "isar_rcv_frame: incoming packet too large");
522 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
523 bcs
->hw
.isar
.rcvidx
= 0;
524 } else if (ireg
->cmsb
& HDLC_ERROR
) {
525 if (cs
->debug
& L1_DEB_WARN
)
526 debugl1(cs
, "isar frame error %x len %d",
527 ireg
->cmsb
, ireg
->clsb
);
528 #ifdef ERROR_STATISTIC
529 if (ireg
->cmsb
& HDLC_ERR_RER
)
531 if (ireg
->cmsb
& HDLC_ERR_CER
)
534 bcs
->hw
.isar
.rcvidx
= 0;
535 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
537 if (ireg
->cmsb
& HDLC_FSD
)
538 bcs
->hw
.isar
.rcvidx
= 0;
539 ptr
= bcs
->hw
.isar
.rcvbuf
+ bcs
->hw
.isar
.rcvidx
;
540 bcs
->hw
.isar
.rcvidx
+= ireg
->clsb
;
541 rcv_mbox(cs
, ireg
, ptr
);
542 if (ireg
->cmsb
& HDLC_FED
) {
543 if (bcs
->hw
.isar
.rcvidx
< 3) { /* last 2 bytes are the FCS */
544 if (cs
->debug
& L1_DEB_WARN
)
545 debugl1(cs
, "isar frame to short %d",
546 bcs
->hw
.isar
.rcvidx
);
547 } else if (!(skb
= dev_alloc_skb(bcs
->hw
.isar
.rcvidx
-2))) {
548 printk(KERN_WARNING
"ISAR: receive out of memory\n");
550 memcpy(skb_put(skb
, bcs
->hw
.isar
.rcvidx
-2),
551 bcs
->hw
.isar
.rcvbuf
, bcs
->hw
.isar
.rcvidx
-2);
552 skb_queue_tail(&bcs
->rqueue
, skb
);
553 schedule_event(bcs
, B_RCVBUFREADY
);
555 bcs
->hw
.isar
.rcvidx
= 0;
560 if (bcs
->hw
.isar
.state
!= STFAX_ACTIV
) {
561 if (cs
->debug
& L1_DEB_WARN
)
562 debugl1(cs
, "isar_rcv_frame: not ACTIV");
563 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
564 bcs
->hw
.isar
.rcvidx
= 0;
567 if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FRM
) {
568 rcv_mbox(cs
, ireg
, bcs
->hw
.isar
.rcvbuf
);
569 bcs
->hw
.isar
.rcvidx
= ireg
->clsb
+
570 dle_count(bcs
->hw
.isar
.rcvbuf
, ireg
->clsb
);
571 if (cs
->debug
& L1_DEB_HSCX
)
572 debugl1(cs
, "isar_rcv_frame: raw(%d) dle(%d)",
573 ireg
->clsb
, bcs
->hw
.isar
.rcvidx
);
574 if ((skb
= dev_alloc_skb(bcs
->hw
.isar
.rcvidx
))) {
575 insert_dle((u_char
*)skb_put(skb
, bcs
->hw
.isar
.rcvidx
),
576 bcs
->hw
.isar
.rcvbuf
, ireg
->clsb
);
577 skb_queue_tail(&bcs
->rqueue
, skb
);
578 schedule_event(bcs
, B_RCVBUFREADY
);
579 if (ireg
->cmsb
& SART_NMD
) { /* ABORT */
580 if (cs
->debug
& L1_DEB_WARN
)
581 debugl1(cs
, "isar_rcv_frame: no more data");
582 bcs
->hw
.isar
.rcvidx
= 0;
584 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) |
585 ISAR_HIS_PUMPCTRL
, PCTRL_CMD_ESC
,
587 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
588 schedule_event(bcs
, B_LL_NOCARRIER
);
591 printk(KERN_WARNING
"HiSax: skb out of memory\n");
595 if (bcs
->hw
.isar
.cmd
!= PCTRL_CMD_FRH
) {
596 if (cs
->debug
& L1_DEB_WARN
)
597 debugl1(cs
, "isar_rcv_frame: unknown fax mode %x",
599 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
600 bcs
->hw
.isar
.rcvidx
= 0;
604 if ((bcs
->hw
.isar
.rcvidx
+ ireg
->clsb
) > HSCX_BUFMAX
) {
605 if (cs
->debug
& L1_DEB_WARN
)
606 debugl1(cs
, "isar_rcv_frame: incoming packet too large");
607 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
608 bcs
->hw
.isar
.rcvidx
= 0;
609 } else if (ireg
->cmsb
& HDLC_ERROR
) {
610 if (cs
->debug
& L1_DEB_WARN
)
611 debugl1(cs
, "isar frame error %x len %d",
612 ireg
->cmsb
, ireg
->clsb
);
613 bcs
->hw
.isar
.rcvidx
= 0;
614 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
616 if (ireg
->cmsb
& HDLC_FSD
) {
617 bcs
->hw
.isar
.rcvidx
= 0;
619 ptr
= bcs
->hw
.isar
.rcvbuf
+ bcs
->hw
.isar
.rcvidx
;
620 bcs
->hw
.isar
.rcvidx
+= ireg
->clsb
;
621 rcv_mbox(cs
, ireg
, ptr
);
622 if (ireg
->cmsb
& HDLC_FED
) {
623 int len
= bcs
->hw
.isar
.rcvidx
+
624 dle_count(bcs
->hw
.isar
.rcvbuf
, bcs
->hw
.isar
.rcvidx
);
625 if (bcs
->hw
.isar
.rcvidx
< 3) { /* last 2 bytes are the FCS */
626 if (cs
->debug
& L1_DEB_WARN
)
627 debugl1(cs
, "isar frame to short %d",
628 bcs
->hw
.isar
.rcvidx
);
629 printk(KERN_WARNING
"ISAR: frame to short %d\n",
630 bcs
->hw
.isar
.rcvidx
);
631 } else if (!(skb
= dev_alloc_skb(len
))) {
632 printk(KERN_WARNING
"ISAR: receive out of memory\n");
634 insert_dle((u_char
*)skb_put(skb
, len
),
636 bcs
->hw
.isar
.rcvidx
);
637 skb_queue_tail(&bcs
->rqueue
, skb
);
638 schedule_event(bcs
, B_RCVBUFREADY
);
640 schedule_event(bcs
, B_LL_OK
);
641 test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
643 bcs
->hw
.isar
.rcvidx
= 0;
646 if (ireg
->cmsb
& SART_NMD
) { /* ABORT */
647 if (cs
->debug
& L1_DEB_WARN
)
648 debugl1(cs
, "isar_rcv_frame: no more data");
649 bcs
->hw
.isar
.rcvidx
= 0;
650 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) |
651 ISAR_HIS_PUMPCTRL
, PCTRL_CMD_ESC
, 0, NULL
);
652 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
653 if (test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
)) {
655 schedule_event(bcs
, B_LL_NOCARRIER
);
660 printk(KERN_ERR
"isar_rcv_frame mode (%x)error\n", bcs
->mode
);
661 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
667 isar_fill_fifo(struct BCState
*bcs
)
669 struct IsdnCardState
*cs
= bcs
->cs
;
674 if ((cs
->debug
& L1_DEB_HSCX
) && !(cs
->debug
& L1_DEB_HSCX_FIFO
))
675 debugl1(cs
, "isar_fill_fifo");
678 if (bcs
->tx_skb
->len
<= 0)
680 if (!(bcs
->hw
.isar
.reg
->bstat
&
681 (bcs
->hw
.isar
.dpath
== 1 ? BSTAT_RDM1
: BSTAT_RDM2
)))
683 if (bcs
->tx_skb
->len
> bcs
->hw
.isar
.mml
) {
685 count
= bcs
->hw
.isar
.mml
;
687 count
= bcs
->tx_skb
->len
;
690 ptr
= bcs
->tx_skb
->data
;
691 if (!bcs
->hw
.isar
.txcnt
) {
693 if ((bcs
->mode
== L1_MODE_FAX
) &&
694 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
)) {
695 if (bcs
->tx_skb
->len
> 1) {
696 if ((ptr
[0]== 0xff) && (ptr
[1] == 0x13))
698 test_and_set_bit(BC_FLG_LASTDATA
,
703 skb_pull(bcs
->tx_skb
, count
);
704 bcs
->tx_cnt
-= count
;
705 bcs
->hw
.isar
.txcnt
+= count
;
708 printk(KERN_ERR
"isar_fill_fifo wrong mode 0\n");
712 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) | ISAR_HIS_SDATA
,
716 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) | ISAR_HIS_SDATA
,
720 if (bcs
->hw
.isar
.state
!= STFAX_ACTIV
) {
721 if (cs
->debug
& L1_DEB_WARN
)
722 debugl1(cs
, "isar_fill_fifo: not ACTIV");
723 } else if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
) {
724 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) | ISAR_HIS_SDATA
,
726 } else if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTM
) {
727 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) | ISAR_HIS_SDATA
,
730 if (cs
->debug
& L1_DEB_WARN
)
731 debugl1(cs
, "isar_fill_fifo: not FTH/FTM");
736 debugl1(cs
, "isar_fill_fifo mode(%x) error", bcs
->mode
);
737 printk(KERN_ERR
"isar_fill_fifo mode(%x) error\n", bcs
->mode
);
743 struct BCState
*sel_bcs_isar(struct IsdnCardState
*cs
, u_char dpath
)
745 if ((!dpath
) || (dpath
== 3))
747 if (cs
->bcs
[0].hw
.isar
.dpath
== dpath
)
749 if (cs
->bcs
[1].hw
.isar
.dpath
== dpath
)
755 send_frames(struct BCState
*bcs
)
758 if (bcs
->tx_skb
->len
) {
762 if (test_bit(FLG_LLI_L1WAKEUP
,&bcs
->st
->lli
.flag
) &&
763 (PACKET_NOACK
!= bcs
->tx_skb
->pkt_type
)) {
765 spin_lock_irqsave(&bcs
->aclock
, flags
);
766 bcs
->ackcnt
+= bcs
->hw
.isar
.txcnt
;
767 spin_unlock_irqrestore(&bcs
->aclock
, flags
);
768 schedule_event(bcs
, B_ACKPENDING
);
770 if (bcs
->mode
== L1_MODE_FAX
) {
771 if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
) {
772 if (test_bit(BC_FLG_LASTDATA
, &bcs
->Flag
)) {
773 test_and_set_bit(BC_FLG_NMD_DATA
, &bcs
->Flag
);
775 } else if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTM
) {
776 if (test_bit(BC_FLG_DLEETX
, &bcs
->Flag
)) {
777 test_and_set_bit(BC_FLG_LASTDATA
, &bcs
->Flag
);
778 test_and_set_bit(BC_FLG_NMD_DATA
, &bcs
->Flag
);
782 dev_kfree_skb_any(bcs
->tx_skb
);
783 bcs
->hw
.isar
.txcnt
= 0;
787 if ((bcs
->tx_skb
= skb_dequeue(&bcs
->squeue
))) {
788 bcs
->hw
.isar
.txcnt
= 0;
789 test_and_set_bit(BC_FLG_BUSY
, &bcs
->Flag
);
792 if (test_and_clear_bit(BC_FLG_DLEETX
, &bcs
->Flag
)) {
793 if (test_and_clear_bit(BC_FLG_LASTDATA
, &bcs
->Flag
)) {
794 if (test_and_clear_bit(BC_FLG_NMD_DATA
, &bcs
->Flag
)) {
796 sendmsg(bcs
->cs
, SET_DPS(bcs
->hw
.isar
.dpath
) |
797 ISAR_HIS_SDATA
, 0x01, 1, &dummy
);
799 test_and_set_bit(BC_FLG_LL_OK
, &bcs
->Flag
);
801 schedule_event(bcs
, B_LL_CONNECT
);
804 test_and_clear_bit(BC_FLG_BUSY
, &bcs
->Flag
);
805 schedule_event(bcs
, B_XMTBUFREADY
);
810 check_send(struct IsdnCardState
*cs
, u_char rdm
)
814 if (rdm
& BSTAT_RDM1
) {
815 if ((bcs
= sel_bcs_isar(cs
, 1))) {
821 if (rdm
& BSTAT_RDM2
) {
822 if ((bcs
= sel_bcs_isar(cs
, 2))) {
831 const char *dmril
[] = {"NO SPEED", "1200/75", "NODEF2", "75/1200", "NODEF4",
832 "300", "600", "1200", "2400", "4800", "7200",
833 "9600nt", "9600t", "12000", "14400", "WRONG"};
834 const char *dmrim
[] = {"NO MOD", "NO DEF", "V32/V32b", "V22", "V21",
835 "Bell103", "V23", "Bell202", "V17", "V29", "V27ter"};
838 isar_pump_status_rsp(struct BCState
*bcs
, struct isar_reg
*ireg
) {
839 struct IsdnCardState
*cs
= bcs
->cs
;
840 u_char ril
= ireg
->par
[0];
843 if (!test_and_clear_bit(ISAR_RATE_REQ
, &bcs
->hw
.isar
.reg
->Flags
))
846 if (cs
->debug
& L1_DEB_WARN
)
847 debugl1(cs
, "wrong pstrsp ril=%d",ril
);
850 switch(ireg
->par
[1]) {
885 sprintf(bcs
->hw
.isar
.conmsg
,"%s %s", dmril
[ril
], dmrim
[rim
]);
886 bcs
->conmsg
= bcs
->hw
.isar
.conmsg
;
887 if (cs
->debug
& L1_DEB_HSCX
)
888 debugl1(cs
, "pump strsp %s", bcs
->conmsg
);
892 isar_pump_statev_modem(struct BCState
*bcs
, u_char devt
) {
893 struct IsdnCardState
*cs
= bcs
->cs
;
894 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
897 case PSEV_10MS_TIMER
:
898 if (cs
->debug
& L1_DEB_HSCX
)
899 debugl1(cs
, "pump stev TIMER");
902 if (cs
->debug
& L1_DEB_HSCX
)
903 debugl1(cs
, "pump stev CONNECT");
904 l1_msg_b(bcs
->st
, PH_ACTIVATE
| REQUEST
, NULL
);
907 if (cs
->debug
& L1_DEB_HSCX
)
908 debugl1(cs
, "pump stev NO CONNECT");
909 sendmsg(cs
, dps
| ISAR_HIS_PSTREQ
, 0, 0, NULL
);
910 l1_msg_b(bcs
->st
, PH_DEACTIVATE
| REQUEST
, NULL
);
913 if (cs
->debug
& L1_DEB_HSCX
)
914 debugl1(cs
, "pump stev V24 OFF");
917 if (cs
->debug
& L1_DEB_HSCX
)
918 debugl1(cs
, "pump stev CTS ON");
921 if (cs
->debug
& L1_DEB_HSCX
)
922 debugl1(cs
, "pump stev CTS OFF");
925 if (cs
->debug
& L1_DEB_HSCX
)
926 debugl1(cs
, "pump stev CARRIER ON");
927 test_and_set_bit(ISAR_RATE_REQ
, &bcs
->hw
.isar
.reg
->Flags
);
928 sendmsg(cs
, dps
| ISAR_HIS_PSTREQ
, 0, 0, NULL
);
931 if (cs
->debug
& L1_DEB_HSCX
)
932 debugl1(cs
, "pump stev CARRIER OFF");
935 if (cs
->debug
& L1_DEB_HSCX
)
936 debugl1(cs
, "pump stev DSR ON");
939 if (cs
->debug
& L1_DEB_HSCX
)
940 debugl1(cs
, "pump stev DSR_OFF");
943 if (cs
->debug
& L1_DEB_HSCX
)
944 debugl1(cs
, "pump stev REMOTE RETRAIN");
947 if (cs
->debug
& L1_DEB_HSCX
)
948 debugl1(cs
, "pump stev REMOTE RENEGOTIATE");
951 if (cs
->debug
& L1_DEB_HSCX
)
952 debugl1(cs
, "pump stev GSTN CLEAR", devt
);
955 if (cs
->debug
& L1_DEB_HSCX
)
956 debugl1(cs
, "unknown pump stev %x", devt
);
962 ll_deliver_faxstat(struct BCState
*bcs
, u_char status
)
965 struct Channel
*chanp
= (struct Channel
*) bcs
->st
->lli
.userdata
;
967 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
968 debugl1(bcs
->cs
, "HL->LL FAXIND %x", status
);
969 ic
.driver
= bcs
->cs
->myid
;
970 ic
.command
= ISDN_STAT_FAXIND
;
971 ic
.arg
= chanp
->chan
;
972 ic
.parm
.aux
.cmd
= status
;
973 bcs
->cs
->iif
.statcallb(&ic
);
977 isar_pump_statev_fax(struct BCState
*bcs
, u_char devt
) {
978 struct IsdnCardState
*cs
= bcs
->cs
;
979 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
983 case PSEV_10MS_TIMER
:
984 if (cs
->debug
& L1_DEB_HSCX
)
985 debugl1(cs
, "pump stev TIMER");
988 if (cs
->debug
& L1_DEB_HSCX
)
989 debugl1(cs
, "pump stev RSP_READY");
990 bcs
->hw
.isar
.state
= STFAX_READY
;
991 l1_msg_b(bcs
->st
, PH_ACTIVATE
| REQUEST
, NULL
);
992 if (test_bit(BC_FLG_ORIG
, &bcs
->Flag
)) {
993 isar_pump_cmd(bcs
, ISDN_FAX_CLASS1_FRH
, 3);
995 isar_pump_cmd(bcs
, ISDN_FAX_CLASS1_FTH
, 3);
999 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1000 if (cs
->debug
& L1_DEB_HSCX
)
1001 debugl1(cs
, "pump stev LINE_TX_H");
1002 bcs
->hw
.isar
.state
= STFAX_CONT
;
1003 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_CONT
, 0, NULL
);
1005 if (cs
->debug
& L1_DEB_WARN
)
1006 debugl1(cs
, "pump stev LINE_TX_H wrong st %x",
1007 bcs
->hw
.isar
.state
);
1010 case PSEV_LINE_RX_H
:
1011 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1012 if (cs
->debug
& L1_DEB_HSCX
)
1013 debugl1(cs
, "pump stev LINE_RX_H");
1014 bcs
->hw
.isar
.state
= STFAX_CONT
;
1015 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_CONT
, 0, NULL
);
1017 if (cs
->debug
& L1_DEB_WARN
)
1018 debugl1(cs
, "pump stev LINE_RX_H wrong st %x",
1019 bcs
->hw
.isar
.state
);
1022 case PSEV_LINE_TX_B
:
1023 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1024 if (cs
->debug
& L1_DEB_HSCX
)
1025 debugl1(cs
, "pump stev LINE_TX_B");
1026 bcs
->hw
.isar
.state
= STFAX_CONT
;
1027 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_CONT
, 0, NULL
);
1029 if (cs
->debug
& L1_DEB_WARN
)
1030 debugl1(cs
, "pump stev LINE_TX_B wrong st %x",
1031 bcs
->hw
.isar
.state
);
1034 case PSEV_LINE_RX_B
:
1035 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1036 if (cs
->debug
& L1_DEB_HSCX
)
1037 debugl1(cs
, "pump stev LINE_RX_B");
1038 bcs
->hw
.isar
.state
= STFAX_CONT
;
1039 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_CONT
, 0, NULL
);
1041 if (cs
->debug
& L1_DEB_WARN
)
1042 debugl1(cs
, "pump stev LINE_RX_B wrong st %x",
1043 bcs
->hw
.isar
.state
);
1047 if (bcs
->hw
.isar
.state
== STFAX_CONT
) {
1048 if (cs
->debug
& L1_DEB_HSCX
)
1049 debugl1(cs
, "pump stev RSP_CONN");
1050 bcs
->hw
.isar
.state
= STFAX_ACTIV
;
1051 test_and_set_bit(ISAR_RATE_REQ
, &bcs
->hw
.isar
.reg
->Flags
);
1052 sendmsg(cs
, dps
| ISAR_HIS_PSTREQ
, 0, 0, NULL
);
1053 if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
) {
1054 /* 1s Flags before data */
1055 if (test_and_set_bit(BC_FLG_FTI_RUN
, &bcs
->Flag
))
1056 del_timer(&bcs
->hw
.isar
.ftimer
);
1058 bcs
->hw
.isar
.ftimer
.expires
=
1059 jiffies
+ ((1000 * HZ
)/1000);
1060 test_and_set_bit(BC_FLG_LL_CONN
,
1062 add_timer(&bcs
->hw
.isar
.ftimer
);
1064 schedule_event(bcs
, B_LL_CONNECT
);
1067 if (cs
->debug
& L1_DEB_WARN
)
1068 debugl1(cs
, "pump stev RSP_CONN wrong st %x",
1069 bcs
->hw
.isar
.state
);
1072 case PSEV_FLAGS_DET
:
1073 if (cs
->debug
& L1_DEB_HSCX
)
1074 debugl1(cs
, "pump stev FLAGS_DET");
1077 if (cs
->debug
& L1_DEB_HSCX
)
1078 debugl1(cs
, "pump stev RSP_DISC");
1079 if (bcs
->hw
.isar
.state
== STFAX_ESCAPE
) {
1081 switch(bcs
->hw
.isar
.newcmd
) {
1083 bcs
->hw
.isar
.state
= STFAX_READY
;
1088 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
,
1089 PCTRL_CMD_SILON
, 1, &p1
);
1090 bcs
->hw
.isar
.state
= STFAX_SILDET
;
1093 if (frm_extra_delay
)
1094 mdelay(frm_extra_delay
);
1096 p1
= bcs
->hw
.isar
.mod
= bcs
->hw
.isar
.newmod
;
1097 bcs
->hw
.isar
.newmod
= 0;
1098 bcs
->hw
.isar
.cmd
= bcs
->hw
.isar
.newcmd
;
1099 bcs
->hw
.isar
.newcmd
= 0;
1100 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
,
1101 bcs
->hw
.isar
.cmd
, 1, &p1
);
1102 bcs
->hw
.isar
.state
= STFAX_LINE
;
1103 bcs
->hw
.isar
.try_mod
= 3;
1106 if (cs
->debug
& L1_DEB_HSCX
)
1107 debugl1(cs
, "RSP_DISC unknown newcmd %x", bcs
->hw
.isar
.newcmd
);
1110 } else if (bcs
->hw
.isar
.state
== STFAX_ACTIV
) {
1111 if (test_and_clear_bit(BC_FLG_LL_OK
, &bcs
->Flag
)) {
1112 schedule_event(bcs
, B_LL_OK
);
1113 } else if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FRM
) {
1115 schedule_event(bcs
, B_LL_NOCARRIER
);
1117 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_FCERROR
);
1119 bcs
->hw
.isar
.state
= STFAX_READY
;
1121 bcs
->hw
.isar
.state
= STFAX_READY
;
1122 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_FCERROR
);
1125 case PSEV_RSP_SILDET
:
1126 if (cs
->debug
& L1_DEB_HSCX
)
1127 debugl1(cs
, "pump stev RSP_SILDET");
1128 if (bcs
->hw
.isar
.state
== STFAX_SILDET
) {
1129 p1
= bcs
->hw
.isar
.mod
= bcs
->hw
.isar
.newmod
;
1130 bcs
->hw
.isar
.newmod
= 0;
1131 bcs
->hw
.isar
.cmd
= bcs
->hw
.isar
.newcmd
;
1132 bcs
->hw
.isar
.newcmd
= 0;
1133 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
,
1134 bcs
->hw
.isar
.cmd
, 1, &p1
);
1135 bcs
->hw
.isar
.state
= STFAX_LINE
;
1136 bcs
->hw
.isar
.try_mod
= 3;
1139 case PSEV_RSP_SILOFF
:
1140 if (cs
->debug
& L1_DEB_HSCX
)
1141 debugl1(cs
, "pump stev RSP_SILOFF");
1143 case PSEV_RSP_FCERR
:
1144 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1145 if (cs
->debug
& L1_DEB_HSCX
)
1146 debugl1(cs
, "pump stev RSP_FCERR try %d",
1147 bcs
->hw
.isar
.try_mod
);
1148 if (bcs
->hw
.isar
.try_mod
--) {
1149 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
,
1150 bcs
->hw
.isar
.cmd
, 1,
1155 if (cs
->debug
& L1_DEB_HSCX
)
1156 debugl1(cs
, "pump stev RSP_FCERR");
1157 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1158 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_ESC
, 0, NULL
);
1159 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_FCERROR
);
1166 static char debbuf
[128];
1169 isar_int_main(struct IsdnCardState
*cs
)
1171 struct isar_reg
*ireg
= cs
->bcs
[0].hw
.isar
.reg
;
1172 struct BCState
*bcs
;
1174 get_irq_infos(cs
, ireg
);
1175 switch (ireg
->iis
& ISAR_IIS_MSCMSD
) {
1176 case ISAR_IIS_RDATA
:
1177 if ((bcs
= sel_bcs_isar(cs
, ireg
->iis
>> 6))) {
1178 isar_rcv_frame(cs
, bcs
);
1180 debugl1(cs
, "isar spurious IIS_RDATA %x/%x/%x",
1181 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
1182 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1185 case ISAR_IIS_GSTEV
:
1186 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1187 ireg
->bstat
|= ireg
->cmsb
;
1188 check_send(cs
, ireg
->cmsb
);
1190 case ISAR_IIS_BSTEV
:
1191 #ifdef ERROR_STATISTIC
1192 if ((bcs
= sel_bcs_isar(cs
, ireg
->iis
>> 6))) {
1193 if (ireg
->cmsb
== BSTEV_TBO
)
1195 if (ireg
->cmsb
== BSTEV_RBO
)
1199 if (cs
->debug
& L1_DEB_WARN
)
1200 debugl1(cs
, "Buffer STEV dpath%d msb(%x)",
1201 ireg
->iis
>>6, ireg
->cmsb
);
1202 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1204 case ISAR_IIS_PSTEV
:
1205 if ((bcs
= sel_bcs_isar(cs
, ireg
->iis
>> 6))) {
1206 rcv_mbox(cs
, ireg
, (u_char
*)ireg
->par
);
1207 if (bcs
->mode
== L1_MODE_V32
) {
1208 isar_pump_statev_modem(bcs
, ireg
->cmsb
);
1209 } else if (bcs
->mode
== L1_MODE_FAX
) {
1210 isar_pump_statev_fax(bcs
, ireg
->cmsb
);
1211 } else if (ireg
->cmsb
== PSEV_10MS_TIMER
) {
1212 if (cs
->debug
& L1_DEB_HSCX
)
1213 debugl1(cs
, "pump stev TIMER");
1215 if (cs
->debug
& L1_DEB_WARN
)
1216 debugl1(cs
, "isar IIS_PSTEV pmode %d stat %x",
1217 bcs
->mode
, ireg
->cmsb
);
1220 debugl1(cs
, "isar spurious IIS_PSTEV %x/%x/%x",
1221 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
1222 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1225 case ISAR_IIS_PSTRSP
:
1226 if ((bcs
= sel_bcs_isar(cs
, ireg
->iis
>> 6))) {
1227 rcv_mbox(cs
, ireg
, (u_char
*)ireg
->par
);
1228 isar_pump_status_rsp(bcs
, ireg
);
1230 debugl1(cs
, "isar spurious IIS_PSTRSP %x/%x/%x",
1231 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
1232 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1236 case ISAR_IIS_BSTRSP
:
1237 case ISAR_IIS_IOM2RSP
:
1238 rcv_mbox(cs
, ireg
, (u_char
*)ireg
->par
);
1239 if ((cs
->debug
& (L1_DEB_HSCX
| L1_DEB_HSCX_FIFO
))
1243 tp
+= sprintf(debbuf
, "msg iis(%x) msb(%x)",
1244 ireg
->iis
, ireg
->cmsb
);
1245 QuickHex(tp
, (u_char
*)ireg
->par
, ireg
->clsb
);
1246 debugl1(cs
, debbuf
);
1249 case ISAR_IIS_INVMSG
:
1250 rcv_mbox(cs
, ireg
, debbuf
);
1251 if (cs
->debug
& L1_DEB_WARN
)
1252 debugl1(cs
, "invalid msg his:%x",
1256 rcv_mbox(cs
, ireg
, debbuf
);
1257 if (cs
->debug
& L1_DEB_WARN
)
1258 debugl1(cs
, "unhandled msg iis(%x) ctrl(%x/%x)",
1259 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
1265 ftimer_handler(struct BCState
*bcs
) {
1267 debugl1(bcs
->cs
, "ftimer flags %04x",
1269 test_and_clear_bit(BC_FLG_FTI_RUN
, &bcs
->Flag
);
1270 if (test_and_clear_bit(BC_FLG_LL_CONN
, &bcs
->Flag
)) {
1271 schedule_event(bcs
, B_LL_CONNECT
);
1273 if (test_and_clear_bit(BC_FLG_FTI_FTS
, &bcs
->Flag
)) {
1274 schedule_event(bcs
, B_LL_OK
);
1279 setup_pump(struct BCState
*bcs
) {
1280 struct IsdnCardState
*cs
= bcs
->cs
;
1281 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
1282 u_char ctrl
, param
[6];
1284 switch (bcs
->mode
) {
1288 sendmsg(cs
, dps
| ISAR_HIS_PUMPCFG
, PMOD_BYPASS
, 0, NULL
);
1291 ctrl
= PMOD_DATAMODEM
;
1292 if (test_bit(BC_FLG_ORIG
, &bcs
->Flag
)) {
1294 param
[5] = PV32P6_CTN
;
1296 param
[5] = PV32P6_ATN
;
1298 param
[0] = para_TOA
; /* 6 db */
1299 param
[1] = PV32P2_V23R
| PV32P2_V22A
| PV32P2_V22B
|
1300 PV32P2_V22C
| PV32P2_V21
| PV32P2_BEL
;
1301 param
[2] = PV32P3_AMOD
| PV32P3_V32B
| PV32P3_V23B
;
1302 param
[3] = PV32P4_UT144
;
1303 param
[4] = PV32P5_UT144
;
1304 sendmsg(cs
, dps
| ISAR_HIS_PUMPCFG
, ctrl
, 6, param
);
1308 if (test_bit(BC_FLG_ORIG
, &bcs
->Flag
)) {
1310 param
[1] = PFAXP2_CTN
;
1312 param
[1] = PFAXP2_ATN
;
1314 param
[0] = para_TOA
; /* 6 db */
1315 sendmsg(cs
, dps
| ISAR_HIS_PUMPCFG
, ctrl
, 2, param
);
1316 bcs
->hw
.isar
.state
= STFAX_NULL
;
1317 bcs
->hw
.isar
.newcmd
= 0;
1318 bcs
->hw
.isar
.newmod
= 0;
1319 test_and_set_bit(BC_FLG_FTI_RUN
, &bcs
->Flag
);
1323 sendmsg(cs
, dps
| ISAR_HIS_PSTREQ
, 0, 0, NULL
);
1328 setup_sart(struct BCState
*bcs
) {
1329 struct IsdnCardState
*cs
= bcs
->cs
;
1330 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
1331 u_char ctrl
, param
[2];
1333 switch (bcs
->mode
) {
1335 sendmsg(cs
, dps
| ISAR_HIS_SARTCFG
, SMODE_DISABLE
, 0,
1339 sendmsg(cs
, dps
| ISAR_HIS_SARTCFG
, SMODE_BINARY
, 2,
1344 sendmsg(cs
, dps
| ISAR_HIS_SARTCFG
, SMODE_HDLC
, 1,
1348 ctrl
= SMODE_V14
| SCTRL_HDMC_BOTH
;
1349 param
[0] = S_P1_CHS_8
;
1350 param
[1] = S_P2_BFT_DEF
;
1351 sendmsg(cs
, dps
| ISAR_HIS_SARTCFG
, ctrl
, 2,
1355 /* SART must not configured with FAX */
1359 sendmsg(cs
, dps
| ISAR_HIS_BSTREQ
, 0, 0, NULL
);
1364 setup_iom2(struct BCState
*bcs
) {
1365 struct IsdnCardState
*cs
= bcs
->cs
;
1366 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
1367 u_char cmsb
= IOM_CTRL_ENA
, msg
[5] = {IOM_P1_TXD
,0,0,0,0};
1370 msg
[1] = msg
[3] = 1;
1371 switch (bcs
->mode
) {
1375 msg
[1] = msg
[3] = bcs
->hw
.isar
.dpath
+ 2;
1382 cmsb
|= IOM_CTRL_ALAW
| IOM_CTRL_RCV
;
1385 sendmsg(cs
, dps
| ISAR_HIS_IOM2CFG
, cmsb
, 5, msg
);
1387 sendmsg(cs
, dps
| ISAR_HIS_IOM2REQ
, 0, 0, NULL
);
1392 modeisar(struct BCState
*bcs
, int mode
, int bc
)
1394 struct IsdnCardState
*cs
= bcs
->cs
;
1396 /* Here we are selecting the best datapath for requested mode */
1397 if(bcs
->mode
== L1_MODE_NULL
) { /* New Setup */
1400 case L1_MODE_NULL
: /* init */
1401 if (!bcs
->hw
.isar
.dpath
)
1402 /* no init for dpath 0 */
1407 /* best is datapath 2 */
1408 if (!test_and_set_bit(ISAR_DP2_USE
,
1409 &bcs
->hw
.isar
.reg
->Flags
))
1410 bcs
->hw
.isar
.dpath
= 2;
1411 else if (!test_and_set_bit(ISAR_DP1_USE
,
1412 &bcs
->hw
.isar
.reg
->Flags
))
1413 bcs
->hw
.isar
.dpath
= 1;
1415 printk(KERN_WARNING
"isar modeisar both pathes in use\n");
1421 /* only datapath 1 */
1422 if (!test_and_set_bit(ISAR_DP1_USE
,
1423 &bcs
->hw
.isar
.reg
->Flags
))
1424 bcs
->hw
.isar
.dpath
= 1;
1426 printk(KERN_WARNING
"isar modeisar analog funktions only with DP1\n");
1427 debugl1(cs
, "isar modeisar analog funktions only with DP1");
1433 if (cs
->debug
& L1_DEB_HSCX
)
1434 debugl1(cs
, "isar dp%d mode %d->%d ichan %d",
1435 bcs
->hw
.isar
.dpath
, bcs
->mode
, mode
, bc
);
1440 if (bcs
->mode
== L1_MODE_NULL
) {
1441 /* Clear resources */
1442 if (bcs
->hw
.isar
.dpath
== 1)
1443 test_and_clear_bit(ISAR_DP1_USE
, &bcs
->hw
.isar
.reg
->Flags
);
1444 else if (bcs
->hw
.isar
.dpath
== 2)
1445 test_and_clear_bit(ISAR_DP2_USE
, &bcs
->hw
.isar
.reg
->Flags
);
1446 bcs
->hw
.isar
.dpath
= 0;
1452 isar_pump_cmd(struct BCState
*bcs
, u_char cmd
, u_char para
)
1454 struct IsdnCardState
*cs
= bcs
->cs
;
1455 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
1456 u_char ctrl
= 0, nom
= 0, p1
= 0;
1459 case ISDN_FAX_CLASS1_FTM
:
1460 test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
1461 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1463 ctrl
= PCTRL_CMD_FTM
;
1465 bcs
->hw
.isar
.state
= STFAX_LINE
;
1466 bcs
->hw
.isar
.cmd
= ctrl
;
1467 bcs
->hw
.isar
.mod
= para
;
1468 bcs
->hw
.isar
.newmod
= 0;
1469 bcs
->hw
.isar
.newcmd
= 0;
1470 bcs
->hw
.isar
.try_mod
= 3;
1471 } else if ((bcs
->hw
.isar
.state
== STFAX_ACTIV
) &&
1472 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTM
) &&
1473 (bcs
->hw
.isar
.mod
== para
)) {
1474 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
1476 bcs
->hw
.isar
.newmod
= para
;
1477 bcs
->hw
.isar
.newcmd
= PCTRL_CMD_FTM
;
1479 ctrl
= PCTRL_CMD_ESC
;
1480 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1483 case ISDN_FAX_CLASS1_FTH
:
1484 test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
1485 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1487 ctrl
= PCTRL_CMD_FTH
;
1489 bcs
->hw
.isar
.state
= STFAX_LINE
;
1490 bcs
->hw
.isar
.cmd
= ctrl
;
1491 bcs
->hw
.isar
.mod
= para
;
1492 bcs
->hw
.isar
.newmod
= 0;
1493 bcs
->hw
.isar
.newcmd
= 0;
1494 bcs
->hw
.isar
.try_mod
= 3;
1495 } else if ((bcs
->hw
.isar
.state
== STFAX_ACTIV
) &&
1496 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
) &&
1497 (bcs
->hw
.isar
.mod
== para
)) {
1498 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
1500 bcs
->hw
.isar
.newmod
= para
;
1501 bcs
->hw
.isar
.newcmd
= PCTRL_CMD_FTH
;
1503 ctrl
= PCTRL_CMD_ESC
;
1504 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1507 case ISDN_FAX_CLASS1_FRM
:
1508 test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
1509 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1511 ctrl
= PCTRL_CMD_FRM
;
1513 bcs
->hw
.isar
.state
= STFAX_LINE
;
1514 bcs
->hw
.isar
.cmd
= ctrl
;
1515 bcs
->hw
.isar
.mod
= para
;
1516 bcs
->hw
.isar
.newmod
= 0;
1517 bcs
->hw
.isar
.newcmd
= 0;
1518 bcs
->hw
.isar
.try_mod
= 3;
1519 } else if ((bcs
->hw
.isar
.state
== STFAX_ACTIV
) &&
1520 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FRM
) &&
1521 (bcs
->hw
.isar
.mod
== para
)) {
1522 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
1524 bcs
->hw
.isar
.newmod
= para
;
1525 bcs
->hw
.isar
.newcmd
= PCTRL_CMD_FRM
;
1527 ctrl
= PCTRL_CMD_ESC
;
1528 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1531 case ISDN_FAX_CLASS1_FRH
:
1532 test_and_set_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
1533 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1535 ctrl
= PCTRL_CMD_FRH
;
1537 bcs
->hw
.isar
.state
= STFAX_LINE
;
1538 bcs
->hw
.isar
.cmd
= ctrl
;
1539 bcs
->hw
.isar
.mod
= para
;
1540 bcs
->hw
.isar
.newmod
= 0;
1541 bcs
->hw
.isar
.newcmd
= 0;
1542 bcs
->hw
.isar
.try_mod
= 3;
1543 } else if ((bcs
->hw
.isar
.state
== STFAX_ACTIV
) &&
1544 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FRH
) &&
1545 (bcs
->hw
.isar
.mod
== para
)) {
1546 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
1548 bcs
->hw
.isar
.newmod
= para
;
1549 bcs
->hw
.isar
.newcmd
= PCTRL_CMD_FRH
;
1551 ctrl
= PCTRL_CMD_ESC
;
1552 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1555 case ISDN_FAXPUMP_HALT
:
1556 bcs
->hw
.isar
.state
= STFAX_NULL
;
1558 ctrl
= PCTRL_CMD_HALT
;
1562 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, ctrl
, nom
, &p1
);
1566 isar_setup(struct IsdnCardState
*cs
)
1573 for (i
=0; i
<2; i
++) {
1575 sendmsg(cs
, (i
? ISAR_HIS_DPS2
: ISAR_HIS_DPS1
) |
1576 ISAR_HIS_P12CFG
, 4, 1, &msg
);
1577 cs
->bcs
[i
].hw
.isar
.mml
= msg
;
1578 cs
->bcs
[i
].mode
= 0;
1579 cs
->bcs
[i
].hw
.isar
.dpath
= i
+ 1;
1580 modeisar(&cs
->bcs
[i
], 0, 0);
1581 INIT_WORK(&cs
->bcs
[i
].tqueue
, (void *)(void *) isar_bh
, &cs
->bcs
[i
]);
1586 isar_l2l1(struct PStack
*st
, int pr
, void *arg
)
1588 struct BCState
*bcs
= st
->l1
.bcs
;
1589 struct sk_buff
*skb
= arg
;
1594 case (PH_DATA
| REQUEST
):
1595 spin_lock_irqsave(&bcs
->cs
->lock
, flags
);
1597 skb_queue_tail(&bcs
->squeue
, skb
);
1600 test_and_set_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1601 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
1602 debugl1(bcs
->cs
, "DRQ set BC_FLG_BUSY");
1603 bcs
->hw
.isar
.txcnt
= 0;
1604 bcs
->cs
->BC_Send_Data(bcs
);
1606 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1608 case (PH_PULL
| INDICATION
):
1609 spin_lock_irqsave(&bcs
->cs
->lock
, flags
);
1611 printk(KERN_WARNING
"isar_l2l1: this shouldn't happen\n");
1613 test_and_set_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1614 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
1615 debugl1(bcs
->cs
, "PUI set BC_FLG_BUSY");
1617 bcs
->hw
.isar
.txcnt
= 0;
1618 bcs
->cs
->BC_Send_Data(bcs
);
1620 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1622 case (PH_PULL
| REQUEST
):
1624 test_and_clear_bit(FLG_L1_PULL_REQ
, &st
->l1
.Flags
);
1625 st
->l1
.l1l2(st
, PH_PULL
| CONFIRM
, NULL
);
1627 test_and_set_bit(FLG_L1_PULL_REQ
, &st
->l1
.Flags
);
1629 case (PH_ACTIVATE
| REQUEST
):
1630 spin_lock_irqsave(&bcs
->cs
->lock
, flags
);
1631 test_and_set_bit(BC_FLG_ACTIV
, &bcs
->Flag
);
1632 bcs
->hw
.isar
.conmsg
[0] = 0;
1633 if (test_bit(FLG_ORIG
, &st
->l2
.flag
))
1634 test_and_set_bit(BC_FLG_ORIG
, &bcs
->Flag
);
1636 test_and_clear_bit(BC_FLG_ORIG
, &bcs
->Flag
);
1637 switch(st
->l1
.mode
) {
1640 ret
= modeisar(bcs
, st
->l1
.mode
, st
->l1
.bc
);
1641 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1643 l1_msg_b(st
, PH_DEACTIVATE
| REQUEST
, arg
);
1645 l1_msg_b(st
, PH_ACTIVATE
| REQUEST
, arg
);
1649 ret
= modeisar(bcs
, st
->l1
.mode
, st
->l1
.bc
);
1650 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1652 l1_msg_b(st
, PH_DEACTIVATE
| REQUEST
, arg
);
1655 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1659 case (PH_DEACTIVATE
| REQUEST
):
1660 l1_msg_b(st
, pr
, arg
);
1662 case (PH_DEACTIVATE
| CONFIRM
):
1663 spin_lock_irqsave(&bcs
->cs
->lock
, flags
);
1664 switch(st
->l1
.mode
) {
1670 isar_pump_cmd(bcs
, ISDN_FAXPUMP_HALT
, 0);
1673 test_and_clear_bit(BC_FLG_ACTIV
, &bcs
->Flag
);
1674 test_and_clear_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1675 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
1676 debugl1(bcs
->cs
, "PDAC clear BC_FLG_BUSY");
1677 modeisar(bcs
, 0, st
->l1
.bc
);
1678 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1679 st
->l1
.l1l2(st
, PH_DEACTIVATE
| CONFIRM
, NULL
);
1685 close_isarstate(struct BCState
*bcs
)
1687 modeisar(bcs
, 0, bcs
->channel
);
1688 if (test_and_clear_bit(BC_FLG_INIT
, &bcs
->Flag
)) {
1689 if (bcs
->hw
.isar
.rcvbuf
) {
1690 kfree(bcs
->hw
.isar
.rcvbuf
);
1691 bcs
->hw
.isar
.rcvbuf
= NULL
;
1693 skb_queue_purge(&bcs
->rqueue
);
1694 skb_queue_purge(&bcs
->squeue
);
1696 dev_kfree_skb_any(bcs
->tx_skb
);
1698 test_and_clear_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1699 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
1700 debugl1(bcs
->cs
, "closeisar clear BC_FLG_BUSY");
1703 del_timer(&bcs
->hw
.isar
.ftimer
);
1707 open_isarstate(struct IsdnCardState
*cs
, struct BCState
*bcs
)
1709 if (!test_and_set_bit(BC_FLG_INIT
, &bcs
->Flag
)) {
1710 if (!(bcs
->hw
.isar
.rcvbuf
= kmalloc(HSCX_BUFMAX
, GFP_ATOMIC
))) {
1712 "HiSax: No memory for isar.rcvbuf\n");
1715 skb_queue_head_init(&bcs
->rqueue
);
1716 skb_queue_head_init(&bcs
->squeue
);
1719 test_and_clear_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1720 if (cs
->debug
& L1_DEB_HSCX
)
1721 debugl1(cs
, "openisar clear BC_FLG_BUSY");
1723 bcs
->hw
.isar
.rcvidx
= 0;
1729 setstack_isar(struct PStack
*st
, struct BCState
*bcs
)
1731 bcs
->channel
= st
->l1
.bc
;
1732 if (open_isarstate(st
->l1
.hardware
, bcs
))
1735 st
->l2
.l2l1
= isar_l2l1
;
1736 setstack_manager(st
);
1743 isar_auxcmd(struct IsdnCardState
*cs
, isdn_ctrl
*ic
) {
1746 struct BCState
*bcs
;
1748 if (cs
->debug
& L1_DEB_HSCX
)
1749 debugl1(cs
, "isar_auxcmd cmd/ch %x/%d", ic
->command
, ic
->arg
);
1750 switch (ic
->command
) {
1751 case (ISDN_CMD_FAXCMD
):
1752 bcs
= cs
->channel
[ic
->arg
].bcs
;
1753 if (cs
->debug
& L1_DEB_HSCX
)
1754 debugl1(cs
, "isar_auxcmd cmd/subcmd %d/%d",
1755 ic
->parm
.aux
.cmd
, ic
->parm
.aux
.subcmd
);
1756 switch(ic
->parm
.aux
.cmd
) {
1757 case ISDN_FAX_CLASS1_CTRL
:
1758 if (ic
->parm
.aux
.subcmd
== ETX
)
1759 test_and_set_bit(BC_FLG_DLEETX
,
1762 case ISDN_FAX_CLASS1_FTS
:
1763 if (ic
->parm
.aux
.subcmd
== AT_QUERY
) {
1764 ic
->command
= ISDN_STAT_FAXIND
;
1765 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_OK
;
1766 cs
->iif
.statcallb(ic
);
1768 } else if (ic
->parm
.aux
.subcmd
== AT_EQ_QUERY
) {
1769 strcpy(ic
->parm
.aux
.para
, "0-255");
1770 ic
->command
= ISDN_STAT_FAXIND
;
1771 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_QUERY
;
1772 cs
->iif
.statcallb(ic
);
1774 } else if (ic
->parm
.aux
.subcmd
== AT_EQ_VALUE
) {
1775 if (cs
->debug
& L1_DEB_HSCX
)
1776 debugl1(cs
, "isar_auxcmd %s=%d",
1777 FC1_CMD
[ic
->parm
.aux
.cmd
], ic
->parm
.aux
.para
[0]);
1778 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1779 if (! ic
->parm
.aux
.para
[0]) {
1780 ic
->command
= ISDN_STAT_FAXIND
;
1781 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_OK
;
1782 cs
->iif
.statcallb(ic
);
1785 if (! test_and_set_bit(BC_FLG_FTI_RUN
, &bcs
->Flag
)) {
1787 bcs
->hw
.isar
.ftimer
.expires
=
1788 jiffies
+ ((ic
->parm
.aux
.para
[0] * 10 * HZ
)/1000);
1789 test_and_set_bit(BC_FLG_FTI_FTS
, &bcs
->Flag
);
1790 add_timer(&bcs
->hw
.isar
.ftimer
);
1794 debugl1(cs
, "isar FTS=%d and FTI busy",
1795 ic
->parm
.aux
.para
[0]);
1799 debugl1(cs
, "isar FTS=%d and isar.state not ready(%x)",
1800 ic
->parm
.aux
.para
[0],bcs
->hw
.isar
.state
);
1802 ic
->command
= ISDN_STAT_FAXIND
;
1803 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_ERROR
;
1804 cs
->iif
.statcallb(ic
);
1807 case ISDN_FAX_CLASS1_FRM
:
1808 case ISDN_FAX_CLASS1_FRH
:
1809 case ISDN_FAX_CLASS1_FTM
:
1810 case ISDN_FAX_CLASS1_FTH
:
1811 if (ic
->parm
.aux
.subcmd
== AT_QUERY
) {
1812 sprintf(ic
->parm
.aux
.para
,
1813 "%d", bcs
->hw
.isar
.mod
);
1814 ic
->command
= ISDN_STAT_FAXIND
;
1815 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_QUERY
;
1816 cs
->iif
.statcallb(ic
);
1818 } else if (ic
->parm
.aux
.subcmd
== AT_EQ_QUERY
) {
1819 char *p
= ic
->parm
.aux
.para
;
1820 for(i
=0;i
<FAXMODCNT
;i
++)
1821 if ((1<<i
) & modmask
)
1822 p
+= sprintf(p
, "%d,", faxmodulation
[i
]);
1825 ic
->command
= ISDN_STAT_FAXIND
;
1826 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_QUERY
;
1827 cs
->iif
.statcallb(ic
);
1829 } else if (ic
->parm
.aux
.subcmd
== AT_EQ_VALUE
) {
1830 if (cs
->debug
& L1_DEB_HSCX
)
1831 debugl1(cs
, "isar_auxcmd %s=%d",
1832 FC1_CMD
[ic
->parm
.aux
.cmd
], ic
->parm
.aux
.para
[0]);
1833 for(i
=0;i
<FAXMODCNT
;i
++)
1834 if (faxmodulation
[i
]==ic
->parm
.aux
.para
[0])
1836 if ((i
< FAXMODCNT
) && ((1<<i
) & modmask
) &&
1837 test_bit(BC_FLG_INIT
, &bcs
->Flag
)) {
1840 ic
->parm
.aux
.para
[0]);
1844 /* wrong modulation or not activ */
1847 ic
->command
= ISDN_STAT_FAXIND
;
1848 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_ERROR
;
1849 cs
->iif
.statcallb(ic
);
1852 case (ISDN_CMD_IOCTL
):
1854 case 9: /* load firmware */
1855 features
= ISDN_FEATURE_L2_MODEM
|
1856 ISDN_FEATURE_L2_FAX
|
1857 ISDN_FEATURE_L3_FCLASS1
;
1858 memcpy(&adr
, ic
->parm
.num
, sizeof(ulong
));
1859 if (isar_load_firmware(cs
, (u_char __user
*)adr
))
1862 ll_run(cs
, features
);
1865 features
= *(unsigned int *) ic
->parm
.num
;
1866 printk(KERN_DEBUG
"HiSax: max modulation old(%04x) new(%04x)\n",
1871 features
= *(unsigned int *) ic
->parm
.num
;
1872 printk(KERN_DEBUG
"HiSax: FRM extra delay old(%d) new(%d) ms\n",
1873 frm_extra_delay
, features
);
1875 frm_extra_delay
= features
;
1878 features
= *(unsigned int *) ic
->parm
.num
;
1879 printk(KERN_DEBUG
"HiSax: TOA old(%d) new(%d) db\n",
1880 para_TOA
, features
);
1881 if (features
>= 0 && features
< 32)
1882 para_TOA
= features
;
1885 printk(KERN_DEBUG
"HiSax: invalid ioctl %d\n",
1897 initisar(struct IsdnCardState
*cs
)
1899 cs
->bcs
[0].BC_SetStack
= setstack_isar
;
1900 cs
->bcs
[1].BC_SetStack
= setstack_isar
;
1901 cs
->bcs
[0].BC_Close
= close_isarstate
;
1902 cs
->bcs
[1].BC_Close
= close_isarstate
;
1903 cs
->bcs
[0].hw
.isar
.ftimer
.function
= (void *) ftimer_handler
;
1904 cs
->bcs
[0].hw
.isar
.ftimer
.data
= (long) &cs
->bcs
[0];
1905 init_timer(&cs
->bcs
[0].hw
.isar
.ftimer
);
1906 cs
->bcs
[1].hw
.isar
.ftimer
.function
= (void *) ftimer_handler
;
1907 cs
->bcs
[1].hw
.isar
.ftimer
.data
= (long) &cs
->bcs
[1];
1908 init_timer(&cs
->bcs
[1].hw
.isar
.ftimer
);