include: Fix performance counters API

This commit is contained in:
aottaviano 2021-06-30 15:58:04 +02:00
parent 6740a0dd08
commit 916bdee9ff
2 changed files with 9 additions and 7 deletions

View file

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

View file

@ -320,7 +320,7 @@ static inline void cpu_perf_start() {
* the rest of the config can be given through conf parameter */ * the rest of the config can be given through conf parameter */
static inline void cpu_perf_stop() { static inline void cpu_perf_stop() {
#ifndef PLP_NO_PERF_COUNTERS #ifndef PLP_NO_PERF_COUNTERS
asm volatile("csrs 0x320, %0" : : "r"(0xffffffff)); asm volatile("csrw 0x320, %0" : : "r"(0xffffffff));
#endif #endif
} }
@ -332,7 +332,7 @@ static inline void cpu_perf_set(unsigned int counterId, unsigned int value) {
/* Set all counters to the specified value */ /* Set all counters to the specified value */
static inline void cpu_perf_setall(unsigned int value) { static inline void cpu_perf_setall(unsigned int value) {
#ifndef PLP_NO_PERF_COUNTERS #ifndef PLP_NO_PERF_COUNTERS
asm volatile("csrw 0x320, %0" : : "r"(value));
#endif #endif
} }