You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/01/25 06:11:13 UTC

[nuttx] branch master updated: litex: Allow custom peripheral memory mapping and IRQ.

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 34fdc3da0d litex: Allow custom peripheral memory mapping and IRQ.
34fdc3da0d is described below

commit 34fdc3da0d65b00720a18d91232d415c8204c491
Author: Stuart Ianna <st...@motec.com.au>
AuthorDate: Wed Jan 25 11:44:20 2023 +1100

    litex: Allow custom peripheral memory mapping and IRQ.
---
 arch/risc-v/include/litex/irq.h                  |  5 ++++
 arch/risc-v/src/litex/Kconfig                    | 38 ++++++++++++++++++++++++
 arch/risc-v/src/litex/hardware/litex_memorymap.h |  9 ++++++
 3 files changed, 52 insertions(+)

diff --git a/arch/risc-v/include/litex/irq.h b/arch/risc-v/include/litex/irq.h
index 6a01e2efe0..1bfef0b5d4 100644
--- a/arch/risc-v/include/litex/irq.h
+++ b/arch/risc-v/include/litex/irq.h
@@ -25,6 +25,10 @@
  * Included Files
  ****************************************************************************/
 
+#ifdef CONFIG_LITEX_USE_CUSTOM_IRQ_DEFINITIONS
+#include CONFIG_LITEX_CUSTOM_IRQ_DEFINITIONS_PATH
+#else
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -40,4 +44,5 @@
 
 #define NR_IRQS            (LITEX_IRQ_SDCARD + 1)
 
+#endif /* CONFIG_LITEX_USE_CUSTOM_IRQ_DEFINITIONS */
 #endif /* __ARCH_RISCV_INCLUDE_LITEX_IRQ_H */
diff --git a/arch/risc-v/src/litex/Kconfig b/arch/risc-v/src/litex/Kconfig
index 846bed7109..99472a9400 100644
--- a/arch/risc-v/src/litex/Kconfig
+++ b/arch/risc-v/src/litex/Kconfig
@@ -16,6 +16,44 @@ menu "LITEX Peripheral Support"
 # These "hidden" settings determine whether a peripheral option is available
 # for the selected MCU
 
+config LITEX_USE_CUSTOM_MEMORY_MAP
+	bool "Custom peripheral memory mapping"
+	default n
+	---help---
+		Use a custom memory map for the peripheral base addresses defined in
+		arch/risc-v/src/litex/hardware/litex_memorymap.h.
+
+if LITEX_USE_CUSTOM_MEMORY_MAP
+
+config LITEX_CUSTOM_MEMORY_MAP_PATH
+	string "Path to custom memory map include file."
+	default ""
+	---help---
+		Specify the path to the file containing the peripheral memory mapping.
+		The path specified must be relative to arch/risc-v/src/litex/hardware/litex_memorymap.h.
+		The file must redefine any symbols which are intended to be overridden.
+
+endif
+
+config LITEX_USE_CUSTOM_IRQ_DEFINITIONS
+	bool "Custom IRQ mapping"
+	default n
+	---help---
+		Use custom definitions for risc-v IRQ numbers and sequence.
+		Allowing for the definitions in arch/risc-v/include/litex/irq.h to be overridden.
+		
+if LITEX_USE_CUSTOM_IRQ_DEFINITIONS
+
+config LITEX_CUSTOM_IRQ_DEFINITIONS_PATH
+	string "Path to custom IRQ mapping include file."
+	default ""
+	---help---
+		Specify the path to the file containing the custom IRQ definitions.
+		The path specified must be relative to arch/risc-v/include/litex/irq.
+		The file must redefine any symbols which are intended to be overridden.
+
+endif
+
 config LITEX_HAVE_UART0
 	bool
 	default y
diff --git a/arch/risc-v/src/litex/hardware/litex_memorymap.h b/arch/risc-v/src/litex/hardware/litex_memorymap.h
index 5211c5464b..1aeb7073b1 100644
--- a/arch/risc-v/src/litex/hardware/litex_memorymap.h
+++ b/arch/risc-v/src/litex/hardware/litex_memorymap.h
@@ -21,6 +21,14 @@
 #ifndef __ARCH_RISCV_SRC_LITEX_HARDWARE_LITEX_MEMORYMAP_H
 #define __ARCH_RISCV_SRC_LITEX_HARDWARE_LITEX_MEMORYMAP_H
 
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#ifdef CONFIG_LITEX_USE_CUSTOM_MEMORY_MAP
+#include CONFIG_LITEX_CUSTOM_MEMORY_MAP_PATH
+#else
+
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -45,4 +53,5 @@
 #define LITEX_ETHMAC_RXBASE     0x80000000
 #define LITEX_ETHMAC_TXBASE     0x80001000
 
+#endif /* CONFIG_LITEX_USE_CUSTOM_MEMORY_MAP */
 #endif /* __ARCH_RISCV_SRC_LITEX_HARDWARE_LITEX_MEMORYMAP_H */