5
Last change
on this file since d7a9eb90 was
d7a9eb90,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/24/18 at 05:42:33
|
bsps: Move armv7m-cpucounter.c to bsps
This patch is a part of the BSP source reorganization.
Update #3285.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * Copyright (c) 2016 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #include <rtems/score/armv7m.h> |
---|
16 | #include <rtems/counter.h> |
---|
17 | #include <rtems/sysinit.h> |
---|
18 | |
---|
19 | #include <bsp.h> |
---|
20 | #include <bsp/fatal.h> |
---|
21 | |
---|
22 | CPU_Counter_ticks _CPU_Counter_read(void) |
---|
23 | { |
---|
24 | volatile ARMV7M_DWT *dwt = _ARMV7M_DWT; |
---|
25 | |
---|
26 | return dwt->cyccnt; |
---|
27 | } |
---|
28 | |
---|
29 | static void armv7m_cpu_counter_initialize(void) |
---|
30 | { |
---|
31 | bool cyccnt_enabled; |
---|
32 | |
---|
33 | cyccnt_enabled = _ARMV7M_DWT_Enable_CYCCNT(); |
---|
34 | |
---|
35 | if (cyccnt_enabled) { |
---|
36 | #ifdef BSP_ARMV7M_SYSTICK_FREQUENCY |
---|
37 | uint64_t freq = BSP_ARMV7M_SYSTICK_FREQUENCY; |
---|
38 | #else |
---|
39 | volatile ARMV7M_Systick *systick = _ARMV7M_Systick; |
---|
40 | uint64_t freq = ARMV7M_SYSTICK_CALIB_TENMS_GET(systick->calib) * 100ULL; |
---|
41 | #endif |
---|
42 | |
---|
43 | rtems_counter_initialize_converter(freq); |
---|
44 | } else { |
---|
45 | bsp_fatal(BSP_ARM_ARMV7M_CPU_COUNTER_INIT); |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | RTEMS_SYSINIT_ITEM( |
---|
50 | armv7m_cpu_counter_initialize, |
---|
51 | RTEMS_SYSINIT_BSP_START, |
---|
52 | RTEMS_SYSINIT_ORDER_FIRST |
---|
53 | ); |
---|
Note: See
TracBrowser
for help on using the repository browser.