Changeset 234ecedd in rtems


Ignore:
Timestamp:
Mar 7, 2014, 6:52:12 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
1550242
Parents:
de5d6d0
git-author:
Sebastian Huber <sebastian.huber@…> (03/07/14 06:52:12)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/14/14 07:46:50)
Message:

bsps/leon3: Add interrupt delay profiling support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/clock/ckinit.c

    rde5d6d0 r234ecedd  
    2222#include <bspopts.h>
    2323#include <ambapp.h>
     24#include <rtems/score/profiling.h>
    2425
    2526#if SIMSPARC_FAST_IDLE==1
     
    3637#define CLOCK_VECTOR LEON_TRAP_TYPE( clkirq )
    3738
    38 #define Clock_driver_support_at_tick()
     39static void leon3_clock_profiling_interrupt_delay(void)
     40{
     41#ifdef RTEMS_PROFILING
     42  /*
     43   * We need a small state machine to ignore the first clock interrupt, since
     44   * it contains the sequential system initialization time.  Do the timestamp
     45   * initialization on the fly.
     46   */
     47  static int state = 1;
     48
     49  volatile struct irqmp_timestamp_regs *irqmp_ts =
     50    &LEON3_IrqCtrl_Regs->timestamp[0];
     51  unsigned int s1_s2 = (1U << 25) | (1U << 26);
     52
     53  if (state == 0) {
     54    unsigned int first = irqmp_ts->assertion;
     55    unsigned int second = irqmp_ts->counter;
     56
     57    irqmp_ts->control |= s1_s2;
     58
     59    _Profiling_Update_max_interrupt_delay(_Per_CPU_Get(), second - first);
     60  } else if (state == 1 && leon3_irqmp_has_timestamp(irqmp_ts)) {
     61    unsigned int ks = 1U << 5;
     62
     63    state = 0;
     64
     65    irqmp_ts->control = ks | s1_s2 | (unsigned int) clkirq;
     66  } else if (state == 1) {
     67    state = 2;
     68  }
     69#endif
     70}
     71
     72#define Clock_driver_support_at_tick() \
     73  do { \
     74    leon3_clock_profiling_interrupt_delay(); \
     75  } while (0)
    3976
    4077#if defined(RTEMS_MULTIPROCESSING)
Note: See TracChangeset for help on using the changeset viewer.