Changeset 958d517 in rtems


Ignore:
Timestamp:
09/15/23 14:20:47 (6 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
36b935f1
Parents:
601b84c7
git-author:
Sebastian Huber <sebastian.huber@…> (09/15/23 14:20:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/20/23 09:20:14)
Message:

bsps/leon3: Use DSU time tag for GR712RC

Close #4954.

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • bsps/sparc/leon3/start/cpucounter.c

    r601b84c7 r958d517  
    7878#define LEON3_GET_TIMECOUNT_INIT leon3_timecounter_get_asr_22_23_up_counter
    7979
    80 #else /* !LEON3_HAS_ASR_22_23_UP_COUNTER */
     80#elif defined(LEON3_DSU_BASE)
     81
     82/*
     83 * In general, using the Debug Support Unit (DSU) is not recommended.  Before
     84 * you use it, check that it is available in flight models and that the time
     85 * tag register is implemented in radiation hardened flip-flops.  For the
     86 * GR712RC, this is the case.
     87 */
     88
     89/* This value is specific to the GR712RC */
     90#define LEON3_DSU_TIME_TAG_ZERO_BITS 2
     91
     92static uint32_t leon3_read_dsu_time_tag(void)
     93{
     94  uint32_t value;
     95  volatile uint32_t *reg;
     96
     97  /* Use a load with a forced cache miss */
     98  reg = (uint32_t *) (LEON3_DSU_BASE + 8);
     99  __asm__ volatile (
     100    "\tlda\t[%1]1, %0"
     101    : "=&r"(value)
     102    : "r"(reg)
     103  );
     104  return value << LEON3_DSU_TIME_TAG_ZERO_BITS;
     105}
     106
     107static uint32_t leon3_timecounter_get_dsu_time_tag(
     108  struct timecounter *tc
     109)
     110{
     111  (void) tc;
     112  return leon3_read_dsu_time_tag();
     113}
     114
     115CPU_Counter_ticks _CPU_Counter_read(void)
     116{
     117  return leon3_read_dsu_time_tag();
     118}
     119
     120RTEMS_ALIAS(_CPU_Counter_read) uint32_t _SPARC_Counter_read_ISR_disabled(void);
     121
     122static void leon3_counter_use_dsu_time_tag(leon3_timecounter *tc)
     123{
     124  tc->base.tc_frequency =
     125    leon3_processor_local_bus_frequency() << LEON3_DSU_TIME_TAG_ZERO_BITS;
     126}
     127
     128#define LEON3_GET_TIMECOUNT_INIT leon3_timecounter_get_dsu_time_tag
     129
     130#else /* !LEON3_HAS_ASR_22_23_UP_COUNTER && !LEON3_DSU_BASE */
    81131
    82132/*
     
    170220
    171221#endif /* LEON3_IRQAMP_PROBE_TIMESTAMP */
    172 #endif /* LEON3_HAS_ASR_22_23_UP_COUNTER */
     222#endif /* LEON3_HAS_ASR_22_23_UP_COUNTER || LEON3_DSU_BASE */
    173223
    174224leon3_timecounter leon3_timecounter_instance = {
     
    193243  leon3_counter_use_asr_22_23_up_counter(&leon3_timecounter_instance);
    194244
    195 #else /* !LEON3_HAS_ASR_22_23_UP_COUNTER */
     245#elif defined(LEON3_DSU_BASE)
     246
     247  leon3_counter_use_dsu_time_tag(&leon3_timecounter_instance);
     248
     249#else /* !LEON3_HAS_ASR_22_23_UP_COUNTER && !LEON3_DSU_BASE */
    196250
    197251  /* Try to find the best CPU counter available */
     
    236290#endif
    237291
    238 #endif /* LEON3_HAS_ASR_22_23_UP_COUNTER */
     292#endif /* LEON3_HAS_ASR_22_23_UP_COUNTER || LEON3_DSU_BASE */
    239293}
    240294
  • spec/build/bsps/sparc/leon3/grp.yml

    r601b84c7 r958d517  
    4040  uid: optasrupcntprobe
    4141- role: build-dependency
     42  uid: optdsubase
     43- role: build-dependency
    4244  uid: optgptimerbase
    4345- role: build-dependency
Note: See TracChangeset for help on using the changeset viewer.