mirror of
https://github.com/saymrwulf/pulp-runtime.git
synced 2026-07-29 20:14:10 +00:00
include: Fix performance counters API
This commit is contained in:
parent
6740a0dd08
commit
916bdee9ff
2 changed files with 9 additions and 7 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ static inline unsigned int hal_spr_read(unsigned int reg)
|
||||||
#if defined(__LLVM__)
|
#if defined(__LLVM__)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define hal_spr_read_then_clr(reg,val) \
|
#define hal_spr_read_then_clr(reg,val) \
|
||||||
({ \
|
({ \
|
||||||
int state; \
|
int state; \
|
||||||
|
|
@ -255,7 +255,7 @@ static inline void hal_irq_enable()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PERFORMANCE COUNTERS
|
* PERFORMANCE COUNTERS
|
||||||
*
|
*
|
||||||
* API for accessing performance counters registers.
|
* API for accessing performance counters registers.
|
||||||
* Have a look at CV32E40P specifications.
|
* Have a look at CV32E40P specifications.
|
||||||
* We implement two not-configurable perf counters: MCYCLE and MISNTR plus a configurable counter
|
* 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 */
|
* 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
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the specified counter to the specified value */
|
/* Set the specified counter to the specified value */
|
||||||
static inline void cpu_perf_set(unsigned int counterId, unsigned int value) {
|
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue