Beispiel #1
0
/*
 * iicbus_write()
 *
 * Write a block of data to the slave previously started by
 * iicbus_start() call
 */
int
iicbus_write(device_t bus, const char *buf, int len, int *sent, int timeout)
{
	struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
	
	/* a slave must have been started for writing */
	if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) != 0))
		return (EINVAL);

	return (IICBUS_WRITE(device_get_parent(bus), buf, len, sent, timeout));
}
/*
 * iicbus_write()
 *
 * Write a block of data to the slave previously started by
 * iicbus_start() call
 */
int
iicbus_write(device_t bus, const char *buf, int len, int *sent, int timeout)
{
	struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
	
	/* a slave must have been started with the appropriate address */
	if (!sc->started || (sc->started & LSB))
		return (EINVAL);

	return (IICBUS_WRITE(device_get_parent(bus), buf, len, sent, timeout));
}