Google is committed to advancing racial equity for Black communities. See how.

fuchsia.hardware.spi

PROTOCOLS

Device

Defined in fuchsia.hardware.spi/spi.fidl

AssertCs

Assert CS for this device. Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.

Request

<EMPTY>

Response

NameType
status zx/status

CanAssertCs

Returns true if the device can call |AssertCs()| and |DeassertCs()|.

Request

<EMPTY>

Response

NameType
can bool

DeassertCs

Deassert CS for this device. Returns ZX_ERR_BAD_STATE if CS is already deasserted. Returns ZX_ERR_NOT_SUPPORTED if there is more than one device on the bus.

Request

<EMPTY>

Response

NameType
status zx/status

Exchange

Simultaneously transmits and receives data. The size fields of tx_buffer and rx_buffer must be the same.

Request

NameType
tx_buffer fuchsia.hardware.sharedmemory/SharedVmoBuffer
rx_buffer fuchsia.hardware.sharedmemory/SharedVmoBuffer

Response

NameType
result fuchsia.hardware.sharedmemory/SharedVmoIo_Exchange_Result

ExchangeVector

Full-duplex SPI transaction. Received data will exactly equal the length of the transmit buffer.

Request

NameType
txdata vector<uint8>[8196]

Response

NameType
status zx/status
rxdata vector<uint8>[8196]

Receive

Receives data from the device into buffer.

Request

NameType
buffer fuchsia.hardware.sharedmemory/SharedVmoBuffer

Response

NameType
result fuchsia.hardware.sharedmemory/SharedVmoIo_Receive_Result

ReceiveVector

Half-duplex receive data from a SPI device; always reads the full size requested.

Request

NameType
size uint32

Response

NameType
status zx/status
data vector<uint8>[8196]

RegisterVmo

Registers a VMO and transfers ownership to the driver. vmo_id: The ID chosen by the client that will be used in operations on this VMO. vmo: The handle, offset, and size of this VMO. IO operations on this VMO will be relative to the offset and size specified here. rights: A bit field of SharedVmoRight values indicating how this VMO may be used. Callers should assume that the driver will map and/or pin the VMO using these rights.

Request

NameType
vmo_id uint32
vmo fuchsia.mem/Range
rights fuchsia.hardware.sharedmemory/SharedVmoRight

Response

NameType
result fuchsia.hardware.sharedmemory/SharedVmoRegister_RegisterVmo_Result

Transmit

Sends the data in buffer to the device.

Request

NameType
buffer fuchsia.hardware.sharedmemory/SharedVmoBuffer

Response

NameType
result fuchsia.hardware.sharedmemory/SharedVmoIo_Transmit_Result

TransmitVector

Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.

Request

NameType
data vector<uint8>[8196]

Response

NameType
status zx/status

UnregisterVmo

Unmaps and/or unpins the VMO and returns the handle to the caller.

Request

NameType
vmo_id uint32

Response

NameType
result fuchsia.hardware.sharedmemory/SharedVmoRegister_UnregisterVmo_Result

Spi

Defined in fuchsia.hardware.spi/spi.fidl

ConnectServer

Tells the SPI driver to start listening for fuchsia.hardware.spi messages on server. See sdk/fidl/fuchsia.hardware.spi/spi.fidl.

Request

NameType
server handle<channel>

Response

<EMPTY>

Exchange

Full-duplex SPI transaction. Received data will exactly equal the length of the transmit buffer.

Request

NameType
txdata vector<uint8>

Response

NameType
status zx/status
rxdata vector<uint8>

Receive

Half-duplex receive data from a SPI device; always reads the full size requested.

Request

NameType
size uint32

Response

NameType
status zx/status
rxdata vector<uint8>

Transmit

Half-duplex transmit data to a SPI device; always transmits the entire buffer on success.

Request

NameType
txdata vector<uint8>

Response

NameType
status zx/status

STRUCTS

ENUMS

SpiClockPhase flexible

Type: uint32

Defined in fuchsia.hardware.spi/spi.fidl

NameValueDescription
CLOCK_PHASE_FIRST 0
CLOCK_PHASE_SECOND 1

TABLES

SpiBusMetadata

Defined in fuchsia.hardware.spi/spi.fidl

Passed to the spi driver in metadata as DEVICE_METADATA_SPI_CHANNELS.

OrdinalFieldTypeDescription
1 channels vector<SpiChannel>[32]

SpiChannel

Defined in fuchsia.hardware.spi/spi.fidl

Represents a single device on a SPI bus.

OrdinalFieldTypeDescription
1 bus_id uint32

ID of the bus that this device is on.

2 cs uint32

Chip select number for the device.

3 vid uint32

Vendor ID. Used when binding via platform bus device IDs.

4 pid uint32

Product ID. Used when binding via platform bus device IDs.

5 did uint32

Device ID. Used when binding via platform bus device IDs.

6 cs_polarity_high bool

Chip select polarity: true == high, false == low.

7 word_length_bits uint8

Size in bits of a single word on the SPI bus.

8 is_bus_controller bool

Are we in charge of the bus?

9 clock_polarity_high bool

Clock polarity. true == high, false == low.

10 clock_phase SpiClockPhase

Clock phase.

CONSTANTS

NameValueTypeDescription
MAX_SPI_CHANNEL 32 uint32
MAX_TRANSFER_SIZE 8196 uint32