diff options
| author | ZhangJing <[email protected]> | 2025-05-30 13:32:58 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2025-05-30 14:06:33 +0800 |
| commit | 97893c004c65760c638fd7eb571a08fc987a55e5 (patch) | |
| tree | 71c7c743e10a1281a104bfac56307e3d338a9818 /bsp/ultrarisc/ur_dp1000_evb/board | |
| parent | 93cc80e461d1e6d81e84c16caee4358f229e80f3 (diff) | |
[bsp]增加超睿DP1000 bsp支持v5.2.1
Diffstat (limited to 'bsp/ultrarisc/ur_dp1000_evb/board')
| -rwxr-xr-x | bsp/ultrarisc/ur_dp1000_evb/board/Kconfig | 69 | ||||
| -rwxr-xr-x | bsp/ultrarisc/ur_dp1000_evb/board/SConscript | 9 | ||||
| -rw-r--r-- | bsp/ultrarisc/ur_dp1000_evb/board/board.c | 126 | ||||
| -rw-r--r-- | bsp/ultrarisc/ur_dp1000_evb/board/board.h | 33 |
4 files changed, 237 insertions, 0 deletions
diff --git a/bsp/ultrarisc/ur_dp1000_evb/board/Kconfig b/bsp/ultrarisc/ur_dp1000_evb/board/Kconfig new file mode 100755 index 0000000000..6f6d714f20 --- /dev/null +++ b/bsp/ultrarisc/ur_dp1000_evb/board/Kconfig @@ -0,0 +1,69 @@ +menu "Ultrarisc DP1000 Soc Drivers Configuration" + +menuconfig BSP_USING_PLIC + bool "Using PLIC" + default y + if BSP_USING_PLIC + config PLIC_BASE_ADDR + hex "plic base mmio addr" + default 0x9000000 + config PLIC_NDEV + hex "plic supported irqs" + default 160 + endif + +menuconfig BSP_USING_UART0 + bool "Using UART0" + select RT_USING_SERIAL + default y + + if BSP_USING_UART0 + config UART0_IRQ_BASE + int "uart0 irq number" + default 18 + + config UART0_REFERENCE_CLOCK + int "uart0 clock" + default 62500000 + + config UART0_DEFAULT_BAUDRATE + int "uart0 baudrate" + default 115200 + + config UART0_BASE_ADDR + hex "uart0 base mmio addr" + default 0x20310000 + + config UART0_REG_SHIFT + int "uart0 reg shift" + default 2 + + endif + +menuconfig BSP_USING_DW_SPI + bool "Using Dw apb ssi SPI" + select RT_USING_SPI + default n + if BSP_USING_DW_SPI + config DW_SPI_IRQ_BASE + int "spi irq number" + default 19 + + config DW_SPI_BASE_ADDR + hex "dw spi base mmio addr" + default 0x20320000 + + config DW_SPI_MAX_FREQ + int "dw max spi freq" + default 62500000 + + endif + +menuconfig BSP_USING_MMC + bool "Using MMC" + select BSP_USING_SPI + select RT_USING_SPI_MSD + select RT_USING_DFS_ELMFAT + default n + +endmenu
\ No newline at end of file diff --git a/bsp/ultrarisc/ur_dp1000_evb/board/SConscript b/bsp/ultrarisc/ur_dp1000_evb/board/SConscript new file mode 100755 index 0000000000..4488cae073 --- /dev/null +++ b/bsp/ultrarisc/ur_dp1000_evb/board/SConscript @@ -0,0 +1,9 @@ +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') + Glob('*.cpp') + Glob('*.S') +CPPPATH = [cwd] + +group = DefineGroup('Driver', src, depend = [''], CPPPATH = CPPPATH) + +Return('group') diff --git a/bsp/ultrarisc/ur_dp1000_evb/board/board.c b/bsp/ultrarisc/ur_dp1000_evb/board/board.c new file mode 100644 index 0000000000..0a672df343 --- /dev/null +++ b/bsp/ultrarisc/ur_dp1000_evb/board/board.c @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2006-2025 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2025-01-22 ZhangJing first version + */ +#include <rthw.h> +#include <rtthread.h> +#include <rtdevice.h> +#include "board.h" +#include "tick.h" +#include "drv_uart.h" +#include "sbi.h" +#include "riscv.h" +#include "plic.h" + +#ifdef RT_USING_SMART +#include <mmu.h> +#include "page.h" +#include "lwp_arch.h" + +rt_region_t init_page_region = {(rt_size_t)RT_HW_PAGE_START, (rt_size_t)RT_HW_PAGE_END}; + +extern size_t MMUTable[]; + +struct mem_desc platform_mem_desc[] = +{ + {KERNEL_VADDR_START, (rt_size_t)RT_HW_PAGE_END - 1, (rt_size_t)ARCH_MAP_FAILED, NORMAL_MEM}, +}; + +#define NUM_MEM_DESC (sizeof(platform_mem_desc) / sizeof(platform_mem_desc[0])) + +#endif + +void primary_cpu_entry(void) +{ + /* disable global interrupt */ + rt_hw_interrupt_disable(); + + entry(); +} + +/*initialize the bss section*/ +void init_bss(void) +{ + unsigned int *dst; + + dst = &__bss_start; + while (dst < &__bss_end) + { + *dst++ = 0; + } +} + +#define IOREMAP_SIZE (1ul << 30) + +#ifndef ARCH_REMAP_KERNEL + #define IOREMAP_VEND USER_VADDR_START +#else + #define IOREMAP_VEND 0ul +#endif + +/*set the plic base*/ +void set_plic_base(void) +{ + plic_base = PLIC_BASE_ADDR; + + return; +} + +void rt_hw_board_init(void) +{ +#if defined(RT_USING_SMART) + /* init data structure */ + rt_hw_mmu_map_init(&rt_kernel_space, (void *)(IOREMAP_VEND - IOREMAP_SIZE), IOREMAP_SIZE, (rt_size_t *)MMUTable, PV_OFFSET); + + /* init page allocator */ + rt_page_init(init_page_region); + + /* setup region, and enable MMU */ + rt_hw_mmu_setup(&rt_kernel_space, platform_mem_desc, NUM_MEM_DESC); +#endif + + /* initialize memory system */ +#ifdef RT_USING_HEAP + rt_system_heap_init(RT_HW_HEAP_BEGIN, RT_HW_HEAP_END); +#endif + + /*set the plic base*/ + set_plic_base(); + + /* initalize interrupt */ + rt_hw_interrupt_init(); + + /* init rtthread hardware */ + rt_hw_tick_init(); + +#ifdef RT_USING_SERIAL + rt_hw_uart_init(); +#endif + +#ifdef RT_USING_CONSOLE + /* set console device */ + rt_console_set_device(RT_CONSOLE_DEVICE_NAME); +#endif /* RT_USING_CONSOLE */ + +#ifdef RT_USING_COMPONENTS_INIT + rt_components_board_init(); +#endif + +#ifdef RT_USING_HEAP + rt_kprintf("heap: [0x%08x - 0x%08x]\n", (rt_ubase_t)RT_HW_HEAP_BEGIN, (rt_ubase_t)RT_HW_HEAP_END); +#endif /* RT_USING_HEAP */ +} + +void rt_hw_cpu_reset(void) +{ + sbi_shutdown(); + + while (1) + ; +} +MSH_CMD_EXPORT_ALIAS(rt_hw_cpu_reset, reboot, reset machine);
\ No newline at end of file diff --git a/bsp/ultrarisc/ur_dp1000_evb/board/board.h b/bsp/ultrarisc/ur_dp1000_evb/board/board.h new file mode 100644 index 0000000000..d19f80e810 --- /dev/null +++ b/bsp/ultrarisc/ur_dp1000_evb/board/board.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2006-2025 RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023/06/25 flyingcys first version + * 2025-05-28 ZhangJing Porting to ultrarisc dp1000 + */ + +#ifndef BOARD_H__ +#define BOARD_H__ + +#include <rtconfig.h> + +extern unsigned int __bss_start; +extern unsigned int __bss_end; + +#ifndef RT_USING_SMART + #define KERNEL_VADDR_START 0x0 +#endif + +#define VIRT64_SBI_MEMSZ (0x200000) + +#define RT_HW_HEAP_BEGIN ((void *)&__bss_end) +#define RT_HW_HEAP_END ((void *)(RT_HW_HEAP_BEGIN + 64 * 1024 * 1024)) +#define RT_HW_PAGE_START RT_HW_HEAP_END +#define RT_HW_PAGE_END ((void *)(KERNEL_VADDR_START + (256 * 1024 * 1024 - VIRT64_SBI_MEMSZ))) + +void rt_hw_board_init(void); + +#endif
\ No newline at end of file |
