Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
spi.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12#ifndef ZEPHYR_INCLUDE_DRIVERS_SPI_H_
13#define ZEPHYR_INCLUDE_DRIVERS_SPI_H_
14
24#include <zephyr/types.h>
25#include <stddef.h>
26#include <zephyr/device.h>
28#include <zephyr/drivers/gpio.h>
29#include <zephyr/kernel.h>
30#include <zephyr/sys/__assert.h>
31#include <zephyr/rtio/rtio.h>
32#include <zephyr/stats/stats.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
42#define SPI_OP_MODE_MASTER 0U
43#define SPI_OP_MODE_SLAVE BIT(0)
45#define SPI_OP_MODE_MASK 0x1U
48#define SPI_OP_MODE_GET(_operation_) ((_operation_) & SPI_OP_MODE_MASK)
61#define SPI_MODE_CPOL BIT(1)
62
70#define SPI_MODE_CPHA BIT(2)
71
77#define SPI_MODE_LOOP BIT(3)
79#define SPI_MODE_MASK (0xEU)
82#define SPI_MODE_GET(_mode_) \
83 ((_mode_) & SPI_MODE_MASK)
84
91#define SPI_TRANSFER_MSB (0U)
92#define SPI_TRANSFER_LSB BIT(4)
100#define SPI_WORD_SIZE_SHIFT (5U)
101#define SPI_WORD_SIZE_MASK (0x3FU << SPI_WORD_SIZE_SHIFT)
104#define SPI_WORD_SIZE_GET(_operation_) \
105 (((_operation_) & SPI_WORD_SIZE_MASK) >> SPI_WORD_SIZE_SHIFT)
107#define SPI_WORD_SET(_word_size_) \
108 ((_word_size_) << SPI_WORD_SIZE_SHIFT)
116#define SPI_HOLD_ON_CS BIT(12)
122#define SPI_LOCK_ON BIT(13)
123
131#define SPI_CS_ACTIVE_HIGH BIT(14)
143#define SPI_LINES_SINGLE (0U << 16)
144#define SPI_LINES_DUAL (1U << 16)
145#define SPI_LINES_QUAD (2U << 16)
146#define SPI_LINES_OCTAL (3U << 16)
148#define SPI_LINES_MASK (0x3U << 16)
174
212#define SPI_CS_GPIOS_DT_SPEC_GET(spi_dev) \
213 GPIO_DT_SPEC_GET_BY_IDX_OR(DT_BUS(spi_dev), cs_gpios, \
214 DT_REG_ADDR_RAW(spi_dev), {})
215
225#define SPI_CS_GPIOS_DT_SPEC_INST_GET(inst) \
226 SPI_CS_GPIOS_DT_SPEC_GET(DT_DRV_INST(inst))
227
266#define SPI_CS_CONTROL_INIT(node_id, delay_) \
267 { \
268 .gpio = SPI_CS_GPIOS_DT_SPEC_GET(node_id), \
269 .delay = (delay_), \
270 }
271
285#define SPI_CS_CONTROL_INIT_INST(inst, delay_) \
286 SPI_CS_CONTROL_INIT(DT_DRV_INST(inst), delay_)
287
292#if defined(CONFIG_SPI_EXTENDED_MODES)
294#else
296#endif
297
333
347#define SPI_CONFIG_DT(node_id, operation_, delay_) \
348 { \
349 .frequency = DT_PROP(node_id, spi_max_frequency), \
350 .operation = (operation_) | \
351 DT_PROP(node_id, duplex) | \
352 DT_PROP(node_id, frame_format) | \
353 COND_CODE_1(DT_PROP(node_id, spi_cpol), SPI_MODE_CPOL, (0)) | \
354 COND_CODE_1(DT_PROP(node_id, spi_cpha), SPI_MODE_CPHA, (0)) | \
355 COND_CODE_1(DT_PROP(node_id, spi_hold_cs), SPI_HOLD_ON_CS, (0)), \
356 .slave = DT_REG_ADDR(node_id), \
357 .cs = SPI_CS_CONTROL_INIT(node_id, delay_), \
358 }
359
371#define SPI_CONFIG_DT_INST(inst, operation_, delay_) \
372 SPI_CONFIG_DT(DT_DRV_INST(inst), operation_, delay_)
373
379 const struct device *bus;
382};
383
401#define SPI_DT_SPEC_GET(node_id, operation_, delay_) \
402 { \
403 .bus = DEVICE_DT_GET(DT_BUS(node_id)), \
404 .config = SPI_CONFIG_DT(node_id, operation_, delay_) \
405 }
406
418#define SPI_DT_SPEC_INST_GET(inst, operation_, delay_) \
419 SPI_DT_SPEC_GET(DT_DRV_INST(inst), operation_, delay_)
420
424#define SPI_MOSI_OVERRUN_UNKNOWN 0x100
425
438#define SPI_MOSI_OVERRUN_DT(node_id) \
439 DT_PROP_OR(node_id, overrun_character, SPI_MOSI_OVERRUN_UNKNOWN)
440
452#define SPI_MOSI_OVERRUN_DT_INST(inst) \
453 DT_INST_PROP_OR(inst, overrun_character, SPI_MOSI_OVERRUN_UNKNOWN)
454
458struct spi_buf {
460 void *buf;
465 size_t len;
466};
467
473 const struct spi_buf *buffers;
475 size_t count;
476};
477
478#if defined(CONFIG_SPI_STATS)
480STATS_SECT_ENTRY32(rx_bytes)
481STATS_SECT_ENTRY32(tx_bytes)
482STATS_SECT_ENTRY32(transfer_error)
484
486STATS_NAME(spi, rx_bytes)
487STATS_NAME(spi, tx_bytes)
488STATS_NAME(spi, transfer_error)
489STATS_NAME_END(spi);
490
494struct spi_device_state {
495 struct device_state devstate;
496 struct stats_spi stats;
497};
498
502#define Z_SPI_GET_STATS(dev_) \
503 CONTAINER_OF(dev_->state, struct spi_device_state, devstate)->stats
504
510#define SPI_STATS_RX_BYTES_INCN(dev_, n) \
511 STATS_INCN(Z_SPI_GET_STATS(dev_), rx_bytes, n)
512
518#define SPI_STATS_TX_BYTES_INCN(dev_, n) \
519 STATS_INCN(Z_SPI_GET_STATS(dev_), tx_bytes, n)
520
528#define SPI_STATS_TRANSFER_ERROR_INC(dev_) \
529 STATS_INC(Z_SPI_GET_STATS(dev_), transfer_error)
530
534#define Z_SPI_DEVICE_STATE_DEFINE(dev_id) \
535 static struct spi_device_state Z_DEVICE_STATE_NAME(dev_id) \
536 __attribute__((__section__(".z_devstate")));
537
544#define Z_SPI_INIT_FN(dev_id, init_fn) \
545 static inline int UTIL_CAT(dev_id, _init)(const struct device *dev) \
546 { \
547 struct spi_device_state *state = \
548 CONTAINER_OF(dev->state, struct spi_device_state, devstate); \
549 stats_init(&state->stats.s_hdr, STATS_SIZE_32, 3, \
550 STATS_NAME_INIT_PARMS(spi)); \
551 stats_register(dev->name, &(state->stats.s_hdr)); \
552 return init_fn(dev); \
553 }
554
574#define SPI_DEVICE_DT_DEFINE(node_id, init_fn, pm_device, \
575 data_ptr, cfg_ptr, level, prio, \
576 api_ptr, ...) \
577 Z_SPI_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \
578 Z_SPI_INIT_FN(Z_DEVICE_DT_DEV_ID(node_id), init_fn) \
579 Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
580 DEVICE_DT_NAME(node_id), \
581 &UTIL_CAT(Z_DEVICE_DT_DEV_ID(node_id), _init), \
582 pm_device, \
583 data_ptr, cfg_ptr, level, prio, \
584 api_ptr, \
585 &(Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)).devstate), \
586 __VA_ARGS__)
587
588static inline void spi_transceive_stats(const struct device *dev, int error,
589 const struct spi_buf_set *tx_bufs,
590 const struct spi_buf_set *rx_bufs)
591{
592 uint32_t tx_bytes;
593 uint32_t rx_bytes;
594
595 if (error) {
597 }
598
599 if (tx_bufs) {
600 tx_bytes = tx_bufs->count ? tx_bufs->buffers->len : 0;
601 SPI_STATS_TX_BYTES_INCN(dev, tx_bytes);
602 }
603
604 if (rx_bufs) {
605 rx_bytes = rx_bufs->count ? rx_bufs->buffers->len : 0;
606 SPI_STATS_RX_BYTES_INCN(dev, rx_bytes);
607 }
608}
609
610#else /*CONFIG_SPI_STATS*/
611
612#define SPI_DEVICE_DT_DEFINE(node_id, init_fn, pm, \
613 data, config, level, prio, \
614 api, ...) \
615 Z_DEVICE_STATE_DEFINE(Z_DEVICE_DT_DEV_ID(node_id)); \
616 Z_DEVICE_DEFINE(node_id, Z_DEVICE_DT_DEV_ID(node_id), \
617 DEVICE_DT_NAME(node_id), init_fn, pm, data, config, \
618 level, prio, api, \
619 &Z_DEVICE_STATE_NAME(Z_DEVICE_DT_DEV_ID(node_id)), \
620 __VA_ARGS__)
621
622#define SPI_STATS_RX_BYTES_INC(dev_)
623#define SPI_STATS_TX_BYTES_INC(dev_)
624#define SPI_STATS_TRANSFER_ERROR_INC(dev_)
625
626#define spi_transceive_stats(dev, error, tx_bufs, rx_bufs)
627
628#endif /*CONFIG_SPI_STATS*/
629
638#define SPI_DEVICE_DT_INST_DEFINE(inst, ...) \
639 SPI_DEVICE_DT_DEFINE(DT_DRV_INST(inst), __VA_ARGS__)
640
646typedef int (*spi_api_io)(const struct device *dev,
647 const struct spi_config *config,
648 const struct spi_buf_set *tx_bufs,
649 const struct spi_buf_set *rx_bufs);
650
658typedef void (*spi_callback_t)(const struct device *dev, int result, void *data);
659
665typedef int (*spi_api_io_async)(const struct device *dev,
666 const struct spi_config *config,
667 const struct spi_buf_set *tx_bufs,
668 const struct spi_buf_set *rx_bufs,
670 void *userdata);
671
672#if defined(CONFIG_SPI_RTIO) || defined(DOXYGEN)
673
678typedef void (*spi_api_iodev_submit)(const struct device *dev,
679 struct rtio_iodev_sqe *iodev_sqe);
680#endif /* CONFIG_SPI_RTIO */
681
687typedef int (*spi_api_release)(const struct device *dev,
688 const struct spi_config *config);
689
690
695__subsystem struct spi_driver_api {
697#ifdef CONFIG_SPI_ASYNC
698 spi_api_io_async transceive_async;
699#endif /* CONFIG_SPI_ASYNC */
700#ifdef CONFIG_SPI_RTIO
701 spi_api_iodev_submit iodev_submit;
702#endif /* CONFIG_SPI_RTIO */
704};
705
713static inline bool spi_cs_is_gpio(const struct spi_config *config)
714{
715 return config->cs.gpio.port != NULL;
716}
717
725static inline bool spi_cs_is_gpio_dt(const struct spi_dt_spec *spec)
726{
727 return spi_cs_is_gpio(&spec->config);
728}
729
738static inline bool spi_is_ready_dt(const struct spi_dt_spec *spec)
739{
740 /* Validate bus is ready */
741 if (!device_is_ready(spec->bus)) {
742 return false;
743 }
744 /* Validate CS gpio port is ready, if it is used */
745 if (spi_cs_is_gpio_dt(spec) &&
746 !gpio_is_ready_dt(&spec->config.cs.gpio)) {
747 return false;
748 }
749 return true;
750}
751
770__syscall int spi_transceive(const struct device *dev,
771 const struct spi_config *config,
772 const struct spi_buf_set *tx_bufs,
773 const struct spi_buf_set *rx_bufs);
774
775static inline int z_impl_spi_transceive(const struct device *dev,
776 const struct spi_config *config,
777 const struct spi_buf_set *tx_bufs,
778 const struct spi_buf_set *rx_bufs)
779{
780 const struct spi_driver_api *api =
781 (const struct spi_driver_api *)dev->api;
782 int ret;
783
784 ret = api->transceive(dev, config, tx_bufs, rx_bufs);
785 spi_transceive_stats(dev, ret, tx_bufs, rx_bufs);
786
787 return ret;
788}
789
805static inline int spi_transceive_dt(const struct spi_dt_spec *spec,
806 const struct spi_buf_set *tx_bufs,
807 const struct spi_buf_set *rx_bufs)
808{
809 return spi_transceive(spec->bus, &spec->config, tx_bufs, rx_bufs);
810}
811
829static inline int spi_read(const struct device *dev,
830 const struct spi_config *config,
831 const struct spi_buf_set *rx_bufs)
832{
833 return spi_transceive(dev, config, NULL, rx_bufs);
834}
835
848static inline int spi_read_dt(const struct spi_dt_spec *spec,
849 const struct spi_buf_set *rx_bufs)
850{
851 return spi_read(spec->bus, &spec->config, rx_bufs);
852}
853
870static inline int spi_write(const struct device *dev,
871 const struct spi_config *config,
872 const struct spi_buf_set *tx_bufs)
873{
874 return spi_transceive(dev, config, tx_bufs, NULL);
875}
876
889static inline int spi_write_dt(const struct spi_dt_spec *spec,
890 const struct spi_buf_set *tx_bufs)
891{
892 return spi_write(spec->bus, &spec->config, tx_bufs);
893}
894
895#if defined(CONFIG_SPI_ASYNC) || defined(__DOXYGEN__)
896
923static inline int spi_transceive_cb(const struct device *dev,
924 const struct spi_config *config,
925 const struct spi_buf_set *tx_bufs,
926 const struct spi_buf_set *rx_bufs,
927 spi_callback_t callback,
928 void *userdata)
929{
930 const struct spi_driver_api *api =
931 (const struct spi_driver_api *)dev->api;
932
933 return api->transceive_async(dev, config, tx_bufs, rx_bufs, callback, userdata);
934}
935
936#if defined(CONFIG_POLL) || defined(__DOXYGEN__)
937
939void z_spi_transfer_signal_cb(const struct device *dev, int result, void *userdata);
967static inline int spi_transceive_signal(const struct device *dev,
968 const struct spi_config *config,
969 const struct spi_buf_set *tx_bufs,
970 const struct spi_buf_set *rx_bufs,
971 struct k_poll_signal *sig)
972{
973 const struct spi_driver_api *api =
974 (const struct spi_driver_api *)dev->api;
975 spi_callback_t cb = (sig == NULL) ? NULL : z_spi_transfer_signal_cb;
976
977 return api->transceive_async(dev, config, tx_bufs, rx_bufs, cb, sig);
978}
979
1004static inline int spi_read_signal(const struct device *dev,
1005 const struct spi_config *config,
1006 const struct spi_buf_set *rx_bufs,
1007 struct k_poll_signal *sig)
1008{
1009 return spi_transceive_signal(dev, config, NULL, rx_bufs, sig);
1010}
1011
1035static inline int spi_write_signal(const struct device *dev,
1036 const struct spi_config *config,
1037 const struct spi_buf_set *tx_bufs,
1038 struct k_poll_signal *sig)
1039{
1040 return spi_transceive_signal(dev, config, tx_bufs, NULL, sig);
1041}
1042
1043#endif /* CONFIG_POLL */
1044
1045#endif /* CONFIG_SPI_ASYNC */
1046
1047
1048#if defined(CONFIG_SPI_RTIO) || defined(__DOXYGEN__)
1049
1057static inline void spi_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
1058{
1059 const struct spi_dt_spec *dt_spec = iodev_sqe->sqe.iodev->data;
1060 const struct device *dev = dt_spec->bus;
1061 const struct spi_driver_api *api = (const struct spi_driver_api *)dev->api;
1062
1063 api->iodev_submit(dt_spec->bus, iodev_sqe);
1064}
1065
1066extern const struct rtio_iodev_api spi_iodev_api;
1067
1079#define SPI_DT_IODEV_DEFINE(name, node_id, operation_, delay_) \
1080 const struct spi_dt_spec _spi_dt_spec_##name = \
1081 SPI_DT_SPEC_GET(node_id, operation_, delay_); \
1082 RTIO_IODEV_DEFINE(name, &spi_iodev_api, (void *)&_spi_dt_spec_##name)
1083
1092static inline bool spi_is_ready_iodev(const struct rtio_iodev *spi_iodev)
1093{
1094 struct spi_dt_spec *spec = spi_iodev->data;
1095
1096 return spi_is_ready_dt(spec);
1097}
1098
1099#endif /* CONFIG_SPI_RTIO */
1100
1121__syscall int spi_release(const struct device *dev,
1122 const struct spi_config *config);
1123
1124static inline int z_impl_spi_release(const struct device *dev,
1125 const struct spi_config *config)
1126{
1127 const struct spi_driver_api *api =
1128 (const struct spi_driver_api *)dev->api;
1129
1130 return api->release(dev, config);
1131}
1132
1144static inline int spi_release_dt(const struct spi_dt_spec *spec)
1145{
1146 return spi_release(spec->bus, &spec->config);
1147}
1148
1149#ifdef __cplusplus
1150}
1151#endif
1152
1157#include <zephyr/syscalls/spi.h>
1158
1159#endif /* ZEPHYR_INCLUDE_DRIVERS_SPI_H_ */
Public APIs for GPIO drivers.
bool device_is_ready(const struct device *dev)
Verify that a device is ready for use.
static bool gpio_is_ready_dt(const struct gpio_dt_spec *spec)
Validate that GPIO port is ready.
Definition gpio.h:836
int(* spi_api_io_async)(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, spi_callback_t cb, void *userdata)
Definition spi.h:665
int spi_release(const struct device *dev, const struct spi_config *config)
Release the SPI device locked on and/or the CS by the current config.
void(* spi_callback_t)(const struct device *dev, int result, void *data)
SPI callback for asynchronous transfer requests.
Definition spi.h:658
static int spi_write_dt(const struct spi_dt_spec *spec, const struct spi_buf_set *tx_bufs)
Write data to a SPI bus specified in spi_dt_spec.
Definition spi.h:889
static bool spi_is_ready_dt(const struct spi_dt_spec *spec)
Validate that SPI bus (and CS gpio if defined) is ready.
Definition spi.h:738
uint16_t spi_operation_t
Opaque type to hold the SPI operation flags.
Definition spi.h:295
int(* spi_api_io)(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
Callback API for I/O See spi_transceive() for argument descriptions.
Definition spi.h:646
static int spi_transceive_signal(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, struct k_poll_signal *sig)
Read/write the specified amount of data from the SPI driver.
Definition spi.h:967
static int spi_read(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *rx_bufs)
Read the specified amount of data from the SPI driver.
Definition spi.h:829
static int spi_transceive_dt(const struct spi_dt_spec *spec, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
Read/write data from an SPI bus specified in spi_dt_spec.
Definition spi.h:805
static int spi_transceive_cb(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, spi_callback_t callback, void *userdata)
Read/write the specified amount of data from the SPI driver.
Definition spi.h:923
#define SPI_STATS_TRANSFER_ERROR_INC(dev_)
Definition spi.h:624
static int spi_read_dt(const struct spi_dt_spec *spec, const struct spi_buf_set *rx_bufs)
Read data from a SPI bus specified in spi_dt_spec.
Definition spi.h:848
static int spi_write(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs)
Write the specified amount of data from the SPI driver.
Definition spi.h:870
static int spi_release_dt(const struct spi_dt_spec *spec)
Release the SPI device specified in spi_dt_spec.
Definition spi.h:1144
static void spi_iodev_submit(struct rtio_iodev_sqe *iodev_sqe)
Submit a SPI device with a request.
Definition spi.h:1057
static int spi_read_signal(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *rx_bufs, struct k_poll_signal *sig)
Read the specified amount of data from the SPI driver.
Definition spi.h:1004
static bool spi_cs_is_gpio_dt(const struct spi_dt_spec *spec)
Check if SPI CS in spi_dt_spec is controlled using a GPIO.
Definition spi.h:725
int(* spi_api_release)(const struct device *dev, const struct spi_config *config)
Callback API for unlocking SPI device.
Definition spi.h:687
const struct rtio_iodev_api spi_iodev_api
int spi_transceive(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
Read/write the specified amount of data from the SPI driver.
#define spi_transceive_stats(dev, error, tx_bufs, rx_bufs)
Definition spi.h:626
static int spi_write_signal(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, struct k_poll_signal *sig)
Write the specified amount of data from the SPI driver.
Definition spi.h:1035
static bool spi_cs_is_gpio(const struct spi_config *config)
Check if SPI CS is controlled using a GPIO.
Definition spi.h:713
static bool spi_is_ready_iodev(const struct rtio_iodev *spi_iodev)
Validate that SPI bus (and CS gpio if defined) is ready.
Definition spi.h:1092
Public kernel APIs.
Real-Time IO device API for moving bytes with low effort.
Statistics.
#define STATS_NAME_END(name__)
Definition stats.h:391
#define STATS_NAME(name__, entry__)
Definition stats.h:390
#define STATS_SECT_END
Ends a stats group struct definition.
Definition stats.h:89
#define STATS_SECT_ENTRY32(var__)
Definition stats.h:359
#define STATS_NAME_START(name__)
Definition stats.h:389
#define STATS_SECT_START(group__)
Definition stats.h:354
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device dynamic structure (in RAM) per driver instance.
Definition device.h:380
Runtime device structure (in ROM) per driver instance.
Definition device.h:412
void * data
Address of the device instance private data.
Definition device.h:422
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:418
Container for GPIO pin information specified in devicetree.
Definition gpio.h:289
const struct device * port
GPIO device controlling the pin.
Definition gpio.h:291
Definition kernel.h:5796
API that an RTIO IO device should implement.
Definition rtio.h:502
Compute the mempool block index for a given pointer.
Definition rtio.h:492
struct rtio_sqe sqe
Definition rtio.h:493
An IO device with a function table for submitting requests.
Definition rtio.h:517
void * data
Definition rtio.h:522
const struct rtio_iodev * iodev
Device to operation on.
Definition rtio.h:295
SPI buffer array structure.
Definition spi.h:471
const struct spi_buf * buffers
Pointer to an array of spi_buf, or NULL.
Definition spi.h:473
size_t count
Length of the array (number of buffers) pointed by buffers.
Definition spi.h:475
SPI buffer structure.
Definition spi.h:458
size_t len
Length of the buffer buf in bytes.
Definition spi.h:465
void * buf
Valid pointer to a data buffer, or NULL otherwise.
Definition spi.h:460
SPI controller configuration structure.
Definition spi.h:301
uint16_t slave
Slave number from 0 to host controller slave limit.
Definition spi.h:326
struct spi_cs_control cs
GPIO chip-select line (optional, must be initialized to zero if not used).
Definition spi.h:331
spi_operation_t operation
Operation flags.
Definition spi.h:324
uint32_t frequency
Bus frequency in Hertz.
Definition spi.h:303
SPI Chip Select control structure.
Definition spi.h:159
uint32_t delay
Delay in microseconds to wait before starting the transmission and before releasing the CS line.
Definition spi.h:172
struct gpio_dt_spec gpio
GPIO devicetree specification of CS GPIO.
Definition spi.h:167
SPI driver API This is the mandatory API any SPI driver needs to expose.
Definition spi.h:695
spi_api_io transceive
Definition spi.h:696
spi_api_release release
Definition spi.h:703
Complete SPI DT information.
Definition spi.h:377
const struct device * bus
SPI bus.
Definition spi.h:379
struct spi_config config
Slave specific configuration.
Definition spi.h:381