12#ifndef ZEPHYR_INCLUDE_ZEPHYR_PMU_H_
13#define ZEPHYR_INCLUDE_ZEPHYR_PMU_H_
15#include <zephyr/autoconf.h>
19#if defined(CONFIG_ARM64)
20#include <zephyr/arch/arm64/pmuv3.h>
51#define PMU_MAX_COUNTERS 8
void pmu_start(void)
Start counting: enable the PMU globally (implementation-defined).
void pmu_counter_enable(uint32_t counter)
Enable counting on hardware event counter counter.
void pmu_counter_clear_overflow(uint32_t counter)
Clear the overflow flag for hardware event counter counter.
int pmu_counter_config(uint32_t counter, pmu_evt_t event)
Map hardware event counter counter to architectural event event.
bool pmu_counter_overflow(uint32_t counter)
Return whether hardware event counter counter has overflowed since the flag was cleared.
void pmu_stop(void)
Stop counting: disable the PMU globally (implementation-defined).
void pmu_counter_reset(uint32_t counter)
Reset hardware event counter counter to zero.
void pmu_get_info(pmu_info_t *info)
Fill info with PMU identification for the current logical CPU.
void pmu_counter_disable_all(void)
Disable all event counters (and the cycle counter where applicable).
void pmu_counter_disable(uint32_t counter)
Disable counting on hardware event counter counter.
void pmu_counter_enable_all(void)
Enable all implemented event counters (and the cycle counter where applicable).
uint32_t pmu_num_counters(void)
uint64_t pmu_cycle_count(void)
Read the architectural cycle count register (if implemented).
int pmu_init(void)
Initialize the PMU for the current logical CPU.
uint64_t pmu_counter_read(uint32_t counter)
Read the current value of hardware event counter counter.
void pmu_cycle_reset(void)
Reset the cycle count register to zero (implementation-defined).
void pmu_counter_reset_all(void)
Reset all hardware event counters to zero (implementation-defined; may include cycle counter policies...
uint32_t pmu_evt_t
Architectural / backend event selector when no arch supplement defines pmu_evt_t.
Definition pmu.h:25
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
PMU counter configuration entry.
Definition pmu.h:54
pmu_evt_t event
Event (e.g.
Definition pmu.h:56
bool enabled
Enable this counter when configured.
Definition pmu.h:58
Placeholder pmu_info_t when no arch supplement is present.
Definition pmu.h:28
uint32_t implementer
PMU implementer identification value when reported by the backend.
Definition pmu.h:30
uint32_t idcode
PMU part number / ID code when reported by the backend.
Definition pmu.h:32