diff options
author | Bhavik Patel <bhavik.patel@arm.com> | 2020-07-15 10:06:43 +0200 |
---|---|---|
committer | tim.hall <tim.hall@arm.com> | 2020-07-22 12:21:58 +0000 |
commit | 5da4092d07c31acaa3d44ac57fa3b02a3be67182 (patch) | |
tree | 04b9a3a61d81fe6ad599bfa55b47315b87fe6ec9 /src/ethosu_driver.c | |
parent | f50578199cca79b73596672a4838640130d1aa8f (diff) | |
download | ethos-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 'src/ethosu_driver.c')
-rw-r--r-- | src/ethosu_driver.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ethosu_driver.c b/src/ethosu_driver.c index 1a9337e..9d74980 100644 --- a/src/ethosu_driver.c +++ b/src/ethosu_driver.c @@ -29,7 +29,12 @@ #include <stdio.h> #include <stdlib.h> -struct ethosu_driver ethosu_drv = {.dev = {.base_address = NULL}, .abort_inference = false}; +struct ethosu_driver ethosu_drv = {.dev = {.base_address = NULL, + .restore_pmu_config = false, + .pmccntr = 0, + .pmu_evcntr = {0, 0, 0, 0}, + .pmu_evtypr = {0, 0, 0, 0}}, + .abort_inference = false}; // IRQ static volatile bool irq_triggered = false; @@ -276,6 +281,7 @@ int ethosu_invoke(const void *custom_data_ptr, int custom_data_32bit_size = (custom_data_size / BYTES_IN_32_BITS - CUSTOM_OPTION_LENGTH_32_BIT_WORD); ethosu_set_clock_and_power(ðosu_drv.dev, ETHOSU_CLOCK_Q_ENABLE, ETHOSU_POWER_Q_DISABLE); + ethosu_restore_pmu_config(ðosu_drv.dev); while (data_ptr < (data_start_ptr + custom_data_32bit_size)) { int ret = 0; @@ -337,6 +343,7 @@ int ethosu_invoke(const void *custom_data_ptr, break; } } + ethosu_save_pmu_config(ðosu_drv.dev); ethosu_set_clock_and_power(ðosu_drv.dev, ETHOSU_CLOCK_Q_ENABLE, ETHOSU_POWER_Q_ENABLE); return return_code; } |