Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mspi_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_MSPI_EMUL_H_
8#define ZEPHYR_INCLUDE_DRIVERS_MSPI_EMUL_H_
9
10#include <zephyr/device.h>
11#include <zephyr/drivers/emul.h>
12#include <zephyr/drivers/mspi.h>
13#include <zephyr/sys/slist.h>
14#include <zephyr/types.h>
15
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33struct mspi_emul;
34
46typedef struct mspi_emul *(*mspi_emul_find_emul)(const struct device *dev,
47 uint16_t dev_idx);
48
59typedef int (*mspi_emul_trigger_event)(const struct device *dev,
60 enum mspi_bus_event evt_type);
61
75typedef int (*emul_mspi_dev_api_transceive)(const struct emul *target,
76 const struct mspi_xfer_packet *packets,
77 uint32_t num_packet,
78 bool async,
79 uint32_t timeout);
80
85
96
99 /* The struct mspi_driver_api has to be first in
100 * struct emul_mspi_driver_api to make pointer casting working
101 */
103 /* The rest, emulator specific functions */
106};
107
115int mspi_emul_register(const struct device *dev, struct mspi_emul *emul);
116
117#ifdef __cplusplus
118}
119#endif
120
125#endif /* ZEPHYR_INCLUDE_DRIVERS_MSPI_EMUL_H_ */
int(* emul_mspi_dev_api_transceive)(const struct emul *target, const struct mspi_xfer_packet *packets, uint32_t num_packet, bool async, uint32_t timeout)
Loopback MSPI transceive request to the device emulator as no real hardware attached.
Definition mspi_emul.h:75
int mspi_emul_register(const struct device *dev, struct mspi_emul *emul)
Register an emulated device on the controller.
int(* mspi_emul_trigger_event)(const struct device *dev, enum mspi_bus_event evt_type)
Triggers an event on the emulator of MSPI controller side which causes calling specific callbacks.
Definition mspi_emul.h:59
struct mspi_emul *(* mspi_emul_find_emul)(const struct device *dev, uint16_t dev_idx)
Find an emulator present on a MSPI bus.
Definition mspi_emul.h:46
mspi_bus_event
MSPI bus event.
Definition mspi.h:123
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
Public APIs for MSPI driver.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
Definition of the MSPI device emulator API.
Definition mspi_emul.h:82
emul_mspi_dev_api_transceive transceive
Definition mspi_emul.h:83
Definition of the MSPI controller emulator API.
Definition mspi_emul.h:98
mspi_emul_find_emul find_emul
Definition mspi_emul.h:105
struct mspi_driver_api mspi_api
Definition mspi_emul.h:102
mspi_emul_trigger_event trigger_event
Definition mspi_emul.h:104
An emulator instance - represents the target emulated device/peripheral that is interacted with throu...
Definition emul.h:82
Definition mspi.h:505
Node in a linked list of emulators for MSPI devices.
Definition mspi_emul.h:87
const struct emul_mspi_device_api * api
API provided for this device.
Definition mspi_emul.h:92
uint16_t dev_idx
device index
Definition mspi_emul.h:94
const struct emul * target
Target emulator - REQUIRED for all emulated bus nodes of any type.
Definition mspi_emul.h:90
sys_snode_t node
Definition mspi_emul.h:88
MSPI peripheral xfer packet format.
Definition mspi.h:367