Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
spi_emul.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DRIVERS_SPI_SPI_EMUL_H_
8#define ZEPHYR_INCLUDE_DRIVERS_SPI_SPI_EMUL_H_
9
16#include <zephyr/types.h>
17#include <device.h>
18
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30struct spi_msg;
31struct spi_emul_api;
32
34struct spi_emul {
36
37 /* API provided for this device */
38 const struct spi_emul_api *api;
39
40 /* SPI chip-slect of the emulated device */
42};
43
60typedef int (*spi_emul_io_t)(struct spi_emul *emul,
61 const struct spi_config *config,
62 const struct spi_buf_set *tx_bufs,
63 const struct spi_buf_set *rx_bufs);
64
73int spi_emul_register(const struct device *dev, const char *name,
74 struct spi_emul *emul);
75
79};
80
88
89#ifdef __cplusplus
90}
91#endif
92
97#endif /* ZEPHYR_INCLUDE_DRIVERS_SPI_SPI_EMUL_H_ */
int(* spi_emul_io_t)(struct spi_emul *emul, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
Definition: spi_emul.h:60
int spi_emul_register(const struct device *dev, const char *name, struct spi_emul *emul)
uint32_t spi_emul_get_config(const struct device *dev)
struct _snode sys_snode_t
Definition: slist.h:33
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
Definition: emul.h:52
SPI buffer array structure.
Definition: spi.h:373
SPI controller configuration structure.
Definition: spi.h:244
Definition: spi_emul.h:77
spi_emul_io_t io
Definition: spi_emul.h:78
Definition: spi_emul.h:34
sys_snode_t node
Definition: spi_emul.h:35
uint16_t chipsel
Definition: spi_emul.h:41
const struct spi_emul_api * api
Definition: spi_emul.h:38