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 */