23#ifndef _UAPI_LINUX_SPI_H
24#define _UAPI_LINUX_SPI_H
26#include <sys/ioccom.h>
70#define SPI_MODE_1 SPI_CPHA
76#define SPI_MODE_2 SPI_CPOL
82#define SPI_MODE_3 (SPI_CPOL | SPI_CPHA)
88#define SPI_CS_HIGH 0x04
94#define SPI_LSB_FIRST 0x08
100#define SPI_3WIRE 0x10
111#define SPI_NO_CS 0x40
116#define SPI_READY 0x80
121#define SPI_TX_DUAL 0x100
126#define SPI_TX_QUAD 0x200
131#define SPI_RX_DUAL 0x400
136#define SPI_RX_QUAD 0x800
140#define SPI_IOC_MAGIC 's'
208#define SPI_MSGSIZE(n) \
209 (((n) * sizeof(struct spi_ioc_transfer) < IOCPARM_MAX) ? \
210 (n) * sizeof(struct spi_ioc_transfer) : 0)
215#define SPI_IOC_MESSAGE(n) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(n)])
220#define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, uint8_t)
226#define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, uint8_t)
231#define SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, uint8_t)
236#define SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, uint8_t)
241#define SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, uint8_t)
246#define SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, uint8_t)
251#define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, uint32_t)
256#define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, uint32_t)
261#define SPI_IOC_RD_MODE32 _IOR(SPI_IOC_MAGIC, 5, uint32_t)
266#define SPI_IOC_WR_MODE32 _IOW(SPI_IOC_MAGIC, 5, uint32_t)
uint8_t cs_change
If true, device is deselected after transfer ended and before a new transfer is started.
Definition: spidev.h:181
uint32_t speed_hz
Sets the bit-rate of the device.
Definition: spidev.h:164
void * rx_buf
Buffer for receive data.
Definition: spidev.h:149
uint8_t rx_nbits
Amount of bits that are used for reading.
Definition: spidev.h:186
uint8_t bits_per_word
Sets the device wordsize.
Definition: spidev.h:175
uint16_t delay_usecs
Sets the delay after a transfer before the chip select status is changed and the next transfer is tri...
Definition: spidev.h:170
uint8_t tx_nbits
Amount of bits that are used for writing.
Definition: spidev.h:191
uint8_t cs
Indicates which device is currently used.
Definition: spidev.h:202
size_t len
Length of receive and transmit buffers in bytes.
Definition: spidev.h:159
const void * tx_buf
Buffer for transmit data.
Definition: spidev.h:154
uint32_t mode
Sets one of the possible modes that can be used for SPI transfers (dependent on clock phase and polar...
Definition: spidev.h:197
SPI transfer message.
Definition: spidev.h:145