zephyr/arch/arc/core/timestamp.c
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00

40 lines
717 B
C

/*
* Copyright (c) 2017 Synopsys, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Time Stamp API for ARCv2
*
* Provide 64-bit time stamp API
*/
#include <kernel.h>
#include <toolchain.h>
#include <kernel_structs.h>
/*
* @brief Read 64-bit timestamp value
*
* This function returns a 64-bit bit time stamp value that is clocked
* at the same frequency as the CPU.
*
* @return 64-bit time stamp value
*/
uint64_t z_tsc_read(void)
{
unsigned int key;
uint64_t t;
uint32_t count;
key = arch_irq_lock();
t = (uint64_t)z_tick_get();
count = z_arc_v2_aux_reg_read(_ARC_V2_TMR0_COUNT);
arch_irq_unlock(key);
t *= k_ticks_to_cyc_floor64(1);
t += (uint64_t)count;
return t;
}