[PR 13] LEON3: make SHM driver configurable using weak

Daniel Hellstrom daniel at gaisler.com
Mon Feb 6 14:15:46 UTC 2012


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/shmsupp/getcfg.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c b/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
index 3711777..55b5659 100644
--- a/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
+++ b/c/src/lib/libbsp/sparc/leon3/shmsupp/getcfg.c
@@ -76,8 +76,12 @@ 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,
+  0x00001000,
+};
 
 void Shm_Get_configuration(
   uint32_t   localnode,
@@ -88,8 +92,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;
 
   /*
-- 
1.7.0.4




More information about the devel mailing list