spi_write_then_read(9)

spi_write_then_read9

Spi synchronous write followed by read

Usage

int spi_write_then_read(struct spi_device * spi, const void * txbuf, unsigned n_tx, void * rxbuf, unsigned n_rx);

Arguments

spi

device with which data will be exchanged

txbuf

data to be written (need not be dma-safe)

n_tx

size of txbuf, in bytes

rxbuf

buffer into which data will be read (need not be dma-safe)

n_rx

size of rxbuf, in bytes

Context

can sleep

Overview

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.

Releases

5 releases since Debian 4.0 (Etch); the text changed 4 times.

  1. 4.0
  2. 5.0
  3. 6.0
  4. 7
  5. 8

From linux-manual-3.16 3.16.56-1+deb8u1 in Debian 8 (Jessie). Parsed by carta from the page's man source.