[PATCH v2 3/9] bsps/leon3: Make GPTIMER fall back mandatory

Martin Åberg maberg at gaisler.com
Thu Oct 19 14:57:44 UTC 2023


Hello Sebastian,

On 2023-10-19 15:44, Sebastian Huber wrote:
> On 19.10.23 12:22, Martin Åberg wrote:
>> On 2023-10-13 13:00, Sebastian Huber wrote >> LEON3_Timer_Regs is probed in amba.c. There is a link time option to
>> set GPTIMER core index (leon3_timer_core_index). Instances could have 
>> unique GPTIMER cores associated.
>>
>> The preprocessor symbols LEON3_CLOCK_INDEX (clock driver) and 
>> LEON3_COUNTER_GPTIMER_INDEX (timecounter) are used as subtimer index 
>> of the GPTIMER core LEON3_Timer_Regs.
>>
>> For CPU0 these are:
>>    - LEON3_CLOCK_INDEX is 0 (equal to hardware processor index)
>>    - LEON3_COUNTER_GPTIMER_INDEX is 1 (LEON3_CLOCK_INDEX+1)
>> For CPU1 these are:
>>    - LEON3_CLOCK_INDEX is 1 (equal to hardware processor index)
>>    - LEON3_COUNTER_GPTIMER_INDEX is 2 (LEON3_CLOCK_INDEX+1)
>> etc...
>>
>> In the case when LEON3_Timer_Regs is different on CPU0 and CPU1, there 
>> is no conflict but will leave low-numbered subtimers unused. (Behavior 
>> not introduced by this patch.)
>>
>> In the case when LEON3_Timer_Regs is equal on the CPU0 and CPU1 
>> instances, it appears there is now a conflict between 
>> CPU0:LEON3_COUNTER_GPTIMER_INDEX and CPU1:LEON3_CLOCK_INDEX.
> 
> Ok, I suggest to change the LEON3_CLOCK_INDEX definition to:
> 
> /**
>   * @brief This constant defines the index of the GPTIMER timer used by the
>   *   clock driver.
>   */
> #if defined(RTEMS_MULTIPROCESSING)
> #define LEON3_CLOCK_INDEX \
>    ( leon3_timer_core_index != 0 ? 0 : 2 * LEON3_Cpu_Index )
> #else
> #define LEON3_CLOCK_INDEX 0
> #endif

OK!


> /**
>   * @brief This constant defines the index of the GPTIMER timer used by the
>   *   CPU counter if the CPU counter uses the GPTIMER.
>   */
> #if defined(RTEMS_SMP)
> #define LEON3_COUNTER_GPTIMER_INDEX ( LEON3_CLOCK_INDEX + 1 )
> #else
> #define LEON3_COUNTER_GPTIMER_INDEX LEON3_CLOCK_INDEX
> #endif
> 
> The rtems_configuration_get_user_multiprocessing_table() is always != 
> NULL if RTEMS_MULTIPROCESSING is defined.
> 

With the suggested update of the LEON3_CLOCK_INDEX definition, the 
following should be enough for all cases:

> #define LEON3_COUNTER_GPTIMER_INDEX ( LEON3_CLOCK_INDEX + 1 )


-- 
Best regards,

Martin Åberg
Software Engineer
Frontgrade Gaisler
martin.aberg at gaisler.com

Frontgrade Gaisler AB, Kungsgatan 12, SE-411 19 GÖTEBORG, Sweden.
+46 (0) 31 775 8650, www.gaisler.com


More information about the devel mailing list