RTEMS
Macros | Functions | Variables
leon.h File Reference

LEON3 BSP data types and macros. More...

#include <rtems.h>
#include <amba.h>

Go to the source code of this file.

Macros

#define LEON_INTERRUPT_EXTERNAL_1   5
 
#define LEON_TRAP_TYPE(_source)   SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
 
#define LEON_TRAP_SOURCE(_trap)   ((_trap) - 0x10)
 
#define LEON_INT_TRAP(_trap)
 
#define LEON_MEMORY_CONFIGURATION_PROM_SIZE_MASK   0x0003C000
 
#define LEON_MEMORY_CONFIGURATION_RAM_SIZE_MASK   0x00001E00
 
#define LEON_REG_TIMER_CONTROL_EN   0x00000001 /* 1 = enable counting */
 
#define LEON_REG_TIMER_CONTROL_RL   0x00000002 /* 1 = reload at 0 */
 
#define LEON_REG_TIMER_CONTROL_LD   0x00000004 /* 1 = load counter */
 
#define LEON_REG_UART_CONTROL_RTD   0x000000FF /* RX/TX data */
 
#define LEON_REG_UART_STATUS_DR   0x00000001 /* Data Ready */
 
#define LEON_REG_UART_STATUS_TSE   0x00000002 /* TX Send Register Empty */
 
#define LEON_REG_UART_STATUS_THE   0x00000004 /* TX Hold Register Empty */
 
#define LEON_REG_UART_STATUS_BR   0x00000008 /* Break Error */
 
#define LEON_REG_UART_STATUS_OE   0x00000010 /* RX Overrun Error */
 
#define LEON_REG_UART_STATUS_PE   0x00000020 /* RX Parity Error */
 
#define LEON_REG_UART_STATUS_FE   0x00000040 /* RX Framing Error */
 
#define LEON_REG_UART_STATUS_TF   0x00000200 /* FIFO Full */
 
#define LEON_REG_UART_STATUS_ERR   0x00000078 /* Error Mask */
 
#define LEON_REG_UART_CTRL_RE   0x00000001 /* Receiver enable */
 
#define LEON_REG_UART_CTRL_TE   0x00000002 /* Transmitter enable */
 
#define LEON_REG_UART_CTRL_RI   0x00000004 /* Receiver interrupt enable */
 
#define LEON_REG_UART_CTRL_TI   0x00000008 /* Transmitter interrupt enable */
 
#define LEON_REG_UART_CTRL_PS   0x00000010 /* Parity select */
 
#define LEON_REG_UART_CTRL_PE   0x00000020 /* Parity enable */
 
#define LEON_REG_UART_CTRL_FL   0x00000040 /* Flow control enable */
 
#define LEON_REG_UART_CTRL_LB   0x00000080 /* Loop Back enable */
 
#define LEON_REG_UART_CTRL_DB   0x00000800 /* Debug FIFO enable */
 
#define LEON_REG_UART_CTRL_SI   0x00004000 /* TX shift register empty IRQ enable */
 
#define LEON_REG_UART_CTRL_FA   0x80000000 /* FIFO Available */
 
#define LEON_REG_UART_CTRL_FA_BIT   31
 
#define LEON3_REG_CACHE_CTRL_FI   0x00200000 /* Flush instruction cache */
 
#define LEON3_REG_CACHE_CTRL_DS   0x00800000 /* Data cache snooping */
 
#define LEON3_IRQMPSTATUS_CPUNR   28
 
#define LEON3_IRQMPSTATUS_BROADCAST   27
 
#define LEON3_IRQCTRL_ACQUIRE(_lock_context)   rtems_interrupt_lock_acquire( &LEON3_IrqCtrl_Lock, _lock_context )
 
#define LEON3_IRQCTRL_RELEASE(_lock_context)   rtems_interrupt_lock_release( &LEON3_IrqCtrl_Lock, _lock_context )
 
#define LEON_Clear_interrupt(_source)
 
#define LEON_Force_interrupt(_source)
 
#define LEON_Enable_interrupt_broadcast(_source)
 
#define LEON_Disable_interrupt_broadcast(_source)
 
#define LEON_Is_interrupt_pending(_source)   (LEON3_IrqCtrl_Regs->ipend & (1U << (_source)))
 
#define LEON_Cpu_Is_interrupt_masked(_source, _cpu)   (!(LEON3_IrqCtrl_Regs->mask[_cpu] & (1U << (_source))))
 
#define LEON_Cpu_Mask_interrupt(_source, _cpu)
 
#define LEON_Cpu_Unmask_interrupt(_source, _cpu)
 
#define LEON_Cpu_Disable_interrupt(_source, _previous, _cpu)
 
#define LEON_Cpu_Restore_interrupt(_source, _previous, _cpu)
 
