Changeset 222d6879 in rtems


Ignore:
Timestamp:
Apr 16, 2020, 12:14:12 PM (8 months ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
5, master
Children:
396e9830
Parents:
3d73642
git-author:
Christian Mauderer <christian.mauderer@…> (04/16/20 12:14:12)
git-committer:
Christian Mauderer <christian.mauderer@…> (04/20/20 07:07:35)
Message:

bsps/arm: Fix uninitialized value in generic timer

_CPU_Counter_frequency() can be called by the rtems_counter
initialization before arm_gt_clock_initialize() initializes the value
used in _CPU_Counter_frequency().

Closes #3961.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/arm/shared/clock/clock-generic-timer.c

    r3d73642 r222d6879  
    149149  struct timecounter *tc;
    150150
    151   frequency = arm_gt_clock_instance.interval;
     151  tc = &arm_gt_clock_instance.tc;
     152  frequency = tc->tc_frequency;
    152153  us_per_tick = rtems_configuration_get_microseconds_per_tick();
    153154  interval = (uint32_t) ((frequency * us_per_tick) / 1000000);
     
    159160  arm_gt_clock_secondary_initialization(cval);
    160161
    161   tc = &arm_gt_clock_instance.tc;
    162162  tc->tc_get_timecount = arm_gt_clock_get_timecount;
    163163  tc->tc_counter_mask = 0xffffffff;
    164   tc->tc_frequency = frequency;
    165164  tc->tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER;
    166165  rtems_timecounter_install(tc);
     
    179178static void arm_gt_clock_early_init(void)
    180179{
     180  uint32_t frequency;
    181181  arm_gt_clock_set_control(0x3);
    182182
    183183  arm_generic_timer_get_config(
    184     &arm_gt_clock_instance.interval,
     184    &frequency,
    185185    &arm_gt_clock_instance.irq
    186186  );
     187
     188  /*
     189   * Used by _CPU_Counter_frequency() before arm_gt_clock_initialize() is
     190   * called.
     191   */
     192  arm_gt_clock_instance.tc.tc_frequency = frequency;
    187193}
    188194
Note: See TracChangeset for help on using the changeset viewer.