FreeBSD/sys/dev/iicbus/twsi/twsi.c
/*
 * Only slave mode supported, disregard [old]addr
 */
Only slave mode supported, disregard [old]addr
Only slave mode supported disregard [ old ] addr
static int
twsi_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr)
{
	struct twsi_softc *sc;
	uint32_t param;
	sc = device_get_softc(dev);
	switch (speed) {
	case IIC_SLOW:
	case IIC_FAST:
		param = sc->baud_rate[speed].param;
		break;
	case IIC_FASTEST:
	case IIC_UNKNOWN:
	default:
		param = sc->baud_rate[IIC_FAST].param;
		break;
	}
	mtx_lock(&sc->mutex);
	TWSI_WRITE(sc, sc->reg_soft_reset, 0x0);
	DELAY(2000);
	TWSI_WRITE(sc, sc->reg_baud_rate, param);
	TWSI_WRITE(sc, sc->reg_control, TWSI_CONTROL_TWSIEN | TWSI_CONTROL_ACK);
	DELAY(1000);
	mtx_unlock(&sc->mutex);
	return (0);
}
static int twsi_reset ( device_t dev , u_char speed , u_char addr , u_char * oldaddr ) { struct twsi_softc * sc ; uint32_t param ; sc = device_get_softc ( dev ) ; switch ( speed ) { case IIC_SLOW : case IIC_FAST : param = sc -> baud_rate [ speed ] . param ; break ; case IIC_FASTEST : case IIC_UNKNOWN : default : param = sc -> baud_rate [ IIC_FAST ] . param ; break ; } mtx_lock ( & sc -> mutex ) ; TWSI_WRITE ( sc , sc -> reg_soft_reset , 0x0 ) ; DELAY ( 2000 ) ; TWSI_WRITE ( sc , sc -> reg_baud_rate , param ) ; TWSI_WRITE ( sc , sc -> reg_control , TWSI_CONTROL_TWSIEN | TWSI_CONTROL_ACK ) ; DELAY ( 1000 ) ; mtx_unlock ( & sc -> mutex ) ; return ( 0 ) ; }
Only slave mode supported, disregard [old]addr
Only slave mode supported disregard [ old ] addr