aboutsummaryrefslogtreecommitdiff
path: root/src/ethosu_device.c
diff options
context:
space:
mode:
authorBhavik Patel <bhavik.patel@arm.com>2020-09-30 09:06:52 +0200
committerBhavik Patel <bhavik.patel@arm.com>2020-10-16 12:52:43 +0200
commit5f8dad185b3e3a381fe2e3d16580a8a8e99f9db0 (patch)
treeb7f7686f5fa9ee6b5850b9a273d6e383ec0d0a06 /src/ethosu_device.c
parent51c18bac97dc3ae3393a786999f4602ca11c22f7 (diff)
downloadethos-u-core-driver-5f8dad185b3e3a381fe2e3d16580a8a8e99f9db0.tar.gz
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
Diffstat (limited to 'src/ethosu_device.c')
-rw-r--r--src/ethosu_device.c16
1 files changed, 16 insertions, 0 deletions
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 @@ enum ethosu_error_codes ethosu_soft_reset(struct ethosu_device *dev)
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 @@ enum ethosu_error_codes ethosu_restore_pmu_config(struct ethosu_device *dev)
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;
+}