summaryrefslogtreecommitdiff
path: root/zephyr/include/emul/emul_power_signals.h
blob: 7dea6079f0f491782581ed38f820d59bf78a4589 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* Copyright 2022 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef EMUL_POWER_SIGNALS_H_
#define EMUL_POWER_SIGNALS_H_

/**
 * @brief Test platform definition,
 *        This structure contains all power signal nodes associated to one
 *        test.
 */
struct power_signal_emul_test_platform {
	char *name_id;
	int nodes_count;
	struct power_signal_emul_node **nodes;
};

#define EMUL_POWER_SIGNAL_TEST_PLATFORM_DECL(inst) \
	extern const struct power_signal_emul_test_platform inst;

#define EMUL_POWER_SIGNAL_TEST_PLATFORM(inst) (&DT_CAT(DT_N_S_, inst))

DT_FOREACH_STATUS_OKAY(intel_ap_pwr_test_platform,
		       EMUL_POWER_SIGNAL_TEST_PLATFORM_DECL)
/**
 * @brief Load test platform.
 *
 * This initializes each of the test platform nodes.
 *
 * @param test_platform Pointer to test platform structure.
 *
 * @return 0 indicating success.
 * @return -EINVAL `test_id` parameter is invalid.
 * @return -EBUSY `test_id` One test platform is currently loaded.
 */
int power_signal_emul_load(
	const struct power_signal_emul_test_platform *test_platform);

/**
 * @brief Unload test platform.
 *
 * @return 0 indicating success.
 * @return -EINVAL no test platform has been loaded.
 */
int power_signal_emul_unload(void);

#endif /* EMUL_POWER_SIGNALS_H_ */