summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/tms570/include/system-clocks.h
blob: 0e1d1301d4c16ff5ae2b5d80e97a98964306ac21 (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
 * @file benchmark_timer.c
 *
 * @ingroup tms570
 *
 * @brief System clocks.
 */

/*
 * Copyright (c) 2014 Pavel Pisa <pisa@cmp.felk.cvut.cz>
 *
 * Czech Technical University in Prague
 * Zikova 1903/4
 * 166 36 Praha 6
 * Czech Republic
 *
 * Based on LPC24xx and LPC1768 BSP
 * by embedded brains GmbH and others
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.org/license/LICENSE.
 */

#ifndef LIBBSP_ARM_TMS570_SYSTEM_CLOCKS_H
#define LIBBSP_ARM_TMS570_SYSTEM_CLOCKS_H

#include <bsp/tms570-rti.h>

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/**
 * @defgroup tms570_clock System Clocks
 *
 * @ingroup tms570
 *
 * @brief System clocks.
 *
 * @{
 */

/**
 * @brief Returns current standard timer value in microseconds.
 *
 * This function uses RTI module free running counter 0 used
 * which is used as system tick timebase as well.
 */
static inline unsigned tms570_timer(void)
{
  uint32_t actual_fcr0 = TMS570_RTI.CNT[0].FRCx;
  return actual_fcr0;
}

/** @} */

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* LIBBSP_ARM_TMS570_SYSTEM_CLOCKS_H */