Changeset dc95663e in rtems for c/src/lib/libbsp/arm/tms570/misc/cpucounterread.c
- Timestamp:
- 03/09/17 13:14:42 (7 years ago)
- Branches:
- 5, master
- Children:
- b437a360
- Parents:
- 5ca634e9
- git-author:
- Sebastian Huber <sebastian.huber@…> (03/09/17 13:14:42)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (03/09/17 13:17:52)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/arm/tms570/misc/cpucounterread.c
r5ca634e9 rdc95663e 27 27 */ 28 28 29 #include <stdlib.h> 29 #include <rtems/counter.h> 30 #include <rtems/sysinit.h> 30 31 31 #include <rtems.h>32 32 #include <bsp.h> 33 34 static int cpu_counter_initialized;35 36 33 37 34 /** … … 44 41 * @retval Void 45 42 */ 46 static inline void _CPU_Counter_init_perfcounters(43 static inline void tms570_init_perfcounters( 47 44 int32_t do_reset, 48 45 int32_t enable_divider … … 82 79 * 83 80 */ 84 static void _CPU_Counter_initialize(void)81 static void tms570_cpu_counter_initialize(void) 85 82 { 86 rtems_interrupt_level level;87 88 rtems_interrupt_disable(level);89 90 if ( cpu_counter_initialized ) {91 rtems_interrupt_enable(level);92 return;93 }94 95 83 /* enable user-mode access to the performance counter */ 96 84 asm volatile ("mcr p15, 0, %0, c9, c14, 0\n\t" :: "r"(1)); … … 99 87 asm volatile ("mcr p15, 0, %0, c9, c14, 2\n\t" :: "r"(0x8000000f)); 100 88 101 _CPU_Counter_init_perfcounters(false, false); 102 103 cpu_counter_initialized = 1; 104 105 rtems_interrupt_enable(level); 89 tms570_init_perfcounters(false, false); 90 rtems_counter_initialize_converter(2 * BSP_PLL_OUT_CLOCK); 106 91 } 107 92 … … 117 102 { 118 103 uint32_t ticks; 119 if ( !cpu_counter_initialized ) {120 _CPU_Counter_initialize();121 }122 104 asm volatile ("mrc p15, 0, %0, c9, c13, 0\n": "=r" (ticks)); 123 105 return ticks; 124 106 } 107 108 RTEMS_SYSINIT_ITEM( 109 tms570_cpu_counter_initialize, 110 RTEMS_SYSINIT_BSP_START, 111 RTEMS_SYSINIT_ORDER_FIRST 112 );
Note: See TracChangeset
for help on using the changeset viewer.