1SPI_WRITE_THEN_READ(9) Serial Peripheral Interface (S SPI_WRITE_THEN_READ(9)
2
3
4
6 spi_write_then_read - SPI synchronous write followed by read
7
9 int spi_write_then_read(struct spi_device * spi, const u8 * txbuf,
10 unsigned n_tx, u8 * rxbuf, unsigned n_rx);
11
13 spi
14 device with which data will be exchanged
15
16 txbuf
17 data to be written (need not be dma-safe)
18
19 n_tx
20 size of txbuf, in bytes
21
22 rxbuf
23 buffer into which data will be read (need not be dma-safe)
24
25 n_rx
26 size of rxbuf, in bytes
27
29 can sleep
30
32 This performs a half duplex MicroWire style transaction with the
33 device, sending txbuf and then reading rxbuf. The return value is zero
34 for success, else a negative errno status code. This call may only be
35 used from a context that may sleep.
36
37 Parameters to this routine are always copied using a small buffer;
38 portable code should never use this for more than 32 bytes.
39 Performance-sensitive or bulk transfer code should instead use
40 spi_{async,sync}() calls with dma-safe buffers.
41
43Kernel Hackers Manual 2.6. June 2019 SPI_WRITE_THEN_READ(9)