[sw/dif_pwrmgr] Update missing bit fields
Add one bit each to reset_info and wakeup.
Update dif_pwrmgr_unittest.cc.
Signed-off-by: Guillermo Maturana <maturana@google.com>
diff --git a/sw/device/lib/dif/dif_pwrmgr.c b/sw/device/lib/dif/dif_pwrmgr.c
index c552564..767941c 100644
--- a/sw/device/lib/dif/dif_pwrmgr.c
+++ b/sw/device/lib/dif/dif_pwrmgr.c
@@ -83,6 +83,9 @@
static_assert(kDifPwrmgrWakeupRequestSourceFive ==
(1u << PWRMGR_PARAM_AON_TIMER_WKUP_REQ_IDX),
"Layout of WAKE_INFO register changed.");
+static_assert(kDifPwrmgrWakeupRequestSourceSix ==
+ (1u << PWRMGR_PARAM_WKUP_REQ_IDX),
+ "Layout of WAKE_INFO register changed.");
/**
* Relevant bits of the RESET_EN register must start at `0` and be in the same
@@ -91,6 +94,9 @@
static_assert(kDifPwrmgrResetRequestSourceOne ==
(1u << PWRMGR_RESET_EN_EN_0_BIT),
"Layout of RESET_EN register changed.");
+static_assert(kDifPwrmgrResetRequestSourceTwo ==
+ (1u << PWRMGR_RESET_EN_EN_1_BIT),
+ "Layout of RESET_EN register changed.");
/**
* `dif_pwrmgr_irq_t` constants must match the corresponding generated values.
@@ -129,7 +135,8 @@
kDifPwrmgrWakeupRequestSourceTwo |
kDifPwrmgrWakeupRequestSourceThree |
kDifPwrmgrWakeupRequestSourceFour |
- kDifPwrmgrWakeupRequestSourceFive,
+ kDifPwrmgrWakeupRequestSourceFive |
+ kDifPwrmgrWakeupRequestSourceSix,
.index = 0,
},
},
@@ -141,7 +148,8 @@
.cur_req_sources_reg_offset = PWRMGR_RESET_STATUS_REG_OFFSET,
.bitfield =
{
- .mask = kDifPwrmgrResetRequestSourceOne,
+ .mask = kDifPwrmgrResetRequestSourceOne |
+ kDifPwrmgrResetRequestSourceTwo,
.index = 0,
},
},
diff --git a/sw/device/lib/dif/dif_pwrmgr.h b/sw/device/lib/dif/dif_pwrmgr.h
index 81d7442..b292b7a 100644
--- a/sw/device/lib/dif/dif_pwrmgr.h
+++ b/sw/device/lib/dif/dif_pwrmgr.h
@@ -131,6 +131,7 @@
kDifPwrmgrWakeupRequestSourceThree = (1u << 2),
kDifPwrmgrWakeupRequestSourceFour = (1u << 3),
kDifPwrmgrWakeupRequestSourceFive = (1u << 4),
+ kDifPwrmgrWakeupRequestSourceSix = (1u << 5),
} dif_pwrmgr_wakeup_request_source_t;
/**
@@ -145,6 +146,7 @@
*/
typedef enum dif_pwrmgr_reset_request_source {
kDifPwrmgrResetRequestSourceOne = (1u << 0),
+ kDifPwrmgrResetRequestSourceTwo = (1u << 1),
} dif_pwrmgr_reset_request_source_t;
/**
diff --git a/sw/device/lib/dif/dif_pwrmgr_unittest.cc b/sw/device/lib/dif/dif_pwrmgr_unittest.cc
index a192e8c..b739574 100644
--- a/sw/device/lib/dif/dif_pwrmgr_unittest.cc
+++ b/sw/device/lib/dif/dif_pwrmgr_unittest.cc
@@ -600,7 +600,7 @@
dif_pwrmgr_wakeup_reason_t exp_output;
};
- std::array<TestCase, 5> test_cases = {{
+ std::array<TestCase, 10> test_cases = {{
// No bits set.
{
.read_val = {{
@@ -624,21 +624,38 @@
.value = 1,
},
{
+ .offset = PWRMGR_PARAM_AON_SYSRST_CTRL_WKUP_REQ_IDX,
+ .value = 1,
+ },
+ {
.offset = PWRMGR_PARAM_DEBUG_CABLE_WAKEUP_IDX,
.value = 1,
},
{
.offset = PWRMGR_PARAM_AON_WKUP_REQ_IDX,
.value = 1,
+ },
+ {
+ .offset = PWRMGR_PARAM_USB_WKUP_REQ_IDX,
+ .value = 1,
+ },
+ {
+ .offset = PWRMGR_PARAM_AON_TIMER_WKUP_REQ_IDX,
+ .value = 1,
+ },
+ {
+ .offset = PWRMGR_PARAM_WKUP_REQ_IDX,
+ .value = 1,
}},
- .exp_output =
- {
- .types = kDifPwrmgrWakeupTypeAbort |
- kDifPwrmgrWakeupTypeFallThrough |
- kDifPwrmgrWakeupTypeRequest,
- .request_sources = kDifPwrmgrWakeupRequestSourceTwo |
- kDifPwrmgrWakeupRequestSourceThree,
- },
+ .exp_output = {.types = kDifPwrmgrWakeupTypeAbort |
+ kDifPwrmgrWakeupTypeFallThrough |
+ kDifPwrmgrWakeupTypeRequest,
+ .request_sources = kDifPwrmgrWakeupRequestSourceOne |
+ kDifPwrmgrWakeupRequestSourceTwo |
+ kDifPwrmgrWakeupRequestSourceThree |
+ kDifPwrmgrWakeupRequestSourceFour |
+ kDifPwrmgrWakeupRequestSourceFive |
+ kDifPwrmgrWakeupRequestSourceSix},
},
// Only abort.
{
@@ -667,6 +684,17 @@
// Only requests from peripherals.
{
.read_val = {{
+ .offset = PWRMGR_PARAM_AON_SYSRST_CTRL_WKUP_REQ_IDX,
+ .value = 1,
+ }},
+ .exp_output =
+ {
+ .types = kDifPwrmgrWakeupTypeRequest,
+ .request_sources = kDifPwrmgrWakeupRequestSourceOne,
+ },
+ },
+ {
+ .read_val = {{
.offset = PWRMGR_PARAM_DEBUG_CABLE_WAKEUP_IDX,
.value = 1,
}},
@@ -676,6 +704,50 @@
.request_sources = kDifPwrmgrWakeupRequestSourceTwo,
},
},
+ {
+ .read_val = {{
+ .offset = PWRMGR_PARAM_AON_WKUP_REQ_IDX,
+ .value = 1,
+ }},
+ .exp_output =
+ {
+ .types = kDifPwrmgrWakeupTypeRequest,
+ .request_sources = kDifPwrmgrWakeupRequestSourceThree,
+ },
+ },
+ {
+ .read_val = {{
+ .offset = PWRMGR_PARAM_USB_WKUP_REQ_IDX,
+ .value = 1,
+ }},
+ .exp_output =
+ {
+ .types = kDifPwrmgrWakeupTypeRequest,
+ .request_sources = kDifPwrmgrWakeupRequestSourceFour,
+ },
+ },
+ {
+ .read_val = {{
+ .offset = PWRMGR_PARAM_AON_TIMER_WKUP_REQ_IDX,
+ .value = 1,
+ }},
+ .exp_output =
+ {
+ .types = kDifPwrmgrWakeupTypeRequest,
+ .request_sources = kDifPwrmgrWakeupRequestSourceFive,
+ },
+ },
+ {
+ .read_val = {{
+ .offset = PWRMGR_PARAM_WKUP_REQ_IDX,
+ .value = 1,
+ }},
+ .exp_output =
+ {
+ .types = kDifPwrmgrWakeupTypeRequest,
+ .request_sources = kDifPwrmgrWakeupRequestSourceSix,
+ },
+ },
}};
for (const auto &test_case : test_cases) {