38#ifndef LIBBSP_SPARC_LEON3_BSP_LEON3_H
39#define LIBBSP_SPARC_LEON3_BSP_LEON3_H
45#include <bsp/irqimpl.h>
47#if !defined(LEON3_PLB_FREQUENCY_DEFINED_BY_GPTIMER)
73#define LEON3_REG_CACHE_CTRL_FI 0x00200000U
79#define LEON3_REG_CACHE_CTRL_DS 0x00800000U
88static inline void leon3_set_system_register( uint32_t addr, uint32_t val )
93 :
"r" ( addr ),
"r" ( val )
104static inline uint32_t leon3_get_system_register( uint32_t addr )
122static inline void leon3_set_cache_control_register( uint32_t val )
124 leon3_set_system_register( 0x0, val );
132static inline uint32_t leon3_get_cache_control_register(
void )
134 return leon3_get_system_register( 0x0 );
143static inline bool leon3_data_cache_snooping_enabled(
void )
153static inline uint32_t leon3_get_inst_cache_config_register(
void )
155 return leon3_get_system_register( 0x8 );
163static inline uint32_t leon3_get_data_cache_config_register(
void )
165 return leon3_get_system_register( 0xc );
175static inline uint32_t leon3_get_cpu_count(
const irqamp *regs )
177 return IRQAMP_MPSTAT_NCPU_GET( grlib_load_32( ®s->
mpstat ) ) + 1;
180#if !defined(LEON3_GPTIMER_BASE)
219#if defined(RTEMS_MULTIPROCESSING)
220#define LEON3_CLOCK_INDEX \
221 ( leon3_timer_core_index != 0 ? 0 : 2 * LEON3_Cpu_Index )
223#define LEON3_CLOCK_INDEX 0
230#define LEON3_COUNTER_GPTIMER_INDEX ( LEON3_CLOCK_INDEX + 1 )
240#define LEON3_GPTIMER_0_FREQUENCY_SET_BY_BOOT_LOADER 1000000
245#if defined(LEON3_GPTIMER_BASE)
246#define LEON3_Timer_Regs ((gptimer *) LEON3_GPTIMER_BASE)
261static inline uint32_t leon3_processor_local_bus_frequency(
void )
263#if defined(LEON3_PLB_FREQUENCY_DEFINED_BY_GPTIMER)
280static inline uint32_t leon3_up_counter_low(
void )
297static inline uint32_t leon3_up_counter_high(
void)
312static inline void leon3_up_counter_enable(
void )
319#if !defined(LEON3_HAS_ASR_22_23_UP_COUNTER)
327static inline bool leon3_up_counter_is_available(
void )
329 return leon3_up_counter_low() != leon3_up_counter_low();
338static inline uint32_t leon3_up_counter_frequency(
void )
340 return leon3_processor_local_bus_frequency();
346#if defined(LEON3_APBUART_BASE)
347#define leon3_debug_uart ((struct apbuart *) LEON3_APBUART_BASE)
361#if !defined(LEON3_HAS_ASR_22_23_UP_COUNTER)
381#if RTEMS_INTERRUPT_LOCK_NEEDS_OBJECT
This header file defines the APBUART register block interface.
This header file defines the GPTIMER register block interface.
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:386
char rtems_interrupt_lock
This structure represents an ISR lock.
Definition: intr.h:532
struct ambapp_dev * LEON3_Timer_Adev
This pointer provides the GPTIMER device information block.
Definition: amba.c:127
gptimer * LEON3_Timer_Regs
This pointer provides the GPTIMER register block address.
Definition: amba.c:126
apbuart * leon3_debug_uart
This pointer provides the debug APBUART register block address.
Definition: printk_support.c:54
int leon3_timer_core_index
This object lets the user override which on-chip GPTIMER core will be used for system clock timer.
unsigned int leon3_timer_prescaler
This object lets the user override system clock timer prescaler.
#define LEON3_REG_CACHE_CTRL_DS
This constant represents the data cache snooping enable flag of the LEON cache control register.
Definition: leon3.h:79
#define LEON3_GPTIMER_0_FREQUENCY_SET_BY_BOOT_LOADER
This constant defines the frequency set by the boot loader of the first GPTIMER instance.
Definition: leon3.h:240
struct ambapp_dev * LEON3_IrqCtrl_Adev
This pointer provides the IRQ(A)MP device information block.
Definition: amba.c:122
RTEMS_NO_RETURN void leon3_power_down_loop(void)
Sets asr19 to zero to enter the power-down mode of the processor in an infinite loop.
leon3_timecounter leon3_timecounter_instance
Provides the LEON3-specific timecounter.
Definition: cpucounter.c:224
struct ambapp_bus * ambapp_plb(void)
Gets the fully scanned AMBA Plug & Play Processor Local Bus (PLB).
Definition: bspstart.c:58
This structure defines the APBUART register block memory map.
Definition: apbuart-regs.h:248
This structure defines the GPTIMER register block memory map.
Definition: gptimer-regs.h:346
uint32_t sreload
See Scaler reload value register (SRELOAD).
Definition: gptimer-regs.h:355
This structure defines the IRQ(A)MP register block memory map.
Definition: irqamp-regs.h:780
uint32_t mpstat
See Multiprocessor status register (MPSTAT).
Definition: irqamp-regs.h:804
Represents the LEON3-specific timecounter.
Definition: leon3.h:355
volatile uint32_t * counter_register
This member may reference a hardware counter register.
Definition: leon3.h:370
uint32_t software_counter
This member provides a software fall-back counter.
Definition: leon3.h:365
This header file provides interfaces of the timecounter implementation.