diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-07-16 11:32:37 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-07-28 08:54:47 +0200 |
commit | e9fef02cfab0edd547f253d57fca24819c11e764 (patch) | |
tree | bdba5c7ae0956c112c1a801260bd4b595751a872 | |
parent | ba95adf0932eb2608f6005719491c535de1909cf (diff) |
bsp/leon3: Add LEON3_HAS_ASR_22_23_UP_COUNTER
-rw-r--r-- | bsps/sparc/leon3/clock/ckinit.c | 6 | ||||
-rw-r--r-- | bsps/sparc/leon3/include/bsp/leon3.h | 2 | ||||
-rw-r--r-- | bsps/sparc/leon3/start/cpucounter.c | 8 | ||||
-rw-r--r-- | spec/build/bsps/sparc/leon3/grp.yml | 2 | ||||
-rw-r--r-- | spec/build/bsps/sparc/leon3/optasrupcnt.yml | 20 |
5 files changed, 38 insertions, 0 deletions
diff --git a/bsps/sparc/leon3/clock/ckinit.c b/bsps/sparc/leon3/clock/ckinit.c index 07c690e092..f7d1cc3c5e 100644 --- a/bsps/sparc/leon3/clock/ckinit.c +++ b/bsps/sparc/leon3/clock/ckinit.c @@ -207,6 +207,7 @@ static void leon3_clock_use_irqamp_timestamp( } #endif +#if !defined(LEON3_HAS_ASR_22_23_UP_COUNTER) static void leon3_clock_use_gptimer( struct timecounter *tc, gptimer_timer *timer @@ -245,6 +246,7 @@ static void leon3_clock_use_gptimer( rtems_timecounter_install(tc); } +#endif static void leon3_clock_initialize(void) { @@ -271,6 +273,9 @@ static void leon3_clock_initialize(void) leon3_up_counter_enable(); +#if defined(LEON3_HAS_ASR_22_23_UP_COUNTER) + leon3_clock_use_up_counter(tc); +#else /* LEON3_HAS_ASR_22_23_UP_COUNTER */ if (leon3_up_counter_is_available()) { /* Use the LEON4 up-counter if available */ leon3_clock_use_up_counter(tc); @@ -288,6 +293,7 @@ static void leon3_clock_initialize(void) #endif leon3_clock_use_gptimer(tc, timer); +#endif /* LEON3_HAS_ASR_22_23_UP_COUNTER */ } #define Clock_driver_support_initialize_hardware() \ diff --git a/bsps/sparc/leon3/include/bsp/leon3.h b/bsps/sparc/leon3/include/bsp/leon3.h index 6fd354c4b3..cc48226c47 100644 --- a/bsps/sparc/leon3/include/bsp/leon3.h +++ b/bsps/sparc/leon3/include/bsp/leon3.h @@ -349,6 +349,7 @@ static inline void leon3_up_counter_enable( void ) ); } +#if !defined(LEON3_HAS_ASR_22_23_UP_COUNTER) /** * @brief Checks if the LEON up-counter is available. * @@ -360,6 +361,7 @@ static inline bool leon3_up_counter_is_available( void ) { return leon3_up_counter_low() != leon3_up_counter_low(); } +#endif /** * @brief Gets the LEON up-counter frequency in Hz. diff --git a/bsps/sparc/leon3/start/cpucounter.c b/bsps/sparc/leon3/start/cpucounter.c index 50dc7b7fae..b02fcecab8 100644 --- a/bsps/sparc/leon3/start/cpucounter.c +++ b/bsps/sparc/leon3/start/cpucounter.c @@ -55,6 +55,7 @@ static void leon3_counter_use_irqamp_timestamp( } #endif +#if !defined(LEON3_HAS_ASR_22_23_UP_COUNTER) static void leon3_counter_use_gptimer(SPARC_Counter *counter, gptimer *gpt) { gptimer_timer *timer; @@ -78,19 +79,25 @@ static void leon3_counter_use_gptimer(SPARC_Counter *counter, gptimer *gpt) (grlib_load_32(&gpt->sreload) + 1); #endif } +#endif static void leon3_counter_initialize(void) { #if defined(LEON3_IRQAMP_PROBE_TIMESTAMP) irqamp_timestamp *irqmp_ts; #endif +#if !defined(LEON3_HAS_ASR_22_23_UP_COUNTER) gptimer *gpt; +#endif SPARC_Counter *counter; counter = &_SPARC_Counter_mutable; leon3_up_counter_enable(); +#if defined(LEON3_HAS_ASR_22_23_UP_COUNTER) + leon3_counter_use_up_counter(counter); +#else /* LEON3_HAS_ASR_22_23_UP_COUNTER */ if (leon3_up_counter_is_available()) { /* Use the LEON4 up-counter if available */ leon3_counter_use_up_counter(counter); @@ -113,6 +120,7 @@ static void leon3_counter_initialize(void) /* Fall back to the first GPTIMER if available */ leon3_counter_use_gptimer(counter, gpt); } +#endif /* LEON3_HAS_ASR_22_23_UP_COUNTER */ } RTEMS_SYSINIT_ITEM( diff --git a/spec/build/bsps/sparc/leon3/grp.yml b/spec/build/bsps/sparc/leon3/grp.yml index cb60510df5..8e4ab3702f 100644 --- a/spec/build/bsps/sparc/leon3/grp.yml +++ b/spec/build/bsps/sparc/leon3/grp.yml @@ -34,6 +34,8 @@ links: - role: build-dependency uid: optapbuartbase - role: build-dependency + uid: optasrupcnt +- role: build-dependency uid: optgptimerbase - role: build-dependency uid: optirqampbase diff --git a/spec/build/bsps/sparc/leon3/optasrupcnt.yml b/spec/build/bsps/sparc/leon3/optasrupcnt.yml new file mode 100644 index 0000000000..7c8b59b671 --- /dev/null +++ b/spec/build/bsps/sparc/leon3/optasrupcnt.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +actions: +- get-boolean: null +- define-condition: null +build-type: option +default: false +default-by-family: [] +default-by-variant: +- value: true + variants: + - sparc/gr740 +enabled-by: true +links: [] +name: LEON3_HAS_ASR_22_23_UP_COUNTER +description: | + If this option is set to true, then the processor has the %asr22 and %asr23 + up-counter. +type: build |