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 static 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 static const u_char
*FC1_CMD
[] = {"FAE", "FTS", "FRS", "FTM", "FRM", "FTH", "FRH", "CTRL" };
30 static 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 #define B_LL_NOCARRIER 8
435 #define B_LL_CONNECT 9
439 isar_bh(struct work_struct
*work
)
441 struct BCState
*bcs
= container_of(work
, struct BCState
, tqueue
);
444 if (test_and_clear_bit(B_LL_NOCARRIER
, &bcs
->event
))
445 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_NOCARR
);
446 if (test_and_clear_bit(B_LL_CONNECT
, &bcs
->event
))
447 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
448 if (test_and_clear_bit(B_LL_OK
, &bcs
->event
))
449 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_OK
);
453 send_DLE_ETX(struct BCState
*bcs
)
455 u_char dleetx
[2] = {DLE
,ETX
};
458 if ((skb
= dev_alloc_skb(2))) {
459 memcpy(skb_put(skb
, 2), dleetx
, 2);
460 skb_queue_tail(&bcs
->rqueue
, skb
);
461 schedule_event(bcs
, B_RCVBUFREADY
);
463 printk(KERN_WARNING
"HiSax: skb out of memory\n");
468 dle_count(unsigned char *buf
, int len
)
479 insert_dle(unsigned char *dest
, unsigned char *src
, int count
) {
480 /* <DLE> in input stream have to be flagged as <DLE><DLE> */
489 isar_rcv_frame(struct IsdnCardState
*cs
, struct BCState
*bcs
)
493 struct isar_reg
*ireg
= bcs
->hw
.isar
.reg
;
496 debugl1(cs
, "isar zero len frame");
497 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
502 debugl1(cs
, "isar mode 0 spurious IIS_RDATA %x/%x/%x",
503 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
504 printk(KERN_WARNING
"isar mode 0 spurious IIS_RDATA %x/%x/%x\n",
505 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
506 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
510 if ((skb
= dev_alloc_skb(ireg
->clsb
))) {
511 rcv_mbox(cs
, ireg
, (u_char
*)skb_put(skb
, ireg
->clsb
));
512 skb_queue_tail(&bcs
->rqueue
, skb
);
513 schedule_event(bcs
, B_RCVBUFREADY
);
515 printk(KERN_WARNING
"HiSax: skb out of memory\n");
516 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
520 if ((bcs
->hw
.isar
.rcvidx
+ ireg
->clsb
) > HSCX_BUFMAX
) {
521 if (cs
->debug
& L1_DEB_WARN
)
522 debugl1(cs
, "isar_rcv_frame: incoming packet too large");
523 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
524 bcs
->hw
.isar
.rcvidx
= 0;
525 } else if (ireg
->cmsb
& HDLC_ERROR
) {
526 if (cs
->debug
& L1_DEB_WARN
)
527 debugl1(cs
, "isar frame error %x len %d",
528 ireg
->cmsb
, ireg
->clsb
);
529 #ifdef ERROR_STATISTIC
530 if (ireg
->cmsb
& HDLC_ERR_RER
)
532 if (ireg
->cmsb
& HDLC_ERR_CER
)
535 bcs
->hw
.isar
.rcvidx
= 0;
536 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
538 if (ireg
->cmsb
& HDLC_FSD
)
539 bcs
->hw
.isar
.rcvidx
= 0;
540 ptr
= bcs
->hw
.isar
.rcvbuf
+ bcs
->hw
.isar
.rcvidx
;
541 bcs
->hw
.isar
.rcvidx
+= ireg
->clsb
;
542 rcv_mbox(cs
, ireg
, ptr
);
543 if (ireg
->cmsb
& HDLC_FED
) {
544 if (bcs
->hw
.isar
.rcvidx
< 3) { /* last 2 bytes are the FCS */
545 if (cs
->debug
& L1_DEB_WARN
)
546 debugl1(cs
, "isar frame to short %d",
547 bcs
->hw
.isar
.rcvidx
);
548 } else if (!(skb
= dev_alloc_skb(bcs
->hw
.isar
.rcvidx
-2))) {
549 printk(KERN_WARNING
"ISAR: receive out of memory\n");
551 memcpy(skb_put(skb
, bcs
->hw
.isar
.rcvidx
-2),
552 bcs
->hw
.isar
.rcvbuf
, bcs
->hw
.isar
.rcvidx
-2);
553 skb_queue_tail(&bcs
->rqueue
, skb
);
554 schedule_event(bcs
, B_RCVBUFREADY
);
556 bcs
->hw
.isar
.rcvidx
= 0;
561 if (bcs
->hw
.isar
.state
!= STFAX_ACTIV
) {
562 if (cs
->debug
& L1_DEB_WARN
)
563 debugl1(cs
, "isar_rcv_frame: not ACTIV");
564 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
565 bcs
->hw
.isar
.rcvidx
= 0;
568 if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FRM
) {
569 rcv_mbox(cs
, ireg
, bcs
->hw
.isar
.rcvbuf
);
570 bcs
->hw
.isar
.rcvidx
= ireg
->clsb
+
571 dle_count(bcs
->hw
.isar
.rcvbuf
, ireg
->clsb
);
572 if (cs
->debug
& L1_DEB_HSCX
)
573 debugl1(cs
, "isar_rcv_frame: raw(%d) dle(%d)",
574 ireg
->clsb
, bcs
->hw
.isar
.rcvidx
);
575 if ((skb
= dev_alloc_skb(bcs
->hw
.isar
.rcvidx
))) {
576 insert_dle((u_char
*)skb_put(skb
, bcs
->hw
.isar
.rcvidx
),
577 bcs
->hw
.isar
.rcvbuf
, ireg
->clsb
);
578 skb_queue_tail(&bcs
->rqueue
, skb
);
579 schedule_event(bcs
, B_RCVBUFREADY
);
580 if (ireg
->cmsb
& SART_NMD
) { /* ABORT */
581 if (cs
->debug
& L1_DEB_WARN
)
582 debugl1(cs
, "isar_rcv_frame: no more data");
583 bcs
->hw
.isar
.rcvidx
= 0;
585 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) |
586 ISAR_HIS_PUMPCTRL
, PCTRL_CMD_ESC
,
588 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
589 schedule_event(bcs
, B_LL_NOCARRIER
);
592 printk(KERN_WARNING
"HiSax: skb out of memory\n");
596 if (bcs
->hw
.isar
.cmd
!= PCTRL_CMD_FRH
) {
597 if (cs
->debug
& L1_DEB_WARN
)
598 debugl1(cs
, "isar_rcv_frame: unknown fax mode %x",
600 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
601 bcs
->hw
.isar
.rcvidx
= 0;
605 if ((bcs
->hw
.isar
.rcvidx
+ ireg
->clsb
) > HSCX_BUFMAX
) {
606 if (cs
->debug
& L1_DEB_WARN
)
607 debugl1(cs
, "isar_rcv_frame: incoming packet too large");
608 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
609 bcs
->hw
.isar
.rcvidx
= 0;
610 } else if (ireg
->cmsb
& HDLC_ERROR
) {
611 if (cs
->debug
& L1_DEB_WARN
)
612 debugl1(cs
, "isar frame error %x len %d",
613 ireg
->cmsb
, ireg
->clsb
);
614 bcs
->hw
.isar
.rcvidx
= 0;
615 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
617 if (ireg
->cmsb
& HDLC_FSD
) {
618 bcs
->hw
.isar
.rcvidx
= 0;
620 ptr
= bcs
->hw
.isar
.rcvbuf
+ bcs
->hw
.isar
.rcvidx
;
621 bcs
->hw
.isar
.rcvidx
+= ireg
->clsb
;
622 rcv_mbox(cs
, ireg
, ptr
);
623 if (ireg
->cmsb
& HDLC_FED
) {
624 int len
= bcs
->hw
.isar
.rcvidx
+
625 dle_count(bcs
->hw
.isar
.rcvbuf
, bcs
->hw
.isar
.rcvidx
);
626 if (bcs
->hw
.isar
.rcvidx
< 3) { /* last 2 bytes are the FCS */
627 if (cs
->debug
& L1_DEB_WARN
)
628 debugl1(cs
, "isar frame to short %d",
629 bcs
->hw
.isar
.rcvidx
);
630 printk(KERN_WARNING
"ISAR: frame to short %d\n",
631 bcs
->hw
.isar
.rcvidx
);
632 } else if (!(skb
= dev_alloc_skb(len
))) {
633 printk(KERN_WARNING
"ISAR: receive out of memory\n");
635 insert_dle((u_char
*)skb_put(skb
, len
),
637 bcs
->hw
.isar
.rcvidx
);
638 skb_queue_tail(&bcs
->rqueue
, skb
);
639 schedule_event(bcs
, B_RCVBUFREADY
);
641 schedule_event(bcs
, B_LL_OK
);
642 test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
644 bcs
->hw
.isar
.rcvidx
= 0;
647 if (ireg
->cmsb
& SART_NMD
) { /* ABORT */
648 if (cs
->debug
& L1_DEB_WARN
)
649 debugl1(cs
, "isar_rcv_frame: no more data");
650 bcs
->hw
.isar
.rcvidx
= 0;
651 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) |
652 ISAR_HIS_PUMPCTRL
, PCTRL_CMD_ESC
, 0, NULL
);
653 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
654 if (test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
)) {
656 schedule_event(bcs
, B_LL_NOCARRIER
);
661 printk(KERN_ERR
"isar_rcv_frame mode (%x)error\n", bcs
->mode
);
662 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
668 isar_fill_fifo(struct BCState
*bcs
)
670 struct IsdnCardState
*cs
= bcs
->cs
;
675 if ((cs
->debug
& L1_DEB_HSCX
) && !(cs
->debug
& L1_DEB_HSCX_FIFO
))
676 debugl1(cs
, "isar_fill_fifo");
679 if (bcs
->tx_skb
->len
<= 0)
681 if (!(bcs
->hw
.isar
.reg
->bstat
&
682 (bcs
->hw
.isar
.dpath
== 1 ? BSTAT_RDM1
: BSTAT_RDM2
)))
684 if (bcs
->tx_skb
->len
> bcs
->hw
.isar
.mml
) {
686 count
= bcs
->hw
.isar
.mml
;
688 count
= bcs
->tx_skb
->len
;
691 ptr
= bcs
->tx_skb
->data
;
692 if (!bcs
->hw
.isar
.txcnt
) {
694 if ((bcs
->mode
== L1_MODE_FAX
) &&
695 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
)) {
696 if (bcs
->tx_skb
->len
> 1) {
697 if ((ptr
[0]== 0xff) && (ptr
[1] == 0x13))
699 test_and_set_bit(BC_FLG_LASTDATA
,
704 skb_pull(bcs
->tx_skb
, count
);
705 bcs
->tx_cnt
-= count
;
706 bcs
->hw
.isar
.txcnt
+= count
;
709 printk(KERN_ERR
"isar_fill_fifo wrong mode 0\n");
713 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) | ISAR_HIS_SDATA
,
717 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) | ISAR_HIS_SDATA
,
721 if (bcs
->hw
.isar
.state
!= STFAX_ACTIV
) {
722 if (cs
->debug
& L1_DEB_WARN
)
723 debugl1(cs
, "isar_fill_fifo: not ACTIV");
724 } else if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
) {
725 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) | ISAR_HIS_SDATA
,
727 } else if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTM
) {
728 sendmsg(cs
, SET_DPS(bcs
->hw
.isar
.dpath
) | ISAR_HIS_SDATA
,
731 if (cs
->debug
& L1_DEB_WARN
)
732 debugl1(cs
, "isar_fill_fifo: not FTH/FTM");
737 debugl1(cs
, "isar_fill_fifo mode(%x) error", bcs
->mode
);
738 printk(KERN_ERR
"isar_fill_fifo mode(%x) error\n", bcs
->mode
);
744 struct BCState
*sel_bcs_isar(struct IsdnCardState
*cs
, u_char dpath
)
746 if ((!dpath
) || (dpath
== 3))
748 if (cs
->bcs
[0].hw
.isar
.dpath
== dpath
)
750 if (cs
->bcs
[1].hw
.isar
.dpath
== dpath
)
756 send_frames(struct BCState
*bcs
)
759 if (bcs
->tx_skb
->len
) {
763 if (test_bit(FLG_LLI_L1WAKEUP
,&bcs
->st
->lli
.flag
) &&
764 (PACKET_NOACK
!= bcs
->tx_skb
->pkt_type
)) {
766 spin_lock_irqsave(&bcs
->aclock
, flags
);
767 bcs
->ackcnt
+= bcs
->hw
.isar
.txcnt
;
768 spin_unlock_irqrestore(&bcs
->aclock
, flags
);
769 schedule_event(bcs
, B_ACKPENDING
);
771 if (bcs
->mode
== L1_MODE_FAX
) {
772 if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
) {
773 if (test_bit(BC_FLG_LASTDATA
, &bcs
->Flag
)) {
774 test_and_set_bit(BC_FLG_NMD_DATA
, &bcs
->Flag
);
776 } else if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTM
) {
777 if (test_bit(BC_FLG_DLEETX
, &bcs
->Flag
)) {
778 test_and_set_bit(BC_FLG_LASTDATA
, &bcs
->Flag
);
779 test_and_set_bit(BC_FLG_NMD_DATA
, &bcs
->Flag
);
783 dev_kfree_skb_any(bcs
->tx_skb
);
784 bcs
->hw
.isar
.txcnt
= 0;
788 if ((bcs
->tx_skb
= skb_dequeue(&bcs
->squeue
))) {
789 bcs
->hw
.isar
.txcnt
= 0;
790 test_and_set_bit(BC_FLG_BUSY
, &bcs
->Flag
);
793 if (test_and_clear_bit(BC_FLG_DLEETX
, &bcs
->Flag
)) {
794 if (test_and_clear_bit(BC_FLG_LASTDATA
, &bcs
->Flag
)) {
795 if (test_and_clear_bit(BC_FLG_NMD_DATA
, &bcs
->Flag
)) {
797 sendmsg(bcs
->cs
, SET_DPS(bcs
->hw
.isar
.dpath
) |
798 ISAR_HIS_SDATA
, 0x01, 1, &dummy
);
800 test_and_set_bit(BC_FLG_LL_OK
, &bcs
->Flag
);
802 schedule_event(bcs
, B_LL_CONNECT
);
805 test_and_clear_bit(BC_FLG_BUSY
, &bcs
->Flag
);
806 schedule_event(bcs
, B_XMTBUFREADY
);
811 check_send(struct IsdnCardState
*cs
, u_char rdm
)
815 if (rdm
& BSTAT_RDM1
) {
816 if ((bcs
= sel_bcs_isar(cs
, 1))) {
822 if (rdm
& BSTAT_RDM2
) {
823 if ((bcs
= sel_bcs_isar(cs
, 2))) {
832 static const char *dmril
[] = {"NO SPEED", "1200/75", "NODEF2", "75/1200",
833 "NODEF4", "300", "600", "1200", "2400",
834 "4800", "7200", "9600nt", "9600t", "12000",
836 static const char *dmrim
[] = {"NO MOD", "NO DEF", "V32/V32b", "V22", "V21",
837 "Bell103", "V23", "Bell202", "V17", "V29",
841 isar_pump_status_rsp(struct BCState
*bcs
, struct isar_reg
*ireg
) {
842 struct IsdnCardState
*cs
= bcs
->cs
;
843 u_char ril
= ireg
->par
[0];
846 if (!test_and_clear_bit(ISAR_RATE_REQ
, &bcs
->hw
.isar
.reg
->Flags
))
849 if (cs
->debug
& L1_DEB_WARN
)
850 debugl1(cs
, "wrong pstrsp ril=%d",ril
);
853 switch(ireg
->par
[1]) {
888 sprintf(bcs
->hw
.isar
.conmsg
,"%s %s", dmril
[ril
], dmrim
[rim
]);
889 bcs
->conmsg
= bcs
->hw
.isar
.conmsg
;
890 if (cs
->debug
& L1_DEB_HSCX
)
891 debugl1(cs
, "pump strsp %s", bcs
->conmsg
);
895 isar_pump_statev_modem(struct BCState
*bcs
, u_char devt
) {
896 struct IsdnCardState
*cs
= bcs
->cs
;
897 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
900 case PSEV_10MS_TIMER
:
901 if (cs
->debug
& L1_DEB_HSCX
)
902 debugl1(cs
, "pump stev TIMER");
905 if (cs
->debug
& L1_DEB_HSCX
)
906 debugl1(cs
, "pump stev CONNECT");
907 l1_msg_b(bcs
->st
, PH_ACTIVATE
| REQUEST
, NULL
);
910 if (cs
->debug
& L1_DEB_HSCX
)
911 debugl1(cs
, "pump stev NO CONNECT");
912 sendmsg(cs
, dps
| ISAR_HIS_PSTREQ
, 0, 0, NULL
);
913 l1_msg_b(bcs
->st
, PH_DEACTIVATE
| REQUEST
, NULL
);
916 if (cs
->debug
& L1_DEB_HSCX
)
917 debugl1(cs
, "pump stev V24 OFF");
920 if (cs
->debug
& L1_DEB_HSCX
)
921 debugl1(cs
, "pump stev CTS ON");
924 if (cs
->debug
& L1_DEB_HSCX
)
925 debugl1(cs
, "pump stev CTS OFF");
928 if (cs
->debug
& L1_DEB_HSCX
)
929 debugl1(cs
, "pump stev CARRIER ON");
930 test_and_set_bit(ISAR_RATE_REQ
, &bcs
->hw
.isar
.reg
->Flags
);
931 sendmsg(cs
, dps
| ISAR_HIS_PSTREQ
, 0, 0, NULL
);
934 if (cs
->debug
& L1_DEB_HSCX
)
935 debugl1(cs
, "pump stev CARRIER OFF");
938 if (cs
->debug
& L1_DEB_HSCX
)
939 debugl1(cs
, "pump stev DSR ON");
942 if (cs
->debug
& L1_DEB_HSCX
)
943 debugl1(cs
, "pump stev DSR_OFF");
946 if (cs
->debug
& L1_DEB_HSCX
)
947 debugl1(cs
, "pump stev REMOTE RETRAIN");
950 if (cs
->debug
& L1_DEB_HSCX
)
951 debugl1(cs
, "pump stev REMOTE RENEGOTIATE");
954 if (cs
->debug
& L1_DEB_HSCX
)
955 debugl1(cs
, "pump stev GSTN CLEAR", devt
);
958 if (cs
->debug
& L1_DEB_HSCX
)
959 debugl1(cs
, "unknown pump stev %x", devt
);
965 ll_deliver_faxstat(struct BCState
*bcs
, u_char status
)
968 struct Channel
*chanp
= (struct Channel
*) bcs
->st
->lli
.userdata
;
970 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
971 debugl1(bcs
->cs
, "HL->LL FAXIND %x", status
);
972 ic
.driver
= bcs
->cs
->myid
;
973 ic
.command
= ISDN_STAT_FAXIND
;
974 ic
.arg
= chanp
->chan
;
975 ic
.parm
.aux
.cmd
= status
;
976 bcs
->cs
->iif
.statcallb(&ic
);
980 isar_pump_statev_fax(struct BCState
*bcs
, u_char devt
) {
981 struct IsdnCardState
*cs
= bcs
->cs
;
982 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
986 case PSEV_10MS_TIMER
:
987 if (cs
->debug
& L1_DEB_HSCX
)
988 debugl1(cs
, "pump stev TIMER");
991 if (cs
->debug
& L1_DEB_HSCX
)
992 debugl1(cs
, "pump stev RSP_READY");
993 bcs
->hw
.isar
.state
= STFAX_READY
;
994 l1_msg_b(bcs
->st
, PH_ACTIVATE
| REQUEST
, NULL
);
995 if (test_bit(BC_FLG_ORIG
, &bcs
->Flag
)) {
996 isar_pump_cmd(bcs
, ISDN_FAX_CLASS1_FRH
, 3);
998 isar_pump_cmd(bcs
, ISDN_FAX_CLASS1_FTH
, 3);
1001 case PSEV_LINE_TX_H
:
1002 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1003 if (cs
->debug
& L1_DEB_HSCX
)
1004 debugl1(cs
, "pump stev LINE_TX_H");
1005 bcs
->hw
.isar
.state
= STFAX_CONT
;
1006 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_CONT
, 0, NULL
);
1008 if (cs
->debug
& L1_DEB_WARN
)
1009 debugl1(cs
, "pump stev LINE_TX_H wrong st %x",
1010 bcs
->hw
.isar
.state
);
1013 case PSEV_LINE_RX_H
:
1014 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1015 if (cs
->debug
& L1_DEB_HSCX
)
1016 debugl1(cs
, "pump stev LINE_RX_H");
1017 bcs
->hw
.isar
.state
= STFAX_CONT
;
1018 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_CONT
, 0, NULL
);
1020 if (cs
->debug
& L1_DEB_WARN
)
1021 debugl1(cs
, "pump stev LINE_RX_H wrong st %x",
1022 bcs
->hw
.isar
.state
);
1025 case PSEV_LINE_TX_B
:
1026 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1027 if (cs
->debug
& L1_DEB_HSCX
)
1028 debugl1(cs
, "pump stev LINE_TX_B");
1029 bcs
->hw
.isar
.state
= STFAX_CONT
;
1030 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_CONT
, 0, NULL
);
1032 if (cs
->debug
& L1_DEB_WARN
)
1033 debugl1(cs
, "pump stev LINE_TX_B wrong st %x",
1034 bcs
->hw
.isar
.state
);
1037 case PSEV_LINE_RX_B
:
1038 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1039 if (cs
->debug
& L1_DEB_HSCX
)
1040 debugl1(cs
, "pump stev LINE_RX_B");
1041 bcs
->hw
.isar
.state
= STFAX_CONT
;
1042 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_CONT
, 0, NULL
);
1044 if (cs
->debug
& L1_DEB_WARN
)
1045 debugl1(cs
, "pump stev LINE_RX_B wrong st %x",
1046 bcs
->hw
.isar
.state
);
1050 if (bcs
->hw
.isar
.state
== STFAX_CONT
) {
1051 if (cs
->debug
& L1_DEB_HSCX
)
1052 debugl1(cs
, "pump stev RSP_CONN");
1053 bcs
->hw
.isar
.state
= STFAX_ACTIV
;
1054 test_and_set_bit(ISAR_RATE_REQ
, &bcs
->hw
.isar
.reg
->Flags
);
1055 sendmsg(cs
, dps
| ISAR_HIS_PSTREQ
, 0, 0, NULL
);
1056 if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
) {
1057 /* 1s Flags before data */
1058 if (test_and_set_bit(BC_FLG_FTI_RUN
, &bcs
->Flag
))
1059 del_timer(&bcs
->hw
.isar
.ftimer
);
1061 bcs
->hw
.isar
.ftimer
.expires
=
1062 jiffies
+ ((1000 * HZ
)/1000);
1063 test_and_set_bit(BC_FLG_LL_CONN
,
1065 add_timer(&bcs
->hw
.isar
.ftimer
);
1067 schedule_event(bcs
, B_LL_CONNECT
);
1070 if (cs
->debug
& L1_DEB_WARN
)
1071 debugl1(cs
, "pump stev RSP_CONN wrong st %x",
1072 bcs
->hw
.isar
.state
);
1075 case PSEV_FLAGS_DET
:
1076 if (cs
->debug
& L1_DEB_HSCX
)
1077 debugl1(cs
, "pump stev FLAGS_DET");
1080 if (cs
->debug
& L1_DEB_HSCX
)
1081 debugl1(cs
, "pump stev RSP_DISC");
1082 if (bcs
->hw
.isar
.state
== STFAX_ESCAPE
) {
1084 switch(bcs
->hw
.isar
.newcmd
) {
1086 bcs
->hw
.isar
.state
= STFAX_READY
;
1091 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
,
1092 PCTRL_CMD_SILON
, 1, &p1
);
1093 bcs
->hw
.isar
.state
= STFAX_SILDET
;
1096 if (frm_extra_delay
)
1097 mdelay(frm_extra_delay
);
1099 p1
= bcs
->hw
.isar
.mod
= bcs
->hw
.isar
.newmod
;
1100 bcs
->hw
.isar
.newmod
= 0;
1101 bcs
->hw
.isar
.cmd
= bcs
->hw
.isar
.newcmd
;
1102 bcs
->hw
.isar
.newcmd
= 0;
1103 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
,
1104 bcs
->hw
.isar
.cmd
, 1, &p1
);
1105 bcs
->hw
.isar
.state
= STFAX_LINE
;
1106 bcs
->hw
.isar
.try_mod
= 3;
1109 if (cs
->debug
& L1_DEB_HSCX
)
1110 debugl1(cs
, "RSP_DISC unknown newcmd %x", bcs
->hw
.isar
.newcmd
);
1113 } else if (bcs
->hw
.isar
.state
== STFAX_ACTIV
) {
1114 if (test_and_clear_bit(BC_FLG_LL_OK
, &bcs
->Flag
)) {
1115 schedule_event(bcs
, B_LL_OK
);
1116 } else if (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FRM
) {
1118 schedule_event(bcs
, B_LL_NOCARRIER
);
1120 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_FCERROR
);
1122 bcs
->hw
.isar
.state
= STFAX_READY
;
1124 bcs
->hw
.isar
.state
= STFAX_READY
;
1125 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_FCERROR
);
1128 case PSEV_RSP_SILDET
:
1129 if (cs
->debug
& L1_DEB_HSCX
)
1130 debugl1(cs
, "pump stev RSP_SILDET");
1131 if (bcs
->hw
.isar
.state
== STFAX_SILDET
) {
1132 p1
= bcs
->hw
.isar
.mod
= bcs
->hw
.isar
.newmod
;
1133 bcs
->hw
.isar
.newmod
= 0;
1134 bcs
->hw
.isar
.cmd
= bcs
->hw
.isar
.newcmd
;
1135 bcs
->hw
.isar
.newcmd
= 0;
1136 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
,
1137 bcs
->hw
.isar
.cmd
, 1, &p1
);
1138 bcs
->hw
.isar
.state
= STFAX_LINE
;
1139 bcs
->hw
.isar
.try_mod
= 3;
1142 case PSEV_RSP_SILOFF
:
1143 if (cs
->debug
& L1_DEB_HSCX
)
1144 debugl1(cs
, "pump stev RSP_SILOFF");
1146 case PSEV_RSP_FCERR
:
1147 if (bcs
->hw
.isar
.state
== STFAX_LINE
) {
1148 if (cs
->debug
& L1_DEB_HSCX
)
1149 debugl1(cs
, "pump stev RSP_FCERR try %d",
1150 bcs
->hw
.isar
.try_mod
);
1151 if (bcs
->hw
.isar
.try_mod
--) {
1152 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
,
1153 bcs
->hw
.isar
.cmd
, 1,
1158 if (cs
->debug
& L1_DEB_HSCX
)
1159 debugl1(cs
, "pump stev RSP_FCERR");
1160 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1161 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, PCTRL_CMD_ESC
, 0, NULL
);
1162 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_FCERROR
);
1169 static char debbuf
[128];
1172 isar_int_main(struct IsdnCardState
*cs
)
1174 struct isar_reg
*ireg
= cs
->bcs
[0].hw
.isar
.reg
;
1175 struct BCState
*bcs
;
1177 get_irq_infos(cs
, ireg
);
1178 switch (ireg
->iis
& ISAR_IIS_MSCMSD
) {
1179 case ISAR_IIS_RDATA
:
1180 if ((bcs
= sel_bcs_isar(cs
, ireg
->iis
>> 6))) {
1181 isar_rcv_frame(cs
, bcs
);
1183 debugl1(cs
, "isar spurious IIS_RDATA %x/%x/%x",
1184 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
1185 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1188 case ISAR_IIS_GSTEV
:
1189 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1190 ireg
->bstat
|= ireg
->cmsb
;
1191 check_send(cs
, ireg
->cmsb
);
1193 case ISAR_IIS_BSTEV
:
1194 #ifdef ERROR_STATISTIC
1195 if ((bcs
= sel_bcs_isar(cs
, ireg
->iis
>> 6))) {
1196 if (ireg
->cmsb
== BSTEV_TBO
)
1198 if (ireg
->cmsb
== BSTEV_RBO
)
1202 if (cs
->debug
& L1_DEB_WARN
)
1203 debugl1(cs
, "Buffer STEV dpath%d msb(%x)",
1204 ireg
->iis
>>6, ireg
->cmsb
);
1205 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1207 case ISAR_IIS_PSTEV
:
1208 if ((bcs
= sel_bcs_isar(cs
, ireg
->iis
>> 6))) {
1209 rcv_mbox(cs
, ireg
, (u_char
*)ireg
->par
);
1210 if (bcs
->mode
== L1_MODE_V32
) {
1211 isar_pump_statev_modem(bcs
, ireg
->cmsb
);
1212 } else if (bcs
->mode
== L1_MODE_FAX
) {
1213 isar_pump_statev_fax(bcs
, ireg
->cmsb
);
1214 } else if (ireg
->cmsb
== PSEV_10MS_TIMER
) {
1215 if (cs
->debug
& L1_DEB_HSCX
)
1216 debugl1(cs
, "pump stev TIMER");
1218 if (cs
->debug
& L1_DEB_WARN
)
1219 debugl1(cs
, "isar IIS_PSTEV pmode %d stat %x",
1220 bcs
->mode
, ireg
->cmsb
);
1223 debugl1(cs
, "isar spurious IIS_PSTEV %x/%x/%x",
1224 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
1225 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1228 case ISAR_IIS_PSTRSP
:
1229 if ((bcs
= sel_bcs_isar(cs
, ireg
->iis
>> 6))) {
1230 rcv_mbox(cs
, ireg
, (u_char
*)ireg
->par
);
1231 isar_pump_status_rsp(bcs
, ireg
);
1233 debugl1(cs
, "isar spurious IIS_PSTRSP %x/%x/%x",
1234 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
1235 cs
->BC_Write_Reg(cs
, 1, ISAR_IIA
, 0);
1239 case ISAR_IIS_BSTRSP
:
1240 case ISAR_IIS_IOM2RSP
:
1241 rcv_mbox(cs
, ireg
, (u_char
*)ireg
->par
);
1242 if ((cs
->debug
& (L1_DEB_HSCX
| L1_DEB_HSCX_FIFO
))
1246 tp
+= sprintf(debbuf
, "msg iis(%x) msb(%x)",
1247 ireg
->iis
, ireg
->cmsb
);
1248 QuickHex(tp
, (u_char
*)ireg
->par
, ireg
->clsb
);
1249 debugl1(cs
, debbuf
);
1252 case ISAR_IIS_INVMSG
:
1253 rcv_mbox(cs
, ireg
, debbuf
);
1254 if (cs
->debug
& L1_DEB_WARN
)
1255 debugl1(cs
, "invalid msg his:%x",
1259 rcv_mbox(cs
, ireg
, debbuf
);
1260 if (cs
->debug
& L1_DEB_WARN
)
1261 debugl1(cs
, "unhandled msg iis(%x) ctrl(%x/%x)",
1262 ireg
->iis
, ireg
->cmsb
, ireg
->clsb
);
1268 ftimer_handler(struct BCState
*bcs
) {
1270 debugl1(bcs
->cs
, "ftimer flags %04x",
1272 test_and_clear_bit(BC_FLG_FTI_RUN
, &bcs
->Flag
);
1273 if (test_and_clear_bit(BC_FLG_LL_CONN
, &bcs
->Flag
)) {
1274 schedule_event(bcs
, B_LL_CONNECT
);
1276 if (test_and_clear_bit(BC_FLG_FTI_FTS
, &bcs
->Flag
)) {
1277 schedule_event(bcs
, B_LL_OK
);
1282 setup_pump(struct BCState
*bcs
) {
1283 struct IsdnCardState
*cs
= bcs
->cs
;
1284 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
1285 u_char ctrl
, param
[6];
1287 switch (bcs
->mode
) {
1291 sendmsg(cs
, dps
| ISAR_HIS_PUMPCFG
, PMOD_BYPASS
, 0, NULL
);
1294 ctrl
= PMOD_DATAMODEM
;
1295 if (test_bit(BC_FLG_ORIG
, &bcs
->Flag
)) {
1297 param
[5] = PV32P6_CTN
;
1299 param
[5] = PV32P6_ATN
;
1301 param
[0] = para_TOA
; /* 6 db */
1302 param
[1] = PV32P2_V23R
| PV32P2_V22A
| PV32P2_V22B
|
1303 PV32P2_V22C
| PV32P2_V21
| PV32P2_BEL
;
1304 param
[2] = PV32P3_AMOD
| PV32P3_V32B
| PV32P3_V23B
;
1305 param
[3] = PV32P4_UT144
;
1306 param
[4] = PV32P5_UT144
;
1307 sendmsg(cs
, dps
| ISAR_HIS_PUMPCFG
, ctrl
, 6, param
);
1311 if (test_bit(BC_FLG_ORIG
, &bcs
->Flag
)) {
1313 param
[1] = PFAXP2_CTN
;
1315 param
[1] = PFAXP2_ATN
;
1317 param
[0] = para_TOA
; /* 6 db */
1318 sendmsg(cs
, dps
| ISAR_HIS_PUMPCFG
, ctrl
, 2, param
);
1319 bcs
->hw
.isar
.state
= STFAX_NULL
;
1320 bcs
->hw
.isar
.newcmd
= 0;
1321 bcs
->hw
.isar
.newmod
= 0;
1322 test_and_set_bit(BC_FLG_FTI_RUN
, &bcs
->Flag
);
1326 sendmsg(cs
, dps
| ISAR_HIS_PSTREQ
, 0, 0, NULL
);
1331 setup_sart(struct BCState
*bcs
) {
1332 struct IsdnCardState
*cs
= bcs
->cs
;
1333 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
1334 u_char ctrl
, param
[2];
1336 switch (bcs
->mode
) {
1338 sendmsg(cs
, dps
| ISAR_HIS_SARTCFG
, SMODE_DISABLE
, 0,
1342 sendmsg(cs
, dps
| ISAR_HIS_SARTCFG
, SMODE_BINARY
, 2,
1347 sendmsg(cs
, dps
| ISAR_HIS_SARTCFG
, SMODE_HDLC
, 1,
1351 ctrl
= SMODE_V14
| SCTRL_HDMC_BOTH
;
1352 param
[0] = S_P1_CHS_8
;
1353 param
[1] = S_P2_BFT_DEF
;
1354 sendmsg(cs
, dps
| ISAR_HIS_SARTCFG
, ctrl
, 2,
1358 /* SART must not configured with FAX */
1362 sendmsg(cs
, dps
| ISAR_HIS_BSTREQ
, 0, 0, NULL
);
1367 setup_iom2(struct BCState
*bcs
) {
1368 struct IsdnCardState
*cs
= bcs
->cs
;
1369 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
1370 u_char cmsb
= IOM_CTRL_ENA
, msg
[5] = {IOM_P1_TXD
,0,0,0,0};
1373 msg
[1] = msg
[3] = 1;
1374 switch (bcs
->mode
) {
1378 msg
[1] = msg
[3] = bcs
->hw
.isar
.dpath
+ 2;
1385 cmsb
|= IOM_CTRL_ALAW
| IOM_CTRL_RCV
;
1388 sendmsg(cs
, dps
| ISAR_HIS_IOM2CFG
, cmsb
, 5, msg
);
1390 sendmsg(cs
, dps
| ISAR_HIS_IOM2REQ
, 0, 0, NULL
);
1395 modeisar(struct BCState
*bcs
, int mode
, int bc
)
1397 struct IsdnCardState
*cs
= bcs
->cs
;
1399 /* Here we are selecting the best datapath for requested mode */
1400 if(bcs
->mode
== L1_MODE_NULL
) { /* New Setup */
1403 case L1_MODE_NULL
: /* init */
1404 if (!bcs
->hw
.isar
.dpath
)
1405 /* no init for dpath 0 */
1410 /* best is datapath 2 */
1411 if (!test_and_set_bit(ISAR_DP2_USE
,
1412 &bcs
->hw
.isar
.reg
->Flags
))
1413 bcs
->hw
.isar
.dpath
= 2;
1414 else if (!test_and_set_bit(ISAR_DP1_USE
,
1415 &bcs
->hw
.isar
.reg
->Flags
))
1416 bcs
->hw
.isar
.dpath
= 1;
1418 printk(KERN_WARNING
"isar modeisar both pathes in use\n");
1424 /* only datapath 1 */
1425 if (!test_and_set_bit(ISAR_DP1_USE
,
1426 &bcs
->hw
.isar
.reg
->Flags
))
1427 bcs
->hw
.isar
.dpath
= 1;
1429 printk(KERN_WARNING
"isar modeisar analog funktions only with DP1\n");
1430 debugl1(cs
, "isar modeisar analog funktions only with DP1");
1436 if (cs
->debug
& L1_DEB_HSCX
)
1437 debugl1(cs
, "isar dp%d mode %d->%d ichan %d",
1438 bcs
->hw
.isar
.dpath
, bcs
->mode
, mode
, bc
);
1443 if (bcs
->mode
== L1_MODE_NULL
) {
1444 /* Clear resources */
1445 if (bcs
->hw
.isar
.dpath
== 1)
1446 test_and_clear_bit(ISAR_DP1_USE
, &bcs
->hw
.isar
.reg
->Flags
);
1447 else if (bcs
->hw
.isar
.dpath
== 2)
1448 test_and_clear_bit(ISAR_DP2_USE
, &bcs
->hw
.isar
.reg
->Flags
);
1449 bcs
->hw
.isar
.dpath
= 0;
1455 isar_pump_cmd(struct BCState
*bcs
, u_char cmd
, u_char para
)
1457 struct IsdnCardState
*cs
= bcs
->cs
;
1458 u_char dps
= SET_DPS(bcs
->hw
.isar
.dpath
);
1459 u_char ctrl
= 0, nom
= 0, p1
= 0;
1462 case ISDN_FAX_CLASS1_FTM
:
1463 test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
1464 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1466 ctrl
= PCTRL_CMD_FTM
;
1468 bcs
->hw
.isar
.state
= STFAX_LINE
;
1469 bcs
->hw
.isar
.cmd
= ctrl
;
1470 bcs
->hw
.isar
.mod
= para
;
1471 bcs
->hw
.isar
.newmod
= 0;
1472 bcs
->hw
.isar
.newcmd
= 0;
1473 bcs
->hw
.isar
.try_mod
= 3;
1474 } else if ((bcs
->hw
.isar
.state
== STFAX_ACTIV
) &&
1475 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTM
) &&
1476 (bcs
->hw
.isar
.mod
== para
)) {
1477 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
1479 bcs
->hw
.isar
.newmod
= para
;
1480 bcs
->hw
.isar
.newcmd
= PCTRL_CMD_FTM
;
1482 ctrl
= PCTRL_CMD_ESC
;
1483 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1486 case ISDN_FAX_CLASS1_FTH
:
1487 test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
1488 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1490 ctrl
= PCTRL_CMD_FTH
;
1492 bcs
->hw
.isar
.state
= STFAX_LINE
;
1493 bcs
->hw
.isar
.cmd
= ctrl
;
1494 bcs
->hw
.isar
.mod
= para
;
1495 bcs
->hw
.isar
.newmod
= 0;
1496 bcs
->hw
.isar
.newcmd
= 0;
1497 bcs
->hw
.isar
.try_mod
= 3;
1498 } else if ((bcs
->hw
.isar
.state
== STFAX_ACTIV
) &&
1499 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FTH
) &&
1500 (bcs
->hw
.isar
.mod
== para
)) {
1501 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
1503 bcs
->hw
.isar
.newmod
= para
;
1504 bcs
->hw
.isar
.newcmd
= PCTRL_CMD_FTH
;
1506 ctrl
= PCTRL_CMD_ESC
;
1507 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1510 case ISDN_FAX_CLASS1_FRM
:
1511 test_and_clear_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
1512 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1514 ctrl
= PCTRL_CMD_FRM
;
1516 bcs
->hw
.isar
.state
= STFAX_LINE
;
1517 bcs
->hw
.isar
.cmd
= ctrl
;
1518 bcs
->hw
.isar
.mod
= para
;
1519 bcs
->hw
.isar
.newmod
= 0;
1520 bcs
->hw
.isar
.newcmd
= 0;
1521 bcs
->hw
.isar
.try_mod
= 3;
1522 } else if ((bcs
->hw
.isar
.state
== STFAX_ACTIV
) &&
1523 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FRM
) &&
1524 (bcs
->hw
.isar
.mod
== para
)) {
1525 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
1527 bcs
->hw
.isar
.newmod
= para
;
1528 bcs
->hw
.isar
.newcmd
= PCTRL_CMD_FRM
;
1530 ctrl
= PCTRL_CMD_ESC
;
1531 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1534 case ISDN_FAX_CLASS1_FRH
:
1535 test_and_set_bit(BC_FLG_FRH_WAIT
, &bcs
->Flag
);
1536 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1538 ctrl
= PCTRL_CMD_FRH
;
1540 bcs
->hw
.isar
.state
= STFAX_LINE
;
1541 bcs
->hw
.isar
.cmd
= ctrl
;
1542 bcs
->hw
.isar
.mod
= para
;
1543 bcs
->hw
.isar
.newmod
= 0;
1544 bcs
->hw
.isar
.newcmd
= 0;
1545 bcs
->hw
.isar
.try_mod
= 3;
1546 } else if ((bcs
->hw
.isar
.state
== STFAX_ACTIV
) &&
1547 (bcs
->hw
.isar
.cmd
== PCTRL_CMD_FRH
) &&
1548 (bcs
->hw
.isar
.mod
== para
)) {
1549 ll_deliver_faxstat(bcs
, ISDN_FAX_CLASS1_CONNECT
);
1551 bcs
->hw
.isar
.newmod
= para
;
1552 bcs
->hw
.isar
.newcmd
= PCTRL_CMD_FRH
;
1554 ctrl
= PCTRL_CMD_ESC
;
1555 bcs
->hw
.isar
.state
= STFAX_ESCAPE
;
1558 case ISDN_FAXPUMP_HALT
:
1559 bcs
->hw
.isar
.state
= STFAX_NULL
;
1561 ctrl
= PCTRL_CMD_HALT
;
1565 sendmsg(cs
, dps
| ISAR_HIS_PUMPCTRL
, ctrl
, nom
, &p1
);
1569 isar_setup(struct IsdnCardState
*cs
)
1576 for (i
=0; i
<2; i
++) {
1578 sendmsg(cs
, (i
? ISAR_HIS_DPS2
: ISAR_HIS_DPS1
) |
1579 ISAR_HIS_P12CFG
, 4, 1, &msg
);
1580 cs
->bcs
[i
].hw
.isar
.mml
= msg
;
1581 cs
->bcs
[i
].mode
= 0;
1582 cs
->bcs
[i
].hw
.isar
.dpath
= i
+ 1;
1583 modeisar(&cs
->bcs
[i
], 0, 0);
1584 INIT_WORK(&cs
->bcs
[i
].tqueue
, isar_bh
);
1589 isar_l2l1(struct PStack
*st
, int pr
, void *arg
)
1591 struct BCState
*bcs
= st
->l1
.bcs
;
1592 struct sk_buff
*skb
= arg
;
1597 case (PH_DATA
| REQUEST
):
1598 spin_lock_irqsave(&bcs
->cs
->lock
, flags
);
1600 skb_queue_tail(&bcs
->squeue
, skb
);
1603 test_and_set_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1604 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
1605 debugl1(bcs
->cs
, "DRQ set BC_FLG_BUSY");
1606 bcs
->hw
.isar
.txcnt
= 0;
1607 bcs
->cs
->BC_Send_Data(bcs
);
1609 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1611 case (PH_PULL
| INDICATION
):
1612 spin_lock_irqsave(&bcs
->cs
->lock
, flags
);
1614 printk(KERN_WARNING
"isar_l2l1: this shouldn't happen\n");
1616 test_and_set_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1617 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
1618 debugl1(bcs
->cs
, "PUI set BC_FLG_BUSY");
1620 bcs
->hw
.isar
.txcnt
= 0;
1621 bcs
->cs
->BC_Send_Data(bcs
);
1623 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1625 case (PH_PULL
| REQUEST
):
1627 test_and_clear_bit(FLG_L1_PULL_REQ
, &st
->l1
.Flags
);
1628 st
->l1
.l1l2(st
, PH_PULL
| CONFIRM
, NULL
);
1630 test_and_set_bit(FLG_L1_PULL_REQ
, &st
->l1
.Flags
);
1632 case (PH_ACTIVATE
| REQUEST
):
1633 spin_lock_irqsave(&bcs
->cs
->lock
, flags
);
1634 test_and_set_bit(BC_FLG_ACTIV
, &bcs
->Flag
);
1635 bcs
->hw
.isar
.conmsg
[0] = 0;
1636 if (test_bit(FLG_ORIG
, &st
->l2
.flag
))
1637 test_and_set_bit(BC_FLG_ORIG
, &bcs
->Flag
);
1639 test_and_clear_bit(BC_FLG_ORIG
, &bcs
->Flag
);
1640 switch(st
->l1
.mode
) {
1643 ret
= modeisar(bcs
, st
->l1
.mode
, st
->l1
.bc
);
1644 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1646 l1_msg_b(st
, PH_DEACTIVATE
| REQUEST
, arg
);
1648 l1_msg_b(st
, PH_ACTIVATE
| REQUEST
, arg
);
1652 ret
= modeisar(bcs
, st
->l1
.mode
, st
->l1
.bc
);
1653 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1655 l1_msg_b(st
, PH_DEACTIVATE
| REQUEST
, arg
);
1658 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1662 case (PH_DEACTIVATE
| REQUEST
):
1663 l1_msg_b(st
, pr
, arg
);
1665 case (PH_DEACTIVATE
| CONFIRM
):
1666 spin_lock_irqsave(&bcs
->cs
->lock
, flags
);
1667 switch(st
->l1
.mode
) {
1673 isar_pump_cmd(bcs
, ISDN_FAXPUMP_HALT
, 0);
1676 test_and_clear_bit(BC_FLG_ACTIV
, &bcs
->Flag
);
1677 test_and_clear_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1678 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
1679 debugl1(bcs
->cs
, "PDAC clear BC_FLG_BUSY");
1680 modeisar(bcs
, 0, st
->l1
.bc
);
1681 spin_unlock_irqrestore(&bcs
->cs
->lock
, flags
);
1682 st
->l1
.l1l2(st
, PH_DEACTIVATE
| CONFIRM
, NULL
);
1688 close_isarstate(struct BCState
*bcs
)
1690 modeisar(bcs
, 0, bcs
->channel
);
1691 if (test_and_clear_bit(BC_FLG_INIT
, &bcs
->Flag
)) {
1692 kfree(bcs
->hw
.isar
.rcvbuf
);
1693 bcs
->hw
.isar
.rcvbuf
= NULL
;
1694 skb_queue_purge(&bcs
->rqueue
);
1695 skb_queue_purge(&bcs
->squeue
);
1697 dev_kfree_skb_any(bcs
->tx_skb
);
1699 test_and_clear_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1700 if (bcs
->cs
->debug
& L1_DEB_HSCX
)
1701 debugl1(bcs
->cs
, "closeisar clear BC_FLG_BUSY");
1704 del_timer(&bcs
->hw
.isar
.ftimer
);
1708 open_isarstate(struct IsdnCardState
*cs
, struct BCState
*bcs
)
1710 if (!test_and_set_bit(BC_FLG_INIT
, &bcs
->Flag
)) {
1711 if (!(bcs
->hw
.isar
.rcvbuf
= kmalloc(HSCX_BUFMAX
, GFP_ATOMIC
))) {
1713 "HiSax: No memory for isar.rcvbuf\n");
1716 skb_queue_head_init(&bcs
->rqueue
);
1717 skb_queue_head_init(&bcs
->squeue
);
1720 test_and_clear_bit(BC_FLG_BUSY
, &bcs
->Flag
);
1721 if (cs
->debug
& L1_DEB_HSCX
)
1722 debugl1(cs
, "openisar clear BC_FLG_BUSY");
1724 bcs
->hw
.isar
.rcvidx
= 0;
1730 setstack_isar(struct PStack
*st
, struct BCState
*bcs
)
1732 bcs
->channel
= st
->l1
.bc
;
1733 if (open_isarstate(st
->l1
.hardware
, bcs
))
1736 st
->l2
.l2l1
= isar_l2l1
;
1737 setstack_manager(st
);
1744 isar_auxcmd(struct IsdnCardState
*cs
, isdn_ctrl
*ic
) {
1747 struct BCState
*bcs
;
1749 if (cs
->debug
& L1_DEB_HSCX
)
1750 debugl1(cs
, "isar_auxcmd cmd/ch %x/%d", ic
->command
, ic
->arg
);
1751 switch (ic
->command
) {
1752 case (ISDN_CMD_FAXCMD
):
1753 bcs
= cs
->channel
[ic
->arg
].bcs
;
1754 if (cs
->debug
& L1_DEB_HSCX
)
1755 debugl1(cs
, "isar_auxcmd cmd/subcmd %d/%d",
1756 ic
->parm
.aux
.cmd
, ic
->parm
.aux
.subcmd
);
1757 switch(ic
->parm
.aux
.cmd
) {
1758 case ISDN_FAX_CLASS1_CTRL
:
1759 if (ic
->parm
.aux
.subcmd
== ETX
)
1760 test_and_set_bit(BC_FLG_DLEETX
,
1763 case ISDN_FAX_CLASS1_FTS
:
1764 if (ic
->parm
.aux
.subcmd
== AT_QUERY
) {
1765 ic
->command
= ISDN_STAT_FAXIND
;
1766 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_OK
;
1767 cs
->iif
.statcallb(ic
);
1769 } else if (ic
->parm
.aux
.subcmd
== AT_EQ_QUERY
) {
1770 strcpy(ic
->parm
.aux
.para
, "0-255");
1771 ic
->command
= ISDN_STAT_FAXIND
;
1772 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_QUERY
;
1773 cs
->iif
.statcallb(ic
);
1775 } else if (ic
->parm
.aux
.subcmd
== AT_EQ_VALUE
) {
1776 if (cs
->debug
& L1_DEB_HSCX
)
1777 debugl1(cs
, "isar_auxcmd %s=%d",
1778 FC1_CMD
[ic
->parm
.aux
.cmd
], ic
->parm
.aux
.para
[0]);
1779 if (bcs
->hw
.isar
.state
== STFAX_READY
) {
1780 if (! ic
->parm
.aux
.para
[0]) {
1781 ic
->command
= ISDN_STAT_FAXIND
;
1782 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_OK
;
1783 cs
->iif
.statcallb(ic
);
1786 if (! test_and_set_bit(BC_FLG_FTI_RUN
, &bcs
->Flag
)) {
1788 bcs
->hw
.isar
.ftimer
.expires
=
1789 jiffies
+ ((ic
->parm
.aux
.para
[0] * 10 * HZ
)/1000);
1790 test_and_set_bit(BC_FLG_FTI_FTS
, &bcs
->Flag
);
1791 add_timer(&bcs
->hw
.isar
.ftimer
);
1795 debugl1(cs
, "isar FTS=%d and FTI busy",
1796 ic
->parm
.aux
.para
[0]);
1800 debugl1(cs
, "isar FTS=%d and isar.state not ready(%x)",
1801 ic
->parm
.aux
.para
[0],bcs
->hw
.isar
.state
);
1803 ic
->command
= ISDN_STAT_FAXIND
;
1804 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_ERROR
;
1805 cs
->iif
.statcallb(ic
);
1808 case ISDN_FAX_CLASS1_FRM
:
1809 case ISDN_FAX_CLASS1_FRH
:
1810 case ISDN_FAX_CLASS1_FTM
:
1811 case ISDN_FAX_CLASS1_FTH
:
1812 if (ic
->parm
.aux
.subcmd
== AT_QUERY
) {
1813 sprintf(ic
->parm
.aux
.para
,
1814 "%d", bcs
->hw
.isar
.mod
);
1815 ic
->command
= ISDN_STAT_FAXIND
;
1816 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_QUERY
;
1817 cs
->iif
.statcallb(ic
);
1819 } else if (ic
->parm
.aux
.subcmd
== AT_EQ_QUERY
) {
1820 char *p
= ic
->parm
.aux
.para
;
1821 for(i
=0;i
<FAXMODCNT
;i
++)
1822 if ((1<<i
) & modmask
)
1823 p
+= sprintf(p
, "%d,", faxmodulation
[i
]);
1826 ic
->command
= ISDN_STAT_FAXIND
;
1827 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_QUERY
;
1828 cs
->iif
.statcallb(ic
);
1830 } else if (ic
->parm
.aux
.subcmd
== AT_EQ_VALUE
) {
1831 if (cs
->debug
& L1_DEB_HSCX
)
1832 debugl1(cs
, "isar_auxcmd %s=%d",
1833 FC1_CMD
[ic
->parm
.aux
.cmd
], ic
->parm
.aux
.para
[0]);
1834 for(i
=0;i
<FAXMODCNT
;i
++)
1835 if (faxmodulation
[i
]==ic
->parm
.aux
.para
[0])
1837 if ((i
< FAXMODCNT
) && ((1<<i
) & modmask
) &&
1838 test_bit(BC_FLG_INIT
, &bcs
->Flag
)) {
1841 ic
->parm
.aux
.para
[0]);
1845 /* wrong modulation or not activ */
1848 ic
->command
= ISDN_STAT_FAXIND
;
1849 ic
->parm
.aux
.cmd
= ISDN_FAX_CLASS1_ERROR
;
1850 cs
->iif
.statcallb(ic
);
1853 case (ISDN_CMD_IOCTL
):
1855 case 9: /* load firmware */
1856 features
= ISDN_FEATURE_L2_MODEM
|
1857 ISDN_FEATURE_L2_FAX
|
1858 ISDN_FEATURE_L3_FCLASS1
;
1859 memcpy(&adr
, ic
->parm
.num
, sizeof(ulong
));
1860 if (isar_load_firmware(cs
, (u_char __user
*)adr
))
1863 ll_run(cs
, features
);
1866 features
= *(unsigned int *) ic
->parm
.num
;
1867 printk(KERN_DEBUG
"HiSax: max modulation old(%04x) new(%04x)\n",
1872 features
= *(unsigned int *) ic
->parm
.num
;
1873 printk(KERN_DEBUG
"HiSax: FRM extra delay old(%d) new(%d) ms\n",
1874 frm_extra_delay
, features
);
1876 frm_extra_delay
= features
;
1879 features
= *(unsigned int *) ic
->parm
.num
;
1880 printk(KERN_DEBUG
"HiSax: TOA old(%d) new(%d) db\n",
1881 para_TOA
, features
);
1882 if (features
>= 0 && features
< 32)
1883 para_TOA
= features
;
1886 printk(KERN_DEBUG
"HiSax: invalid ioctl %d\n",
1897 void 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
);