Zephyr Project API 4.2.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
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34struct mspi_emul;
35
47typedef struct mspi_emul *(*mspi_emul_find_emul)(const struct device *dev,
48 uint16_t dev_idx);
49
60typedef int (*mspi_emul_trigger_event)(const struct device *dev,
61 enum mspi_bus_event evt_type);
62
76typedef int (*emul_mspi_dev_api_transceive)(const struct emul *target,
77 const struct mspi_xfer_packet *packets,
78 uint32_t num_packet,
79 bool async,
80 uint32_t timeout);
81
86
97
100 /* The struct mspi_driver_api has to be first in
101 * struct emul_mspi_driver_api to make pointer casting working
102 */
104 /* The rest, emulator specific functions */
107};
108
116int mspi_emul_register(const struct device *dev, struct mspi_emul *emul);
117
118#ifdef __cplusplus
119}
120#endif
121
126#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:76
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:60
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:47
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:510
Definition of the MSPI device emulator API.
Definition mspi_emul.h:83
emul_mspi_dev_api_transceive transceive
Definition mspi_emul.h:84
Definition of the MSPI controller emulator API.
Definition mspi_emul.h:99
mspi_emul_find_emul find_emul
Definition mspi_emul.h:106
struct mspi_driver_api mspi_api
Definition mspi_emul.h:103
mspi_emul_trigger_event trigger_event
Definition mspi_emul.h:105
An emulator instance - represents the target emulated device/peripheral that is interacted with throu...
Definition emul.h:82
Definition mspi.h:513
Node in a linked list of emulators for MSPI devices.
Definition mspi_emul.h:88
const struct emul_mspi_device_api * api
API provided for this device.
Definition mspi_emul.h:93
uint16_t dev_idx
device index
Definition mspi_emul.h:95
const struct emul * target
Target emulator - REQUIRED for all emulated bus nodes of any type.
Definition mspi_emul.h:91
sys_snode_t node
Definition mspi_emul.h:89
MSPI peripheral xfer packet format.
Definition mspi.h:377