Changeset 291945f1 in rtems
- Timestamp:
- 06/21/16 08:58:04 (7 years ago)
- Branches:
- 5, master
- Children:
- a4ff2a2
- Parents:
- 9460333e
- git-author:
- Sebastian Huber <sebastian.huber@…> (06/21/16 08:58:04)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (06/21/16 13:54:18)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
r9460333e r291945f1 93 93 #endif 94 94 95 #ifdef RTEMS_PROFILING 96 #define IRQMP_TIMESTAMP_S1_S2 ((1U << 25) | (1U << 26)) 97 95 98 static void leon3_tc_tick_irqmp_timestamp(void) 99 { 100 volatile struct irqmp_timestamp_regs *irqmp_ts = 101 &LEON3_IrqCtrl_Regs->timestamp[0]; 102 unsigned int first = irqmp_ts->assertion; 103 unsigned int second = irqmp_ts->counter; 104 105 irqmp_ts->control |= IRQMP_TIMESTAMP_S1_S2; 106 107 _Profiling_Update_max_interrupt_delay(_Per_CPU_Get(), second - first); 108 109 rtems_timecounter_tick(); 110 } 111 #endif 112 113 static void leon3_tc_tick_irqmp_timestamp_init(void) 96 114 { 97 115 #ifdef RTEMS_PROFILING 98 116 /* 99 * We need a small state machine to ignore the first clock interrupt, since 100 * it contains the sequential system initialization time. Do the timestamp 101 * initialization on the fly. 117 * Ignore the first clock interrupt, since it contains the sequential system 118 * initialization time. Do the timestamp initialization on the fly. 102 119 */ 103 static int state = 1; 120 121 #ifdef RTEMS_SMP 122 static Atomic_Uint counter = ATOMIC_INITIALIZER_UINT(0); 123 124 bool done = 125 _Atomic_Fetch_add_uint(&counter, 1, ATOMIC_ORDER_RELAXED) 126 == rtems_get_processor_count() - 1; 127 #else 128 bool done = true; 129 #endif 104 130 105 131 volatile struct irqmp_timestamp_regs *irqmp_ts = 106 132 &LEON3_IrqCtrl_Regs->timestamp[0]; 107 unsigned int s1_s2 = (1U << 25) | (1U << 26); 108 109 if (state == 0) { 110 unsigned int first = irqmp_ts->assertion; 111 unsigned int second = irqmp_ts->counter; 112 113 irqmp_ts->control |= s1_s2; 114 115 _Profiling_Update_max_interrupt_delay(_Per_CPU_Get(), second - first); 116 } else if (state == 1) { 117 unsigned int ks = 1U << 5; 118 119 state = 0; 120 121 irqmp_ts->control = ks | s1_s2 | (unsigned int) clkirq; 122 } else if (state == 1) { 123 state = 2; 133 unsigned int ks = 1U << 5; 134 135 irqmp_ts->control = ks | IRQMP_TIMESTAMP_S1_S2 | (unsigned int) clkirq; 136 137 if (done) { 138 leon3_tc_tick = leon3_tc_tick_irqmp_timestamp; 124 139 } 125 140 #endif … … 202 217 leon3_tc.tc.tc_frequency = ambapp_freq_get(&ambapp_plb, LEON3_Timer_Adev); 203 218 leon3_tc.tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER; 204 leon3_tc_tick = leon3_tc_tick_irqmp_timestamp ;219 leon3_tc_tick = leon3_tc_tick_irqmp_timestamp_init; 205 220 rtems_timecounter_install(&leon3_tc.tc); 206 221 } else {
Note: See TracChangeset
for help on using the changeset viewer.