about FAST_IDLE in Clock_isr

朱忠杰 zhongjiezhu1 at gmail.com
Fri Aug 14 02:49:00 UTC 2020


Hi, everyone

Is there any consideration why the FAST_IDLE is separated from normal
path,can I change the FAST_IDLE like the following?

#if defined(BSP_FEATURE_IRQ_EXTENSION) || \
    (CPU_SIMPLE_VECTORED_INTERRUPTS != TRUE)
void Clock_isr(void *arg);
void Clock_isr(void *arg)
{
#else
rtems_isr Clock_isr(rtems_vector_number vector);
rtems_isr Clock_isr(
  rtems_vector_number vector
)
{
#endif
  /*
   *  Accurate count of ISRs
   */
  Clock_driver_ticks += 1;

  #if CLOCK_DRIVER_ISRS_PER_TICK
    /*
     *  The driver is multiple ISRs per clock tick.
     */
    if ( !Clock_driver_isrs ) {
      Clock_driver_timecounter_tick();

      Clock_driver_isrs = CLOCK_DRIVER_ISRS_PER_TICK_VALUE;
    }
    Clock_driver_isrs--;
  #else
    /*
     *  The driver is one ISR per clock tick.
     */
    Clock_driver_timecounter_tick();

    #if CLOCK_DRIVER_USE_FAST_IDLE
      if (_SMP_Get_processor_maximum() == 1) {
        struct timecounter *tc;
        uint64_t            us_per_tick;
        uint32_t            interval;
        Per_CPU_Control    *cpu_self;

        cpu_self = _Per_CPU_Get();
        tc = _Timecounter;
        us_per_tick = rtems_configuration_get_microseconds_per_tick();
        interval = (uint32_t) ((tc->tc_frequency * us_per_tick) / 1000000);

        while (
          cpu_self->thread_dispatch_disable_level == cpu_self->isr_nest_level
            && cpu_self->heir == cpu_self->executing
            && cpu_self->executing->is_idle
        ) {
          ISR_lock_Context lock_context;

          _Timecounter_Acquire(&lock_context);
          _Timecounter_Tick_simple(
            interval,
            (*tc->tc_get_timecount)(tc),
            &lock_context
          );
        }
      }
    #endif
  #endif
    /*
     *  Do the hardware specific per-tick action.
     *
     *  The counter/timer may or may not be set to automatically reload.
     */
    Clock_driver_support_at_tick();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Clock_isr.diff
Type: text/x-patch
Size: 1681 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200814/a5117134/attachment.bin>


More information about the devel mailing list