diff options
author | roger <roger@FreeBSD.org> | 1999-01-28 15:59:15 +0000 |
---|---|---|
committer | roger <roger@FreeBSD.org> | 1999-01-28 15:59:15 +0000 |
commit | c7de0df78589f3f43f2c57f2f6affec5ec891cde (patch) | |
tree | c25c70ef9e13b9c08e404488c7cdc15d0a9b3ffe /sys/dev/iicbus | |
parent | c7d92faaf0fd3e1a442e5d4db7ec7dc121f7e323 (diff) | |
download | FreeBSD-src-c7de0df78589f3f43f2c57f2f6affec5ec891cde.zip FreeBSD-src-c7de0df78589f3f43f2c57f2f6affec5ec891cde.tar.gz |
Submitted by: Nicolas Souchu <nsouch@freebsd.org>
Updated to support bt848 driver and MSP3400 audio chip.
This adds changes made in 1.4.2.1 and 1.4.2.2 from RELENG_3
Diffstat (limited to 'sys/dev/iicbus')
-rw-r--r-- | sys/dev/iicbus/iiconf.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/sys/dev/iicbus/iiconf.c b/sys/dev/iicbus/iiconf.c index 47f1686..353a207 100644 --- a/sys/dev/iicbus/iiconf.c +++ b/sys/dev/iicbus/iiconf.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: iiconf.c,v 1.3 1998/11/22 22:01:42 nsouch Exp $ + * $Id: iiconf.c,v 1.4 1999/01/09 18:08:24 nsouch Exp $ * */ #include <sys/param.h> @@ -196,6 +196,28 @@ iicbus_start(device_t bus, u_char slave, int timeout) } /* + * 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_START(device_get_parent(bus), slave, timeout))) + sc->started = slave; + else + sc->started = 0; + + return (error); +} + +/* * iicbus_stop() * * Send stop condition to the bus @@ -254,6 +276,33 @@ iicbus_read(device_t bus, char *buf, int len, int *read, int last, int delay) } /* + * iicbus_write_byte() + * + * Write a byte to the slave previously started by iicbus_start() call + */ +int +iicbus_write_byte(device_t bus, char byte, int timeout) +{ + char data = byte; + int sent; + + return (iicbus_write(bus, &data, 1, &sent, timeout)); +} + +/* + * iicbus_read_byte() + * + * Read a byte from the slave previously started by iicbus_start() call + */ +int +iicbus_read_byte(device_t bus, char *byte, int timeout) +{ + int read; + + return (iicbus_read(bus, byte, 1, &read, IIC_LAST_READ, timeout)); +} + +/* * iicbus_block_write() * * Write a block of data to slave ; start/stop protocol managed |