aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/arch/common/odp_time_cpu.c
blob: bbfe82e2131e2649b2ba674b4c0a44473cc286e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* Copyright (c) 2013-2018, Linaro Limited
 * Copyright (c) 2020-2023, Nokia
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#include <odp/api/time_types.h>

#include <odp/api/abi/time_cpu.h>
#include <odp/api/abi/time_cpu_inlines.h>

#include <odp_debug_internal.h>
#include <odp_init_internal.h>

#include <inttypes.h>
#include <stdint.h>
#include <string.h>

#include <odp/visibility_begin.h>

_odp_time_global_t _odp_time_glob;

#include <odp/visibility_end.h>

int _odp_time_init_global(void)
{
	_odp_time_global_t *global = &_odp_time_glob;

	memset(global, 0, sizeof(_odp_time_global_t));

	if (!_odp_time_cpu_global_freq_is_const())
		return -1;

	global->freq_hz  = _odp_time_cpu_global_freq();
	if (global->freq_hz == 0)
		return -1;

	_ODP_PRINT("HW time counter freq: %" PRIu64 " hz\n\n", global->freq_hz);

	global->start_time = _odp_time_cpu_global();
	return 0;
}

int _odp_time_term_global(void)
{
	return 0;
}