Lines Matching refs:dch
1608 struct dchannel *dch; in hfcmulti_leds() local
1623 dch = hc->chan[hc->dnum[0]].dch; in hfcmulti_leds()
1624 if (dch) { in hfcmulti_leds()
1668 dch = hc->chan[(i << 2) | 2].dch; in hfcmulti_leds()
1669 if (dch) { in hfcmulti_leds()
1670 state = dch->state; in hfcmulti_leds()
1671 if (dch->dev.D.protocol == ISDN_P_NT_S0) in hfcmulti_leds()
1732 dch = hc->chan[(i << 2) | 2].dch; in hfcmulti_leds()
1733 if (dch) { in hfcmulti_leds()
1734 state = dch->state; in hfcmulti_leds()
1735 if (dch->dev.D.protocol == ISDN_P_NT_S0) in hfcmulti_leds()
1779 dch = hc->chan[(i << 2) | 2].dch; in hfcmulti_leds()
1780 if (dch) { in hfcmulti_leds()
1781 state = dch->state; in hfcmulti_leds()
1782 if (dch->dev.D.protocol == ISDN_P_NT_S0) in hfcmulti_leds()
1940 struct dchannel *dch; in hfcmulti_tx() local
1945 dch = hc->chan[ch].dch; in hfcmulti_tx()
1946 if ((!dch) && (!bch)) in hfcmulti_tx()
1951 if (dch) { in hfcmulti_tx()
1952 if (!test_bit(FLG_ACTIVE, &dch->Flags)) in hfcmulti_tx()
1954 sp = &dch->tx_skb; in hfcmulti_tx()
1955 idxp = &dch->tx_idx; in hfcmulti_tx()
1985 if (dch || test_bit(FLG_HDLC, &bch->Flags)) { in hfcmulti_tx()
2011 if (hc->ctype != HFC_TYPE_E1 && dch) { in hfcmulti_tx()
2118 if (dch) in hfcmulti_tx()
2123 if (dch || test_bit(FLG_HDLC, &bch->Flags)) in hfcmulti_tx()
2149 if (dch || test_bit(FLG_HDLC, &bch->Flags)) { in hfcmulti_tx()
2161 if (dch && get_next_dframe(dch)) { in hfcmulti_tx()
2185 struct dchannel *dch = NULL; in hfcmulti_rx() local
2193 } else if (hc->chan[ch].dch) { in hfcmulti_rx()
2194 dch = hc->chan[ch].dch; in hfcmulti_rx()
2195 if (!test_bit(FLG_ACTIVE, &dch->Flags)) in hfcmulti_rx()
2219 if (dch || test_bit(FLG_HDLC, &bch->Flags)) { in hfcmulti_rx()
2239 if ((dch || test_bit(FLG_HDLC, &bch->Flags)) && f1 != f2) in hfcmulti_rx()
2258 sp = &dch->rx_skb; in hfcmulti_rx()
2259 maxlen = dch->maxlen + 3; in hfcmulti_rx()
2270 if (dch) in hfcmulti_rx()
2274 if (dch || test_bit(FLG_HDLC, &bch->Flags)) { in hfcmulti_rx()
2340 if (dch) in hfcmulti_rx()
2341 recv_Dchannel(dch); in hfcmulti_rx()
2367 signal_state_up(struct dchannel *dch, int info, char *msg) in signal_state_up() argument
2381 recv_Dchannel_skb(dch, skb); in signal_state_up()
2388 struct dchannel *dch; in handle_timer_irq() local
2428 if (hc->chan[ch].dch && in handle_timer_irq()
2430 dch = hc->chan[ch].dch; in handle_timer_irq()
2432 schedule_event(dch, in handle_timer_irq()
2440 dch->state); in handle_timer_irq()
2446 dch = hc->chan[hc->dnum[0]].dch; in handle_timer_irq()
2452 signal_state_up(dch, L1_SIGNAL_LOS_ON, in handle_timer_irq()
2455 signal_state_up(dch, L1_SIGNAL_LOS_OFF, in handle_timer_irq()
2462 signal_state_up(dch, L1_SIGNAL_AIS_ON, in handle_timer_irq()
2465 signal_state_up(dch, L1_SIGNAL_AIS_OFF, in handle_timer_irq()
2473 signal_state_up(dch, L1_SIGNAL_SLIP_RX, in handle_timer_irq()
2478 signal_state_up(dch, L1_SIGNAL_SLIP_TX, in handle_timer_irq()
2486 signal_state_up(dch, L1_SIGNAL_RDI_ON, in handle_timer_irq()
2489 signal_state_up(dch, L1_SIGNAL_RDI_OFF, in handle_timer_irq()
2564 struct dchannel *dch; in ph_state_irq() local
2571 if (hc->chan[ch].dch) { in ph_state_irq()
2572 dch = hc->chan[ch].dch; in ph_state_irq()
2592 dch->dev.D.protocol == ISDN_P_TE_S0) { in ph_state_irq()
2600 dch->state = st_status & 0x0f; in ph_state_irq()
2601 if (dch->dev.D.protocol == ISDN_P_NT_S0) in ph_state_irq()
2605 if (dch->state == active) { in ph_state_irq()
2612 dch->tx_idx = 0; in ph_state_irq()
2614 schedule_event(dch, FLG_PHCHANGE); in ph_state_irq()
2618 __func__, dch->state, in ph_state_irq()
2632 struct dchannel *dch; in fifo_irq() local
2640 dch = hc->chan[ch].dch; in fifo_irq()
2642 if (((!dch) && (!bch)) || (!hc->created[hc->chan[ch].port])) { in fifo_irq()
2646 if (dch && (r_irq_fifo_bl & (1 << j)) && in fifo_irq()
2647 test_bit(FLG_ACTIVE, &dch->Flags)) { in fifo_irq()
2661 if (dch && (r_irq_fifo_bl & (1 << j)) && in fifo_irq()
2662 test_bit(FLG_ACTIVE, &dch->Flags)) { in fifo_irq()
2684 struct dchannel *dch; in hfcmulti_interrupt() local
2764 dch = hc->chan[hc->dnum[0]].dch; in hfcmulti_interrupt()
2789 dch = hc->chan[hc->dnum[i]].dch; in hfcmulti_interrupt()
2790 dch->state = temp & 0x7; in hfcmulti_interrupt()
2791 schedule_event(dch, FLG_PHCHANGE); in hfcmulti_interrupt()
3219 hfcm_l1callback(struct dchannel *dch, u_int cmd) in hfcm_l1callback() argument
3221 struct hfc_multi *hc = dch->hw; in hfcm_l1callback()
3238 HFC_outb(hc, R_ST_SEL, hc->chan[dch->slot].port); in hfcm_l1callback()
3248 l1_event(dch->l1, HW_POWERUP_IND); in hfcm_l1callback()
3260 HFC_outb(hc, R_ST_SEL, hc->chan[dch->slot].port); in hfcm_l1callback()
3267 ~(1 << hc->chan[dch->slot].port); in hfcm_l1callback()
3271 skb_queue_splice_init(&dch->squeue, &free_queue); in hfcm_l1callback()
3272 if (dch->tx_skb) { in hfcm_l1callback()
3273 __skb_queue_tail(&free_queue, dch->tx_skb); in hfcm_l1callback()
3274 dch->tx_skb = NULL; in hfcm_l1callback()
3276 dch->tx_idx = 0; in hfcm_l1callback()
3277 if (dch->rx_skb) { in hfcm_l1callback()
3278 __skb_queue_tail(&free_queue, dch->rx_skb); in hfcm_l1callback()
3279 dch->rx_skb = NULL; in hfcm_l1callback()
3281 test_and_clear_bit(FLG_TX_BUSY, &dch->Flags); in hfcm_l1callback()
3282 if (test_and_clear_bit(FLG_BUSY_TIMER, &dch->Flags)) in hfcm_l1callback()
3283 del_timer(&dch->timer); in hfcm_l1callback()
3295 HFC_outb(hc, R_ST_SEL, hc->chan[dch->slot].port); in hfcm_l1callback()
3305 test_and_set_bit(FLG_ACTIVE, &dch->Flags); in hfcm_l1callback()
3306 _queue_data(&dch->dev.D, cmd, MISDN_ID_ANY, 0, NULL, in hfcm_l1callback()
3310 test_and_clear_bit(FLG_ACTIVE, &dch->Flags); in hfcm_l1callback()
3311 _queue_data(&dch->dev.D, cmd, MISDN_ID_ANY, 0, NULL, in hfcm_l1callback()
3315 if (dch->debug & DEBUG_HW) in hfcm_l1callback()
3331 struct dchannel *dch = container_of(dev, struct dchannel, dev); in handle_dmsg() local
3332 struct hfc_multi *hc = dch->hw; in handle_dmsg()
3343 ret = dchannel_senddata(dch, skb); in handle_dmsg()
3346 hfcmulti_tx(hc, dch->slot); in handle_dmsg()
3357 if (dch->dev.D.protocol != ISDN_P_TE_S0) { in handle_dmsg()
3363 __func__, hc->chan[dch->slot].port, in handle_dmsg()
3367 ph_state_change(dch); in handle_dmsg()
3371 __func__, dch->state); in handle_dmsg()
3374 hc->chan[dch->slot].port); in handle_dmsg()
3383 dch->state = 1; in handle_dmsg()
3387 ret = l1_event(dch->l1, hh->prim); in handle_dmsg()
3390 test_and_clear_bit(FLG_L2_ACTIVATED, &dch->Flags); in handle_dmsg()
3391 if (dch->dev.D.protocol != ISDN_P_TE_S0) { in handle_dmsg()
3399 __func__, hc->chan[dch->slot].port, in handle_dmsg()
3409 hc->chan[dch->slot].port); in handle_dmsg()
3414 dch->state = 1; in handle_dmsg()
3416 skb_queue_splice_init(&dch->squeue, &free_queue); in handle_dmsg()
3417 if (dch->tx_skb) { in handle_dmsg()
3418 __skb_queue_tail(&free_queue, dch->tx_skb); in handle_dmsg()
3419 dch->tx_skb = NULL; in handle_dmsg()
3421 dch->tx_idx = 0; in handle_dmsg()
3422 if (dch->rx_skb) { in handle_dmsg()
3423 __skb_queue_tail(&free_queue, dch->rx_skb); in handle_dmsg()
3424 dch->rx_skb = NULL; in handle_dmsg()
3426 test_and_clear_bit(FLG_TX_BUSY, &dch->Flags); in handle_dmsg()
3427 if (test_and_clear_bit(FLG_BUSY_TIMER, &dch->Flags)) in handle_dmsg()
3428 del_timer(&dch->timer); in handle_dmsg()
3430 if (test_and_clear_bit(FLG_L1_BUSY, &dch->Flags)) in handle_dmsg()
3431 dchannel_sched_event(&hc->dch, D_CLEARBUSY); in handle_dmsg()
3437 ret = l1_event(dch->l1, hh->prim); in handle_dmsg()
3725 ph_state_change(struct dchannel *dch) in ph_state_change() argument
3730 if (!dch) { in ph_state_change()
3734 hc = dch->hw; in ph_state_change()
3735 ch = dch->slot; in ph_state_change()
3738 if (dch->dev.D.protocol == ISDN_P_TE_E1) { in ph_state_change()
3742 __func__, hc->id, dch->state); in ph_state_change()
3747 __func__, hc->id, dch->state); in ph_state_change()
3749 switch (dch->state) { in ph_state_change()
3762 test_and_set_bit(FLG_ACTIVE, &dch->Flags); in ph_state_change()
3763 _queue_data(&dch->dev.D, PH_ACTIVATE_IND, in ph_state_change()
3770 test_and_clear_bit(FLG_ACTIVE, &dch->Flags); in ph_state_change()
3771 _queue_data(&dch->dev.D, PH_DEACTIVATE_IND, in ph_state_change()
3774 hc->e1_state = dch->state; in ph_state_change()
3776 if (dch->dev.D.protocol == ISDN_P_TE_S0) { in ph_state_change()
3780 __func__, dch->state); in ph_state_change()
3781 switch (dch->state) { in ph_state_change()
3783 l1_event(dch->l1, HW_RESET_IND); in ph_state_change()
3786 l1_event(dch->l1, HW_DEACT_IND); in ph_state_change()
3790 l1_event(dch->l1, ANYSIGNAL); in ph_state_change()
3793 l1_event(dch->l1, INFO2); in ph_state_change()
3796 l1_event(dch->l1, INFO4_P8); in ph_state_change()
3802 __func__, dch->state); in ph_state_change()
3803 switch (dch->state) { in ph_state_change()
3815 dch->state = 4; in ph_state_change()
3831 test_and_clear_bit(FLG_ACTIVE, &dch->Flags); in ph_state_change()
3832 _queue_data(&dch->dev.D, PH_DEACTIVATE_IND, in ph_state_change()
3840 test_and_set_bit(FLG_ACTIVE, &dch->Flags); in ph_state_change()
3841 _queue_data(&dch->dev.D, PH_ACTIVATE_IND, in ph_state_change()
3854 hfcmulti_initmode(struct dchannel *dch) in hfcmulti_initmode() argument
3856 struct hfc_multi *hc = dch->hw; in hfcmulti_initmode()
3863 i = dch->slot; in hfcmulti_initmode()
3871 mode_hfcmulti(hc, dch->slot, dch->dev.D.protocol, in hfcmulti_initmode()
3873 timer_setup(&dch->timer, hfcmulti_dbusy_timer, 0); in hfcmulti_initmode()
3886 dch = hc->chan[hc->dnum[0]].dch; in hfcmulti_initmode()
3912 if (dch->dev.D.protocol == ISDN_P_NT_E1) { in hfcmulti_initmode()
3978 mode_hfcmulti(hc, i, dch->dev.D.protocol, -1, 0, -1, 0); in hfcmulti_initmode()
3979 timer_setup(&dch->timer, hfcmulti_dbusy_timer, 0); in hfcmulti_initmode()
3992 if (dch->dev.D.protocol == ISDN_P_NT_S0) { in hfcmulti_initmode()
4021 if ((dch->dev.D.protocol == ISDN_P_NT_S0) || in hfcmulti_initmode()
4038 ~(1 << hc->chan[dch->slot].port); in hfcmulti_initmode()
4048 open_dchannel(struct hfc_multi *hc, struct dchannel *dch, in open_dchannel() argument
4056 dch->dev.id, __builtin_return_address(0)); in open_dchannel()
4059 if ((dch->dev.D.protocol != ISDN_P_NONE) && in open_dchannel()
4060 (dch->dev.D.protocol != rq->protocol)) { in open_dchannel()
4063 __func__, dch->dev.D.protocol, rq->protocol); in open_dchannel()
4065 if ((dch->dev.D.protocol == ISDN_P_TE_S0) && in open_dchannel()
4067 l1_event(dch->l1, CLOSE_CHANNEL); in open_dchannel()
4068 if (dch->dev.D.protocol != rq->protocol) { in open_dchannel()
4070 err = create_l1(dch, hfcm_l1callback); in open_dchannel()
4074 dch->dev.D.protocol = rq->protocol; in open_dchannel()
4076 hfcmulti_initmode(dch); in open_dchannel()
4079 if (test_bit(FLG_ACTIVE, &dch->Flags)) in open_dchannel()
4080 _queue_data(&dch->dev.D, PH_ACTIVATE_IND, MISDN_ID_ANY, in open_dchannel()
4082 rq->ch = &dch->dev.D; in open_dchannel()
4089 open_bchannel(struct hfc_multi *hc, struct dchannel *dch, in open_bchannel() argument
4095 if (!test_channelmap(rq->adr.channel, dch->dev.channelmap)) in open_bchannel()
4102 ch = (rq->adr.channel - 1) + (dch->slot - 2); in open_bchannel()
4123 channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq) in channel_dctrl() argument
4125 struct hfc_multi *hc = dch->hw; in channel_dctrl()
4162 ret = l1_event(dch->l1, HW_TIMER3_VALUE | (cq->p1 & 0xff)); in channel_dctrl()
4177 struct dchannel *dch = container_of(dev, struct dchannel, dev); in hfcm_dctrl() local
4178 struct hfc_multi *hc = dch->hw; in hfcm_dctrl()
4183 if (dch->debug & DEBUG_HW) in hfcm_dctrl()
4196 err = open_dchannel(hc, dch, rq); /* locked there */ in hfcm_dctrl()
4204 err = open_dchannel(hc, dch, rq); /* locked there */ in hfcm_dctrl()
4208 err = open_bchannel(hc, dch, rq); in hfcm_dctrl()
4215 __func__, dch->dev.id, in hfcm_dctrl()
4221 err = channel_dctrl(dch, arg); in hfcm_dctrl()
4225 if (dch->debug & DEBUG_HW) in hfcm_dctrl()
4520 release_port(struct hfc_multi *hc, struct dchannel *dch) in release_port() argument
4526 ci = dch->slot; in release_port()
4543 if (dch->dev.D.protocol == ISDN_P_TE_S0) in release_port()
4544 l1_event(dch->l1, CLOSE_CHANNEL); in release_port()
4546 hc->chan[ci].dch = NULL; in release_port()
4550 mISDN_unregister_device(&dch->dev); in release_port()
4555 if (dch->timer.function) { in release_port()
4556 del_timer(&dch->timer); in release_port()
4557 dch->timer.function = NULL; in release_port()
4627 mISDN_freedchannel(dch); in release_port()
4628 kfree(dch); in release_port()
4667 if (hc->chan[ch].dch) in release_card()
4668 release_port(hc, hc->chan[ch].dch); in release_card()
4805 struct dchannel *dch; in init_e1_port() local
4811 dch = kzalloc(sizeof(struct dchannel), GFP_KERNEL); in init_e1_port()
4812 if (!dch) in init_e1_port()
4814 dch->debug = debug; in init_e1_port()
4815 mISDN_initdchannel(dch, MAX_DFRAME_LEN_L1, ph_state_change); in init_e1_port()
4816 dch->hw = hc; in init_e1_port()
4817 dch->dev.Dprotocols = (1 << ISDN_P_TE_E1) | (1 << ISDN_P_NT_E1); in init_e1_port()
4818 dch->dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) | in init_e1_port()
4820 dch->dev.D.send = handle_dmsg; in init_e1_port()
4821 dch->dev.D.ctrl = hfcm_dctrl; in init_e1_port()
4822 dch->slot = hc->dnum[pt]; in init_e1_port()
4823 hc->chan[hc->dnum[pt]].dch = dch; in init_e1_port()
4852 list_add(&bch->ch.list, &dch->dev.bchannels); in init_e1_port()
4855 set_channelmap(bch->nr, dch->dev.channelmap); in init_e1_port()
4858 dch->dev.nrbchan = bcount; in init_e1_port()
4866 ret = mISDN_register_device(&dch->dev, &hc->pci_dev->dev, name); in init_e1_port()
4872 release_port(hc, dch); in init_e1_port()
4879 struct dchannel *dch; in init_multi_port() local
4884 dch = kzalloc(sizeof(struct dchannel), GFP_KERNEL); in init_multi_port()
4885 if (!dch) in init_multi_port()
4887 dch->debug = debug; in init_multi_port()
4888 mISDN_initdchannel(dch, MAX_DFRAME_LEN_L1, ph_state_change); in init_multi_port()
4889 dch->hw = hc; in init_multi_port()
4890 dch->dev.Dprotocols = (1 << ISDN_P_TE_S0) | (1 << ISDN_P_NT_S0); in init_multi_port()
4891 dch->dev.Bprotocols = (1 << (ISDN_P_B_RAW & ISDN_P_B_MASK)) | in init_multi_port()
4893 dch->dev.D.send = handle_dmsg; in init_multi_port()
4894 dch->dev.D.ctrl = hfcm_dctrl; in init_multi_port()
4895 dch->dev.nrbchan = 2; in init_multi_port()
4897 dch->slot = i + 2; in init_multi_port()
4898 hc->chan[i + 2].dch = dch; in init_multi_port()
4901 for (ch = 0; ch < dch->dev.nrbchan; ch++) { in init_multi_port()
4925 list_add(&bch->ch.list, &dch->dev.bchannels); in init_multi_port()
4928 set_channelmap(bch->nr, dch->dev.channelmap); in init_multi_port()
4937 if (dch->dev.D.protocol != ISDN_P_TE_S0) { in init_multi_port()
4978 ret = mISDN_register_device(&dch->dev, NULL, name); in init_multi_port()
4982 ret = mISDN_register_device(&dch->dev, &hc->pci_dev->dev, name); in init_multi_port()
4989 release_port(hc, dch); in init_multi_port()
5165 hc->chan[hc->dnum[pt]].dch); in hfcmulti_init()
5168 hc->chan[(pt << 2) + 2].dch); in hfcmulti_init()