Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
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 <ztest.h>
8#include <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
19};
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
void
Definition: eswifi_shell.c:15
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
const void * api
Definition: device.h:373
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.