static int iavc_receive_init(iavc_softc_t *sc, u_int8_t *dmabuf) { u_int32_t Length; u_int8_t *p; u_int8_t *cardtype, *serial, *profile, *version, *caps, *prot; if (sc->sc_dma) { p = amcc_get_word(dmabuf, &Length); } else { Length = iavc_get_slice(sc, sc->sc_recvbuf); p = sc->sc_recvbuf; } #if 0 { int len = 0; printf("iavc%d: rx_init: ", sc->sc_unit); while (len < Length) { printf(" %02x", p[len]); if (len && (len % 16) == 0) printf("\n"); len++; } if (len % 16) printf("\n"); } #endif version = (p + 1); p += (*p + 1); /* driver version */ cardtype = (p + 1); p += (*p + 1); /* card type */ p += (*p + 1); /* hardware ID */ serial = (p + 1); p += (*p + 1); /* serial number */ caps = (p + 1); p += (*p + 1); /* supported options */ prot = (p + 1); p += (*p + 1); /* supported protocols */ profile = (p + 1); if (cardtype && serial && profile) { int nbch = ((profile[3]<<8) | profile[2]); printf("iavc%d: AVM %s, s/n %s, %d chans, f/w rev %s, prot %s\n", sc->sc_unit, cardtype, serial, nbch, version, prot); if(bootverbose) printf("iavc%d: %s\n", sc->sc_unit, caps); capi_ll_control(&sc->sc_capi, CAPI_CTRL_PROFILE, (int) profile); } else { printf("iavc%d: no profile data in info response?\n", sc->sc_unit); } sc->sc_blocked = TRUE; /* controller will send START when ready */ return 0; }
static int iavc_receive_free_ncci(iavc_softc_t *sc, u_int8_t *dmabuf) { u_int32_t ApplId, NCCI; if (sc->sc_dma) { dmabuf = amcc_get_word(dmabuf, &ApplId); dmabuf = amcc_get_word(dmabuf, &NCCI); } else { ApplId = iavc_get_word(sc); NCCI = iavc_get_word(sc); } capi_ll_control(&sc->sc_capi, CAPI_CTRL_FREE_NCCI, NCCI); return 0; }
static int iavc_receive_start(iavc_softc_t *sc, u_int8_t *dmabuf) { struct mbuf *m = i4b_Dgetmbuf(3); u_int8_t *p; if (sc->sc_blocked && sc->sc_state == IAVC_UP) printf("iavc%d: receive_start\n", sc->sc_unit); if (!m) { printf("iavc%d: can't get memory\n", sc->sc_unit); return (ENOMEM); } /* * byte 0x73 = SEND_POLLACK */ p = amcc_put_byte(mtod(m, u_int8_t*), 0); p = amcc_put_byte(p, 0); p = amcc_put_byte(p, SEND_POLLACK); _IF_PREPEND(&sc->sc_txq, m); NDBGL4(L4_IAVCDBG, "iavc%d: blocked = %d, state = %d", sc->sc_unit, sc->sc_blocked, sc->sc_state); sc->sc_blocked = FALSE; iavc_start_tx(sc); /* If this was our first START, register our readiness */ if (sc->sc_state != IAVC_UP) { sc->sc_state = IAVC_UP; capi_ll_control(&sc->sc_capi, CAPI_CTRL_READY, TRUE); } return 0; }
static int iavc_receive_start(iavc_softc_t *sc) { struct mbuf *m = i4b_Dgetmbuf(3); u_int8_t *p; if (sc->sc_blocked && sc->sc_state == IAVC_UP) printf("%s: receive_start\n", device_xname(&sc->sc_dev)); if (!m) { aprint_error_dev(&sc->sc_dev, "can't get memory\n"); return (ENOMEM); } /* * byte 0x73 = SEND_POLLACK */ p = amcc_put_byte(mtod(m, u_int8_t*), 0); p = amcc_put_byte(p, 0); p = amcc_put_byte(p, SEND_POLLACK); IF_PREPEND(&sc->sc_txq, m); NDBGL4(L4_IAVCDBG, "%s: blocked = %d, state = %d", device_xname(&sc->sc_dev), sc->sc_blocked, sc->sc_state); sc->sc_blocked = 0; iavc_start_tx(sc); /* If this was our first START, register our readiness */ if (sc->sc_state != IAVC_UP) { sc->sc_state = IAVC_UP; capi_ll_control(&sc->sc_capi, CAPI_CTRL_READY, 1); } return 0; }