mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-17 07:05:31 +08:00
[bsp][qemu-virt64-aarch64] support full dm
Signed-off-by: GuEe-GUI <2991707448@qq.com>
This commit is contained in:
1 parent
a777a34758
commit
ed332e4aa9
40 files changed
+2926
-1444
No files matched your search
+121
-65
File diff suppressed because it is too large.
Load diff
Executable
+2
@@ -0,0 +1,2 @@
|
||||
*.qcow2
|
||||
*.dtb
|
||||
@@ -6,20 +6,17 @@ RTT_DIR := ../../
|
||||
|
||||
PKGS_DIR := packages
|
||||
|
||||
SOC_DM_SOC_DIR := $(BSP_DIR)/drivers
|
||||
|
||||
source "$(RTT_DIR)/Kconfig"
|
||||
osource "$PKGS_DIR/Kconfig"
|
||||
|
||||
config SOC_VIRT64_AARCH64
|
||||
bool
|
||||
select ARCH_ARMV8
|
||||
select ARCH_CPU_64BIT
|
||||
select ARCH_ARM_MMU
|
||||
select RT_USING_CACHE
|
||||
select RT_USING_COMPONENTS_INIT
|
||||
select RT_USING_USER_MAIN
|
||||
select RT_USING_GIC
|
||||
select BSP_USING_GIC
|
||||
select ARCH_MM_MMU
|
||||
select ARCH_CPU_64BIT
|
||||
select RT_USING_CACHE
|
||||
select RT_USING_STDC_ATOMIC
|
||||
default y
|
||||
|
||||
source "$(BSP_DIR)/drivers/Kconfig"
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-02-25 GuEe-GUI the first version
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
#define AMP_SLAVE
|
||||
#include "amp.dtsi"
|
||||
#include "amp.dt.h"
|
||||
|
||||
/delete-node/ &_memory;
|
||||
|
||||
&pic_mailbox1 {
|
||||
interrupt-affinity = <&cpu0>;
|
||||
};
|
||||
|
||||
/ {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
model = "linux,dummy-virt";
|
||||
interrupt-parent = <&gic>;
|
||||
|
||||
chosen {
|
||||
bootargs = "rpmsg.mode=slave console=ttyAMA0 cma=8M coherent_pool=2M root=vda0 rootfstype=elm rw";
|
||||
stdout-path = "/pl011@9040000";
|
||||
};
|
||||
|
||||
memory {
|
||||
reg = <0x0 (MEMORY_BASE + AMP_MEMORY_BASE) 0x0 AMP_MEMORY_SIZE>;
|
||||
device_type = "memory";
|
||||
};
|
||||
|
||||
cpus {
|
||||
#size-cells = <0>;
|
||||
#address-cells = <1>;
|
||||
|
||||
cpu0: cpu@CPU_ID {
|
||||
compatible = ""; /* To be filled */
|
||||
reg = <CPU_ID>;
|
||||
device_type = "cpu";
|
||||
};
|
||||
};
|
||||
|
||||
timer {
|
||||
compatible = "arm,armv8-timer","arm,armv7-timer";
|
||||
always-on;
|
||||
interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
|
||||
<GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
|
||||
<GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
|
||||
<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
|
||||
};
|
||||
|
||||
gic: interrupt-controller@8000000 {
|
||||
#if GIC_VERSION != 2
|
||||
compatible = "arm,gic-v3";
|
||||
reg = <0x0 0x8000000 0x0 0x010000>, /* GICD */
|
||||
<0x0 0x80a0000 0x0 0xf60000>; /* GICR */
|
||||
#redistributor-regions = <0x01>;
|
||||
#else
|
||||
compatible = "arm,cortex-a15-gic";
|
||||
reg = <0x0 0x8000000 0x0 0x010000>, /* GICD */
|
||||
<0x0 0x8010000 0x0 0x010000>; /* GICC */
|
||||
#endif
|
||||
skip-init;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <3>;
|
||||
};
|
||||
|
||||
clk24m: apb-pclk {
|
||||
clock-output-names = "clk24mhz";
|
||||
clock-frequency = <24000000>;
|
||||
#clock-cells = <0>;
|
||||
compatible = "fixed-clock";
|
||||
};
|
||||
|
||||
pl011@9040000 {
|
||||
clock-names = "uartclk", "apb_pclk";
|
||||
clocks = <&clk24m &clk24m>;
|
||||
interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-affinity = <&cpu0>;
|
||||
reg = <0x00 0x9040000 0x00 0x1000>;
|
||||
compatible = "arm,pl011", "arm,primecell";
|
||||
};
|
||||
|
||||
virtio_blk {
|
||||
compatible = "virtio,mmio";
|
||||
reg = <0 0 0 0>; /* To be filled */
|
||||
interrupts = <GIC_SPI 0 IRQ_TYPE_EDGE_RISING>; /* To be filled */
|
||||
interrupt-affinity = <&cpu0>;
|
||||
dma-coherent;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
/delete-node/ soc;
|
||||
|
||||
amp_soc {
|
||||
compatible = "simple-bus";
|
||||
/delete-property/ memory-region;
|
||||
/delete-property/ dtb-entry;
|
||||
/delete-property/ kernel-entry;
|
||||
|
||||
virtio_rpmsg {
|
||||
interrupt-affinity = <&cpu0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-02-25 GuEe-GUI the first version
|
||||
*/
|
||||
|
||||
#include <dt-bindings/size.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
|
||||
#define MEMORY_BASE 0x48000000
|
||||
#define MEMORY_SIZE (130 * SIZE_MB)
|
||||
|
||||
#define AMP_MEMORY_BASE 0x200000
|
||||
#define AMP_MEMORY_SIZE (128 * SIZE_MB)
|
||||
|
||||
/*
|
||||
* RUN COMMAND: ./qemu.py -dtbo amp.dtsi -mem 258
|
||||
* REMOTE: telnet localhost 4323
|
||||
*/
|
||||
|
||||
/ {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
reserved-memory {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
ranges = <0x0 0x0 0x0 MEMORY_BASE 0x0 MEMORY_SIZE>;
|
||||
|
||||
pic_mailbox@1ffe00 {
|
||||
reg = <0x0 0x1ffe00 0x0 0x200>;
|
||||
};
|
||||
|
||||
virtio_sram: virtio_sram@0 {
|
||||
reg = <0x0 0x0 0x0 0x1ffe00>;
|
||||
};
|
||||
|
||||
amp_memory: amp_memory@200000 {
|
||||
reg = <0x0 AMP_MEMORY_BASE 0x0 AMP_MEMORY_SIZE>;
|
||||
};
|
||||
};
|
||||
|
||||
soc {
|
||||
compatible = "simple-bus";
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
ranges = <0x0 0x0 0x0 MEMORY_BASE 0x0 MEMORY_SIZE>;
|
||||
|
||||
pic_mailbox0: pic_mailbox@1ffe00 {
|
||||
compatible = "rt-thread,pic-mailbox";
|
||||
reg = <0x0 0x1ffe00 0x0 0x200>;
|
||||
position = <0>;
|
||||
interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
|
||||
peer-interrupts = <(32 + 10)>;
|
||||
uid = <0>;
|
||||
#mbox-cells = <1>;
|
||||
};
|
||||
|
||||
virtio_rpmsg {
|
||||
compatible = "rt-thread,virtio-rpmsg";
|
||||
shmem = <&virtio_sram>;
|
||||
mboxes = <&pic_mailbox0 0>;
|
||||
queue-max = <64>;
|
||||
master;
|
||||
};
|
||||
};
|
||||
|
||||
#ifndef AMP_SLAVE
|
||||
/delete-node/ pl011@9040000;
|
||||
|
||||
aliases {
|
||||
/delete-property/ serial1;
|
||||
};
|
||||
#endif
|
||||
|
||||
amp_soc {
|
||||
/* DO NOT set a 'compatible' property on this node */
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
ranges = <0x0 0x0 0x0 MEMORY_BASE 0x0 MEMORY_SIZE>;
|
||||
memory-region = <&_memory>;
|
||||
dtb-entry = <0x48200000>;
|
||||
kernel-entry = <0x48480000>;
|
||||
|
||||
pic_mailbox1: pic_mailbox@1ffe00 {
|
||||
compatible = "rt-thread,pic-mailbox";
|
||||
reg = <0x0 0x1ffe00 0x0 0x200>;
|
||||
position = <1>;
|
||||
interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
|
||||
peer-interrupts = <(32 + 9)>;
|
||||
uid = <1>;
|
||||
#mbox-cells = <1>;
|
||||
};
|
||||
|
||||
virtio_rpmsg {
|
||||
compatible = "rt-thread,virtio-rpmsg";
|
||||
shmem = <&virtio_sram>;
|
||||
mboxes = <&pic_mailbox1 0>;
|
||||
queue-max = <64>;
|
||||
slave;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -4,6 +4,12 @@ cwd = GetCurrentDir()
|
||||
src = Glob('*.c') + Glob('*.cpp')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if not GetDepend(['RT_RPMSG_RT_THREAD_VIRTIO']):
|
||||
SrcRemove(src, ['amp.c'])
|
||||
|
||||
if not GetDepend(['RT_SOC_CAMERA']):
|
||||
SrcRemove(src, ['camera.c'])
|
||||
|
||||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
Executable
+277
File diff suppressed because it is too large.
Load diff
+207
File diff suppressed because it is too large.
Load diff
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-11-11 GuEe-GUI the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <virtio_console.h>
|
||||
|
||||
static int console_init()
|
||||
{
|
||||
rt_err_t status = RT_EOK;
|
||||
rt_device_t device = rt_device_find("virtio-console0");
|
||||
|
||||
if (device != RT_NULL && rt_device_open(device, 0) == RT_EOK)
|
||||
{
|
||||
/* Create vport0p1 */
|
||||
status = rt_device_control(device, VIRTIO_DEVICE_CTRL_CONSOLE_PORT_CREATE, RT_NULL);
|
||||
}
|
||||
|
||||
if (device != RT_NULL)
|
||||
{
|
||||
rt_device_close(device);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
INIT_ENV_EXPORT(console_init);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021/08/19 bernard the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#ifdef RT_USING_DFS
|
||||
#include <dfs_fs.h>
|
||||
|
||||
int mnt_init(void)
|
||||
{
|
||||
if (rt_device_find("virtio-blk0"))
|
||||
{
|
||||
/* mount virtio-blk as root directory */
|
||||
if (dfs_mount("virtio-blk0", "/", "elm", 0, RT_NULL) == 0)
|
||||
{
|
||||
rt_kprintf("file system initialization done!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dfs_mount("virtio-blk0", "/", "ext", 0, RT_NULL) == 0)
|
||||
{
|
||||
rt_kprintf("file system initialization done!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("file system initialization fail!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_ENV_EXPORT(mnt_init);
|
||||
#endif
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-6-30 GuEe-GUI first version
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#ifdef RT_USING_PIN
|
||||
|
||||
void qemu_gpio3_key_poweroff(void *args)
|
||||
{
|
||||
rt_kprintf("\nYou power off the machine.\n");
|
||||
|
||||
rt_hw_cpu_shutdown();
|
||||
}
|
||||
|
||||
static int pin_init()
|
||||
{
|
||||
rt_pin_attach_irq(3, PIN_IRQ_MODE_FALLING, qemu_gpio3_key_poweroff, RT_NULL);
|
||||
rt_pin_irq_enable(3, RT_TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_ENV_EXPORT(pin_init);
|
||||
|
||||
#endif /* RT_USING_PIN */
|
||||
Regular → Executable
+13
-78
@@ -1,80 +1,15 @@
|
||||
config RT_GRAPHIC_ROMFB_WIDTH
|
||||
int "ROM FB width"
|
||||
depends on RT_GRAPHIC_FB
|
||||
default 800
|
||||
|
||||
menu "AARCH64 qemu virt64 configs"
|
||||
menuconfig BSP_SUPPORT_FPU
|
||||
bool "Using Float"
|
||||
default y
|
||||
config RT_GRAPHIC_ROMFB_HEIGHT
|
||||
int "ROM FB height"
|
||||
depends on RT_GRAPHIC_FB
|
||||
default 600
|
||||
|
||||
menuconfig BSP_USING_UART
|
||||
bool "Using UART"
|
||||
select RT_USING_SERIAL
|
||||
default y
|
||||
|
||||
if BSP_USING_UART
|
||||
config RT_USING_UART0
|
||||
bool "Enabel UART 0"
|
||||
default y
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_RTC
|
||||
bool "Using RTC"
|
||||
select RT_USING_RTC
|
||||
default y
|
||||
|
||||
if BSP_USING_RTC
|
||||
config BSP_USING_ALARM
|
||||
bool "Enable Alarm"
|
||||
select RT_USING_ALARM
|
||||
default n
|
||||
endif
|
||||
|
||||
config BSP_USING_PIN
|
||||
bool "Using PIN"
|
||||
select RT_USING_PIN
|
||||
default y
|
||||
|
||||
config BSP_USING_VIRTIO_BLK
|
||||
bool "Using VirtIO BLK"
|
||||
select RT_USING_VIRTIO
|
||||
select RT_USING_VIRTIO_BLK
|
||||
default y
|
||||
|
||||
config BSP_USING_VIRTIO_NET
|
||||
bool "Using VirtIO NET"
|
||||
select RT_USING_VIRTIO
|
||||
select RT_USING_VIRTIO_NET
|
||||
default y
|
||||
|
||||
config BSP_USING_VIRTIO_CONSOLE
|
||||
bool "Using VirtIO Console"
|
||||
select RT_USING_VIRTIO
|
||||
select RT_USING_VIRTIO_CONSOLE
|
||||
default y
|
||||
|
||||
config BSP_USING_VIRTIO_GPU
|
||||
bool "Using VirtIO GPU"
|
||||
select RT_USING_VIRTIO
|
||||
select RT_USING_VIRTIO_GPU
|
||||
default y
|
||||
|
||||
config BSP_USING_VIRTIO_INPUT
|
||||
bool "Using VirtIO Input"
|
||||
select RT_USING_VIRTIO
|
||||
select RT_USING_VIRTIO_INPUT
|
||||
default y
|
||||
|
||||
config BSP_USING_GIC
|
||||
bool
|
||||
default y
|
||||
|
||||
choice
|
||||
prompt "GIC Version"
|
||||
default BSP_USING_GICV2
|
||||
|
||||
config BSP_USING_GICV2
|
||||
bool "GICv2"
|
||||
|
||||
config BSP_USING_GICV3
|
||||
bool "GICv3"
|
||||
endchoice
|
||||
|
||||
endmenu
|
||||
config RT_SOC_CAMERA
|
||||
bool "Camera"
|
||||
depends on RT_GRAPHIC_FB
|
||||
depends on RT_USING_PCI
|
||||
default y
|
||||
Regular → Executable
+7
-1
@@ -3,9 +3,15 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = Glob('*.c')
|
||||
src = ['board.c']
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if GetDepend(['RT_GRAPHIC_FB']):
|
||||
src += ['drv_romfb.c']
|
||||
|
||||
if GetDepend(['RT_SOC_CAMERA']):
|
||||
src += ['drv_camera.c']
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
@@ -11,14 +11,8 @@
|
||||
* add smp ipi init
|
||||
*/
|
||||
|
||||
#include <mmu.h>
|
||||
#include <board.h>
|
||||
#include <mm_aspace.h>
|
||||
#include <mm_page.h>
|
||||
#include <setup.h>
|
||||
|
||||
extern size_t MMUTable[];
|
||||
|
||||
void rt_hw_board_init(void)
|
||||
{
|
||||
rt_hw_common_setup();
|
||||
|
||||
@@ -12,16 +12,9 @@
|
||||
#ifndef __BOARD_H__
|
||||
#define __BOARD_H__
|
||||
|
||||
#include <virt.h>
|
||||
|
||||
extern unsigned char __bss_start;
|
||||
extern unsigned char __bss_end;
|
||||
|
||||
#define HEAP_BEGIN (void *)&__bss_end
|
||||
#define HEAP_END ((void *)HEAP_BEGIN + 64 * 1024 * 1024)
|
||||
|
||||
void rt_hw_board_init(void);
|
||||
|
||||
int rt_hw_uart_init(void);
|
||||
|
||||
#endif
|
||||
#endif /* __BOARD_H__ */
|
||||
Executable
+280
File diff suppressed because it is too large.
Load diff
Executable
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2026, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2026-04-07 GuEe-GUI the first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_CAMERA_H__
|
||||
#define __DRV_CAMERA_H__
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
#define RT_DEVICE_CTRL_CAMERA_GET_WIDTH (RT_DEVICE_CTRL_BASE(Char) + 'V' + 1)
|
||||
#define RT_DEVICE_CTRL_CAMERA_GET_HEIGHT (RT_DEVICE_CTRL_BASE(Char) + 'V' + 2)
|
||||
#define RT_DEVICE_CTRL_CAMERA_GET_FRAMEBUFFER (RT_DEVICE_CTRL_BASE(Char) + 'V' + 3)
|
||||
|
||||
#endif /* __DRV_CAMERA_H__ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-6-30 GuEe-GUI first version
|
||||
*/
|
||||
|
||||
#ifndef DRV_GPIO_H__
|
||||
#define DRV_GPIO_H__
|
||||
|
||||
int rt_hw_gpio_init(void);
|
||||
|
||||
#endif
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-02-25 GuEe-GUI the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
void platform_get_ramfb_params(rt_uint32_t *width, rt_uint32_t *height)
|
||||
{
|
||||
*width = RT_GRAPHIC_ROMFB_WIDTH;
|
||||
*height = RT_GRAPHIC_ROMFB_HEIGHT;
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-11-4 GuEe-GUI first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <sys/time.h>
|
||||
#include <board.h>
|
||||
|
||||
#include "drv_rtc.h"
|
||||
|
||||
#ifdef BSP_USING_RTC
|
||||
|
||||
#define RTC_DR 0x00 /* data read register */
|
||||
#define RTC_MR 0x04 /* match register */
|
||||
#define RTC_LR 0x08 /* data load register */
|
||||
#define RTC_CR 0x0c /* control register */
|
||||
#define RTC_IMSC 0x10 /* interrupt mask and set register */
|
||||
#define RTC_RIS 0x14 /* raw interrupt status register */
|
||||
#define RTC_MIS 0x18 /* masked interrupt status register */
|
||||
#define RTC_ICR 0x1c /* interrupt clear register */
|
||||
|
||||
#define RTC_CR_OPEN 1
|
||||
#define RTC_CR_CLOSE 0
|
||||
|
||||
static struct hw_rtc_device rtc_device;
|
||||
static rt_ubase_t pl031_rtc_base = PL031_RTC_BASE;
|
||||
|
||||
rt_inline rt_uint32_t pl031_read32(rt_ubase_t offset)
|
||||
{
|
||||
return (*((volatile unsigned int *)(pl031_rtc_base + offset)));
|
||||
}
|
||||
|
||||
rt_inline void pl031_write32(rt_ubase_t offset, rt_uint32_t value)
|
||||
{
|
||||
(*((volatile unsigned int *)(pl031_rtc_base + offset))) = value;
|
||||
}
|
||||
|
||||
static rt_err_t pl031_rtc_init(rt_device_t dev)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t pl031_rtc_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
{
|
||||
pl031_write32(RTC_CR, RTC_CR_OPEN);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t pl031_rtc_close(rt_device_t dev)
|
||||
{
|
||||
pl031_write32(RTC_CR, RTC_CR_CLOSE);
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t pl031_rtc_control(rt_device_t dev, int cmd, void *args)
|
||||
{
|
||||
|
||||
RT_ASSERT(dev != RT_NULL);
|
||||
|
||||
if (args == RT_NULL)
|
||||
{
|
||||
return -RT_EINVAL;
|
||||
}
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case RT_DEVICE_CTRL_RTC_GET_TIME:
|
||||
*(time_t *)args = pl031_read32(RTC_DR);
|
||||
break;
|
||||
case RT_DEVICE_CTRL_RTC_SET_TIME:
|
||||
pl031_write32(RTC_LR, *(time_t *)args);
|
||||
break;
|
||||
default:
|
||||
return -RT_EINVAL;
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_ssize_t pl031_rtc_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
|
||||
{
|
||||
pl031_rtc_control(dev, RT_DEVICE_CTRL_RTC_GET_TIME, buffer);
|
||||
return size;
|
||||
}
|
||||
|
||||
static rt_ssize_t pl031_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
|
||||
{
|
||||
pl031_rtc_control(dev, RT_DEVICE_CTRL_RTC_SET_TIME, (void *)buffer);
|
||||
return size;
|
||||
}
|
||||
|
||||
const static struct rt_device_ops pl031_rtc_ops =
|
||||
{
|
||||
.init = pl031_rtc_init,
|
||||
.open = pl031_rtc_open,
|
||||
.close = pl031_rtc_close,
|
||||
.read = pl031_rtc_read,
|
||||
.write = pl031_rtc_write,
|
||||
.control = pl031_rtc_control
|
||||
};
|
||||
|
||||
int rt_hw_rtc_init(void)
|
||||
{
|
||||
pl031_rtc_base = (rt_size_t)rt_ioremap((void *)pl031_rtc_base, PL031_RTC_SIZE);
|
||||
|
||||
rt_memset(&rtc_device, 0, sizeof(rtc_device));
|
||||
|
||||
rtc_device.device.type = RT_Device_Class_RTC;
|
||||
rtc_device.device.rx_indicate = RT_NULL;
|
||||
rtc_device.device.tx_complete = RT_NULL;
|
||||
rtc_device.device.ops = &pl031_rtc_ops;
|
||||
rtc_device.device.user_data = RT_NULL;
|
||||
|
||||
/* register a rtc device */
|
||||
rt_device_register(&rtc_device.device, "rtc0", RT_DEVICE_FLAG_RDWR);
|
||||
rt_soft_rtc_set_source("rtc0");
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_hw_rtc_init);
|
||||
#endif /* BSP_USING_RTC */
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-11-4 GuEe-GUI first version
|
||||
*/
|
||||
|
||||
#ifndef DRV_RTC_H__
|
||||
#define DRV_RTC_H__
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtdevice.h>
|
||||
#include <time.h>
|
||||
|
||||
struct hw_rtc_device
|
||||
{
|
||||
struct rt_device device;
|
||||
};
|
||||
|
||||
int rt_hw_rtc_init(void);
|
||||
|
||||
#endif
|
||||
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* serial.c UART driver
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2013-03-30 Bernard the first verion
|
||||
*/
|
||||
|
||||
#include <rthw.h>
|
||||
#include <rtdevice.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "mmu.h"
|
||||
|
||||
struct hw_uart_device
|
||||
{
|
||||
rt_size_t hw_base;
|
||||
rt_size_t irqno;
|
||||
};
|
||||
|
||||
#define UART_DR(base) __REG32(base + 0x00)
|
||||
#define UART_FR(base) __REG32(base + 0x18)
|
||||
#define UART_CR(base) __REG32(base + 0x30)
|
||||
#define UART_IMSC(base) __REG32(base + 0x38)
|
||||
#define UART_ICR(base) __REG32(base + 0x44)
|
||||
|
||||
#define UARTFR_RXFE 0x10
|
||||
#define UARTFR_TXFF 0x20
|
||||
#define UARTIMSC_RXIM 0x10
|
||||
#define UARTIMSC_TXIM 0x20
|
||||
#define UARTICR_RXIC 0x10
|
||||
#define UARTICR_TXIC 0x20
|
||||
|
||||
static void rt_hw_uart_isr(int irqno, void *param)
|
||||
{
|
||||
struct rt_serial_device *serial = (struct rt_serial_device *)param;
|
||||
|
||||
rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
|
||||
}
|
||||
|
||||
static rt_err_t uart_configure(struct rt_serial_device *serial, struct serial_configure *cfg)
|
||||
{
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t uart_control(struct rt_serial_device *serial, int cmd, void *arg)
|
||||
{
|
||||
struct hw_uart_device *uart;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uart = (struct hw_uart_device *)serial->parent.user_data;
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case RT_DEVICE_CTRL_CLR_INT:
|
||||
/* disable rx irq */
|
||||
UART_IMSC(uart->hw_base) &= ~UARTIMSC_RXIM;
|
||||
break;
|
||||
|
||||
case RT_DEVICE_CTRL_SET_INT:
|
||||
/* enable rx irq */
|
||||
UART_IMSC(uart->hw_base) |= UARTIMSC_RXIM;
|
||||
rt_hw_interrupt_umask(uart->irqno);
|
||||
break;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static int uart_putc(struct rt_serial_device *serial, char c)
|
||||
{
|
||||
struct hw_uart_device *uart;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uart = (struct hw_uart_device *)serial->parent.user_data;
|
||||
|
||||
while (UART_FR(uart->hw_base) & UARTFR_TXFF);
|
||||
UART_DR(uart->hw_base) = c;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int uart_getc(struct rt_serial_device *serial)
|
||||
{
|
||||
int ch;
|
||||
struct hw_uart_device *uart;
|
||||
|
||||
RT_ASSERT(serial != RT_NULL);
|
||||
uart = (struct hw_uart_device *)serial->parent.user_data;
|
||||
|
||||
ch = -1;
|
||||
if (!(UART_FR(uart->hw_base) & UARTFR_RXFE))
|
||||
{
|
||||
ch = UART_DR(uart->hw_base) & 0xff;
|
||||
}
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
static const struct rt_uart_ops _uart_ops =
|
||||
{
|
||||
uart_configure,
|
||||
uart_control,
|
||||
uart_putc,
|
||||
uart_getc,
|
||||
};
|
||||
|
||||
#ifdef RT_USING_UART0
|
||||
/* UART device driver structure */
|
||||
static struct hw_uart_device _uart0_device =
|
||||
{
|
||||
PL011_UART0_BASE,
|
||||
PL011_UART0_IRQNUM,
|
||||
};
|
||||
static struct rt_serial_device _serial0;
|
||||
#endif
|
||||
|
||||
int rt_hw_uart_init(void)
|
||||
{
|
||||
struct hw_uart_device *uart;
|
||||
struct serial_configure config = RT_SERIAL_CONFIG_DEFAULT;
|
||||
|
||||
#ifdef RT_USING_UART0
|
||||
_uart0_device.hw_base = (rt_size_t)rt_ioremap((void*)_uart0_device.hw_base, PL011_UART0_SIZE);
|
||||
uart = &_uart0_device;
|
||||
|
||||
_serial0.ops = &_uart_ops;
|
||||
_serial0.config = config;
|
||||
|
||||
/* register UART1 device */
|
||||
rt_hw_serial_register(&_serial0, "uart0",
|
||||
RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
|
||||
uart);
|
||||
rt_hw_interrupt_install(uart->irqno, rt_hw_uart_isr, &_serial0, "uart0");
|
||||
/* enable Rx and Tx of UART */
|
||||
UART_CR(uart->hw_base) = (1 << 0) | (1 << 8) | (1 << 9);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2013-03-30 Bernard the first verion
|
||||
*/
|
||||
|
||||
#ifndef __DRV_UART_H__
|
||||
#define __DRV_UART_H__
|
||||
|
||||
int rt_hw_uart_init(void);
|
||||
|
||||
#endif /* __DRV_UART_H__ */
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-11-11 GuEe-GUI the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
#include <virtio.h>
|
||||
#ifdef BSP_USING_VIRTIO_BLK
|
||||
#include <virtio_blk.h>
|
||||
#endif
|
||||
#ifdef BSP_USING_VIRTIO_NET
|
||||
#include <virtio_net.h>
|
||||
#endif
|
||||
#ifdef BSP_USING_VIRTIO_CONSOLE
|
||||
#include <virtio_console.h>
|
||||
#endif
|
||||
#ifdef BSP_USING_VIRTIO_GPU
|
||||
#include <virtio_gpu.h>
|
||||
#endif
|
||||
#ifdef BSP_USING_VIRTIO_INPUT
|
||||
#include <virtio_input.h>
|
||||
#endif
|
||||
|
||||
#include <board.h>
|
||||
|
||||
static virtio_device_init_handler virtio_device_init_handlers[] =
|
||||
{
|
||||
#ifdef BSP_USING_VIRTIO_BLK
|
||||
[VIRTIO_DEVICE_ID_BLOCK] = rt_virtio_blk_init,
|
||||
#endif
|
||||
#ifdef BSP_USING_VIRTIO_NET
|
||||
[VIRTIO_DEVICE_ID_NET] = rt_virtio_net_init,
|
||||
#endif
|
||||
#ifdef BSP_USING_VIRTIO_CONSOLE
|
||||
[VIRTIO_DEVICE_ID_CONSOLE] = rt_virtio_console_init,
|
||||
#endif
|
||||
#ifdef BSP_USING_VIRTIO_GPU
|
||||
[VIRTIO_DEVICE_ID_GPU] = rt_virtio_gpu_init,
|
||||
#endif
|
||||
#ifdef BSP_USING_VIRTIO_INPUT
|
||||
[VIRTIO_DEVICE_ID_INPUT] = rt_virtio_input_init,
|
||||
#endif
|
||||
};
|
||||
|
||||
int rt_virtio_devices_init(void)
|
||||
{
|
||||
int i;
|
||||
rt_uint32_t irq = VIRTIO_IRQ_BASE;
|
||||
rt_ubase_t mmio_base = VIRTIO_MMIO_BASE;
|
||||
struct virtio_mmio_config *mmio_config;
|
||||
virtio_device_init_handler init_handler;
|
||||
|
||||
if (sizeof(virtio_device_init_handlers) == 0)
|
||||
{
|
||||
/* The compiler will optimize the codes after here. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
mmio_base = (rt_ubase_t)rt_ioremap((void *)mmio_base, VIRTIO_MMIO_SIZE * VIRTIO_MAX_NR);
|
||||
|
||||
if (mmio_base == RT_NULL)
|
||||
{
|
||||
return -RT_ERROR;
|
||||
}
|
||||
|
||||
for (i = 0; i < VIRTIO_MAX_NR; ++i, ++irq, mmio_base += VIRTIO_MMIO_SIZE)
|
||||
{
|
||||
mmio_config = (struct virtio_mmio_config *)mmio_base;
|
||||
|
||||
if (mmio_config->magic != VIRTIO_MAGIC_VALUE ||
|
||||
mmio_config->version != RT_USING_VIRTIO_VERSION ||
|
||||
mmio_config->vendor_id != VIRTIO_VENDOR_ID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
init_handler = virtio_device_init_handlers[mmio_config->device_id];
|
||||
|
||||
if (init_handler != RT_NULL)
|
||||
{
|
||||
init_handler((rt_ubase_t *)mmio_base, irq);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(rt_virtio_devices_init);
|
||||
@@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-11-11 GuEe-GUI the first version
|
||||
*/
|
||||
|
||||
#ifndef __DRV_VIRTIO_H__
|
||||
#define __DRV_VIRTIO_H__
|
||||
|
||||
int rt_virtio_devices_init(void);
|
||||
|
||||
#endif /* __DRV_VIRTIO_H__ */
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-02-17 GuEe-GUI the first version
|
||||
*/
|
||||
|
||||
#ifndef VIRT_H__
|
||||
#define VIRT_H__
|
||||
|
||||
#include <rtdef.h>
|
||||
#include <ioremap.h>
|
||||
|
||||
#ifdef RT_USING_SMART
|
||||
#include <mmu.h>
|
||||
#endif
|
||||
|
||||
#define __REG32(x) (*((volatile unsigned int *)(x)))
|
||||
#define __REG16(x) (*((volatile unsigned short *)(x)))
|
||||
|
||||
/* UART */
|
||||
#define PL011_UART0_BASE 0x09000000
|
||||
#define PL011_UART0_SIZE 0x00001000
|
||||
#define PL011_UART0_IRQNUM (32 + 1)
|
||||
|
||||
/* RTC */
|
||||
#define PL031_RTC_BASE 0x9010000
|
||||
#define PL031_RTC_SIZE 0x00001000
|
||||
#define PL031_RTC_IRQNUM (32 + 2)
|
||||
|
||||
/* GPIO */
|
||||
#define PL061_GPIO_BASE 0x09030000
|
||||
#define PL061_GPIO_SIZE 0x00001000
|
||||
#define PL061_GPIO_IRQNUM (32 + 7)
|
||||
|
||||
/* VirtIO */
|
||||
#define VIRTIO_MMIO_BASE 0x0a000000
|
||||
#define VIRTIO_MMIO_SIZE 0x00000200
|
||||
#define VIRTIO_MAX_NR 32
|
||||
#define VIRTIO_IRQ_BASE (32 + 16)
|
||||
#define VIRTIO_VENDOR_ID 0x554d4551 /* "QEMU" */
|
||||
|
||||
/* GIC */
|
||||
#define MAX_HANDLERS 96
|
||||
#define GIC_IRQ_START 0
|
||||
#define ARM_GIC_NR_IRQS 96
|
||||
#define ARM_GIC_MAX_NR 1
|
||||
|
||||
#define IRQ_ARM_IPI_KICK 0
|
||||
#define IRQ_ARM_IPI_CALL 1
|
||||
|
||||
/* GICv2 */
|
||||
#define GIC_PL390_DISTRIBUTOR_PPTR 0x08000000
|
||||
#define GIC_PL390_CONTROLLER_PPTR 0x08010000
|
||||
#define GIC_PL390_HYPERVISOR_BASE 0x08030000
|
||||
#define GIC_PL390_VIRTUAL_CPU_BASE 0x08040000
|
||||
|
||||
/* GICv3 */
|
||||
#define GIC_PL500_DISTRIBUTOR_PPTR GIC_PL390_DISTRIBUTOR_PPTR
|
||||
#define GIC_PL500_REDISTRIBUTOR_PPTR 0x080a0000
|
||||
#define GIC_PL500_CONTROLLER_PPTR GIC_PL390_CONTROLLER_PPTR
|
||||
#define GIC_PL500_ITS_PPTR 0x08080000
|
||||
|
||||
/* the basic constants and interfaces needed by gic */
|
||||
rt_inline rt_ubase_t platform_get_gic_dist_base(void)
|
||||
{
|
||||
#ifdef BSP_USING_GICV2
|
||||
return GIC_PL390_DISTRIBUTOR_PPTR;
|
||||
#else
|
||||
return GIC_PL500_DISTRIBUTOR_PPTR;
|
||||
#endif
|
||||
}
|
||||
|
||||
rt_inline rt_ubase_t platform_get_gic_redist_base(void)
|
||||
{
|
||||
return GIC_PL500_REDISTRIBUTOR_PPTR;
|
||||
}
|
||||
|
||||
rt_inline rt_ubase_t platform_get_gic_cpu_base(void)
|
||||
{
|
||||
#ifdef BSP_USING_GICV2
|
||||
return GIC_PL390_CONTROLLER_PPTR;
|
||||
#else
|
||||
return GIC_PL500_CONTROLLER_PPTR;
|
||||
#endif
|
||||
}
|
||||
|
||||
rt_inline rt_ubase_t platform_get_gic_its_base(void)
|
||||
{
|
||||
return GIC_PL500_ITS_PPTR;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
@echo off
|
||||
if exist sd.bin goto run
|
||||
qemu-img create -f raw sd.bin 64M
|
||||
|
||||
:run
|
||||
qemu-system-aarch64 -M virt,gic-version=2 -cpu cortex-a53 -smp 4 -kernel rtthread.bin -nographic ^
|
||||
-drive if=none,file=sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 ^
|
||||
-netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 -s -S ^
|
||||
-device virtio-serial-device -chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 -device virtserialport,chardev=console0
|
||||
@@ -1,8 +0,0 @@
|
||||
if [ ! -f "sd.bin" ]; then
|
||||
dd if=/dev/zero of=sd.bin bs=1024 count=65536
|
||||
mkfs.fat sd.bin
|
||||
fi
|
||||
qemu-system-aarch64 -M virt,gic-version=2 -cpu cortex-a53 -m 128M -smp 4 -kernel rtthread.bin -nographic \
|
||||
-drive if=none,file=sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
|
||||
-netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 -s -S \
|
||||
-device virtio-serial-device -chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 -device virtserialport,chardev=console0
|
||||
Executable
+709
File diff suppressed because it is too large.
Load diff
@@ -1,13 +0,0 @@
|
||||
@echo off
|
||||
if exist sd.bin goto run
|
||||
qemu-img create -f raw sd.bin 64M
|
||||
|
||||
:run
|
||||
qemu-system-aarch64 -M virt,gic-version=2 -cpu cortex-a53 -smp 4 -kernel rtthread.bin -serial stdio ^
|
||||
-drive if=none,file=sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 ^
|
||||
-netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 ^
|
||||
-device virtio-gpu-device,xres=800,yres=600,bus=virtio-mmio-bus.2 ^
|
||||
-device virtio-keyboard-device,bus=virtio-mmio-bus.3 ^
|
||||
-device virtio-mouse-device,bus=virtio-mmio-bus.4 ^
|
||||
-device virtio-tablet-device,bus=virtio-mmio-bus.5 ^
|
||||
-device virtio-serial-device -chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 -device virtserialport,chardev=console0
|
||||
@@ -1,12 +0,0 @@
|
||||
if [ ! -f "sd.bin" ]; then
|
||||
dd if=/dev/zero of=sd.bin bs=1024 count=65536
|
||||
mkfs.fat sd.bin
|
||||
fi
|
||||
qemu-system-aarch64 -M virt,gic-version=2 -cpu cortex-a53 -smp 4 -kernel rtthread.bin -serial stdio \
|
||||
-drive if=none,file=sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
|
||||
-netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \
|
||||
-device virtio-gpu-device,xres=800,yres=600,bus=virtio-mmio-bus.2 \
|
||||
-device virtio-keyboard-device,bus=virtio-mmio-bus.3 \
|
||||
-device virtio-mouse-device,bus=virtio-mmio-bus.4 \
|
||||
-device virtio-tablet-device,bus=virtio-mmio-bus.5 \
|
||||
-device virtio-serial-device -chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 -device virtserialport,chardev=console0
|
||||
@@ -1,9 +0,0 @@
|
||||
@echo off
|
||||
if exist sd.bin goto run
|
||||
qemu-img create -f raw sd.bin 64M
|
||||
|
||||
:run
|
||||
qemu-system-aarch64 -M virt,gic-version=2 -cpu cortex-a53 -smp 4 -kernel rtthread.bin -nographic ^
|
||||
-drive if=none,file=sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 ^
|
||||
-netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 ^
|
||||
-device virtio-serial-device -chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 -device virtserialport,chardev=console0
|
||||
Executable
+380
File diff suppressed because it is too large.
Load diff
@@ -1,8 +0,0 @@
|
||||
if [ ! -f "sd.bin" ]; then
|
||||
dd if=/dev/zero of=sd.bin bs=1024 count=65536
|
||||
mkfs.fat sd.bin
|
||||
fi
|
||||
qemu-system-aarch64 -M virt,gic-version=2 -cpu cortex-a53 -m 128M -smp 4 -kernel rtthread.bin -nographic \
|
||||
-drive if=none,file=sd.bin,format=raw,id=blk0 -device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
|
||||
-netdev user,id=net0 -device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \
|
||||
-device virtio-serial-device -chardev socket,host=127.0.0.1,port=4321,server=on,wait=off,telnet=on,id=console0 -device virtserialport,chardev=console0
|
||||
@@ -7,17 +7,6 @@
|
||||
|
||||
/* rt_vsnprintf options */
|
||||
|
||||
#define RT_KLIBC_USING_VSNPRINTF_LONGLONG
|
||||
#define RT_KLIBC_USING_VSNPRINTF_STANDARD
|
||||
#define RT_KLIBC_USING_VSNPRINTF_DECIMAL_SPECIFIERS
|
||||
#define RT_KLIBC_USING_VSNPRINTF_EXPONENTIAL_SPECIFIERS
|
||||
#define RT_KLIBC_USING_VSNPRINTF_WRITEBACK_SPECIFIER
|
||||
#define RT_KLIBC_USING_VSNPRINTF_CHECK_NUL_IN_FORMAT_SPECIFIER
|
||||
#define RT_KLIBC_USING_VSNPRINTF_INTEGER_BUFFER_SIZE 32
|
||||
#define RT_KLIBC_USING_VSNPRINTF_DECIMAL_BUFFER_SIZE 32
|
||||
#define RT_KLIBC_USING_VSNPRINTF_FLOAT_PRECISION 6
|
||||
#define RT_KLIBC_USING_VSNPRINTF_MAX_INTEGRAL_DIGITS_FOR_DECIMAL 9
|
||||
#define RT_KLIBC_USING_VSNPRINTF_LOG10_TAYLOR_TERMS 4
|
||||
/* end of rt_vsnprintf options */
|
||||
|
||||
/* rt_vsscanf options */
|
||||
@@ -198,6 +187,7 @@
|
||||
#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
|
||||
/* end of elm-chan's FatFs, Generic FAT Filesystem Module */
|
||||
#define RT_USING_DFS_DEVFS
|
||||
#define RT_USING_DFS_9PFS
|
||||
#define RT_USING_DFS_ROMFS
|
||||
/* end of DFS: device virtual file system */
|
||||
|
||||
@@ -214,30 +204,106 @@
|
||||
#define RT_USING_SERIAL_V1
|
||||
#define RT_SERIAL_USING_DMA
|
||||
#define RT_SERIAL_RB_BUFSZ 256
|
||||
#define RT_SERIAL_PL011
|
||||
#define RT_SERIAL_8250
|
||||
#define RT_SERIAL_8250_PCI
|
||||
#define RT_USING_CLOCK_TIME
|
||||
#define RT_CLOCK_TIME_ARM_ARCH
|
||||
#define RT_USING_NULL
|
||||
#define RT_USING_ZERO
|
||||
#define RT_USING_RANDOM
|
||||
#define RT_USING_PM
|
||||
#define PM_TICKLESS_THRESHOLD_TIME 2
|
||||
#define RT_USING_MTD_NOR
|
||||
#define RT_USING_MTD_NOR_CFI
|
||||
#define RT_USING_RTC
|
||||
#define RT_USING_SOFT_RTC
|
||||
#define RT_USING_ALARM
|
||||
#define RT_ALARM_STACK_SIZE 8192
|
||||
#define RT_ALARM_TIMESLICE 5
|
||||
#define RT_ALARM_PRIORITY 10
|
||||
#define RT_RTC_PL031
|
||||
#define RT_USING_WDT
|
||||
#define RT_WDT_I6300ESB
|
||||
#define RT_USING_LCD
|
||||
#define RT_USING_GRAPHIC
|
||||
#define RT_GRAPHIC_FB
|
||||
#define RT_GRAPHIC_LOGO
|
||||
#define RT_GRAPHIC_LOGO_RT_THREAD_CLUT224
|
||||
#define RT_USING_HWCRYPTO
|
||||
#define RT_HWCRYPTO_DEFAULT_NAME "hwcryto"
|
||||
#define RT_HWCRYPTO_IV_MAX_SIZE 16
|
||||
#define RT_HWCRYPTO_KEYBIT_MAX_SIZE 256
|
||||
#define RT_HWCRYPTO_USING_AES
|
||||
#define RT_HWCRYPTO_USING_AES_ECB
|
||||
#define RT_HWCRYPTO_USING_AES_CBC
|
||||
#define RT_HWCRYPTO_USING_AES_CTR
|
||||
#define RT_HWCRYPTO_USING_DES
|
||||
#define RT_HWCRYPTO_USING_DES_ECB
|
||||
#define RT_HWCRYPTO_USING_DES_CBC
|
||||
#define RT_HWCRYPTO_USING_3DES
|
||||
#define RT_HWCRYPTO_USING_3DES_ECB
|
||||
#define RT_HWCRYPTO_USING_3DES_CBC
|
||||
#define RT_HWCRYPTO_USING_RC4
|
||||
#define RT_HWCRYPTO_USING_RNG
|
||||
#define RT_USING_INPUT
|
||||
#define RT_INPUT_POWER
|
||||
#define RT_INPUT_KEYBOARD
|
||||
#define RT_INPUT_KEYBOARD_GPIO
|
||||
#define RT_USING_ATA
|
||||
#define RT_ATA_AHCI
|
||||
#define RT_ATA_AHCI_PCI
|
||||
#define RT_USING_BLK
|
||||
|
||||
/* Partition Types */
|
||||
|
||||
#define RT_BLK_PARTITION_DFS
|
||||
#define RT_BLK_PARTITION_EFI
|
||||
/* end of Partition Types */
|
||||
#define RT_USING_SCSI
|
||||
#define RT_SCSI_SD
|
||||
#define RT_SCSI_CDROM
|
||||
#define RT_USING_FIRMWARE
|
||||
#define RT_FIRMWARE_QEMU_FW_CFG
|
||||
#define RT_USING_REGULATOR
|
||||
|
||||
/* Power Management (PM) Domains device drivers */
|
||||
|
||||
/* end of Power Management (PM) Domains device drivers */
|
||||
#define RT_USING_VIRTIO
|
||||
#define RT_USING_VIRTIO10
|
||||
#define RT_USING_VIRTIO_MMIO_ALIGN
|
||||
#define RT_USING_VIRTIO_BLK
|
||||
#define RT_USING_VIRTIO_CONSOLE
|
||||
#define RT_USING_VIRTIO_CONSOLE_PORT_MAX_NR 4
|
||||
#define RT_USING_VIRTIO_GPU
|
||||
#define RT_USING_VIRTIO_INPUT
|
||||
#define RT_VIRTIO_TRANSPORT_MMIO
|
||||
#define RT_VIRTIO_TRANSPORT_PCI
|
||||
#define RT_VIRTIO_BLK
|
||||
#define RT_VIRTIO_CONSOLE
|
||||
#define RT_VIRTIO_RNG
|
||||
#define RT_VIRTIO_SCSI
|
||||
#define RT_VIRTIO_RPROC_SERIAL
|
||||
#define RT_VIRTIO_GPU
|
||||
#define RT_VIRTIO_CRYPTO
|
||||
#define RT_USING_DMA
|
||||
#define RT_USING_MFD
|
||||
#define RT_MFD_EDU
|
||||
#define RT_MFD_SYSCON
|
||||
#define RT_USING_OFW
|
||||
#define RT_FDT_EARLYCON_MSG_SIZE 128
|
||||
#define RT_USING_OFW_BUS_RANGES_NUMBER 8
|
||||
#define RT_USING_PCI
|
||||
#define RT_PCI_MSI
|
||||
#define RT_PCI_SYS_64BIT
|
||||
#define RT_PCI_CACHE_LINE_SIZE 8
|
||||
|
||||
/* PCI Device Drivers */
|
||||
|
||||
#define RT_PCI_ECAM
|
||||
#define RT_PCI_HOST_COMMON
|
||||
#define RT_PCI_HOST_GENERIC
|
||||
#define RT_USING_PIC
|
||||
#define MAX_HANDLERS 512
|
||||
#define RT_PIC_ARM_GIC
|
||||
#define RT_PIC_ARM_GIC_V2M
|
||||
#define RT_PIC_ARM_GIC_V3
|
||||
#define RT_PIC_ARM_GIC_V3_ITS
|
||||
#define RT_PIC_ARM_GIC_V3_ITS_IRQ_MAX 127
|
||||
#define RT_PIC_ARM_GIC_MAX_NR 1
|
||||
#define RT_USING_PIN
|
||||
#define RT_PIN_PL061
|
||||
#define RT_USING_CLK
|
||||
|
||||
/* SoC (System on Chip) Drivers */
|
||||
@@ -528,19 +594,4 @@
|
||||
/* end of RT-Thread online packages */
|
||||
#define SOC_VIRT64_AARCH64
|
||||
|
||||
/* AARCH64 qemu virt64 configs */
|
||||
|
||||
#define BSP_SUPPORT_FPU
|
||||
#define BSP_USING_UART
|
||||
#define RT_USING_UART0
|
||||
#define BSP_USING_RTC
|
||||
#define BSP_USING_PIN
|
||||
#define BSP_USING_VIRTIO_BLK
|
||||
#define BSP_USING_VIRTIO_CONSOLE
|
||||
#define BSP_USING_VIRTIO_GPU
|
||||
#define BSP_USING_VIRTIO_INPUT
|
||||
#define BSP_USING_GIC
|
||||
#define BSP_USING_GICV2
|
||||
/* end of AARCH64 qemu virt64 configs */
|
||||
|
||||
#endif
|
||||
@@ -14,6 +14,12 @@ config RT_RPMSG_CHAR_MSG_SIZE_MAX
|
||||
depends on RT_USING_RPMSG
|
||||
default 256
|
||||
|
||||
config RT_RPMSG_RT_THREAD_VIRTIO
|
||||
bool "RT-Thread common VirtIO RPMSG"
|
||||
depends on RT_USING_RPMSG
|
||||
select RT_USING_SLAB
|
||||
default y
|
||||
|
||||
if RT_USING_RPMSG
|
||||
osource "$(SOC_DM_RPMSG_DIR)/Kconfig"
|
||||
endif
|
||||
@@ -10,6 +10,9 @@ CPPPATH = [cwd + '/../include']
|
||||
|
||||
src = ['rpmsg.c', 'rpmsg_char.c', 'rpmsg_ns.c']
|
||||
|
||||
if GetDepend(['RT_RPMSG_RT_THREAD_VIRTIO']):
|
||||
src += ['rpmsg-rt-thread-virtio.c']
|
||||
|
||||
group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user