1 /*
2 * Copyright (c) 2020-2021 Vestas Wind Systems A/S
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/kernel.h>
8 #include <zephyr/ztest.h>
9
10 #include "test_pwm_loopback.h"
11
pwm_loopback_setup(void)12 static void *pwm_loopback_setup(void)
13 {
14 struct test_pwm in;
15 struct test_pwm out;
16
17 get_test_pwms(&out, &in);
18
19 k_object_access_grant(out.dev, k_current_get());
20 k_object_access_grant(in.dev, k_current_get());
21
22 return NULL;
23 }
24
pwm_loopback_after(void * f)25 static void pwm_loopback_after(void *f)
26 {
27 struct test_pwm in;
28 struct test_pwm out;
29 int err;
30
31 ARG_UNUSED(f);
32
33 get_test_pwms(&out, &in);
34
35 err = pwm_disable_capture(in.dev, in.pwm);
36 zassert_equal(err, 0, "failed to disable pwm capture (err %d)", err);
37 }
38
39 ZTEST_SUITE(pwm_loopback, NULL, pwm_loopback_setup, NULL, pwm_loopback_after, NULL);
40