From 4dc73dcea25d951971ae306481d1f201c8d6ebdd Mon Sep 17 00:00:00 2001 From: Kristofer Jonsson Date: Fri, 16 Oct 2020 12:33:47 +0200 Subject: PMU counter shadow Storing PMU counters in shadow variables, in case the PMU was powered off or soft reset. Change-Id: I64ccf3fb6195f9be2d8315891ec612bb75404885 --- src/ethosu_driver.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/ethosu_driver.c') diff --git a/src/ethosu_driver.c b/src/ethosu_driver.c index 6c55b0b..77b8727 100644 --- a/src/ethosu_driver.c +++ b/src/ethosu_driver.c @@ -149,7 +149,7 @@ struct opt_cfg_s ******************************************************************************/ struct ethosu_driver ethosu_drv = { - .dev = {.base_address = NULL, .reset = 0, .pmccntr = 0, .pmu_evcntr = {0, 0, 0, 0}, .pmu_evtypr = {0, 0, 0, 0}}, + .dev = {.base_address = NULL, .reset = 0, .pmccntr = {0}, .pmu_evcntr = {0, 0, 0, 0}, .pmu_evtypr = {0, 0, 0, 0}}, .abort_inference = false, .status_error = false}; @@ -419,7 +419,7 @@ int ethosu_invoke_v2(const void *custom_data_ptr, if (!ethosu_drv.status_error) { - ethosu_save_pmu_config(ðosu_drv.dev); + ethosu_save_pmu_counters(ðosu_drv.dev); ethosu_set_clock_and_power(ðosu_drv.dev, ETHOSU_CLOCK_Q_ENABLE, ETHOSU_POWER_Q_ENABLE); } @@ -580,17 +580,14 @@ static int handle_command_stream(struct ethosu_driver *drv, return -1; } - // ETHOSU would have been reset in the IRQ handler if there were - // status error(s). So don't read the QREAD register. (void)ethosu_get_qread(&drv->dev, &qread); if (qread != cms_bytes) { - LOG_ERR( + LOG_WARN( "Failure: IRQ received but qread (%" PRIu32 ") not at end of stream (%" PRIu32 ").\n", qread, cms_bytes); return -1; } - // TODO Power off return 0; } -- cgit v1.2.1