blob: b3fd8e83d810c9153c2a79d865f5f7090fc3c6c7 [file] [log] [blame]
Kshitij Sisodiada2ec062022-04-01 14:43:53 +01001/*
2 * Copyright (c) 2022 Arm Limited. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef PLATFORM_PMU_INTERFACE_H
18#define PLATFORM_PMU_INTERFACE_H
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <stdint.h>
25#include <stdbool.h>
26
27#define NUM_PMU_COUNTERS (10) /**< Maximum number of available counters. */
28
29/**
30 * @brief Container for a single unit for a PMU counter.
31 */
32typedef struct _pmu_counter_unit {
33 uint64_t value; /**< Value of the counter expressed as 64 bits unsigned integer. */
34 const char* name; /**< Name for the counter. */
35 const char* unit; /**< Unit that the counter value represents (like cycles, beats, or milliseconds). */
36} pmu_counter_unit;
37
38/**
39 * @brief Container for a an array of counters
40 */
41typedef struct _pmu_counters {
42 pmu_counter_unit counters[NUM_PMU_COUNTERS]; /**< Counter array. */
43 uint32_t num_counters; /**< Number of valid counters. */
44 bool initialised; /**< Initialised or not. */
45} pmu_counters;
46
47/**
48 * @brief Resets the counters.
49 */
50void platform_reset_counters(void);
51
52/**
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010053 * @brief Gets the current counter values.
54 * @param[out] Pointer to a pmu_counters object.
Kshitij Sisodiada2ec062022-04-01 14:43:53 +010055 **/
Kshitij Sisodia4cc40212022-04-08 09:54:53 +010056void platform_get_counters(pmu_counters* counters);
Kshitij Sisodiada2ec062022-04-01 14:43:53 +010057
58#ifdef __cplusplus
59}
60#endif
61
62#endif /* PLATFORM_PMU_INTERFACE_H */