'\" t .\" Title: spi_write_then_read .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: January 2017 .\" Manual: Serial Peripheral Interface (SPI) .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "SPI_WRITE_THEN_READ" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Serial Peripheral Interface (S" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" spi_write_then_read \- SPI synchronous write followed by read .SH "SYNOPSIS" .HP \w'int\ spi_write_then_read('u .BI "int spi_write_then_read(struct\ spi_device\ *\ " "spi" ", const\ void\ *\ " "txbuf" ", unsigned\ " "n_tx" ", void\ *\ " "rxbuf" ", unsigned\ " "n_rx" ");" .SH "ARGUMENTS" .PP \fIspi\fR .RS 4 device with which data will be exchanged .RE .PP \fItxbuf\fR .RS 4 data to be written (need not be dma\-safe) .RE .PP \fIn_tx\fR .RS 4 size of txbuf, in bytes .RE .PP \fIrxbuf\fR .RS 4 buffer into which data will be read (need not be dma\-safe) .RE .PP \fIn_rx\fR .RS 4 size of rxbuf, in bytes .RE .SH "CONTEXT" .PP can sleep .SH "DESCRIPTION" .PP 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\&. .PP 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\&. .SH "RETURN" .PP zero on success, else a negative error code\&. .SH "COPYRIGHT" .br