Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
abstract_driver.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <zephyr/ztest.h>
8#include <zephyr/device.h>
9
10/* define subsystem common API for drivers */
11typedef int (*subsystem_do_this_t)(const struct device *device, int foo,
12 int bar);
13typedef void (*subsystem_do_that_t)(const struct device *device,
14 unsigned int *baz);
15
20
21static inline int subsystem_do_this(const struct device *device, int foo,
22 int bar)
23{
24 struct subsystem_api *api;
25
26 api = (struct subsystem_api *)device->api;
27 return api->do_this(device, foo, bar);
28}
29
30static inline void subsystem_do_that(const struct device *device,
31 unsigned int *baz)
32{
33 struct subsystem_api *api;
34
35 api = (struct subsystem_api *)device->api;
36 api->do_that(device, baz);
37}
int(* subsystem_do_this_t)(const struct device *device, int foo, int bar)
Definition abstract_driver.h:11
static int subsystem_do_this(const struct device *device, int foo, int bar)
Definition abstract_driver.h:21
void(* subsystem_do_that_t)(const struct device *device, unsigned int *baz)
Definition abstract_driver.h:13
static void subsystem_do_that(const struct device *device, unsigned int *baz)
Definition abstract_driver.h:30
Runtime device structure (in ROM) per driver instance.
Definition device.h:403
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:409
Definition main.c:25
Definition abstract_driver.h:16
subsystem_do_that_t do_that
Definition abstract_driver.h:18
subsystem_do_this_t do_this
Definition abstract_driver.h:17
Zephyr Testsuite.