Oleg Gopov wrote:
I find excerpt of pcnet driver

/*
 * pcn_intr:
 *
 *	Interrupt service routine.
 */
static int
pcn_intr(void *arg)
{
	struct pcn_softc *sc = arg;
	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
	uint32_t csr0;
	int wantinit, handled = 0;

	for (wantinit = 0; wantinit == 0;) {
		csr0 = pcn_csr_read(sc, LE_CSR0);
		if ((csr0 & LE_C0_INTR) == 0)
			break;

#if NRND > 0
		if (RND_ENABLED(&sc->rnd_source))
			rnd_add_uint32(&sc->rnd_source, csr0);
#endif

		/* ACK the bits and re-enable interrupts. */
		pcn_csr_write(sc, LE_CSR0, csr0 &
		    (LE_C0_INEA|LE_C0_BABL|LE_C0_MISS|LE_C0_MERR|LE_C0_RINT|
		     LE_C0_TINT|LE_C0_IDON));

		handled = 1;

		if (csr0 & LE_C0_RINT) {
			PCN_EVCNT_INCR(&sc->sc_ev_rxintr);
			wantinit = pcn_rxintr(sc);
		}

		if (csr0 & LE_C0_TINT) {
			PCN_EVCNT_INCR(&sc->sc_ev_txintr);
			pcn_txintr(sc);
		}

		if (csr0 & LE_C0_ERR) {
			if (csr0 & LE_C0_BABL) {
				PCN_EVCNT_INCR(&sc->sc_ev_babl);
				ifp->if_oerrors++;
			}
			if (csr0 & LE_C0_MISS) {
				PCN_EVCNT_INCR(&sc->sc_ev_miss);
				ifp->if_ierrors++;
			}
			if (csr0 & LE_C0_MERR) {
				PCN_EVCNT_INCR(&sc->sc_ev_merr);
				printf("%s: memory error\n",
				    sc->sc_dev.dv_xname);
				wantinit = 1;
				break;
			}
		}

		if ((csr0 & LE_C0_RXON) == 0) {
			printf("%s: receiver disabled\n",
			    sc->sc_dev.dv_xname);
			ifp->if_ierrors++;
			wantinit = 1;
		}

		if ((csr0 & LE_C0_TXON) == 0) {
			printf("%s: transmitter disabled\n",
			    sc->sc_dev.dv_xname);
			ifp->if_oerrors++;
			wantinit = 1;
		}
	}

	if (handled) {
		if (wantinit)
			pcn_init(ifp);

		/* Try to get more packets going. */
#ifdef __QNXNTO__
                NW_SIGLOCK(&ifp->if_snd_ex, iopkt_selfp);
#endif
		pcn_start(ifp);
	}

	return (handled);
}




*******************************************************
There is place in driver when "pcnet memory error" occur

			if (csr0 & LE_C0_MERR) {
				PCN_EVCNT_INCR(&sc->sc_ev_merr);
				printf("%s: memory error\n",
				    sc->sc_dev.dv_xname);
				wantinit = 1;
				break;
			}

LINUX:

        if (csr0 & LE_C0_MERR) {
                printk("%s: Bus master arbitration failure, status %4.4x.\n",
                       dev->name, csr0);
                /* Restart the chip. */
                WRITERDP(lp, LE_C0_STRT);
        }









_______________________________________________

Networking Drivers
http://community.qnx.com/sf/go/post98334
To cancel your subscription to this discussion, please e-mail drivers-networking-unsubscribe@community.qnx.com