aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBhavik Patel <bhavik.patel@arm.com>2020-07-15 10:06:43 +0200
committertim.hall <tim.hall@arm.com>2020-07-22 12:21:58 +0000
commit5da4092d07c31acaa3d44ac57fa3b02a3be67182 (patch)
tree04b9a3a61d81fe6ad599bfa55b47315b87fe6ec9 /include
parentf50578199cca79b73596672a4838640130d1aa8f (diff)
downloadethos-u-core-driver-5da4092d07c31acaa3d44ac57fa3b02a3be67182.tar.gz
MLBEDSW-2594 Initialize the Ethos-U before every job
This includes resetting the Ethos-U and restoring the previosuly saved PMU configuration (if any). Change-Id: Id952fb6fef513468952b6a469e857510f8c0214c
Diffstat (limited to 'include')
-rw-r--r--include/ethosu_device.h23
-rw-r--r--include/pmu_ethosu.h1
2 files changed, 23 insertions, 1 deletions
diff --git a/include/ethosu_device.h b/include/ethosu_device.h
index 46772ba..81f24a9 100644
--- a/include/ethosu_device.h
+++ b/include/ethosu_device.h
@@ -22,6 +22,9 @@
* Includes
******************************************************************************/
+#include "pmu_ethosu.h"
+
+#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
@@ -51,6 +54,10 @@ enum ethosu_error_codes
struct ethosu_device
{
uintptr_t base_address;
+ bool restore_pmu_config;
+ uint64_t pmccntr;
+ uint32_t pmu_evcntr[ETHOSU_PMU_NCOUNTERS];
+ enum ethosu_pmu_event_type pmu_evtypr[ETHOSU_PMU_NCOUNTERS];
};
struct ethosu_id
@@ -355,6 +362,22 @@ uint32_t ethosu_read_reg(struct ethosu_device *dev, uint32_t address);
void ethosu_write_reg(struct ethosu_device *dev, uint32_t address, uint32_t value);
+/**
+ * Save the PMU configuration to ethosu_device struct.
+ * \param[in] dev Ethos-U device where the PMU configuration is
+ * saved.
+ * \return \ref ethosu_error_codes
+ */
+enum ethosu_error_codes ethosu_save_pmu_config(struct ethosu_device *dev);
+
+/**
+ * Restore the PMU configuration from a ethosu_device struct.
+ * \param[in] dev Ethos-U device where the PMU configuration is
+ * stored.
+ * \return \ref ethosu_error_codes
+ */
+enum ethosu_error_codes ethosu_restore_pmu_config(struct ethosu_device *dev);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/pmu_ethosu.h b/include/pmu_ethosu.h
index e83b879..41614e7 100644
--- a/include/pmu_ethosu.h
+++ b/include/pmu_ethosu.h
@@ -19,7 +19,6 @@
#ifndef PMU_ETHOSU_H
#define PMU_ETHOSU_H
-#include "ethosu_device.h"
#include <stdint.h>
#ifdef __cplusplus