summaryrefslogtreecommitdiff
path: root/source/hal/source/platform/mps3/source/timer_mps3.c
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2022-04-08 09:54:53 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2022-04-08 12:30:28 +0100
commit4cc4021d356c174f780be2b7ef96910e36c8dd7b (patch)
treec2a790b914577873a368982a07a9491f6743443e /source/hal/source/platform/mps3/source/timer_mps3.c
parent11b75cc7dc140119dee490f425e25a004122703b (diff)
downloadml-embedded-evaluation-kit-4cc4021d356c174f780be2b7ef96910e36c8dd7b.tar.gz
MLECO-3070: Further HAL cleanup.
Cleaning up HAL sources by removing unnecessary redirections with function pointers. The "platform packages" under HAL are now streamlined enough to not need any major HAL wrapping (as was the case before). This allows us to have a very thin HAL layer that sits on top of the platform and compnent packs. Also helps in getting rid of "hal platform" pointer being passed around in the code to use any HAL functionality. Change-Id: I04b2057f972aad7a5cfb4a396bcdf147c9f9ef1c Signed-off-by: Kshitij Sisodia <kshitij.sisodia@arm.com>
Diffstat (limited to 'source/hal/source/platform/mps3/source/timer_mps3.c')
-rw-r--r--source/hal/source/platform/mps3/source/timer_mps3.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/source/hal/source/platform/mps3/source/timer_mps3.c b/source/hal/source/platform/mps3/source/timer_mps3.c
index 6330269..7ce3002 100644
--- a/source/hal/source/platform/mps3/source/timer_mps3.c
+++ b/source/hal/source/platform/mps3/source/timer_mps3.c
@@ -20,6 +20,8 @@
#include "smm_mps3.h" /* Memory map for MPS3. */
static uint64_t cpu_cycle_count = 0; /* 64-bit cpu cycle counter */
+static const char* unit_cycles = "cycles";
+static const char* unit_ms = "milliseconds";
/**
* @brief Gets the system tick triggered cycle counter for the CPU.
@@ -69,12 +71,10 @@ void platform_reset_counters(void)
#endif /* defined (ARM_NPU) */
}
-pmu_counters platform_get_counters(void)
+void platform_get_counters(pmu_counters* counters)
{
- pmu_counters platform_counters = {
- .num_counters = 0,
- .initialised = true
- };
+ counters->num_counters = 0;
+ counters->initialised = true;
uint32_t i = 0;
#if defined (ARM_NPU)
@@ -84,20 +84,20 @@ pmu_counters platform_get_counters(void)
npu_counters.npu_evt_counters[i].counter_value,
npu_counters.npu_evt_counters[i].name,
npu_counters.npu_evt_counters[i].unit,
- &platform_counters);
+ counters);
}
for (i = 0; i < ETHOSU_DERIVED_NCOUNTERS; ++i) {
add_pmu_counter(
npu_counters.npu_derived_counters[i].counter_value,
npu_counters.npu_derived_counters[i].name,
npu_counters.npu_derived_counters[i].unit,
- &platform_counters);
+ counters);
}
add_pmu_counter(
npu_counters.npu_total_ccnt,
"NPU TOTAL",
- "cycles",
- &platform_counters);
+ unit_cycles,
+ counters);
#endif /* defined (ARM_NPU) */
#if defined(CPU_PROFILE_ENABLED)
@@ -111,14 +111,14 @@ pmu_counters platform_get_counters(void)
add_pmu_counter(
mps3_counters.counter_systick,
"CPU TOTAL",
- "cycles",
- &platform_counters);
+ unit_cycles,
+ counters);
add_pmu_counter(
get_tstamp_milliseconds(&mps3_counters),
"DURATION",
- "milliseconds",
- &platform_counters);
+ unit_ms,
+ counters);
#endif /* defined(CPU_PROFILE_ENABLED) */
#if !defined(CPU_PROFILE_ENABLED)
@@ -129,8 +129,6 @@ pmu_counters platform_get_counters(void)
UNUSED(i);
#endif /* !defined(ARM_NPU) */
#endif /* !defined(CPU_PROFILE_ENABLED) */
-
- return platform_counters;
}
uint32_t get_mps3_core_clock(void)