forked from Imagelibrary/rtems
bsp/leon3: Add LEON3_HAS_ASR_22_23_UP_COUNTER
This commit is contained in:
@@ -230,6 +230,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
|
||||
@@ -262,6 +263,7 @@ static void leon3_clock_use_gptimer(
|
||||
|
||||
rtems_timecounter_install(tc);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void leon3_clock_initialize(void)
|
||||
{
|
||||
@@ -288,6 +290,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);
|
||||
@@ -305,6 +310,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() \
|
||||
|
||||
@@ -263,6 +263,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.
|
||||
*
|
||||
@@ -274,6 +275,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.
|
||||
|
||||
@@ -68,6 +68,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;
|
||||
@@ -88,19 +89,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);
|
||||
@@ -123,6 +130,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(
|
||||
|
||||
Reference in New Issue
Block a user