Lines Matching refs:cs
579 if (cards[i].cs) in hisax_findcard()
580 if (cards[i].cs->myid == driverid) in hisax_findcard()
581 return cards[i].cs; in hisax_findcard()
592 if (cards[cardnr - 1].cs)
593 return cards[cardnr - 1].cs;
602 struct IsdnCardState *cs = hisax_findcard(id); in HiSax_readstatus() local
604 if (cs) { in HiSax_readstatus()
610 count = cs->status_end - cs->status_read + 1; in HiSax_readstatus()
613 if (copy_to_user(p, cs->status_read, count)) in HiSax_readstatus()
615 cs->status_read += count; in HiSax_readstatus()
616 if (cs->status_read > cs->status_end) in HiSax_readstatus()
617 cs->status_read = cs->status_buf; in HiSax_readstatus()
625 if (copy_to_user(p, cs->status_read, cnt)) in HiSax_readstatus()
628 cs->status_read += cnt % HISAX_STATUS_BUFSIZE; in HiSax_readstatus()
662 void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, in VHiSax_putstatus() argument
673 if (!cs) { in VHiSax_putstatus()
677 spin_lock_irqsave(&cs->statlock, flags); in VHiSax_putstatus()
692 spin_unlock_irqrestore(&cs->statlock, flags); in VHiSax_putstatus()
698 i = cs->status_end - cs->status_write + 1; in VHiSax_putstatus()
702 memcpy(cs->status_write, p, i); in VHiSax_putstatus()
703 cs->status_write += i; in VHiSax_putstatus()
704 if (cs->status_write > cs->status_end) in VHiSax_putstatus()
705 cs->status_write = cs->status_buf; in VHiSax_putstatus()
708 memcpy(cs->status_write, p, len); in VHiSax_putstatus()
709 cs->status_write += len; in VHiSax_putstatus()
717 *cs->status_write++ = *p; in VHiSax_putstatus()
718 if (cs->status_write > cs->status_end) in VHiSax_putstatus()
719 cs->status_write = cs->status_buf; in VHiSax_putstatus()
723 spin_unlock_irqrestore(&cs->statlock, flags); in VHiSax_putstatus()
726 ic.driver = cs->myid; in VHiSax_putstatus()
728 cs->iif.statcallb(&ic); in VHiSax_putstatus()
732 void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...) in HiSax_putstatus() argument
737 VHiSax_putstatus(cs, head, fmt, args); in HiSax_putstatus()
741 int ll_run(struct IsdnCardState *cs, int addfeatures) in ll_run() argument
745 ic.driver = cs->myid; in ll_run()
747 cs->iif.features |= addfeatures; in ll_run()
748 cs->iif.statcallb(&ic); in ll_run()
752 static void ll_stop(struct IsdnCardState *cs) in ll_stop() argument
757 ic.driver = cs->myid; in ll_stop()
758 cs->iif.statcallb(&ic); in ll_stop()
762 static void ll_unload(struct IsdnCardState *cs) in ll_unload() argument
767 ic.driver = cs->myid; in ll_unload()
768 cs->iif.statcallb(&ic); in ll_unload()
769 kfree(cs->status_buf); in ll_unload()
770 cs->status_read = NULL; in ll_unload()
771 cs->status_write = NULL; in ll_unload()
772 cs->status_end = NULL; in ll_unload()
773 kfree(cs->dlog); in ll_unload()
774 cs->dlog = NULL; in ll_unload()
779 struct IsdnCardState *csta = cards[cardnr].cs; in closecard()
806 struct IsdnCardState *cs = dev_id; in card_irq() local
807 irqreturn_t ret = cs->irq_func(intno, cs); in card_irq()
810 cs->irq_cnt++; in card_irq()
814 static int init_card(struct IsdnCardState *cs) in init_card() argument
818 if (!cs->irq) { in init_card()
819 ret = cs->cardmsg(cs, CARD_INIT, NULL); in init_card()
822 irq_cnt = cs->irq_cnt = 0; in init_card()
823 printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], in init_card()
824 cs->irq, irq_cnt); in init_card()
825 if (request_irq(cs->irq, card_irq, cs->irq_flags, "HiSax", cs)) { in init_card()
827 cs->irq); in init_card()
831 cs->cardmsg(cs, CARD_INIT, NULL); in init_card()
835 CardType[cs->typ], cs->irq, cs->irq_cnt); in init_card()
836 if (cs->irq_cnt == irq_cnt) { in init_card()
839 CardType[cs->typ], cs->irq, 4 - cnt); in init_card()
841 free_irq(cs->irq, cs); in init_card()
844 cs->cardmsg(cs, CARD_RESET, NULL); in init_card()
848 cs->cardmsg(cs, CARD_TEST, NULL); in init_card()
1028 struct IsdnCardState *cs; in hisax_cs_new() local
1032 cs = kzalloc(sizeof(struct IsdnCardState), GFP_ATOMIC); in hisax_cs_new()
1033 if (!cs) { in hisax_cs_new()
1039 card->cs = cs; in hisax_cs_new()
1040 spin_lock_init(&cs->statlock); in hisax_cs_new()
1041 spin_lock_init(&cs->lock); in hisax_cs_new()
1042 cs->chanlimit = 2; /* maximum B-channel number */ in hisax_cs_new()
1043 cs->logecho = 0; /* No echo logging */ in hisax_cs_new()
1044 cs->cardnr = cardnr; in hisax_cs_new()
1045 cs->debug = L1_DEB_WARN; in hisax_cs_new()
1046 cs->HW_Flags = 0; in hisax_cs_new()
1047 cs->busy_flag = busy_flag; in hisax_cs_new()
1048 cs->irq_flags = I4L_IRQ_FLAG; in hisax_cs_new()
1051 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags); in hisax_cs_new()
1053 test_and_set_bit(FLG_TWO_DCHAN, &cs->HW_Flags); in hisax_cs_new()
1055 cs->protocol = card->protocol; in hisax_cs_new()
1062 if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) { in hisax_cs_new()
1067 if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) { in hisax_cs_new()
1073 cs->stlist = NULL; in hisax_cs_new()
1074 cs->status_read = cs->status_buf; in hisax_cs_new()
1075 cs->status_write = cs->status_buf; in hisax_cs_new()
1076 cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1; in hisax_cs_new()
1077 cs->typ = card->typ; in hisax_cs_new()
1079 cs->iif.owner = lockowner; in hisax_cs_new()
1081 strcpy(cs->iif.id, id); in hisax_cs_new()
1082 cs->iif.channels = 2; in hisax_cs_new()
1083 cs->iif.maxbufsize = MAX_DATA_SIZE; in hisax_cs_new()
1084 cs->iif.hl_hdrlen = MAX_HEADER_LEN; in hisax_cs_new()
1085 cs->iif.features = in hisax_cs_new()
1102 cs->iif.command = HiSax_command; in hisax_cs_new()
1103 cs->iif.writecmd = NULL; in hisax_cs_new()
1104 cs->iif.writebuf_skb = HiSax_writebuf_skb; in hisax_cs_new()
1105 cs->iif.readstat = HiSax_readstatus; in hisax_cs_new()
1106 register_isdn(&cs->iif); in hisax_cs_new()
1107 cs->myid = cs->iif.channels; in hisax_cs_new()
1109 *cs_out = cs; in hisax_cs_new()
1113 kfree(cs->dlog); in hisax_cs_new()
1115 kfree(cs); in hisax_cs_new()
1116 card->cs = NULL; in hisax_cs_new()
1122 struct IsdnCardState *cs) in hisax_cs_setup() argument
1126 if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) { in hisax_cs_setup()
1128 ll_unload(cs); in hisax_cs_setup()
1131 cs->rcvidx = 0; in hisax_cs_setup()
1132 cs->tx_skb = NULL; in hisax_cs_setup()
1133 cs->tx_cnt = 0; in hisax_cs_setup()
1134 cs->event = 0; in hisax_cs_setup()
1136 skb_queue_head_init(&cs->rq); in hisax_cs_setup()
1137 skb_queue_head_init(&cs->sq); in hisax_cs_setup()
1139 init_bcstate(cs, 0); in hisax_cs_setup()
1140 init_bcstate(cs, 1); in hisax_cs_setup()
1149 ret = init_card(cs); in hisax_cs_setup()
1156 init_tei(cs, cs->protocol); in hisax_cs_setup()
1157 ret = CallcNewChan(cs); in hisax_cs_setup()
1163 if (!test_bit(HW_ISAR, &cs->HW_Flags)) in hisax_cs_setup()
1164 ll_run(cs, 0); in hisax_cs_setup()
1169 kfree(cs); in hisax_cs_setup()
1170 card->cs = NULL; in hisax_cs_setup()
1179 struct IsdnCardState *cs; in checkcard() local
1181 ret = hisax_cs_new(cardnr, id, card, &cs, busy_flag, lockowner); in checkcard()
1191 "NONE", cs->iif.id, cs->myid); in checkcard()
1195 ll_unload(cs); in checkcard()
1199 ret = hisax_cs_setup(cardnr, card, cs); in checkcard()
1203 kfree(cs); in checkcard()
1204 card->cs = NULL; in checkcard()
1271 if (cards[cardnr].cs) { in HiSax_closecard()
1272 ll_stop(cards[cardnr].cs); in HiSax_closecard()
1273 release_tei(cards[cardnr].cs); in HiSax_closecard()
1274 CallcFreeChan(cards[cardnr].cs); in HiSax_closecard()
1277 if (cards[cardnr].cs->irq) in HiSax_closecard()
1278 free_irq(cards[cardnr].cs->irq, cards[cardnr].cs); in HiSax_closecard()
1279 kfree((void *) cards[cardnr].cs); in HiSax_closecard()
1280 cards[cardnr].cs = NULL; in HiSax_closecard()
1292 struct IsdnCardState *cs = cards[cardnr].cs; in HiSax_reportcard() local
1295 printk(KERN_DEBUG "HiSax: Type %s\n", CardType[cs->typ]); in HiSax_reportcard()
1296 printk(KERN_DEBUG "HiSax: debuglevel %x\n", cs->debug); in HiSax_reportcard()
1299 printk(KERN_DEBUG "HiSax: cs 0x%lX\n", (ulong) cs); in HiSax_reportcard()
1301 cs->HW_Flags, cs->bcs[0].Flag, cs->bcs[1].Flag); in HiSax_reportcard()
1303 cs->bcs[0].mode, cs->bcs[0].channel); in HiSax_reportcard()
1305 cs->bcs[1].mode, cs->bcs[1].channel); in HiSax_reportcard()
1308 cs->err_rx, cs->err_crc, cs->err_tx); in HiSax_reportcard()
1311 cs->bcs[0].err_inv, cs->bcs[0].err_rdo, cs->bcs[0].err_crc, in HiSax_reportcard()
1312 cs->bcs[0].err_tx); in HiSax_reportcard()
1315 cs->bcs[1].err_inv, cs->bcs[1].err_rdo, cs->bcs[1].err_crc, in HiSax_reportcard()
1316 cs->bcs[1].err_tx); in HiSax_reportcard()
1318 cs->err_rx = 0; in HiSax_reportcard()
1319 cs->err_crc = 0; in HiSax_reportcard()
1320 cs->err_tx = 0; in HiSax_reportcard()
1321 cs->bcs[0].err_inv = 0; in HiSax_reportcard()
1322 cs->bcs[0].err_rdo = 0; in HiSax_reportcard()
1323 cs->bcs[0].err_crc = 0; in HiSax_reportcard()
1324 cs->bcs[0].err_tx = 0; in HiSax_reportcard()
1325 cs->bcs[1].err_inv = 0; in HiSax_reportcard()
1326 cs->bcs[1].err_rdo = 0; in HiSax_reportcard()
1327 cs->bcs[1].err_crc = 0; in HiSax_reportcard()
1328 cs->bcs[1].err_tx = 0; in HiSax_reportcard()
1578 static int hisax_cardmsg(struct IsdnCardState *cs, int mt, void *arg);
1594 struct IsdnCardState *cs; in hisax_register() local
1615 cs = cards[i].cs; in hisax_register()
1616 hisax_d_if->cs = cs; in hisax_register()
1617 cs->hw.hisax_d_if = hisax_d_if; in hisax_register()
1618 cs->cardmsg = hisax_cardmsg; in hisax_register()
1619 INIT_WORK(&cs->tqueue, hisax_bh); in hisax_register()
1620 cs->channel[0].d_st->l2.l2l1 = hisax_d_l2l1; in hisax_register()
1622 cs->bcs[i].BC_SetStack = hisax_bc_setstack; in hisax_register()
1623 cs->bcs[i].BC_Close = hisax_bc_close; in hisax_register()
1638 cards[hisax_d_if->cs->cardnr].typ = 0; in hisax_unregister()
1639 HiSax_closecard(hisax_d_if->cs->cardnr); in hisax_unregister()
1645 static void hisax_sched_event(struct IsdnCardState *cs, int event) in hisax_sched_event() argument
1647 test_and_set_bit(event, &cs->event); in hisax_sched_event()
1648 schedule_work(&cs->tqueue); in hisax_sched_event()
1653 struct IsdnCardState *cs = in hisax_bh() local
1658 if (test_and_clear_bit(D_RCVBUFREADY, &cs->event)) in hisax_bh()
1659 DChannel_proc_rcv(cs); in hisax_bh()
1660 if (test_and_clear_bit(E_RCVBUFREADY, &cs->event)) in hisax_bh()
1661 EChannel_proc_rcv(cs->hw.hisax_d_if); in hisax_bh()
1662 if (test_and_clear_bit(D_L1STATECHANGE, &cs->event)) { in hisax_bh()
1663 if (test_bit(0, &cs->hw.hisax_d_if->ph_state)) in hisax_bh()
1667 for (st = cs->stlist; st; st = st->next) in hisax_bh()
1694 struct IsdnCardState *cs = d_if->cs; in hisax_d_l1l2() local
1701 hisax_sched_event(cs, D_L1STATECHANGE); in hisax_d_l1l2()
1705 hisax_sched_event(cs, D_L1STATECHANGE); in hisax_d_l1l2()
1708 skb_queue_tail(&cs->rq, arg); in hisax_d_l1l2()
1709 hisax_sched_event(cs, D_RCVBUFREADY); in hisax_d_l1l2()
1712 skb = skb_dequeue(&cs->sq); in hisax_d_l1l2()
1717 clear_bit(FLG_L1_DBUSY, &cs->HW_Flags); in hisax_d_l1l2()
1718 for (st = cs->stlist; st; st = st->next) { in hisax_d_l1l2()
1727 hisax_sched_event(cs, E_RCVBUFREADY); in hisax_d_l1l2()
1784 struct IsdnCardState *cs = st->l1.hardware; in hisax_d_l2l1() local
1785 struct hisax_d_if *hisax_d_if = cs->hw.hisax_d_if; in hisax_d_l2l1()
1791 if (cs->debug & DEB_DLOG_HEX) in hisax_d_l2l1()
1792 LogFrame(cs, skb->data, skb->len); in hisax_d_l2l1()
1793 if (cs->debug & DEB_DLOG_VERBOSE) in hisax_d_l2l1()
1794 dlogframe(cs, skb, 0); in hisax_d_l2l1()
1795 Logl2Frame(cs, skb, "PH_DATA_REQ", 0); in hisax_d_l2l1()
1797 if (!test_and_set_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in hisax_d_l2l1()
1800 skb_queue_tail(&cs->sq, skb); in hisax_d_l2l1()
1803 if (!test_bit(FLG_L1_DBUSY, &cs->HW_Flags)) in hisax_d_l2l1()
1814 static int hisax_cardmsg(struct IsdnCardState *cs, int mt, void *arg) in hisax_cardmsg() argument
1854 struct IsdnCardState *cs = st->l1.hardware; in hisax_bc_setstack() local
1855 struct hisax_d_if *hisax_d_if = cs->hw.hisax_d_if; in hisax_bc_setstack()
1882 struct IsdnCardState *cs = d_if->cs; in EChannel_proc_rcv() local
1887 if (cs->debug & DEB_DLOG_HEX) { in EChannel_proc_rcv()
1888 ptr = cs->dlog; in EChannel_proc_rcv()
1899 HiSax_putstatus(cs, NULL, cs->dlog); in EChannel_proc_rcv()
1901 HiSax_putstatus(cs, "LogEcho: ", in EChannel_proc_rcv()