#define LEON_Is_interrupt_masked(_source)   LEON_Cpu_Is_interrupt_masked(_source, _LEON3_Get_current_processor())
 
#define LEON_Mask_interrupt(_source)   LEON_Cpu_Mask_interrupt(_source, _LEON3_Get_current_processor())
 
#define LEON_Unmask_interrupt(_source)   LEON_Cpu_Unmask_interrupt(_source, _LEON3_Get_current_processor())
 
#define LEON_Disable_interrupt(_source, _previous)   LEON_Cpu_Disable_interrupt(_source, _previous, _LEON3_Get_current_processor())
 
#define LEON_Restore_interrupt(_source, _previous)   LEON_Cpu_Restore_interrupt(_source, _previous, _LEON3_Get_current_processor())
 
#define BSP_Clear_interrupt(_source)   LEON_Clear_interrupt(_source)
 
#define BSP_Force_interrupt(_source)   LEON_Force_interrupt(_source)
 
#define BSP_Is_interrupt_pending(_source)   LEON_Is_interrupt_pending(_source)
 
#define BSP_Is_interrupt_masked(_source)   LEON_Is_interrupt_masked(_source)
 
#define BSP_Unmask_interrupt(_source)   LEON_Unmask_interrupt(_source)
 
#define BSP_Mask_interrupt(_source)   LEON_Mask_interrupt(_source)
 
#define BSP_Disable_interrupt(_source, _previous)   LEON_Disable_interrupt(_source, _prev)
 
#define BSP_Restore_interrupt(_source, _previous)   LEON_Restore_interrupt(_source, _previous)
 
#define BSP_Cpu_Is_interrupt_masked(_source, _cpu)   LEON_Cpu_Is_interrupt_masked(_source, _cpu)
 
#define BSP_Cpu_Unmask_interrupt(_source, _cpu)   LEON_Cpu_Unmask_interrupt(_source, _cpu)
 
#define BSP_Cpu_Mask_interrupt(_source, _cpu)   LEON_Cpu_Mask_interrupt(_source, _cpu)
 
#define BSP_Cpu_Disable_interrupt(_source, _previous, _cpu)   LEON_Cpu_Disable_interrupt(_source, _prev, _cpu)
 
#define BSP_Cpu_Restore_interrupt(_source, _previous, _cpu)   LEON_Cpu_Restore_interrupt(_source, _previous, _cpu)
 
#define LEON_REG_TIMER_COUNTER_RELOAD_AT_ZERO   0x00000002
 
#define LEON_REG_TIMER_COUNTER_STOP_AT_ZERO   0x00000000
 
#define LEON_REG_TIMER_COUNTER_LOAD_COUNTER   0x00000004
 
#define LEON_REG_TIMER_COUNTER_ENABLE_COUNTING   0x00000001
 
#define LEON_REG_TIMER_COUNTER_DISABLE_COUNTING   0x00000000
 
#define LEON_REG_TIMER_COUNTER_RELOAD_MASK   0x00000002
 
#define LEON_REG_TIMER_COUNTER_ENABLE_MASK   0x00000001
 
#define LEON_REG_TIMER_COUNTER_DEFINED_MASK   0x00000003
 
#define LEON_REG_TIMER_COUNTER_CURRENT_MODE_MASK   0x00000003
 
#define LEON3_CLOCK_INDEX   0
 
#define LEON3_COUNTER_GPTIMER_INDEX   (LEON3_CLOCK_INDEX + 1)
 
#define LEON3_GPTIMER_0_FREQUENCY_SET_BY_BOOT_LOADER   1000000
 

Functions

static __inline__ int bsp_irq_fixup (int irq)
 
static unsigned int leon_r32_no_cache (uintptr_t addr)
 
void leon3_ext_irq_init (void)
 
void leon3_power_down_loop (void) RTEMS_NO_RETURN
 
static uint32_t leon3_get_cpu_count (volatile struct irqmp_regs *irqmp)
 
static void leon3_set_system_register (uint32_t addr, uint32_t val)
 
static uint32_t leon3_get_system_register (uint32_t addr)
 
static void leon3_set_cache_control_register (uint32_t val)
 
static uint32_t leon3_get_cache_control_register (void)
 
static bool leon3_data_cache_snooping_enabled (void)
 
static uint32_t leon3_get_inst_cache_config_register (void)
 
static uint32_t leon3_get_data_cache_config_register (void)
 
static bool leon3_irqmp_has_timestamp (volatile struct irqmp_timestamp_regs *irqmp_ts)
 
static uint32_t leon3_up_counter_low (void)
 
static uint32_t leon3_up_counter_high (void)
 
static void leon3_up_counter_enable (void)
 
static bool leon3_up_counter_is_available (void)
 
static uint32_t leon3_up_counter_frequency (void)
 

Variables

