add full duplex interface support

This commit is contained in:
luowei
2013-10-09 11:12:56 +08:00
parent 565bb88003
commit 37ca06ba09

View File

@@ -619,6 +619,21 @@ spi_read(struct spi_device *spi, void *buf, size_t len)
return spi_sync(spi, &m);
}
static inline int
spi_write_and_read(struct spi_device *spi, const void *tx_buf, void *rx_buf, size_t len)
{
struct spi_transfer t = {
.tx_buf = tx_buf,
.rx_buf = rx_buf,
.len = len,
};
struct spi_message m;
spi_message_init(&m);
spi_message_add_tail(&t, &m);
return spi_sync(spi, &m);
}
/* this copies txbuf and rxbuf data; for small transfers only! */
extern int spi_write_then_read(struct spi_device *spi,
const void *txbuf, unsigned n_tx,