36#ifndef _UAPI_LINUX_SPI_H
37#define _UAPI_LINUX_SPI_H
39#include <sys/ioccom.h>
83#define SPI_MODE_1 SPI_CPHA
89#define SPI_MODE_2 SPI_CPOL
95#define SPI_MODE_3 (SPI_CPOL | SPI_CPHA)
101#define SPI_CS_HIGH 0x04
107#define SPI_LSB_FIRST 0x08
113#define SPI_3WIRE 0x10
124#define SPI_NO_CS 0x40
129#define SPI_READY 0x80
134#define SPI_TX_DUAL 0x100
139#define SPI_TX_QUAD 0x200
144#define SPI_RX_DUAL 0x400
149#define SPI_RX_QUAD 0x800
153#define SPI_IOC_MAGIC 's'
221#define SPI_MSGSIZE(n) \
222 (((n) * sizeof(struct spi_ioc_transfer) < IOCPARM_MAX) ? \
223 (n) * sizeof(struct spi_ioc_transfer) : 0)
228#define SPI_IOC_MESSAGE(n) _IOW(SPI_IOC_MAGIC, 0, char[SPI_MSGSIZE(n)])
233#define SPI_IOC_RD_MODE _IOR(SPI_IOC_MAGIC, 1, uint8_t)
239#define SPI_IOC_WR_MODE _IOW(SPI_IOC_MAGIC, 1, uint8_t)
244#define SPI_IOC_RD_LSB_FIRST _IOR(SPI_IOC_MAGIC, 2, uint8_t)
249#define SPI_IOC_WR_LSB_FIRST _IOW(SPI_IOC_MAGIC, 2, uint8_t)
254#define SPI_IOC_RD_BITS_PER_WORD _IOR(SPI_IOC_MAGIC, 3, uint8_t)
259#define SPI_IOC_WR_BITS_PER_WORD _IOW(SPI_IOC_MAGIC, 3, uint8_t)
264#define SPI_IOC_RD_MAX_SPEED_HZ _IOR(SPI_IOC_MAGIC, 4, uint32_t)
269#define SPI_IOC_WR_MAX_SPEED_HZ _IOW(SPI_IOC_MAGIC, 4, uint32_t)
274#define SPI_IOC_RD_MODE32 _IOR(SPI_IOC_MAGIC, 5, uint32_t)
279#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:194
uint32_t speed_hz
Sets the bit-rate of the device.
Definition: spidev.h:177
void * rx_buf
Buffer for receive data.
Definition: spidev.h:162
uint8_t rx_nbits
Amount of bits that are used for reading.
Definition: spidev.h:199
uint8_t bits_per_word
Sets the device wordsize.
Definition: spidev.h:188
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:183
uint8_t tx_nbits
Amount of bits that are used for writing.
Definition: spidev.h:204
uint8_t cs
Indicates which device is currently used.
Definition: spidev.h:215
size_t len
Length of receive and transmit buffers in bytes.
Definition: spidev.h:172
const void * tx_buf
Buffer for transmit data.
Definition: spidev.h:167
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:210
SPI transfer message.
Definition: spidev.h:158