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 */
11 typedef int (*subsystem_do_this_t)(const struct device *device, int foo,
12 				   int bar);
13 typedef void (*subsystem_do_that_t)(const struct device *device,
14 				    unsigned int *baz);
15 
16 struct subsystem_api {
17 	subsystem_do_this_t do_this;
18 	subsystem_do_that_t do_that;
19 };
20 
subsystem_do_this(const struct device * device,int foo,int bar)21 static 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 
subsystem_do_that(const struct device * device,unsigned int * baz)30 static 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 }
38