MLBEDSW-3094 Improve soft reset of ETHOSU when running jobs
The ETHOSU is soft-reset only if the previous job failed or if
the current privilege level is not user or if the current security
level is not secure.
Change-Id: Id10b96058d67805d179ac693537606d55e10379b
diff --git a/src/ethosu_device.c b/src/ethosu_device.c
index 973caad..85dc022 100644
--- a/src/ethosu_device.c
+++ b/src/ethosu_device.c
@@ -193,6 +193,8 @@
ethosu_write_reg(dev, NPU_REG_RESET, reset.word);
return_code = ethosu_wait_for_reset(dev);
+
+ dev->reset = ethosu_read_reg(dev, NPU_REG_PROT);
#else
UNUSED(dev);
#endif
@@ -618,3 +620,17 @@
return ETHOSU_SUCCESS;
}
+
+bool ethosu_status_has_error(struct ethosu_device *dev)
+{
+ bool status_error = false;
+#if !defined(ARM_NPU_STUB)
+ struct status_r status;
+ status.word = ethosu_read_reg(dev, NPU_REG_STATUS);
+ status_error = ((1 == status.bus_status) || (1 == status.cmd_parse_error) || (1 == status.wd_fault) ||
+ (1 == status.ecc_fault));
+#else
+ UNUSED(dev);
+#endif
+ return status_error;
+}