forked from Imagelibrary/rtems
bsps/sparc: Use rtems_interrupt_handler_install()
Avoid using set_vector() which depends on _ISR_Vector_table(). Prepare for a statically initialized trap table. Update #4458.
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <bspopts.h>
|
#include <rtems/irq-extension.h>
|
||||||
#include <rtems/sysinit.h>
|
#include <rtems/sysinit.h>
|
||||||
#include <rtems/timecounter.h>
|
#include <rtems/timecounter.h>
|
||||||
#include <rtems/score/sparcimpl.h>
|
#include <rtems/score/sparcimpl.h>
|
||||||
@@ -105,7 +105,13 @@ RTEMS_SYSINIT_ITEM(
|
|||||||
#define CLOCK_VECTOR ERC32_TRAP_TYPE( ERC32_INTERRUPT_REAL_TIME_CLOCK )
|
#define CLOCK_VECTOR ERC32_TRAP_TYPE( ERC32_INTERRUPT_REAL_TIME_CLOCK )
|
||||||
|
|
||||||
#define Clock_driver_support_install_isr( _new ) \
|
#define Clock_driver_support_install_isr( _new ) \
|
||||||
set_vector( _new, CLOCK_VECTOR, 1 )
|
(void) rtems_interrupt_handler_install( \
|
||||||
|
ERC32_INTERRUPT_REAL_TIME_CLOCK, \
|
||||||
|
"Clock", \
|
||||||
|
RTEMS_INTERRUPT_SHARED, \
|
||||||
|
_new, \
|
||||||
|
NULL \
|
||||||
|
)
|
||||||
|
|
||||||
#define Clock_driver_support_set_interrupt_affinity( _online_processors ) \
|
#define Clock_driver_support_set_interrupt_affinity( _online_processors ) \
|
||||||
do { \
|
do { \
|
||||||
|
|||||||
@@ -46,6 +46,8 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BSP_FEATURE_IRQ_EXTENSION
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BSP provides its own Idle thread body
|
* BSP provides its own Idle thread body
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -58,14 +58,28 @@
|
|||||||
|
|
||||||
#define TEST_INTERRUPT_SOURCE ERC32_INTERRUPT_EXTERNAL_1
|
#define TEST_INTERRUPT_SOURCE ERC32_INTERRUPT_EXTERNAL_1
|
||||||
#define TEST_INTERRUPT_SOURCE2 (ERC32_INTERRUPT_EXTERNAL_1+1)
|
#define TEST_INTERRUPT_SOURCE2 (ERC32_INTERRUPT_EXTERNAL_1+1)
|
||||||
#define TEST_VECTOR ERC32_TRAP_TYPE( TEST_INTERRUPT_SOURCE )
|
|
||||||
#define TEST_VECTOR2 ERC32_TRAP_TYPE( TEST_INTERRUPT_SOURCE2 )
|
|
||||||
|
|
||||||
#define MUST_WAIT_FOR_INTERRUPT 1
|
#define MUST_WAIT_FOR_INTERRUPT 1
|
||||||
|
|
||||||
#define Install_tm27_vector( handler ) \
|
static inline void Install_tm27_vector(
|
||||||
set_vector( (handler), TEST_VECTOR, 1 ); \
|
void ( *handler )( rtems_vector_number )
|
||||||
set_vector( (handler), TEST_VECTOR2, 1 );
|
)
|
||||||
|
{
|
||||||
|
(void) rtems_interrupt_handler_install(
|
||||||
|
TEST_INTERRUPT_SOURCE,
|
||||||
|
"tm27 low",
|
||||||
|
RTEMS_INTERRUPT_SHARED,
|
||||||
|
(rtems_interrupt_handler) handler,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
(void) rtems_interrupt_handler_install(
|
||||||
|
TEST_INTERRUPT_SOURCE2,
|
||||||
|
"tm27 high",
|
||||||
|
RTEMS_INTERRUPT_SHARED,
|
||||||
|
(rtems_interrupt_handler) handler,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#define Cause_tm27_intr() \
|
#define Cause_tm27_intr() \
|
||||||
do { \
|
do { \
|
||||||
|
|||||||
@@ -93,14 +93,14 @@ uint32_t _CPU_Counter_frequency(void)
|
|||||||
return LEON2_TIMER_1_FREQUENCY;
|
return LEON2_TIMER_1_FREQUENCY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* The Real Time Clock Counter Timer uses this trap type.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CLOCK_VECTOR LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER1 )
|
|
||||||
|
|
||||||
#define Clock_driver_support_install_isr( _new ) \
|
#define Clock_driver_support_install_isr( _new ) \
|
||||||
set_vector( _new, CLOCK_VECTOR, 1 )
|
(void) rtems_interrupt_handler_install( \
|
||||||
|
LEON_INTERRUPT_TIMER1, \
|
||||||
|
"Clock", \
|
||||||
|
RTEMS_INTERRUPT_SHARED, \
|
||||||
|
_new, \
|
||||||
|
NULL \
|
||||||
|
)
|
||||||
|
|
||||||
#define Clock_driver_support_at_tick() leon2_clock_at_tick()
|
#define Clock_driver_support_at_tick() leon2_clock_at_tick()
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ extern "C" {
|
|||||||
/* SPARC CPU variant: LEON2 */
|
/* SPARC CPU variant: LEON2 */
|
||||||
#define LEON2 1
|
#define LEON2 1
|
||||||
|
|
||||||
|
#define BSP_FEATURE_IRQ_EXTENSION
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BSP provides its own Idle thread body
|
* BSP provides its own Idle thread body
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -57,14 +57,28 @@
|
|||||||
#else /* use a regular asynchronous trap */
|
#else /* use a regular asynchronous trap */
|
||||||
|
|
||||||
#define TEST_INTERRUPT_SOURCE LEON_INTERRUPT_EXTERNAL_1
|
#define TEST_INTERRUPT_SOURCE LEON_INTERRUPT_EXTERNAL_1
|
||||||
#define TEST_VECTOR LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE )
|
|
||||||
#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
|
#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
|
||||||
#define TEST_VECTOR2 LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE2 )
|
|
||||||
#define MUST_WAIT_FOR_INTERRUPT 1
|
#define MUST_WAIT_FOR_INTERRUPT 1
|
||||||
|
|
||||||
#define Install_tm27_vector( handler ) \
|
static inline void Install_tm27_vector(
|
||||||
set_vector( (handler), TEST_VECTOR, 1 ); \
|
void ( *handler )( rtems_vector_number )
|
||||||
set_vector( (handler), TEST_VECTOR2, 1 );
|
)
|
||||||
|
{
|
||||||
|
(void) rtems_interrupt_handler_install(
|
||||||
|
TEST_INTERRUPT_SOURCE,
|
||||||
|
"tm27 low",
|
||||||
|
RTEMS_INTERRUPT_SHARED,
|
||||||
|
(rtems_interrupt_handler) handler,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
(void) rtems_interrupt_handler_install(
|
||||||
|
TEST_INTERRUPT_SOURCE2,
|
||||||
|
"tm27 high",
|
||||||
|
RTEMS_INTERRUPT_SHARED,
|
||||||
|
(rtems_interrupt_handler) handler,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#define Cause_tm27_intr() \
|
#define Cause_tm27_intr() \
|
||||||
do { \
|
do { \
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ extern "C" {
|
|||||||
/* SPARC CPU variant: LEON3 */
|
/* SPARC CPU variant: LEON3 */
|
||||||
#define LEON3 1
|
#define LEON3 1
|
||||||
|
|
||||||
|
#define BSP_FEATURE_IRQ_EXTENSION
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BSP provides its own Idle thread body
|
* BSP provides its own Idle thread body
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -57,14 +57,28 @@
|
|||||||
#else /* use a regular asynchronous trap */
|
#else /* use a regular asynchronous trap */
|
||||||
|
|
||||||
#define TEST_INTERRUPT_SOURCE LEON_INTERRUPT_EXTERNAL_1
|
#define TEST_INTERRUPT_SOURCE LEON_INTERRUPT_EXTERNAL_1
|
||||||
#define TEST_VECTOR LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE )
|
|
||||||
#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
|
#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
|
||||||
#define TEST_VECTOR2 LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE2 )
|
|
||||||
#define MUST_WAIT_FOR_INTERRUPT 1
|
#define MUST_WAIT_FOR_INTERRUPT 1
|
||||||
|
|
||||||
#define Install_tm27_vector( handler ) \
|
static inline void Install_tm27_vector(
|
||||||
set_vector( (handler), TEST_VECTOR, 1 ); \
|
void ( *handler )( rtems_vector_number )
|
||||||
set_vector( (handler), TEST_VECTOR2, 1 );
|
)
|
||||||
|
{
|
||||||
|
(void) rtems_interrupt_handler_install(
|
||||||
|
TEST_INTERRUPT_SOURCE,
|
||||||
|
"tm27 low",
|
||||||
|
RTEMS_INTERRUPT_SHARED,
|
||||||
|
(rtems_interrupt_handler) handler,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
(void) rtems_interrupt_handler_install(
|
||||||
|
TEST_INTERRUPT_SOURCE2,
|
||||||
|
"tm27 high",
|
||||||
|
RTEMS_INTERRUPT_SHARED,
|
||||||
|
(rtems_interrupt_handler) handler,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#define Cause_tm27_intr() \
|
#define Cause_tm27_intr() \
|
||||||
do { \
|
do { \
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ void Shm_setvec( void )
|
|||||||
* Interrupt driven mode is not currently supported.
|
* Interrupt driven mode is not currently supported.
|
||||||
* This is thought to be the interrupt to use.
|
* This is thought to be the interrupt to use.
|
||||||
*/
|
*/
|
||||||
LEON_Unmask_interrupt(LEON3_mp_irq);
|
(void) rtems_interrupt_handler_install(
|
||||||
set_vector((rtems_isr_entry) Shm_isr, LEON_TRAP_TYPE(LEON3_mp_irq), 1);
|
LEON3_mp_irq,
|
||||||
|
"MPCI",
|
||||||
|
RTEMS_INTERRUPT_SHARED,
|
||||||
|
(rtems_interrupt_handler) Shm_isr,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include <bsp/fatal.h>
|
#include <bsp/fatal.h>
|
||||||
#include <leon.h>
|
#include <leon.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
|
#include <rtems/score/assert.h>
|
||||||
#include <rtems/score/smpimpl.h>
|
#include <rtems/score/smpimpl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@@ -28,10 +29,9 @@ uint32_t _CPU_SMP_Get_current_processor( void )
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static rtems_isr bsp_inter_processor_interrupt(
|
static void bsp_inter_processor_interrupt( void *arg )
|
||||||
rtems_vector_number vector
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
|
(void) arg;
|
||||||
_SMP_Inter_processor_interrupt_handler(_Per_CPU_Get());
|
_SMP_Inter_processor_interrupt_handler(_Per_CPU_Get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,11 +57,19 @@ void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self)
|
|||||||
|
|
||||||
uint32_t _CPU_SMP_Initialize( void )
|
uint32_t _CPU_SMP_Initialize( void )
|
||||||
{
|
{
|
||||||
|
rtems_status_code sc;
|
||||||
|
|
||||||
if ( !leon3_data_cache_snooping_enabled() )
|
if ( !leon3_data_cache_snooping_enabled() )
|
||||||
bsp_fatal( LEON3_FATAL_INVALID_CACHE_CONFIG_MAIN_PROCESSOR );
|
bsp_fatal( LEON3_FATAL_INVALID_CACHE_CONFIG_MAIN_PROCESSOR );
|
||||||
|
|
||||||
LEON_Unmask_interrupt(LEON3_mp_irq);
|
sc = rtems_interrupt_handler_install(
|
||||||
set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_mp_irq), 1);
|
LEON3_mp_irq,
|
||||||
|
"IPI",
|
||||||
|
RTEMS_INTERRUPT_SHARED,
|
||||||
|
bsp_inter_processor_interrupt,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
_Assert_Unused_variable_equals( sc, RTEMS_SUCCESSFUL );
|
||||||
|
|
||||||
return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
|
return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user