1 /*
2  * Copyright 2023 Google LLC
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef TEST_SUBSYS_EMUL_SRC_EMUL_TESTER_H_
8 #define TEST_SUBSYS_EMUL_SRC_EMUL_TESTER_H_
9 
10 #include <zephyr/drivers/emul.h>
11 
12 struct emul_tester_backend_api {
13 	int (*set_action)(const struct emul *target, int action);
14 	int (*get_action)(const struct emul *target, int *action);
15 };
16 
emul_tester_backend_set_action(const struct emul * target,int action)17 static inline int emul_tester_backend_set_action(const struct emul *target, int action)
18 {
19 	const struct emul_tester_backend_api *api =
20 		(const struct emul_tester_backend_api *)target->backend_api;
21 
22 	return api->set_action(target, action);
23 }
24 
emul_tester_backend_get_action(const struct emul * target,int * action)25 static inline int emul_tester_backend_get_action(const struct emul *target, int *action)
26 {
27 	const struct emul_tester_backend_api *api =
28 		(const struct emul_tester_backend_api *)target->backend_api;
29 
30 	return api->get_action(target, action);
31 }
32 
33 #endif /* TEST_SUBSYS_EMUL_SRC_EMUL_TESTER_H_ */
34