[rtems commit] PR 2015 - LEON3: make SHM driver configurable using weak

Joel Sherrill joel at rtems.org
Fri Feb 17 20:30:09 UTC 2012


Module:    rtems
Branch:    master
Commit:    39e8aa960383471d19c46b0e8a7e65d53b85f643
Changeset: http://git.rtems.org/rtems/commit/?id=39e8aa960383471d19c46b0e8a7e65d53b85f643

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Fri Feb 17 14:28:19 2012 -0600

PR 2015 - LEON3: make SHM driver configurable using weak

PR 2015/bsps

Since the configuration struct is always present one can let
DATA initialize it to reduce footprint, at the same time it
is made weak to let the user able to configure the SHM driver
without editing the driver code.

Signed-off-by: Daniel Hellstrom <daniel at gaisler.com>

---

 c/src/lib/libbsp/sparc/leon3/ChangeLog        |    5 +++++
 c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c |   22 +++++++++++++++++-----
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/leon3/ChangeLog b/c/src/lib/libbsp/sparc/leon3/ChangeLog
index c8ed389..4a926fd 100644
--- a/c/src/lib/libbsp/sparc/leon3/ChangeLog
+++ b/c/src/lib/libbsp/sparc/leon3/ChangeLog
@@ -1,3 +1,8 @@
+2012-02-17	Daniel Hellstrom <daniel at gaisler.com>
+
+	PR 2015/bsps
+	* shmsupp/getcfg.c: Make SHM driver configurable using weak symbol.
+
 2011-06-29	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* smp/getcpuid.c: Fix header from accidental and irrelevant copy and
diff --git a/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c b/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
index 3711777..f8edf11 100644
--- a/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
+++ b/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
@@ -76,8 +76,21 @@ extern rtems_mpci_entry Shm_Send_packet(
 #define INTERRUPT 0        /* XXX: */
 #define POLLING   1        /* XXX: fix me -- is polling ONLY!!! */
 
-
-shm_config_table BSP_shm_cfgtbl;
+/* Let user override this configuration by declaring this a weak variable */
+shm_config_table BSP_shm_cfgtbl __attribute__((weak)) =
+{
+  (vol_u32 *)0x40000000,    /* USER OVERRIDABLE */
+  0x00001000,               /* USER OVERRIDABLE */
+  SHM_BIG,
+  NULL_CONVERT,
+  INTR_MODE,
+  Shm_Cause_interrupt,
+  {
+    NULL,
+    1 << LEON3_MP_IRQ,      /* USER OVERRIDABLE */
+    4,
+  },
+};
 
 void Shm_Get_configuration(
   uint32_t   localnode,
@@ -88,8 +101,6 @@ void Shm_Get_configuration(
   int i;
   unsigned int tmp;
 
-  BSP_shm_cfgtbl.base         = 0x40000000;
-  BSP_shm_cfgtbl.length       = 0x00001000;
   BSP_shm_cfgtbl.format       = SHM_BIG;
 
   /*
@@ -108,7 +119,8 @@ void Shm_Get_configuration(
   BSP_shm_cfgtbl.poll_intr    = INTR_MODE;
   BSP_shm_cfgtbl.Intr.address =
      (vol_u32 *) &(LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index]);
-  BSP_shm_cfgtbl.Intr.value   = 1 << LEON3_MP_IRQ ;
+  if (BSP_shm_cfgtbl.Intr.value == 0)
+    BSP_shm_cfgtbl.Intr.value = 1 << LEON3_MP_IRQ; /* Use default MP-IRQ */
   BSP_shm_cfgtbl.Intr.length  = 4;
 
   if (LEON3_Cpu_Index == 0) {




More information about the vc mailing list