- Timestamp:
- Mar 15, 2016, 1:29:15 PM (5 years ago)
- Branches:
- 5, master
- Children:
- 78c9fe8
- Parents:
- 057154e
- git-author:
- Sebastian Huber <sebastian.huber@…> (03/15/16 13:29:15)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (03/15/16 13:32:16)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/sparc/leon3/clock/ckinit.c
r057154e r5a0b27ed 42 42 static int clkirq; 43 43 44 static bool leon3_tc_use_irqmp;44 static void (*leon3_tc_tick)(void); 45 45 46 46 static rtems_timecounter_simple leon3_tc; 47 47 48 #ifndef RTEMS_SMP 48 49 static uint32_t leon3_tc_get(rtems_timecounter_simple *tc) 49 50 { … … 54 55 { 55 56 return LEON_Is_interrupt_pending(clkirq); 57 } 58 59 static void leon3_tc_at_tick( rtems_timecounter_simple *tc ) 60 { 61 /* Nothing to do */ 56 62 } 57 63 … … 65 71 } 66 72 73 static void leon3_tc_tick_simple(void) 74 { 75 rtems_timecounter_simple_downcounter_tick( 76 &leon3_tc, 77 leon3_tc_get, 78 leon3_tc_at_tick 79 ); 80 } 81 #endif 82 67 83 static uint32_t leon3_tc_get_timecount_irqmp(struct timecounter *tc) 68 84 { … … 70 86 } 71 87 72 static void leon3_clock_profiling_interrupt_delay(void) 88 #ifdef RTEMS_SMP 89 static uint32_t leon3_tc_get_timecount_second_timer(struct timecounter *tc) 90 { 91 return 0xffffffff - LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX + 1].value; 92 } 93 #endif 94 95 static void leon3_tc_tick_irqmp_timestamp(void) 73 96 { 74 97 #ifdef RTEMS_PROFILING … … 91 114 92 115 _Profiling_Update_max_interrupt_delay(_Per_CPU_Get(), second - first); 93 } else if (state == 1 && leon3_irqmp_has_timestamp(irqmp_ts)) {116 } else if (state == 1) { 94 117 unsigned int ks = 1U << 5; 95 118 … … 101 124 } 102 125 #endif 103 } 104 105 static void leon3_tc_at_tick( rtems_timecounter_simple *tc ) 106 { 107 leon3_clock_profiling_interrupt_delay(); 108 } 109 110 static void leon3_tc_tick(void) 111 { 112 if (leon3_tc_use_irqmp) { 113 leon3_clock_profiling_interrupt_delay(); 114 rtems_timecounter_tick(); 115 } else { 116 rtems_timecounter_simple_downcounter_tick( 117 &leon3_tc, 118 leon3_tc_get, 119 leon3_tc_at_tick 120 ); 121 } 126 127 rtems_timecounter_tick(); 128 } 129 130 #ifdef RTEMS_SMP 131 static void leon3_tc_tick_second_timer(void) 132 { 133 rtems_timecounter_tick(); 134 } 135 #endif 136 137 static void leon3_tc_do_tick(void) 138 { 139 (*leon3_tc_tick)(); 122 140 } 123 141 … … 184 202 leon3_tc.tc.tc_frequency = ambapp_freq_get(&ambapp_plb, LEON3_Timer_Adev); 185 203 leon3_tc.tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER; 186 leon3_tc_ use_irqmp = true;204 leon3_tc_tick = leon3_tc_tick_irqmp_timestamp; 187 205 rtems_timecounter_install(&leon3_tc.tc); 188 206 } else { 207 #ifdef RTEMS_SMP 208 /* 209 * The GR712RC for example has no timestamp unit in the interrupt 210 * controller. At least on SMP configurations we must use a second timer 211 * in free running mode for the timecounter. 212 */ 213 LEON3_Timer_Regs->timer[LEON3_CLOCK_INDEX + 1].ctrl = 214 GPTIMER_TIMER_CTRL_EN | GPTIMER_TIMER_CTRL_IE; 215 leon3_tc.tc.tc_get_timecount = leon3_tc_get_timecount_second_timer; 216 leon3_tc.tc.tc_counter_mask = 0xffffffff; 217 leon3_tc.tc.tc_frequency = LEON3_GPTIMER_0_FREQUENCY_SET_BY_BOOT_LOADER; 218 leon3_tc.tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER; 219 leon3_tc_tick = leon3_tc_tick_second_timer; 220 rtems_timecounter_install(&leon3_tc.tc); 221 #else 222 leon3_tc_tick = leon3_tc_tick_simple; 189 223 rtems_timecounter_simple_install( 190 224 &leon3_tc, … … 193 227 leon3_tc_get_timecount 194 228 ); 229 #endif 195 230 } 196 231 } … … 205 240 } while (0) 206 241 207 #define Clock_driver_timecounter_tick() leon3_tc_ tick()242 #define Clock_driver_timecounter_tick() leon3_tc_do_tick() 208 243 209 244 #include "../../../shared/clockdrv_shell.h"
Note: See TracChangeset
for help on using the changeset viewer.