blob: 56abf7a5d1301efa0ebd314be9c983e7a504bae8 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Boyan Karatotev4e282422024-10-25 14:34:13 +01002 * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <amu.h>
8#include <amu_private.h>
9#include <arch.h>
Boyan Karatotev4e282422024-10-25 14:34:13 +010010#include <arch_features.h>
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020011#include <arch_helpers.h>
12#include <assert.h>
13
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020014/* Read the group 0 counter identified by the given `idx`. */
johpow01b7d752a2020-10-08 17:29:11 -050015uint64_t amu_group0_cnt_read(unsigned int idx)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020016{
johpow01b7d752a2020-10-08 17:29:11 -050017 assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED);
18 assert(idx < AMU_GROUP0_NR_COUNTERS);
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020019
20 return amu_group0_cnt_read_internal(idx);
21}
22
23/* Read the group 1 counter identified by the given `idx`. */
johpow01b7d752a2020-10-08 17:29:11 -050024uint64_t amu_group1_cnt_read(unsigned int idx)
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020025{
johpow01b7d752a2020-10-08 17:29:11 -050026 assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED);
27 assert(idx < AMU_GROUP1_NR_COUNTERS);
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020028
29 return amu_group1_cnt_read_internal(idx);
30}