oveRTOS C API
Embedded RTOS framework — build system, configuration, and portable C API
Loading...
Searching...
No Matches
Data Structures | Enumerations | Functions
spi.h File Reference
#include "ove/types.h"
#include "ove_config.h"
#include "ove/storage.h"
Include dependency graph for spi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ove_spi_cfg
 SPI bus configuration descriptor. More...
 
struct  ove_spi_cs
 SPI chip-select descriptor. More...
 
struct  ove_spi_xfer
 SPI transfer segment for multi-segment transactions. More...
 

Enumerations

enum  ove_spi_mode_t { OVE_SPI_MODE_0 = 0 , OVE_SPI_MODE_1 = 1 , OVE_SPI_MODE_2 = 2 , OVE_SPI_MODE_3 = 3 }
 SPI clock polarity / phase mode. More...
 
enum  ove_spi_bit_order_t { OVE_SPI_MSB_FIRST = 0 , OVE_SPI_LSB_FIRST = 1 }
 SPI bit order. More...
 

Functions

int ove_spi_init (ove_spi_t *spi, ove_spi_storage_t *storage, const struct ove_spi_cfg *cfg)
 Initialise an SPI bus controller with caller-provided storage.
 
void ove_spi_deinit (ove_spi_t spi)
 Release an SPI bus handle previously created with ove_spi_init.
 
int ove_spi_create (ove_spi_t *spi, const struct ove_spi_cfg *cfg)
 Heap-mode counterpart of ove_spi_init() — allocates storage internally.
 
void ove_spi_destroy (ove_spi_t spi)
 Destroy an SPI bus handle previously created with ove_spi_create.
 
int ove_spi_transfer (ove_spi_t spi, const struct ove_spi_cs *cs, const void *tx, void *rx, size_t len, uint64_t timeout_ns)
 Full-duplex SPI transfer.
 
int ove_spi_write (ove_spi_t spi, const struct ove_spi_cs *cs, const void *data, size_t len, uint64_t timeout_ns)
 Write-only SPI transfer (TX only, ignore RX).
 
int ove_spi_read (ove_spi_t spi, const struct ove_spi_cs *cs, void *buf, size_t len, uint64_t timeout_ns)
 Read-only SPI transfer (clock out zeros, capture RX).
 
int ove_spi_transfer_seq (ove_spi_t spi, const struct ove_spi_cs *cs, const struct ove_spi_xfer *xfers, unsigned int num_xfers, uint64_t timeout_ns)
 Multi-segment SPI transfer under a single CS assertion.
 
int ove_spi_transfer_async (ove_spi_t spi, const struct ove_spi_cs *cs, const void *tx, void *rx, size_t len, ove_dma_complete_cb cb, void *user_data)
 Submit an SPI transfer asynchronously and return immediately.