diff options
author | Kristofer Jonsson <kristofer.jonsson@arm.com> | 2020-10-16 12:33:47 +0200 |
---|---|---|
committer | Kristofer Jonsson <kristofer.jonsson@arm.com> | 2020-10-20 14:33:06 +0200 |
commit | 4dc73dcea25d951971ae306481d1f201c8d6ebdd (patch) | |
tree | 6c9d460f047e9123dda07480a6abb5efbcecb050 /include/ethosu_device.h | |
parent | 5f8dad185b3e3a381fe2e3d16580a8a8e99f9db0 (diff) | |
download | ethos-u-core-driver-4dc73dcea25d951971ae306481d1f201c8d6ebdd.tar.gz |
PMU counter shadow
Storing PMU counters in shadow variables, in case the PMU was powered
off or soft reset.
Change-Id: I64ccf3fb6195f9be2d8315891ec612bb75404885
Diffstat (limited to 'include/ethosu_device.h')
-rw-r--r-- | include/ethosu_device.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/ethosu_device.h b/include/ethosu_device.h index 5edba94..91aa877 100644 --- a/include/ethosu_device.h +++ b/include/ethosu_device.h @@ -54,15 +54,15 @@ enum ethosu_error_codes struct ethosu_device { - uintptr_t base_address; + volatile uint32_t *base_address; uint32_t reset; uint32_t pmcr; - uint64_t pmccntr; + uint32_t pmccntr[2]; uint32_t pmcnten; uint32_t pmint; uint32_t pmccntr_cfg; uint32_t pmu_evcntr[ETHOSU_PMU_NCOUNTERS]; - enum ethosu_pmu_event_type pmu_evtypr[ETHOSU_PMU_NCOUNTERS]; + uint32_t pmu_evtypr[ETHOSU_PMU_NCOUNTERS]; }; struct ethosu_id @@ -378,6 +378,13 @@ 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); /** + * Write register with shadow variable. + * \param[in] address Address to read. + * \param[in] value Value to be written. + */ +void ethosu_write_reg_shadow(struct ethosu_device *dev, uint32_t address, uint32_t value, uint32_t *shadow); + +/** * Save the PMU configuration to ethosu_device struct. * \param[in] dev Ethos-U device where the PMU configuration is * saved. @@ -394,6 +401,14 @@ enum ethosu_error_codes ethosu_save_pmu_config(struct ethosu_device *dev); enum ethosu_error_codes ethosu_restore_pmu_config(struct ethosu_device *dev); /** + * Save PMU counters to shadow variables in memory. + * \param[in] dev Ethos-U device where the PMU configuration is + * stored. + * \return \ref ethosu_error_codes + */ +enum ethosu_error_codes ethosu_save_pmu_counters(struct ethosu_device *dev); + +/** * Check if the STATUS register has any error bits set or not. * \param[in] dev Ethos-U device to check. * \return true if any error bits set, |