Visit Our UNIX and Linux User Community

Linux and UNIX Man Pages

Test Your Knowledge in Computers #810
Difficulty: Medium
The CSS3 RGB Decimal Code for Turquoise is 64,224,218.
True or False?
Linux & Unix Commands - Search Man Pages

struct_spi_device(9) [centos man page]

SPI_DEVICE(9) Serial Peripheral Interface (S STRUCT SPI_DEVICE(9) NAME
struct_spi_device - Master side proxy for an SPI slave device SYNOPSIS
struct spi_device { struct device dev; struct spi_master * master; u32 max_speed_hz; u8 chip_select; u8 mode; #define SPI_CPHA 0x01 #define SPI_CPOL 0x02 #define SPI_MODE_0 (0|0) #define SPI_MODE_1 (0|SPI_CPHA) #define SPI_MODE_2 (SPI_CPOL|0) #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA) #define SPI_CS_HIGH 0x04 #define SPI_LSB_FIRST 0x08 #define SPI_3WIRE 0x10 #define SPI_LOOP 0x20 #define SPI_NO_CS 0x40 #define SPI_READY 0x80 u8 bits_per_word; int irq; void * controller_state; void * controller_data; char modalias[SPI_NAME_SIZE]; int cs_gpio; }; MEMBERS
dev Driver model representation of the device. master SPI controller used with the device. max_speed_hz Maximum clock rate to be used with this chip (on this board); may be changed by the device's driver. The spi_transfer.speed_hz can override this for each transfer. chip_select Chipselect, distinguishing chips handled by master. mode The spi mode defines how data is clocked out and in. This may be changed by the device's driver. The "active low" default for chipselect mode can be overridden (by specifying SPI_CS_HIGH) as can the "MSB first" default for each word in a transfer (by specifying SPI_LSB_FIRST). bits_per_word Data transfers involve one or more words; word sizes like eight or 12 bits are common. In-memory wordsizes are powers of two bytes (e.g. 20 bit samples use 32 bits). This may be changed by the device's driver, or left at the default (0) indicating protocol words are eight bit bytes. The spi_transfer.bits_per_word can override this for each transfer. irq Negative, or the number passed to request_irq to receive interrupts from this device. controller_state Controller's runtime state controller_data Board-specific definitions for controller, such as FIFO initialization parameters; from board_info.controller_data modalias[SPI_NAME_SIZE] Name of the driver to use with this device, or an alias for that name. This appears in the sysfs "modalias" attribute for driver coldplugging, and in uevents used for hotplugging cs_gpio gpio number of the chipselect line (optional, -ENOENT when when not using a GPIO line) DESCRIPTION
A spi_device is used to interchange data between an SPI slave (usually a discrete chip) and CPU memory. In dev, the platform_data is used to hold information about this device that's meaningful to the device's protocol driver, but not to its controller. One example might be an identifier for a chip variant with slightly different functionality; another might be information about how this particular board wires the chip's pins. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 STRUCT SPI_DEVICE(9)

Check Out this Related Man Page

SPI_MASTER(9) Serial Peripheral Interface (S STRUCT SPI_MASTER(9) NAME
struct_spi_master - interface to SPI master controller SYNOPSIS
struct spi_master { struct device dev; s16 bus_num; u16 num_chipselect; u16 dma_alignment; u16 mode_bits; u16 flags; #define SPI_MASTER_HALF_DUPLEX BIT(0) #define SPI_MASTER_NO_RX BIT(1) #define SPI_MASTER_NO_TX BIT(2) int (* setup) (struct spi_device *spi); int (* transfer) (struct spi_device *spi,struct spi_message *mesg); void (* cleanup) (struct spi_device *spi); }; MEMBERS
dev device interface to this driver bus_num board-specific (and often SOC-specific) identifier for a given SPI controller. num_chipselect chipselects are used to distinguish individual SPI slaves, and are numbered from zero to num_chipselects. each slave has a chipselect signal, but it's common that not every chipselect is connected to a slave. dma_alignment SPI controller constraint on DMA buffers alignment. mode_bits flags understood by this controller driver flags other constraints relevant to this driver setup updates the device mode and clocking records used by a device's SPI controller; protocol code may call this. This must fail if an unrecognized or unsupported mode is requested. It's always safe to call this unless transfers are pending on the device whose settings are being modified. transfer adds a message to the controller's transfer queue. cleanup frees controller-specific state DESCRIPTION
Each SPI master controller can communicate with one or more spi_device children. These make a small bus, sharing MOSI, MISO and SCK signals but not chip select signals. Each device may be configured to use a different clock rate, since those shared signals are ignored unless the chip is selected. The driver for an SPI controller manages access to those devices through a queue of spi_message transactions, copying data between CPU memory and an SPI slave device. For each such message it queues, it calls the message's completion function when the transaction completes. COPYRIGHT
Kernel Hackers Manual 2.6. July 2010 STRUCT SPI_MASTER(9)

Featured Tech Videos