FreeBSD/sys/dev/utopia/utopia.c
/*
 * Read a multi-register value.
 */
Read a multi-register value.
Read a multi - register value .
uint32_t
utopia_update(struct utopia *utp, u_int reg, u_int nreg, uint32_t mask)
{
	int err;
	u_int n;
	uint8_t regs[4];
	uint32_t val;
	n = nreg;
	if ((err = UTP_READREGS(utp, reg, regs, &n)) != 0) {
#ifdef DIAGNOSTIC
		printf("%s: register read error %s(%u,%u): %d\n", __func__,
		    utp->chip->name, reg, nreg, err);
#endif
		return (0);
	}
	if (n < nreg) {
#ifdef DIAGNOSTIC
		printf("%s: got only %u regs %s(%u,%u): %d\n", __func__, n,
		    utp->chip->name, reg, nreg, err);
#endif
		return (0);
	}
	val = 0;
	for (n = nreg; n > 0; n--) {
		val <<= 8;
		val |= regs[n - 1];
	}
	return (val & mask);
}
uint32_t utopia_update ( struct utopia * utp , u_int reg , u_int nreg , uint32_t mask ) { int err ; u_int n ; uint8_t regs [ 4 ] ; uint32_t val ; n = nreg ; if ( ( err = UTP_READREGS ( utp , reg , regs , & n ) ) != 0 ) { #ifdef DIAGNOSTIC printf ( " \n " , __func__ , utp -> chip -> name , reg , nreg , err ) ; #endif return ( 0 ) ; } if ( n < nreg ) { #ifdef DIAGNOSTIC printf ( " \n " , __func__ , n , utp -> chip -> name , reg , nreg , err ) ; #endif return ( 0 ) ; } val = 0 ; for ( n = nreg ; n > 0 ; n -- ) { val <<= 8 ; val |= regs [ n - 1 ] ; } return ( val & mask ) ; }
Read a multi-register value.
Read a multi - register value .