Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sdhc_emul.h
Go to the documentation of this file.
1/*
2 * Copyright 2026 Alif Semiconductor
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14
15#ifndef ZEPHYR_INCLUDE_DRIVERS_SDHC_EMUL_H_
16#define ZEPHYR_INCLUDE_DRIVERS_SDHC_EMUL_H_
17
18#include <zephyr/device.h>
19#include <zephyr/drivers/sdhc.h>
20#include <zephyr/sys/slist.h>
21#include <zephyr/types.h>
22
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34struct sdhc_emul_api;
35
37struct sdhc_emul {
40
42 const struct emul *target;
43
45 const struct sdhc_emul_api *api;
46
52
55};
56
68typedef int (*sdhc_emul_request_t)(const struct emul *target,
69 struct sdhc_command *cmd,
70 struct sdhc_data *data);
71
80typedef int (*sdhc_emul_card_busy_t)(const struct emul *target);
81
90typedef int (*sdhc_emul_card_present_t)(const struct emul *target);
91
99int sdhc_emul_register(const struct device *dev, struct sdhc_emul *emul);
100
108struct sdhc_emul *sdhc_emul_get_card(const struct device *dev);
109
116void sdhc_emul_raise_interrupt(const struct device *dev, int sources);
117
129
130#ifdef __cplusplus
131}
132#endif
133
137
138#endif /* ZEPHYR_INCLUDE_DRIVERS_SDHC_EMUL_H_ */
APIs and macros for the Zephyr device model.
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition ft8xx_reference_api.h:153
int(* sdhc_emul_card_present_t)(const struct emul *target)
Check if the emulated card is present.
Definition sdhc_emul.h:90
void sdhc_emul_raise_interrupt(const struct device *dev, int sources)
Raise an interrupt from an emulated SDHC card through its controller.
int(* sdhc_emul_card_busy_t)(const struct emul *target)
Check if the emulated card is busy.
Definition sdhc_emul.h:80
int sdhc_emul_register(const struct device *dev, struct sdhc_emul *emul)
Register an emulated card device on the controller.
int(* sdhc_emul_request_t)(const struct emul *target, struct sdhc_command *cmd, struct sdhc_data *data)
Passes an SDHC request to the card emulator.
Definition sdhc_emul.h:68
struct sdhc_emul * sdhc_emul_get_card(const struct device *dev)
Find the first SDHC emulator registered on a controller.
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:44
Main header file for SDHC (Secure Digital Host Controller) driver API.
Header file for the single-linked list API.
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:543
An emulator instance - represents the target emulated device/peripheral that is interacted with throu...
Definition emul.h:90
const struct device * dev
handle to the device for which this provides low-level emulation
Definition emul.h:94
SD host controller command structure.
Definition sdhc.h:48
SD host controller data structure.
Definition sdhc.h:66
void * data
Data to transfer or receive.
Definition sdhc.h:74
Definition of the emulator API for SDHC card devices.
Definition sdhc_emul.h:119
sdhc_emul_request_t request
Pass an SDHC request to the card emulator.
Definition sdhc_emul.h:121
sdhc_emul_card_busy_t card_busy
Check if the emulated card is busy.
Definition sdhc_emul.h:124
sdhc_emul_card_present_t card_present
Check if the emulated card is present.
Definition sdhc_emul.h:127
Node in a linked list of emulators for SDHC card devices.
Definition sdhc_emul.h:37
struct sdhc_emul_api * mock_api
A mock API that if not NULL will take precedence over the actual API.
Definition sdhc_emul.h:51
const struct sdhc_emul_api * api
API provided for this device.
Definition sdhc_emul.h:45
uint16_t slot
Card slot index (typically 0 for single-slot controllers).
Definition sdhc_emul.h:54
sys_snode_t node
Linked list node for emulator registry.
Definition sdhc_emul.h:39
const struct emul * target
Target emulator - REQUIRED for all emulated bus nodes.
Definition sdhc_emul.h:42