[rtems commit] bsp/leon3: Add LEON3_GPTIMER_BASE

Sebastian Huber sebh at rtems.org
Fri Jul 14 10:01:03 UTC 2023


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Jul 16 11:18:14 2021 +0200

bsp/leon3: Add LEON3_GPTIMER_BASE

---

 bsps/sparc/leon3/include/bsp/leon3.h           |  4 ++++
 bsps/sparc/leon3/start/amba.c                  |  4 ++++
 spec/build/bsps/sparc/leon3/grp.yml            |  2 ++
 spec/build/bsps/sparc/leon3/optgptimerbase.yml | 20 ++++++++++++++++++++
 4 files changed, 30 insertions(+)

diff --git a/bsps/sparc/leon3/include/bsp/leon3.h b/bsps/sparc/leon3/include/bsp/leon3.h
index 599d616aaf..18db7b8aea 100644
--- a/bsps/sparc/leon3/include/bsp/leon3.h
+++ b/bsps/sparc/leon3/include/bsp/leon3.h
@@ -189,7 +189,11 @@ static inline uint32_t leon3_get_data_cache_config_register( void )
 /**
  * @brief This pointer provides the GPTIMER register block address.
  */
+#if defined(LEON3_GPTIMER_BASE)
+#define LEON3_Timer_Regs ((gptimer *) LEON3_GPTIMER_BASE)
+#else
 extern gptimer *LEON3_Timer_Regs;
+#endif
 
 /**
  * @brief This pointer provides the GPTIMER device information block.
diff --git a/bsps/sparc/leon3/start/amba.c b/bsps/sparc/leon3/start/amba.c
index d4494224c4..36b988e90b 100644
--- a/bsps/sparc/leon3/start/amba.c
+++ b/bsps/sparc/leon3/start/amba.c
@@ -119,8 +119,10 @@ RTEMS_SYSINIT_ITEM(
 irqamp *LEON3_IrqCtrl_Regs;
 struct ambapp_dev *LEON3_IrqCtrl_Adev;
 
+#if !defined(LEON3_GPTIMER_BASE)
 gptimer *LEON3_Timer_Regs;
 struct ambapp_dev *LEON3_Timer_Adev;
+#endif
 
 /*
  *  amba_initialize
@@ -166,6 +168,7 @@ static void amba_initialize(void)
     LEON3_IrqCtrl_Regs += icsel;
   }
 
+#if !defined(LEON3_GPTIMER_BASE)
   /* find GP Timer */
   adev = (void *)ambapp_for_each(plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
                                  VENDOR_GAISLER, GAISLER_GPTIMER,
@@ -189,6 +192,7 @@ static void amba_initialize(void)
     if (leon3_timer_prescaler)
       grlib_store_32(&LEON3_Timer_Regs->sreload, leon3_timer_prescaler);
   }
+#endif
 }
 
 RTEMS_SYSINIT_ITEM(
diff --git a/spec/build/bsps/sparc/leon3/grp.yml b/spec/build/bsps/sparc/leon3/grp.yml
index 964682d0fe..cce4c1dc06 100644
--- a/spec/build/bsps/sparc/leon3/grp.yml
+++ b/spec/build/bsps/sparc/leon3/grp.yml
@@ -34,6 +34,8 @@ links:
   uid: objsmp
 - role: build-dependency
   uid: optapbuartbase
+- role: build-dependency
+  uid: optgptimerbase
 - role: build-dependency
   uid: optconirq
 - role: build-dependency
diff --git a/spec/build/bsps/sparc/leon3/optgptimerbase.yml b/spec/build/bsps/sparc/leon3/optgptimerbase.yml
new file mode 100644
index 0000000000..b2158208a0
--- /dev/null
+++ b/spec/build/bsps/sparc/leon3/optgptimerbase.yml
@@ -0,0 +1,20 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH & Co. KG
+actions:
+- get-integer: null
+- format-and-define: null
+build-type: option
+default:
+- enabled-by: sparc/gr712rc
+  value: 0x80000300
+- enabled-by: sparc/gr740
+  value: 0xff908000
+enabled-by: true
+format: '{:#010x}'
+links: []
+name: LEON3_GPTIMER_BASE
+description: |
+  This option defines the base address of the GPTIMER register block used by
+  the clock driver.
+type: build



More information about the vc mailing list