XCORE SDK
XCORE Software Development Kit
Functions
rtos_spi_master_driver_core

Functions

void rtos_spi_master_transaction_start (rtos_spi_master_device_t *ctx)
 
void rtos_spi_master_transfer (rtos_spi_master_device_t *ctx, uint8_t *data_out, uint8_t *data_in, size_t len)
 
void rtos_spi_master_delay_before_next_transfer (rtos_spi_master_device_t *ctx, uint32_t delay_ticks)
 
void rtos_spi_master_transaction_end (rtos_spi_master_device_t *ctx)
 

Detailed Description

The core functions for using an RTOS SPI master driver instance after it has been initialized and started. These functions may be used by both the host and any client tiles that RPC has been enabled for.

Function Documentation

◆ rtos_spi_master_delay_before_next_transfer()

void rtos_spi_master_delay_before_next_transfer ( rtos_spi_master_device_t ctx,
uint32_t  delay_ticks 
)
inline

If there is a minimum amount of idle time that is required by the device between transfers within a single transaction, then this may be called between each transfer where a delay is required.

This function will return immediately. If the call for the next transfer happens before the minimum time specified has elapsed, the delay will occur then before the transfer begins.

Note
This must be called during a transaction, otherwise the behavior is unspecified.
Technically the next transfer will occur no earlier than delay_ticks after this function is called, so this should be called immediately following a transfer, rather than immediately before the next.
Parameters
ctxA pointer to the SPI device instance.
delay_ticksThe number of reference clock ticks to delay.

◆ rtos_spi_master_transaction_end()

void rtos_spi_master_transaction_end ( rtos_spi_master_device_t ctx)
inline

Ends a transaction with the specified SPI device on a SPI bus. This leaves chip select de-asserted.

Parameters
ctxA pointer to the SPI device instance.

◆ rtos_spi_master_transaction_start()

void rtos_spi_master_transaction_start ( rtos_spi_master_device_t ctx)
inline

Starts a transaction with the specified SPI device on a SPI bus. This leaves chip select asserted.

Parameters
ctxA pointer to the SPI device instance.

◆ rtos_spi_master_transfer()

void rtos_spi_master_transfer ( rtos_spi_master_device_t ctx,
uint8_t *  data_out,
uint8_t *  data_in,
size_t  len 
)
inline

Transfers data to and from the specified SPI device on a SPI bus. The transaction must already have been started by calling rtos_spi_master_transaction_start() on the same device instance. This may be called multiple times during a single transaction.

This function may return before the transfer is complete when data_in is NULL, as the actual transfer operation is queued and executed by a thread created by the driver.

Parameters
ctxA pointer to the SPI device instance.
data_outPointer to the data to transfer to the device. This may be NULL if there is no data to send.
data_inPointer to the buffer to save the received data to. This may be NULL if the received data is not needed.
lenThe number of bytes to transfer in each direction. This number of bytes must be available in both the data_out and data_in buffers if they are not NULL.