volatile struct irqmp_regsLEON3_IrqCtrl_Regs
 
struct ambapp_devLEON3_IrqCtrl_Adev
 
volatile struct gptimer_regsLEON3_Timer_Regs
 
struct ambapp_devLEON3_Timer_Adev
 
uint32_t LEON3_Cpu_Index
 
int LEON3_IrqCtrl_EIrq
 
rtems_interrupt_lock LEON3_IrqCtrl_Lock
 
int syscon_uart_index
 
int leon3_debug_uart_index
 
int leon3_timer_core_index
 
unsigned int leon3_timer_prescaler
 

Detailed Description

LEON3 BSP data types and macros.

Definition in file leon.h.

Macro Definition Documentation

◆ LEON_Clear_interrupt

#define LEON_Clear_interrupt (   _source)
Value:
do { \
LEON3_IrqCtrl_Regs->iclear = (1U << (_source)); \
} while (0)

Definition at line 187 of file leon.h.

◆ LEON_Cpu_Disable_interrupt

#define LEON_Cpu_Disable_interrupt (   _source,
  _previous,
  _cpu 
)
Value:
do { \
rtems_interrupt_lock_context _lock_context; \
uint32_t _mask = 1U << (_source); \
LEON3_IRQCTRL_ACQUIRE( &_lock_context ); \
(_previous) = LEON3_IrqCtrl_Regs->mask[_cpu]; \
LEON3_IrqCtrl_Regs->mask[_cpu] = _previous & ~_mask; \
LEON3_IRQCTRL_RELEASE( &_lock_context ); \
(_previous) &= _mask; \
} while (0)

Definition at line 237 of file leon.h.

◆ LEON_Cpu_Mask_interrupt

#define LEON_Cpu_Mask_interrupt (   _source,
  _cpu 
)
Value:
do { \
rtems_interrupt_lock_context _lock_context; \
LEON3_IRQCTRL_ACQUIRE( &_lock_context ); \
LEON3_IrqCtrl_Regs->mask[_cpu] &= ~(1U << (_source)); \
LEON3_IRQCTRL_RELEASE( &_lock_context ); \
} while (0)

Definition at line 221 of file leon.h.

◆ LEON_Cpu_Restore_interrupt

#define LEON_Cpu_Restore_interrupt (   _source,
  _previous,
  _cpu 
)
Value:
do { \
rtems_interrupt_lock_context _lock_context; \
uint32_t _mask = 1U << (_source); \
LEON3_IRQCTRL_ACQUIRE( &_lock_context ); \
LEON3_IrqCtrl_Regs->mask[_cpu] = \
(LEON3_IrqCtrl_Regs->mask[_cpu] & ~_mask) | (_previous); \
LEON3_IRQCTRL_RELEASE( &_lock_context ); \
} while (0)

Definition at line 248 of file leon.h.

◆ LEON_Cpu_Unmask_interrupt

#define LEON_Cpu_Unmask_interrupt (   _source,
  _cpu 
)
Value:
do { \
rtems_interrupt_lock_context _lock_context; \
LEON3_IRQCTRL_ACQUIRE( &_lock_context ); \
LEON3_IrqCtrl_Regs->mask[_cpu] |= (1U << (_source)); \
LEON3_IRQCTRL_RELEASE( &_lock_context ); \
} while (0)

Definition at line 229 of file leon.h.

◆ LEON_Disable_interrupt_broadcast

#define LEON_Disable_interrupt_broadcast (   _source)
Value:
do { \
rtems_interrupt_lock_context _lock_context; \
uint32_t _mask = 1U << ( _source ); \
LEON3_IRQCTRL_ACQUIRE( &_lock_context ); \
LEON3_IrqCtrl_Regs->bcast &= ~_mask; \
LEON3_IRQCTRL_RELEASE( &_lock_context ); \
} while (0)

Definition at line 206 of file leon.h.

◆ LEON_Enable_interrupt_broadcast

#define LEON_Enable_interrupt_broadcast (   _source)
Value:
do { \
rtems_interrupt_lock_context _lock_context; \
uint32_t _mask = 1U << ( _source ); \
LEON3_IRQCTRL_ACQUIRE( &_lock_context ); \
LEON3_IrqCtrl_Regs->bcast |= _mask; \
LEON3_IRQCTRL_RELEASE( &_lock_context ); \
} while (0)

Definition at line 197 of file leon.h.

◆ LEON_Force_interrupt

#define LEON_Force_interrupt (   _source)
Value:
do { \
LEON3_IrqCtrl_Regs->iforce = (1U << (_source)); \
} while (0)

Definition at line 192 of file leon.h.

◆ LEON_INT_TRAP

#define LEON_INT_TRAP (   _trap)
Value:
( (_trap) >= 0x11 && \
(_trap) <= 0x1F )

Definition at line 49 of file leon.h.