mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-26 06:08:20 +00:00
grlib: Add and use irqmp_has_timestamp()
Replace leon3_irqmp_has_timestamp() with irqmp_has_timestamp() and move it to grlib.h. Close #4128.
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
#ifndef __GRLIB_H__
|
||||
#define __GRLIB_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -51,6 +53,13 @@ struct irqmp_timestamp_regs {
|
||||
volatile unsigned int ack; /* 0x0c */
|
||||
};
|
||||
|
||||
static inline bool irqmp_has_timestamp(
|
||||
volatile struct irqmp_timestamp_regs *irqmp_ts
|
||||
)
|
||||
{
|
||||
return (irqmp_ts->control >> 27) > 0;
|
||||
}
|
||||
|
||||
/* IRQMP and IRQAMP interrupt controllers */
|
||||
struct irqmp_regs {
|
||||
volatile unsigned int ilevel; /* 0x00 */
|
||||
|
||||
@@ -171,7 +171,7 @@ static void grlib_clock_initialize(void)
|
||||
volatile struct irqmp_timestamp_regs *irqmp_ts =
|
||||
&GRLIB_IrqCtrl_Regs->timestamp[0];
|
||||
|
||||
if (!grlib_irqmp_has_timestamp(irqmp_ts)) {
|
||||
if (!irqmp_has_timestamp(irqmp_ts)) {
|
||||
bsp_fatal(GRLIB_FATAL_CLOCK_NO_IRQMP_TIMESTAMP_SUPPORT);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -126,7 +126,7 @@ static rtems_device_driver tlib_clock_find_timer(void)
|
||||
volatile struct irqmp_timestamp_regs *irqmp_ts;
|
||||
|
||||
irqmp_ts = &LEON3_IrqCtrl_Regs->timestamp[0];
|
||||
if (leon3_irqmp_has_timestamp(irqmp_ts)) {
|
||||
if (irqmp_has_timestamp(irqmp_ts)) {
|
||||
priv.ops = &ops_irqamp;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -176,13 +176,13 @@ static void leon3_clock_initialize(void)
|
||||
tc->tc_frequency = leon3_up_counter_frequency();
|
||||
|
||||
#ifdef RTEMS_PROFILING
|
||||
if (!leon3_irqmp_has_timestamp(irqmp_ts)) {
|
||||
if (!irqmp_has_timestamp(irqmp_ts)) {
|
||||
bsp_fatal(LEON3_FATAL_CLOCK_NO_IRQMP_TIMESTAMP_SUPPORT);
|
||||
}
|
||||
#endif
|
||||
|
||||
leon3_tc_tick = leon3_tc_tick_irqmp_timestamp_init;
|
||||
} else if (leon3_irqmp_has_timestamp(irqmp_ts)) {
|
||||
} else if (irqmp_has_timestamp(irqmp_ts)) {
|
||||
/* Use the interrupt controller timestamp counter if available */
|
||||
tc->tc_get_timecount = _SPARC_Get_timecount_up;
|
||||
tc->tc_frequency = ambapp_freq_get(&ambapp_plb, LEON3_Timer_Adev);
|
||||
|
||||
@@ -454,13 +454,6 @@ static inline uint32_t leon3_get_data_cache_config_register(void)
|
||||
return leon3_get_system_register(0xc);
|
||||
}
|
||||
|
||||
static inline bool leon3_irqmp_has_timestamp(
|
||||
volatile struct irqmp_timestamp_regs *irqmp_ts
|
||||
)
|
||||
{
|
||||
return (irqmp_ts->control >> 27) > 0;
|
||||
}
|
||||
|
||||
static inline uint32_t leon3_up_counter_low(void)
|
||||
{
|
||||
uint32_t asr23;
|
||||
|
||||
@@ -43,7 +43,7 @@ static void leon3_counter_initialize(void)
|
||||
counter->read = _SPARC_Counter_read_asr23;
|
||||
|
||||
leon3_counter_frequency = leon3_up_counter_frequency();
|
||||
} else if (leon3_irqmp_has_timestamp(irqmp_ts)) {
|
||||
} else if (irqmp_has_timestamp(irqmp_ts)) {
|
||||
/* Use the interrupt controller timestamp counter if available */
|
||||
counter->read_isr_disabled = _SPARC_Counter_read_up;
|
||||
counter->read = _SPARC_Counter_read_up;
|
||||
|
||||
Reference in New Issue
Block a user