예제 #1
0
/*
 * iicbus_repeated_start()
 *
 * Send start condition to the slave addressed by 'slave'
 */
int
iicbus_repeated_start(device_t bus, u_char slave, int timeout)
{
	struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
	int error = 0;

	if (!sc->started)
		return (EINVAL);     /* bus should have been already started */

	if (!(error = IICBUS_REPEATED_START(device_get_parent(bus), slave, timeout)))
		sc->started = slave;
	else
		sc->started = 0;

	return (error);
}
예제 #2
0
/*
 * iicbus_repeated_start()
 *
 * Send start condition to the slave addressed by 'slave'
 */
int
iicbus_repeated_start(device_t bus, u_char slave, int timeout)
{
    struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
    int error = 0;

    if (!sc->started)
        return (IIC_ESTATUS); /* protocol error, bus not started */

    if (!(error = IICBUS_REPEATED_START(device_get_parent(bus), slave, timeout)))
        sc->started = slave;
    else
        sc->started = 0;

    return (error);
}