58#ifndef _INCLUDE_LEON_h
59#define _INCLUDE_LEON_h
75#define LEON_INTERRUPT_CORRECTABLE_MEMORY_ERROR 1
76#define LEON_INTERRUPT_UART_2_RX_TX 2
77#define LEON_INTERRUPT_UART_1_RX_TX 3
78#define LEON_INTERRUPT_EXTERNAL_0 4
79#define LEON_INTERRUPT_EXTERNAL_1 5
80#define LEON_INTERRUPT_EXTERNAL_2 6
81#define LEON_INTERRUPT_EXTERNAL_3 7
82#define LEON_INTERRUPT_TIMER1 8
83#define LEON_INTERRUPT_TIMER2 9
84#define LEON_INTERRUPT_EMPTY1 10
85#define LEON_INTERRUPT_EMPTY2 11
86#define LEON_INTERRUPT_EMPTY3 12
87#define LEON_INTERRUPT_EMPTY4 13
88#define LEON_INTERRUPT_EMPTY5 14
89#define LEON_INTERRUPT_EMPTY6 15
102#define LEON_TRAP_TYPE( _source ) SPARC_INTERRUPT_SOURCE_TO_TRAP( _source )
104#define LEON_TRAP_SOURCE( _trap ) SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap )
106#define LEON_INT_TRAP( _trap ) SPARC_IS_INTERRUPT_TRAP( _trap )
119 volatile unsigned int Memory_Config_1;
120 volatile unsigned int Memory_Config_2;
121 volatile unsigned int Edac_Control;
122 volatile unsigned int Failed_Address;
123 volatile unsigned int Memory_Status;
124 volatile unsigned int Cache_Control;
125 volatile unsigned int Power_Down;
126 volatile unsigned int Write_Protection_1;
127 volatile unsigned int Write_Protection_2;
128 volatile unsigned int Leon_Configuration;
129 volatile unsigned int dummy2;
130 volatile unsigned int dummy3;
131 volatile unsigned int dummy4;
132 volatile unsigned int dummy5;
133 volatile unsigned int dummy6;
134 volatile unsigned int dummy7;
135 volatile unsigned int Timer_Counter_1;
136 volatile unsigned int Timer_Reload_1;
137 volatile unsigned int Timer_Control_1;
138 volatile unsigned int Watchdog;
139 volatile unsigned int Timer_Counter_2;
140 volatile unsigned int Timer_Reload_2;
141 volatile unsigned int Timer_Control_2;
142 volatile unsigned int dummy8;
143 volatile unsigned int Scaler_Counter;
144 volatile unsigned int Scaler_Reload;
145 volatile unsigned int dummy9;
146 volatile unsigned int dummy10;
147 volatile unsigned int UART_Channel_1;
148 volatile unsigned int UART_Status_1;
149 volatile unsigned int UART_Control_1;
150 volatile unsigned int UART_Scaler_1;
151 volatile unsigned int UART_Channel_2;
152 volatile unsigned int UART_Status_2;
153 volatile unsigned int UART_Control_2;
154 volatile unsigned int UART_Scaler_2;
155 volatile unsigned int Interrupt_Mask;
156 volatile unsigned int Interrupt_Pending;
157 volatile unsigned int Interrupt_Force;
158 volatile unsigned int Interrupt_Clear;
159 volatile unsigned int PIO_Data;
160 volatile unsigned int PIO_Direction;
161 volatile unsigned int PIO_Interrupt;
177#define LEON_REG_MEMCFG1_OFFSET 0x00
178#define LEON_REG_MEMCFG2_OFFSET 0x04
179#define LEON_REG_EDACCTRL_OFFSET 0x08
180#define LEON_REG_FAILADDR_OFFSET 0x0C
181#define LEON_REG_MEMSTATUS_OFFSET 0x10
182#define LEON_REG_CACHECTRL_OFFSET 0x14
183#define LEON_REG_POWERDOWN_OFFSET 0x18
184#define LEON_REG_WRITEPROT1_OFFSET 0x1C
185#define LEON_REG_WRITEPROT2_OFFSET 0x20
186#define LEON_REG_LEONCONF_OFFSET 0x24
187#define LEON_REG_UNIMPLEMENTED_2_OFFSET 0x28
188#define LEON_REG_UNIMPLEMENTED_3_OFFSET 0x2C
189#define LEON_REG_UNIMPLEMENTED_4_OFFSET 0x30
190#define LEON_REG_UNIMPLEMENTED_5_OFFSET 0x34
191#define LEON_REG_UNIMPLEMENTED_6_OFFSET 0x38
192#define LEON_REG_UNIMPLEMENTED_7_OFFSET 0x3C
193#define LEON_REG_TIMERCNT1_OFFSET 0x40
194#define LEON_REG_TIMERLOAD1_OFFSET 0x44
195#define LEON_REG_TIMERCTRL1_OFFSET 0x48
196#define LEON_REG_WDOG_OFFSET 0x4C
197#define LEON_REG_TIMERCNT2_OFFSET 0x50
198#define LEON_REG_TIMERLOAD2_OFFSET 0x54
199#define LEON_REG_TIMERCTRL2_OFFSET 0x58
200#define LEON_REG_UNIMPLEMENTED_8_OFFSET 0x5C
201#define LEON_REG_SCALERCNT_OFFSET 0x60
202#define LEON_REG_SCALER_LOAD_OFFSET 0x64
203#define LEON_REG_UNIMPLEMENTED_9_OFFSET 0x68
204#define LEON_REG_UNIMPLEMENTED_10_OFFSET 0x6C
205#define LEON_REG_UARTDATA1_OFFSET 0x70
206#define LEON_REG_UARTSTATUS1_OFFSET 0x74
207#define LEON_REG_UARTCTRL1_OFFSET 0x78
208#define LEON_REG_UARTSCALER1_OFFSET 0x7C
209#define LEON_REG_UARTDATA2_OFFSET 0x80
210#define LEON_REG_UARTSTATUS2_OFFSET 0x84
211#define LEON_REG_UARTCTRL2_OFFSET 0x88
212#define LEON_REG_UARTSCALER2_OFFSET 0x8C
213#define LEON_REG_IRQMASK_OFFSET 0x90
214#define LEON_REG_IRQPEND_OFFSET 0x94
215#define LEON_REG_IRQFORCE_OFFSET 0x98
216#define LEON_REG_IRQCLEAR_OFFSET 0x9C
217#define LEON_REG_PIODATA_OFFSET 0xA0
218#define LEON_REG_PIODIR_OFFSET 0xA4
219#define LEON_REG_PIOIRQ_OFFSET 0xA8
220#define LEON_REG_SIM_RAM_SIZE_OFFSET 0xF4
221#define LEON_REG_SIM_ROM_SIZE_OFFSET 0xF8
229#define LEON_MEMORY_CONFIGURATION_PROM_SIZE_MASK 0x0003C000
235#define LEON_MEMORY_CONFIGURATION_RAM_SIZE_MASK 0x00001E00
242#define LEON_REG_TIMER_CONTROL_EN 0x00000001
244#define LEON_REG_TIMER_CONTROL_RL 0x00000002
246#define LEON_REG_TIMER_CONTROL_LD 0x00000004
254#define LEON_REG_UART_CONTROL_RTD 0x000000FF
260#define LEON_REG_UART_STATUS_CLR 0x00000000
261#define LEON_REG_UART_STATUS_DR 0x00000001
262#define LEON_REG_UART_STATUS_TSE 0x00000002
263#define LEON_REG_UART_STATUS_THE 0x00000004
264#define LEON_REG_UART_STATUS_BR 0x00000008
265#define LEON_REG_UART_STATUS_OE 0x00000010
266#define LEON_REG_UART_STATUS_PE 0x00000020
267#define LEON_REG_UART_STATUS_FE 0x00000040
268#define LEON_REG_UART_STATUS_ERR 0x00000078
275#define LEON_REG_UART_CTRL_RE 0x00000001
276#define LEON_REG_UART_CTRL_TE 0x00000002
277#define LEON_REG_UART_CTRL_RI 0x00000004
278#define LEON_REG_UART_CTRL_TI 0x00000008
279#define LEON_REG_UART_CTRL_PS 0x00000010
280#define LEON_REG_UART_CTRL_PE 0x00000020
281#define LEON_REG_UART_CTRL_FL 0x00000040
282#define LEON_REG_UART_CTRL_LB 0x00000080
305#define LEON_Clear_interrupt( _source ) \
307 LEON_REG.Interrupt_Clear = (1 << (_source)); \
310#define LEON_Force_interrupt( _source ) \
314 _level = sparc_disable_interrupts(); \
315 LEON_REG.Interrupt_Force |= (1 << (_source)); \
316 sparc_enable_interrupts( _level ); \
319#define LEON_Is_interrupt_pending( _source ) \
320 (LEON_REG.Interrupt_Pending & (1 << (_source)))
322#define LEON_Is_interrupt_masked( _source ) \
323 (!(LEON_REG.Interrupt_Mask & (1 << (_source))))
325#define LEON_Mask_interrupt( _source ) \
329 _level = sparc_disable_interrupts(); \
330 LEON_REG.Interrupt_Mask &= ~(1 << (_source)); \
331 sparc_enable_interrupts( _level ); \
334#define LEON_Unmask_interrupt( _source ) \
338 _level = sparc_disable_interrupts(); \
339 LEON_REG.Interrupt_Mask |= (1 << (_source)); \
340 sparc_enable_interrupts( _level ); \
343#define LEON_Disable_interrupt( _source, _previous ) \
346 uint32_t _mask = 1 << (_source); \
348 _level = sparc_disable_interrupts(); \
349 (_previous) = LEON_REG.Interrupt_Mask; \
350 LEON_REG.Interrupt_Mask = _previous & ~_mask; \
351 sparc_enable_interrupts( _level ); \
352 (_previous) &= _mask; \
355#define LEON_Restore_interrupt( _source, _previous ) \
358 uint32_t _mask = 1 << (_source); \
360 _level = sparc_disable_interrupts(); \
361 LEON_REG.Interrupt_Mask = \
362 (LEON_REG.Interrupt_Mask & ~_mask) | (_previous); \
363 sparc_enable_interrupts( _level ); \
367#define BSP_Clear_interrupt(_source) LEON_Clear_interrupt(_source)
368#define BSP_Force_interrupt(_source) LEON_Force_interrupt(_source)
369#define BSP_Clear_forced_interrupt( _source ) \
373 _level = sparc_disable_interrupts(); \
374 LEON_REG.Interrupt_Force &= ~(1 << (_source)); \
375 sparc_enable_interrupts( _level ); \
377#define BSP_Is_interrupt_pending(_source) LEON_Is_interrupt_pending(_source)
378#define BSP_Is_interrupt_forced(_source) \
379 (LEON_REG.Interrupt_Force & (1 << (_source)))
380#define BSP_Is_interrupt_masked(_source) LEON_Is_interrupt_masked(_source)
381#define BSP_Unmask_interrupt(_source) LEON_Unmask_interrupt(_source)
382#define BSP_Mask_interrupt(_source) LEON_Mask_interrupt(_source)
383#define BSP_Disable_interrupt(_source, _previous) \
384 LEON_Disable_interrupt(_source, _prev)
385#define BSP_Restore_interrupt(_source, _previous) \
386 LEON_Restore_interrupt(_source, _previous)
389#define BSP_Cpu_Is_interrupt_masked(_source, _cpu) \
390 BSP_Is_interrupt_masked(_source)
391#define BSP_Cpu_Unmask_interrupt(_source, _cpu) \
392 BSP_Unmask_interrupt(_source)
393#define BSP_Cpu_Mask_interrupt(_source, _cpu) \
394 BSP_Mask_interrupt(_source)
395#define BSP_Cpu_Disable_interrupt(_source, _previous, _cpu) \
396 BSP_Disable_interrupt(_source, _prev)
397#define BSP_Cpu_Restore_interrupt(_source, _previous, _cpu) \
398 BSP_Cpu_Restore_interrupt(_source, _previous)
417#define LEON_REG_TIMER_COUNTER_RELOAD_AT_ZERO 0x00000002
418#define LEON_REG_TIMER_COUNTER_STOP_AT_ZERO 0x00000000
420#define LEON_REG_TIMER_COUNTER_LOAD_COUNTER 0x00000004
422#define LEON_REG_TIMER_COUNTER_ENABLE_COUNTING 0x00000001
423#define LEON_REG_TIMER_COUNTER_DISABLE_COUNTING 0x00000000
425#define LEON_REG_TIMER_COUNTER_RELOAD_MASK 0x00000002
426#define LEON_REG_TIMER_COUNTER_ENABLE_MASK 0x00000001
428#define LEON_REG_TIMER_COUNTER_DEFINED_MASK 0x00000003
429#define LEON_REG_TIMER_COUNTER_CURRENT_MODE_MASK 0x00000003
432static inline unsigned int leon_r32_no_cache(uintptr_t addr)
435 __asm__ volatile (
" lda [%1] 1, %0\n" :
"=r"(tmp) :
"r"(addr));
register struct Per_CPU_Control *_SPARC_Per_CPU_current __asm__("g6")
The pointer to the current per-CPU control is available via register g6.
This header file provides information required to build RTEMS for a particular member of the SPARC fa...