int isic_detach_bri(struct isic_softc *sc) { isdn_layer2_status_ind(&sc->sc_l2, sc->sc_l3token, STI_ATTACH, 0); isdn_detach_bri(sc->sc_l3token); sc->sc_l3token = NULL; return 1; }
/*---------------------------------------------------------------------------* * I.430 Timer T3 expire function *---------------------------------------------------------------------------*/ static void timer3_expired(struct isic_softc *sc) { if(sc->sc_I430T3) { NDBGL1(L1_T_ERR, "state = %s", isic_printstate(sc)); sc->sc_I430T3 = 0; /* XXX try some recovery here XXX */ switch(sc->sc_cardtyp) { #if NNISACSX > 0 case CARD_TYPEP_AVMA1PCIV2: isic_isacsx_recover(sc); break; #endif /* NNISACSX > 0 */ default: #if NNISAC > 0 isic_recover(sc); #endif /* NNISAC > 0 */ break; } sc->sc_init_tries++; /* increment retry count */ /*XXX*/ if(sc->sc_init_tries > 4) { int s = splnet(); sc->sc_init_tries = 0; if(sc->sc_obuf2 != NULL) { i4b_Dfreembuf(sc->sc_obuf2); sc->sc_obuf2 = NULL; } if(sc->sc_obuf != NULL) { i4b_Dfreembuf(sc->sc_obuf); sc->sc_obuf = NULL; sc->sc_freeflag = 0; sc->sc_op = NULL; sc->sc_ol = 0; } splx(s); isdn_layer2_status_ind(&sc->sc_l2, sc->sc_l3token, STI_NOL1ACC, 0); } isic_next_state(sc, EV_T3); } else { NDBGL1(L1_T_ERR, "expired without starting it ...."); } }
/*---------------------------------------------------------------------------* * Timer T4 expire function *---------------------------------------------------------------------------*/ static void timer4_expired(struct isic_softc *sc) { if(sc->sc_I430T4) { NDBGL1(L1_T_MSG, "state = %s", isic_printstate(sc)); sc->sc_I430T4 = 0; isdn_layer2_status_ind(&sc->sc_l2, sc->sc_l3token, STI_PDEACT, 0); } else { NDBGL1(L1_T_ERR, "expired without starting it ...."); } }
int isic_attach_bri(struct isic_softc *sc, const char *cardname, const struct isdn_layer1_bri_driver *dchan_driver) { struct isdn_l3_driver * drv; drv = isdn_attach_bri(sc->sc_dev.dv_xname, cardname, &sc->sc_l2, &isic_l3_driver); sc->sc_l3token = drv; sc->sc_l2.driver = dchan_driver; sc->sc_l2.l1_token = sc; sc->sc_l2.drv = drv; isdn_layer2_status_ind(&sc->sc_l2, drv, STI_ATTACH, 1); isdn_bri_ready(drv->bri); return 1; }
static int iwic_attach_bri(struct iwic_softc * sc) { struct isdn_l3_driver *drv; drv = isdn_attach_isdnif(device_xname(sc->sc_dev), sc->sc_cardname, &sc->sc_l2, &iwic_l3_driver, NBCH_BRI); sc->sc_l3token = drv; sc->sc_l2.driver = &iwic_bri_driver; sc->sc_l2.l1_token = sc; sc->sc_l2.drv = drv; isdn_layer2_status_ind(&sc->sc_l2, drv, STI_ATTACH, 1); isdn_isdnif_ready(drv->isdnif); return 1; }
/*---------------------------------------------------------------------------* * ISACSX L1 Indication handler *---------------------------------------------------------------------------*/ static void isic_isacsx_ind_hdlr(register struct isic_softc *sc, int ind) { register int event; switch(ind) { case ISACSX_CIR0_IAI8: NDBGL1(L1_I_CICO, "rx AI8 in state %s", isic_printstate(sc)); if(sc->sc_bustyp == BUS_TYPE_IOM2) isic_isacsx_l1_cmd(sc, CMD_AR8); event = EV_INFO48; isdn_layer2_status_ind(&sc->sc_l2, sc->sc_l3token, STI_L1STAT, LAYER_ACTIVE); break; case ISACSX_CIR0_IAI10: NDBGL1(L1_I_CICO, "rx AI10 in state %s", isic_printstate(sc)); if(sc->sc_bustyp == BUS_TYPE_IOM2) isic_isacsx_l1_cmd(sc, CMD_AR10); event = EV_INFO410; isdn_layer2_status_ind(&sc->sc_l2, sc->sc_l3token, STI_L1STAT, LAYER_ACTIVE); break; case ISACSX_CIR0_IRSY: NDBGL1(L1_I_CICO, "rx RSY in state %s", isic_printstate(sc)); event = EV_RSY; break; case ISACSX_CIR0_IPU: NDBGL1(L1_I_CICO, "rx PU in state %s", isic_printstate(sc)); event = EV_PU; break; case ISACSX_CIR0_IDR: NDBGL1(L1_I_CICO, "rx DR in state %s", isic_printstate(sc)); isic_isacsx_l1_cmd(sc, CMD_DIU); event = EV_DR; break; case ISACSX_CIR0_IDID: NDBGL1(L1_I_CICO, "rx DID in state %s", isic_printstate(sc)); event = EV_INFO0; isdn_layer2_status_ind(&sc->sc_l2, sc->sc_l3token, STI_L1STAT, LAYER_IDLE); break; case ISACSX_CIR0_IDIS: NDBGL1(L1_I_CICO, "rx DIS in state %s", isic_printstate(sc)); event = EV_DIS; break; case ISACSX_CIR0_IEI: NDBGL1(L1_I_CICO, "rx EI in state %s", isic_printstate(sc)); isic_isacsx_l1_cmd(sc, CMD_DIU); event = EV_EI; break; case ISACSX_CIR0_IARD: NDBGL1(L1_I_CICO, "rx ARD in state %s", isic_printstate(sc)); event = EV_INFO2; break; case ISACSX_CIR0_ITI: NDBGL1(L1_I_CICO, "rx TI in state %s", isic_printstate(sc)); event = EV_INFO0; break; case ISACSX_CIR0_IATI: NDBGL1(L1_I_CICO, "rx ATI in state %s", isic_printstate(sc)); event = EV_INFO0; break; case ISACSX_CIR0_ISD: NDBGL1(L1_I_CICO, "rx SD in state %s", isic_printstate(sc)); event = EV_INFO0; break; default: NDBGL1(L1_I_ERR, "UNKNOWN Indication 0x%x in state %s", ind, isic_printstate(sc)); event = EV_INFO0; break; } isic_next_state(sc, event); }