42 #ifndef _INCLUDE_ERC32_h 43 #define _INCLUDE_ERC32_h 59 #define ERC32_INTERRUPT_MASKED_ERRORS 1 60 #define ERC32_INTERRUPT_EXTERNAL_1 2 61 #define ERC32_INTERRUPT_EXTERNAL_2 3 62 #define ERC32_INTERRUPT_UART_A_RX_TX 4 63 #define ERC32_INTERRUPT_UART_B_RX_TX 5 64 #define ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR 6 65 #define ERC32_INTERRUPT_UART_ERROR 7 66 #define ERC32_INTERRUPT_DMA_ACCESS_ERROR 8 67 #define ERC32_INTERRUPT_DMA_TIMEOUT 9 68 #define ERC32_INTERRUPT_EXTERNAL_3 10 69 #define ERC32_INTERRUPT_EXTERNAL_4 11 70 #define ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER 12 71 #define ERC32_INTERRUPT_REAL_TIME_CLOCK 13 72 #define ERC32_INTERRUPT_EXTERNAL_5 14 73 #define ERC32_INTERRUPT_WATCHDOG_TIMEOUT 15 86 #define ERC32_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10) 88 #define ERC32_TRAP_SOURCE( _trap ) ((_trap) - 0x10) 90 #define ERC32_Is_MEC_Trap( _trap ) \ 91 ( (_trap) >= ERC32_TRAP_TYPE( ERC32_INTERRUPT_MASKED_ERRORS ) && \ 92 (_trap) <= ERC32_TRAP_TYPE( ERC32_INTERRUPT_WATCHDOG_TIMEOUT ) ) 105 volatile uint32_t Control;
106 volatile uint32_t Software_Reset;
107 volatile uint32_t Power_Down;
108 volatile uint32_t Unimplemented_0;
109 volatile uint32_t Memory_Configuration;
110 volatile uint32_t IO_Configuration;
111 volatile uint32_t Wait_State_Configuration;
112 volatile uint32_t Unimplemented_1;
113 volatile uint32_t Memory_Access_0;
114 volatile uint32_t Memory_Access_1;
115 volatile uint32_t Unimplemented_2[ 7 ];
116 volatile uint32_t Interrupt_Shape;
117 volatile uint32_t Interrupt_Pending;
118 volatile uint32_t Interrupt_Mask;
119 volatile uint32_t Interrupt_Clear;
120 volatile uint32_t Interrupt_Force;
121 volatile uint32_t Unimplemented_3[ 2 ];
123 volatile uint32_t Watchdog_Program_and_Timeout_Acknowledge;
124 volatile uint32_t Watchdog_Trap_Door_Set;
125 volatile uint32_t Unimplemented_4[ 6 ];
126 volatile uint32_t Real_Time_Clock_Counter;
127 volatile uint32_t Real_Time_Clock_Scalar;
128 volatile uint32_t General_Purpose_Timer_Counter;
129 volatile uint32_t General_Purpose_Timer_Scalar;
130 volatile uint32_t Unimplemented_5[ 2 ];
132 volatile uint32_t Unimplemented_6;
133 volatile uint32_t System_Fault_Status;
134 volatile uint32_t First_Failing_Address;
135 volatile uint32_t First_Failing_Data;
136 volatile uint32_t First_Failing_Syndrome_and_Check_Bits;
137 volatile uint32_t Error_and_Reset_Status;
138 volatile uint32_t Error_Mask;
139 volatile uint32_t Unimplemented_7[ 2 ];
140 volatile uint32_t Debug_Control;
141 volatile uint32_t Breakpoint;
142 volatile uint32_t Watchpoint;
143 volatile uint32_t Unimplemented_8;
144 volatile uint32_t Test_Control;
145 volatile uint32_t Test_Data;
146 volatile uint32_t Unimplemented_9[ 2 ];
147 volatile uint32_t UART_Channel_A;
148 volatile uint32_t UART_Channel_B;
149 volatile uint32_t UART_Status;
165 #define ERC32_MEC_CONTROL_OFFSET 0x00 166 #define ERC32_MEC_SOFTWARE_RESET_OFFSET 0x04 167 #define ERC32_MEC_POWER_DOWN_OFFSET 0x08 168 #define ERC32_MEC_UNIMPLEMENTED_0_OFFSET 0x0C 169 #define ERC32_MEC_MEMORY_CONFIGURATION_OFFSET 0x10 170 #define ERC32_MEC_IO_CONFIGURATION_OFFSET 0x14 171 #define ERC32_MEC_WAIT_STATE_CONFIGURATION_OFFSET 0x18 172 #define ERC32_MEC_UNIMPLEMENTED_1_OFFSET 0x1C 173 #define ERC32_MEC_MEMORY_ACCESS_0_OFFSET 0x20 174 #define ERC32_MEC_MEMORY_ACCESS_1_OFFSET 0x24 175 #define ERC32_MEC_UNIMPLEMENTED_2_OFFSET 0x28 176 #define ERC32_MEC_INTERRUPT_SHAPE_OFFSET 0x44 177 #define ERC32_MEC_INTERRUPT_PENDING_OFFSET 0x48 178 #define ERC32_MEC_INTERRUPT_MASK_OFFSET 0x4C 179 #define ERC32_MEC_INTERRUPT_CLEAR_OFFSET 0x50 180 #define ERC32_MEC_INTERRUPT_FORCE_OFFSET 0x54 181 #define ERC32_MEC_UNIMPLEMENTED_3_OFFSET 0x58 182 #define ERC32_MEC_WATCHDOG_PROGRAM_AND_TIMEOUT_ACKNOWLEDGE_OFFSET 0x60 183 #define ERC32_MEC_WATCHDOG_TRAP_DOOR_SET_OFFSET 0x64 184 #define ERC32_MEC_UNIMPLEMENTED_4_OFFSET 0x6C 185 #define ERC32_MEC_REAL_TIME_CLOCK_COUNTER_OFFSET 0x80 186 #define ERC32_MEC_REAL_TIME_CLOCK_SCALAR_OFFSET 0x84 187 #define ERC32_MEC_GENERAL_PURPOSE_TIMER_COUNTER_OFFSET 0x88 188 #define ERC32_MEC_GENERAL_PURPOSE_TIMER_SCALAR_OFFSET 0x8C 189 #define ERC32_MEC_UNIMPLEMENTED_5_OFFSET 0x90 190 #define ERC32_MEC_TIMER_CONTROL_OFFSET 0x98 191 #define ERC32_MEC_UNIMPLEMENTED_6_OFFSET 0x9C 192 #define ERC32_MEC_SYSTEM_FAULT_STATUS_OFFSET 0xA0 193 #define ERC32_MEC_FIRST_FAILING_ADDRESS_OFFSET 0xA4 194 #define ERC32_MEC_FIRST_FAILING_DATA_OFFSET 0xA8 195 #define ERC32_MEC_FIRST_FAILING_SYNDROME_AND_CHECK_BITS_OFFSET 0xAC 196 #define ERC32_MEC_ERROR_AND_RESET_STATUS_OFFSET 0xB0 197 #define ERC32_MEC_ERROR_MASK_OFFSET 0xB4 198 #define ERC32_MEC_UNIMPLEMENTED_7_OFFSET 0xB8 199 #define ERC32_MEC_DEBUG_CONTROL_OFFSET 0xC0 200 #define ERC32_MEC_BREAKPOINT_OFFSET 0xC4 201 #define ERC32_MEC_WATCHPOINT_OFFSET 0xC8 202 #define ERC32_MEC_UNIMPLEMENTED_8_OFFSET 0xCC 203 #define ERC32_MEC_TEST_CONTROL_OFFSET 0xD0 204 #define ERC32_MEC_TEST_DATA_OFFSET 0xD4 205 #define ERC32_MEC_UNIMPLEMENTED_9_OFFSET 0xD8 206 #define ERC32_MEC_UART_CHANNEL_A_OFFSET 0xE0 207 #define ERC32_MEC_UART_CHANNEL_B_OFFSET 0xE4 208 #define ERC32_MEC_UART_STATUS_OFFSET 0xE8 216 #define ERC32_CONFIGURATION_POWER_DOWN_MASK 0x00000001 217 #define ERC32_CONFIGURATION_POWER_DOWN_ALLOWED 0x00000001 218 #define ERC32_CONFIGURATION_POWER_DOWN_DISABLED 0x00000000 220 #define ERC32_CONFIGURATION_SOFTWARE_RESET_MASK 0x00000002 221 #define ERC32_CONFIGURATION_SOFTWARE_RESET_ALLOWED 0x00000002 222 #define ERC32_CONFIGURATION_SOFTWARE_RESET_DISABLED 0x00000000 224 #define ERC32_CONFIGURATION_BUS_TIMEOUT_MASK 0x00000004 225 #define ERC32_CONFIGURATION_BUS_TIMEOUT_ENABLED 0x00000004 226 #define ERC32_CONFIGURATION_BUS_TIMEOUT_DISABLED 0x00000000 228 #define ERC32_CONFIGURATION_ACCESS_PROTECTION_MASK 0x00000008 229 #define ERC32_CONFIGURATION_ACCESS_PROTECTION_ENABLED 0x00000008 230 #define ERC32_CONFIGURATION_ACCESS_PROTECTION_DISABLED 0x00000000 236 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_MASK 0x00001C00 237 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_256K ( 0 << 10 ) 238 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_512K ( 1 << 10 ) 239 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_1MB ( 2 << 10 ) 240 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_2MB ( 3 << 10 ) 241 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_4MB ( 4 << 10 ) 242 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_8MB ( 5 << 10 ) 243 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_16MB ( 6 << 10 ) 244 #define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_32MB ( 7 << 10 ) 246 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_MASK 0x001C0000 247 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_128K ( 0 << 18 ) 248 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_256K ( 1 << 18 ) 249 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_512K ( 2 << 18 ) 250 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_1M ( 3 << 18 ) 251 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_2M ( 4 << 18 ) 252 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_4M ( 5 << 18 ) 253 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_8M ( 6 << 18 ) 254 #define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_16M ( 7 << 18 ) 260 #define ERC32_MEC_TIMER_CONTROL_GCR 0x00000001 262 #define ERC32_MEC_TIMER_CONTROL_GCL 0x00000002 264 #define ERC32_MEC_TIMER_CONTROL_GSE 0x00000004 266 #define ERC32_MEC_TIMER_CONTROL_GSL 0x00000008 269 #define ERC32_MEC_TIMER_CONTROL_RTCCR 0x00000100 271 #define ERC32_MEC_TIMER_CONTROL_RTCCL 0x00000200 273 #define ERC32_MEC_TIMER_CONTROL_RTCSE 0x00000400 275 #define ERC32_MEC_TIMER_CONTROL_RTCSL 0x00000800 283 #define ERC32_MEC_UART_CONTROL_RTD 0x000000FF 289 #define ERC32_MEC_UART_STATUS_DR 0x00000001 290 #define ERC32_MEC_UART_STATUS_TSE 0x00000002 291 #define ERC32_MEC_UART_STATUS_THE 0x00000004 292 #define ERC32_MEC_UART_STATUS_FE 0x00000010 293 #define ERC32_MEC_UART_STATUS_PE 0x00000020 294 #define ERC32_MEC_UART_STATUS_OE 0x00000040 295 #define ERC32_MEC_UART_STATUS_CU 0x00000080 296 #define ERC32_MEC_UART_STATUS_TXE 0x00000006 297 #define ERC32_MEC_UART_STATUS_CLRA 0x00000080 298 #define ERC32_MEC_UART_STATUS_CLRB 0x00800000 299 #define ERC32_MEC_UART_STATUS_ERRA 0x00000070 300 #define ERC32_MEC_UART_STATUS_ERRB 0x00700000 302 #define ERC32_MEC_UART_STATUS_DRA (ERC32_MEC_UART_STATUS_DR << 0) 303 #define ERC32_MEC_UART_STATUS_TSEA (ERC32_MEC_UART_STATUS_TSE << 0) 304 #define ERC32_MEC_UART_STATUS_THEA (ERC32_MEC_UART_STATUS_THE << 0) 305 #define ERC32_MEC_UART_STATUS_FEA (ERC32_MEC_UART_STATUS_FE << 0) 306 #define ERC32_MEC_UART_STATUS_PEA (ERC32_MEC_UART_STATUS_PE << 0) 307 #define ERC32_MEC_UART_STATUS_OEA (ERC32_MEC_UART_STATUS_OE << 0) 308 #define ERC32_MEC_UART_STATUS_CUA (ERC32_MEC_UART_STATUS_CU << 0) 309 #define ERC32_MEC_UART_STATUS_TXEA (ERC32_MEC_UART_STATUS_TXE << 0) 311 #define ERC32_MEC_UART_STATUS_DRB (ERC32_MEC_UART_STATUS_DR << 16) 312 #define ERC32_MEC_UART_STATUS_TSEB (ERC32_MEC_UART_STATUS_TSE << 16) 313 #define ERC32_MEC_UART_STATUS_THEB (ERC32_MEC_UART_STATUS_THE << 16) 314 #define ERC32_MEC_UART_STATUS_FEB (ERC32_MEC_UART_STATUS_FE << 16) 315 #define ERC32_MEC_UART_STATUS_PEB (ERC32_MEC_UART_STATUS_PE << 16) 316 #define ERC32_MEC_UART_STATUS_OEB (ERC32_MEC_UART_STATUS_OE << 16) 317 #define ERC32_MEC_UART_STATUS_CUB (ERC32_MEC_UART_STATUS_CU << 16) 318 #define ERC32_MEC_UART_STATUS_TXEB (ERC32_MEC_UART_STATUS_TXE << 16) 331 static __inline__
int bsp_irq_fixup(
int irq)
346 #define ERC32_Clear_interrupt( _source ) \ 348 ERC32_MEC.Interrupt_Clear = (1 << (_source)); \ 351 #define ERC32_Force_interrupt( _source ) \ 355 _level = sparc_disable_interrupts(); \ 356 ERC32_MEC.Test_Control = ERC32_MEC.Test_Control | 0x80000; \ 357 ERC32_MEC.Interrupt_Force = (1 << (_source)); \ 358 sparc_enable_interrupts( _level ); \ 361 #define ERC32_Is_interrupt_pending( _source ) \ 362 (ERC32_MEC.Interrupt_Pending & (1 << (_source))) 364 #define ERC32_Is_interrupt_masked( _source ) \ 365 (ERC32_MEC.Interrupt_Mask & (1 << (_source))) 367 #define ERC32_Mask_interrupt( _source ) \ 371 _level = sparc_disable_interrupts(); \ 372 ERC32_MEC.Interrupt_Mask |= (1 << (_source)); \ 373 sparc_enable_interrupts( _level ); \ 376 #define ERC32_Unmask_interrupt( _source ) \ 380 _level = sparc_disable_interrupts(); \ 381 ERC32_MEC.Interrupt_Mask &= ~(1 << (_source)); \ 382 sparc_enable_interrupts( _level ); \ 385 #define ERC32_Disable_interrupt( _source, _previous ) \ 388 uint32_t _mask = 1 << (_source); \ 390 _level = sparc_disable_interrupts(); \ 391 (_previous) = ERC32_MEC.Interrupt_Mask; \ 392 ERC32_MEC.Interrupt_Mask = _previous | _mask; \ 393 sparc_enable_interrupts( _level ); \ 394 (_previous) &= _mask; \ 397 #define ERC32_Restore_interrupt( _source, _previous ) \ 400 uint32_t _mask = 1 << (_source); \ 402 _level = sparc_disable_interrupts(); \ 403 ERC32_MEC.Interrupt_Mask = \ 404 (ERC32_MEC.Interrupt_Mask & ~_mask) | (_previous); \ 405 sparc_enable_interrupts( _level ); \ 409 #define BSP_Clear_interrupt(_source) ERC32_Clear_interrupt(_source) 410 #define BSP_Force_interrupt(_source) ERC32_Force_interrupt(_source) 411 #define BSP_Is_interrupt_pending(_source) ERC32_Is_interrupt_pending(_source) 412 #define BSP_Is_interrupt_masked(_source) ERC32_Is_interrupt_masked(_source) 413 #define BSP_Unmask_interrupt(_source) ERC32_Unmask_interrupt(_source) 414 #define BSP_Mask_interrupt(_source) ERC32_Mask_interrupt(_source) 415 #define BSP_Disable_interrupt(_source, _previous) \ 416 ERC32_Disable_interrupt(_source, _prev) 417 #define BSP_Restore_interrupt(_source, _previous) \ 418 ERC32_Restore_interrupt(_source, _previous) 421 #define BSP_Cpu_Is_interrupt_masked(_source, _cpu) \ 422 BSP_Is_interrupt_masked(_source) 423 #define BSP_Cpu_Unmask_interrupt(_source, _cpu) \ 424 BSP_Unmask_interrupt(_source) 425 #define BSP_Cpu_Mask_interrupt(_source, _cpu) \ 426 BSP_Mask_interrupt(_source) 427 #define BSP_Cpu_Disable_interrupt(_source, _previous, _cpu) \ 428 BSP_Disable_interrupt(_source, _prev) 429 #define BSP_Cpu_Restore_interrupt(_source, _previous, _cpu) \ 430 BSP_Cpu_Restore_interrupt(_source, _previous) 467 #define ERC32_MEC_TIMER_COUNTER_RELOAD_AT_ZERO 0x00000001 468 #define ERC32_MEC_TIMER_COUNTER_STOP_AT_ZERO 0x00000000 470 #define ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER 0x00000002 472 #define ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING 0x00000004 473 #define ERC32_MEC_TIMER_COUNTER_DISABLE_COUNTING 0x00000000 475 #define ERC32_MEC_TIMER_COUNTER_LOAD_SCALER 0x00000008 477 #define ERC32_MEC_TIMER_COUNTER_RELOAD_MASK 0x00000001 478 #define ERC32_MEC_TIMER_COUNTER_ENABLE_MASK 0x00000004 480 #define ERC32_MEC_TIMER_COUNTER_DEFINED_MASK 0x0000000F 481 #define ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK 0x00000005 483 extern uint32_t _ERC32_MEC_Timer_Control_Mirror;
491 #define ERC32_MEC_Set_General_Purpose_Timer_Control( _value ) \ 497 __value = ((_value) & 0x0f); \ 498 _level = sparc_disable_interrupts(); \ 499 _control = _ERC32_MEC_Timer_Control_Mirror; \ 500 _control &= ERC32_MEC_TIMER_COUNTER_DEFINED_MASK << 8; \ 501 _ERC32_MEC_Timer_Control_Mirror = _control | _value; \ 502 _control &= (ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK << 8); \ 503 _control |= __value; \ 505 ERC32_MEC.Timer_Control = _control; \ 506 sparc_enable_interrupts( _level ); \ 509 #define ERC32_MEC_Get_General_Purpose_Timer_Control( _value ) \ 511 (_value) = _ERC32_MEC_Timer_Control_Mirror & 0xf; \ 520 #define ERC32_MEC_Set_Real_Time_Clock_Timer_Control( _value ) \ 526 __value = ((_value) & 0x0f) << 8; \ 527 _level = sparc_disable_interrupts(); \ 528 _control = _ERC32_MEC_Timer_Control_Mirror; \ 529 _control &= ERC32_MEC_TIMER_COUNTER_DEFINED_MASK; \ 530 _ERC32_MEC_Timer_Control_Mirror = _control | __value; \ 531 _control &= ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK; \ 532 _control |= __value; \ 534 ERC32_MEC.Timer_Control = _control; \ 535 sparc_enable_interrupts( _level ); \ 538 #define ERC32_MEC_Get_Real_Time_Clock_Timer_Control( _value ) \ 540 (_value) = (_ERC32_MEC_Timer_Control_Mirror >> 8) & 0xf; \ Information Required to Build RTEMS for a Particular Member of the SPARC Family.
Definition: timerdata.h:41