summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c
diff options
context:
space:
mode:
authorDaniel Cederman <cederman@gaisler.com>2014-10-01 13:53:03 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-10-02 07:29:05 +0200
commit93b000e6457c7b033a9e2826847a712e40e33ec0 (patch)
tree6fd279e6caec35e7f7a0426671c38bf9ae172959 /c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c
parentpppd: Import change from NetBSD (diff)
downloadrtems-93b000e6457c7b033a9e2826847a712e40e33ec0.tar.bz2
bsp/leon3: Replace the define LEON3_MP_IRQ with a weakly linked variable
The LEON3_MP_IRQ define is used to pick the IRQ to be used by the shared memory driver and for inter-processor interrupts. On some LEON3 systems, for example the GR712RC, the default value of 14 is not suitable. To make this value configurable from the application, it is replaced with a weakly linked variable that can be overridden from the application.
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c b/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c
index b7c347e451..567c971d2e 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspsmp.c
@@ -21,6 +21,11 @@
#include <rtems/score/smpimpl.h>
#include <stdlib.h>
+/* Irq used by shared memory driver and for inter-processor interrupts.
+ * Can be overridden by being defined in the application.
+ */
+unsigned char LEON3_mp_irq __attribute__((weak)) = 14;
+
#if !defined(__leon__) || defined(RTEMS_PARAVIRT)
uint32_t _CPU_SMP_Get_current_processor( void )
{
@@ -41,7 +46,7 @@ void bsp_start_on_secondary_processor()
leon3_set_cache_control_register(0x80000F);
/* Unmask IPI interrupts at Interrupt controller for this CPU */
- LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_MP_IRQ;
+ LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_mp_irq;
_SMP_Start_multitasking_on_secondary_processor();
}
@@ -51,8 +56,8 @@ uint32_t _CPU_SMP_Initialize( void )
leon3_set_cache_control_register(0x80000F);
if ( rtems_configuration_get_maximum_processors() > 1 ) {
- LEON_Unmask_interrupt(LEON3_MP_IRQ);
- set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1);
+ LEON_Unmask_interrupt(LEON3_mp_irq);
+ set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_mp_irq), 1);
}
return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
@@ -79,7 +84,7 @@ void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
{
/* send interrupt to destination CPU */
- LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
+ LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_mp_irq;
}
void _LEON3_Start_multitasking(