if (stp4020_debug != 0) { char bits[64]; bitmask_snprintf(v, STP4020_ISR0_IOBITS, bits, sizeof(bits)); printf("stp4020_statintr: ISR0=%s\n", bits); }
if (stp4020_debug != 0) printf("stp4020_statintr: ISR0=%b\n", v, STP4020_ISR0_IOBITS);
stp4020_statintr(arg)	void *arg;{	struct stp4020_softc *sc = arg;	int i, r = 0;	/*	 * Check each socket for pending requests.	 */	for (i = 0 ; i < STP4020_NSOCK; i++) {		struct stp4020_socket *h;		int v;		h = &sc->sc_socks[i];		/* Read socket's ISR0 for the interrupt status bits */		v = stp4020_rd_sockctl(h, STP4020_ISR0_IDX);#ifdef STP4020_DEBUG		if (stp4020_debug != 0) {			char bits[64];			bitmask_snprintf(v, STP4020_ISR0_IOBITS,			    bits, sizeof(bits));			printf("stp4020_statintr: ISR0=%s\n", bits);		}#endif		/* Ack all interrupts at once */		stp4020_wr_sockctl(h, STP4020_ISR0_IDX,		    STP4020_ISR0_ALL_STATUS_IRQ);		if ((v & STP4020_ISR0_CDCHG) != 0) {			/*			 * Card status change detect			 */			r = 1;			if ((v & (STP4020_ISR0_CD1ST|STP4020_ISR0_CD2ST)) ==			    (STP4020_ISR0_CD1ST|STP4020_ISR0_CD2ST)) {				if ((h->flags & STP4020_SOCKET_BUSY) == 0) {					stp4020_queue_event(sc, i,					    STP4020_EVENT_INSERTION);					h->flags |= STP4020_SOCKET_BUSY;				}			}			if ((v & (STP4020_ISR0_CD1ST|STP4020_ISR0_CD2ST)) ==			    0) {				if ((h->flags & STP4020_SOCKET_BUSY) != 0) {					stp4020_queue_event(sc, i,					    STP4020_EVENT_REMOVAL);					h->flags &= ~STP4020_SOCKET_BUSY;				}			}		}		/* informational messages */		if ((v & STP4020_ISR0_BVD1CHG) != 0) {			DPRINTF(("stp4020[%d]: Battery change 1\n",			    h->sock));			r = 1;		}		if ((v & STP4020_ISR0_BVD2CHG) != 0) {			DPRINTF(("stp4020[%d]: Battery change 2\n",			    h->sock));			r = 1;		}		if ((v & STP4020_ISR0_RDYCHG) != 0) {			DPRINTF(("stp4020[%d]: Ready/Busy change\n",			    h->sock));			r = 1;		}		if ((v & STP4020_ISR0_WPCHG) != 0) {			DPRINTF(("stp4020[%d]: Write protect change\n",			    h->sock));			r = 1;		}		if ((v & STP4020_ISR0_PCTO) != 0) {			DPRINTF(("stp4020[%d]: Card access timeout\n",			    h->sock));			r = 1;		}	}	return (r);}