Fix performance counters API

This commit is contained in:
aottaviano 2021-06-30 15:58:04 +02:00 committed by bluew
parent 8891d83838
commit e4fa83f99e
2 changed files with 9 additions and 7 deletions

View file

@ -179,6 +179,8 @@ static inline void perf_reset(void) {
perf_stop();
cpu_perf_setall(0);
perf_start();
#elif defined(__cv32e40p__)
cpu_perf_setall(0xffffffff);
#endif
// TODO this is failing on most targets, please include that also for specific ones
#if 0
@ -221,13 +223,13 @@ static inline void plp_power_init() {
static inline void plp_power_start() {
#if PULP_CHIP == CHIP_PULP4
set_gpio_pin_value(PIN_CAM_I2S_SDI1+1, 1);
set_gpio_pin_value(PIN_CAM_I2S_SDI1+1, 1);
#endif
}
static inline void plp_power_stop() {
#if PULP_CHIP == CHIP_PULP4
set_gpio_pin_value(PIN_CAM_I2S_SDI1+1, 0);
set_gpio_pin_value(PIN_CAM_I2S_SDI1+1, 0);
#endif
}

View file

@ -59,7 +59,7 @@ static inline unsigned int hal_spr_read(unsigned int reg)
#if defined(__LLVM__)
#else
#define hal_spr_read_then_clr(reg,val) \
({ \
int state; \
@ -255,7 +255,7 @@ static inline void hal_irq_enable()
/*
* PERFORMANCE COUNTERS
*
*
* API for accessing performance counters registers.
* Have a look at CV32E40P specifications.
* We implement two not-configurable perf counters: MCYCLE and MISNTR plus a configurable counter
@ -320,19 +320,19 @@ static inline void cpu_perf_start() {
* the rest of the config can be given through conf parameter */
static inline void cpu_perf_stop() {
#ifndef PLP_NO_PERF_COUNTERS
asm volatile("csrs 0x320, %0" : : "r"(0xffffffff));
asm volatile("csrw 0x320, %0" : : "r"(0xffffffff));
#endif
}
/* Set the specified counter to the specified value */
static inline void cpu_perf_set(unsigned int counterId, unsigned int value) {
}
/* Set all counters to the specified value */
static inline void cpu_perf_setall(unsigned int value) {
#ifndef PLP_NO_PERF_COUNTERS
asm volatile("csrw 0x320, %0" : : "r"(value));
#endif
}