Add support for resuming at PC in dif_ml_top
Change-Id: I0d148afddfb6f47c905fe8475718b58c820d8c62
diff --git a/sw/device/lib/dif/dif_ml_top.c b/sw/device/lib/dif/dif_ml_top.c
index f2ca845..9580874 100644
--- a/sw/device/lib/dif/dif_ml_top.c
+++ b/sw/device/lib/dif/dif_ml_top.c
@@ -45,6 +45,19 @@
return kDifOk;
}
+dif_result_t dif_ml_top_resume_ctrl_en(const dif_ml_top_t *ml_top, uint32_t pc) {
+ if (ml_top == NULL) {
+ return kDifBadArg;
+ }
+ if (pc >= 0x400000) {
+ return kDifBadArg;
+ }
+ uint32_t ctrl_en = 0;
+ ctrl_en = bitfield_field32_write(ctrl_en, ML_TOP_CTRL_PC_START_FIELD, pc);
+ mmio_region_write32(ml_top->base_addr, ML_TOP_CTRL_REG_OFFSET, ctrl_en);
+ return kDifOk;
+}
+
dif_result_t dif_ml_top_read_ctrl_en(const dif_ml_top_t *ml_top, uint32_t *result) {
if (ml_top == NULL) {
return kDifBadArg;
diff --git a/sw/device/lib/dif/dif_ml_top.h b/sw/device/lib/dif/dif_ml_top.h
index 81f079c..57ed19e 100644
--- a/sw/device/lib/dif/dif_ml_top.h
+++ b/sw/device/lib/dif/dif_ml_top.h
@@ -34,6 +34,7 @@
// ML_Top Control Register
dif_result_t dif_ml_top_reset_ctrl_en(const dif_ml_top_t *ml_top);
dif_result_t dif_ml_top_release_ctrl_en(const dif_ml_top_t *ml_top);
+dif_result_t dif_ml_top_resume_ctrl_en(const dif_ml_top_t *ml_top, uint32_t pc);
dif_result_t dif_ml_top_read_ctrl_en(const dif_ml_top_t *ml_top,
uint32_t *result);