SPI_WRITE_THEN_READ(9) | Serial Peripheral Interface (S | SPI_WRITE_THEN_READ(9) |
NAME¶
spi_write_then_read - SPI synchronous write followed by read
SYNOPSIS¶
int spi_write_then_read(struct spi_device * spi, const void * txbuf, unsigned n_tx, void * rxbuf, unsigned n_rx);
ARGUMENTS¶
spi
txbuf
n_tx
rxbuf
n_rx
CONTEXT¶
can sleep
DESCRIPTION¶
This performs a half duplex MicroWire style transaction with the device, sending txbuf and then reading rxbuf. The return value is zero for success, else a negative errno status code. This call may only be used from a context that may sleep.
Parameters to this routine are always copied using a small buffer; portable code should never use this for more than 32 bytes. Performance-sensitive or bulk transfer code should instead use spi_{async,sync}() calls with dma-safe buffers.
RETURN¶
zero on success, else a negative error code.
COPYRIGHT¶
January 2017 | Kernel Hackers Manual 4.8. |