FreeBSD/sys/dev/utopia/idtphy.c
/*
 * Set loopback mode for the 77155
 */
Set loopback mode for the 77155
Set loopback mode for the 77155
static int
idt77155_set_loopback(struct utopia *utp, u_int mode)
{
	int err;
	uint32_t val;
	u_int nmode;
	val = 0;
	nmode = mode;
	if (mode & UTP_LOOP_TIME) {
		nmode &= ~UTP_LOOP_TIME;
		val |= IDTPHY_REGM_MCTL_TLOOP;
	}
	if (mode & UTP_LOOP_DIAG) {
		nmode &= ~UTP_LOOP_DIAG;
		val |= IDTPHY_REGM_MCTL_DLOOP;
	}
	if (mode & UTP_LOOP_LINE) {
		nmode &= ~UTP_LOOP_LINE;
		val |= IDTPHY_REGM_MCTL_LLOOP;
	}
	if (nmode != 0)
		return (EINVAL);
	err = UTP_WRITEREG(utp, IDTPHY_REGO_MCTL, IDTPHY_REGM_MCTL_TLOOP |
	    IDTPHY_REGM_MCTL_DLOOP | IDTPHY_REGM_MCTL_LLOOP, val);
	if (err)
		return (err);
	utp->loopback = mode;
	return (0);
}
static int idt77155_set_loopback ( struct utopia * utp , u_int mode ) { int err ; uint32_t val ; u_int nmode ; val = 0 ; nmode = mode ; if ( mode & UTP_LOOP_TIME ) { nmode &= ~ UTP_LOOP_TIME ; val |= IDTPHY_REGM_MCTL_TLOOP ; } if ( mode & UTP_LOOP_DIAG ) { nmode &= ~ UTP_LOOP_DIAG ; val |= IDTPHY_REGM_MCTL_DLOOP ; } if ( mode & UTP_LOOP_LINE ) { nmode &= ~ UTP_LOOP_LINE ; val |= IDTPHY_REGM_MCTL_LLOOP ; } if ( nmode != 0 ) return ( EINVAL ) ; err = UTP_WRITEREG ( utp , IDTPHY_REGO_MCTL , IDTPHY_REGM_MCTL_TLOOP | IDTPHY_REGM_MCTL_DLOOP | IDTPHY_REGM_MCTL_LLOOP , val ) ; if ( err ) return ( err ) ; utp -> loopback = mode ; return ( 0 ) ; }
Set loopback mode for the 77155
Set loopback mode for the 77155