Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
Boyan Karatotev | 4e28242 | 2024-10-25 14:34:13 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2024, Arm Limited. All rights reserved. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <amu.h> |
| 8 | #include <amu_private.h> |
| 9 | #include <arch.h> |
Boyan Karatotev | 4e28242 | 2024-10-25 14:34:13 +0100 | [diff] [blame] | 10 | #include <arch_features.h> |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 11 | #include <arch_helpers.h> |
| 12 | #include <assert.h> |
| 13 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 14 | /* Read the group 0 counter identified by the given `idx`. */ |
johpow01 | b7d752a | 2020-10-08 17:29:11 -0500 | [diff] [blame] | 15 | uint64_t amu_group0_cnt_read(unsigned int idx) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 16 | { |
johpow01 | b7d752a | 2020-10-08 17:29:11 -0500 | [diff] [blame] | 17 | assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED); |
| 18 | assert(idx < AMU_GROUP0_NR_COUNTERS); |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 19 | |
| 20 | return amu_group0_cnt_read_internal(idx); |
| 21 | } |
| 22 | |
| 23 | /* Read the group 1 counter identified by the given `idx`. */ |
johpow01 | b7d752a | 2020-10-08 17:29:11 -0500 | [diff] [blame] | 24 | uint64_t amu_group1_cnt_read(unsigned int idx) |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 25 | { |
johpow01 | b7d752a | 2020-10-08 17:29:11 -0500 | [diff] [blame] | 26 | assert(amu_get_version() != ID_PFR0_AMU_NOT_SUPPORTED); |
| 27 | assert(idx < AMU_GROUP1_NR_COUNTERS); |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 28 | |
| 29 | return amu_group1_cnt_read_internal(idx); |
| 30 | } |