Software APIs
pwrmgr_testutils.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 
5 #ifndef OPENTITAN_SW_DEVICE_LIB_TESTING_PWRMGR_TESTUTILS_H_
6 #define OPENTITAN_SW_DEVICE_LIB_TESTING_PWRMGR_TESTUTILS_H_
7 
8 #include <stdint.h>
9 
10 #include "sw/device/lib/base/status.h"
12 
13 /**
14  * Set the device in low power mode.
15  *
16  * A WFI instruction needs to be separately run by the processor to actually
17  * enter low power.
18  *
19  * @param pwrmgr A power manager handle.
20  * @param wakeups The bit mask of wakeup requestors.
21  * @param domain_config The bit mask for configuring the clock and power
22  * domains.
23  * @return The result of the operation.
24  */
26 status_t pwrmgr_testutils_enable_low_power(
27  const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_request_sources_t wakeups,
28  dif_pwrmgr_domain_config_t domain_config);
29 
30 /**
31  * Determines if the wakeup reasons is as given.
32  *
33  * @param pwrmgr A power manager handle.
34  * @param reasons A bit mask of reasons.
35  * @return `kOk(res)` where `res` is true when wakeup reasons matches with
36  * `reasons`, otherwise `kInternal`.
37  */
39 status_t pwrmgr_testutils_is_wakeup_reason(
40  const dif_pwrmgr_t *pwrmgr, dif_pwrmgr_request_sources_t reasons);
41 
42 #endif // OPENTITAN_SW_DEVICE_LIB_TESTING_PWRMGR_TESTUTILS_H_