[BSP] Update QEMU VExpress A9 BSP.
This commit is contained in:
parent
7b2decbb7c
commit
252432baf0
|
@ -12,9 +12,10 @@ CONFIG_RT_THREAD_PRIORITY_MAX=32
|
|||
CONFIG_RT_TICK_PER_SECOND=100
|
||||
CONFIG_RT_DEBUG=y
|
||||
CONFIG_RT_USING_OVERFLOW_CHECK=y
|
||||
# CONFIG_RT_DEBUG_INIT is not set
|
||||
CONFIG_RT_DEBUG_INIT=1
|
||||
# CONFIG_RT_DEBUG_THREAD is not set
|
||||
CONFIG_RT_USING_HOOK=y
|
||||
CONFIG_IDLE_THREAD_STACK_SIZE=256
|
||||
# CONFIG_RT_USING_TIMER_SOFT is not set
|
||||
|
||||
#
|
||||
|
@ -25,6 +26,7 @@ CONFIG_RT_USING_MUTEX=y
|
|||
CONFIG_RT_USING_EVENT=y
|
||||
CONFIG_RT_USING_MAILBOX=y
|
||||
CONFIG_RT_USING_MESSAGEQUEUE=y
|
||||
# CONFIG_RT_USING_SIGNALS is not set
|
||||
|
||||
#
|
||||
# Memory Management
|
||||
|
@ -59,11 +61,13 @@ CONFIG_RT_USING_USER_MAIN=y
|
|||
# Command shell
|
||||
#
|
||||
CONFIG_RT_USING_FINSH=y
|
||||
CONFIG_FINSH_USING_HISTORY=y
|
||||
CONFIG_FINSH_USING_SYMTAB=y
|
||||
CONFIG_FINSH_USING_DESCRIPTION=y
|
||||
CONFIG_FINSH_THREAD_PRIORITY=20
|
||||
CONFIG_FINSH_THREAD_STACK_SIZE=4096
|
||||
CONFIG_FINSH_CMD_SIZE=80
|
||||
# CONFIG_FINSH_USING_AUTH is not set
|
||||
CONFIG_FINSH_DEFAULT_PASSWORD="rtthread"
|
||||
CONFIG_FINSH_USING_MSH=y
|
||||
CONFIG_FINSH_USING_MSH_DEFAULT=y
|
||||
# CONFIG_FINSH_USING_MSH_ONLY is not set
|
||||
|
@ -77,14 +81,19 @@ CONFIG_DFS_FILESYSTEMS_MAX=2
|
|||
CONFIG_DFS_FD_MAX=4
|
||||
CONFIG_RT_USING_DFS_ELMFAT=y
|
||||
CONFIG_RT_DFS_ELM_CODE_PAGE=437
|
||||
CONFIG_RT_DFS_ELM_MAX_LFN=256
|
||||
CONFIG_RT_DFS_ELM_WORD_ACCESS=y
|
||||
CONFIG_RT_DFS_ELM_USE_LFN_0=y
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_1 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
|
||||
# CONFIG_RT_DFS_ELM_USE_LFN_3 is not set
|
||||
CONFIG_RT_DFS_ELM_USE_LFN=0
|
||||
CONFIG_RT_DFS_ELM_MAX_LFN=255
|
||||
CONFIG_RT_DFS_ELM_DRIVES=2
|
||||
CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=512
|
||||
# CONFIG_RT_DFS_ELM_USE_ERASE is not set
|
||||
CONFIG_RT_DFS_ELM_REENTRANT=y
|
||||
CONFIG_RT_USING_DFS_DEVFS=y
|
||||
# CONFIG_RT_USING_DFS_NET is not set
|
||||
# CONFIG_RT_USING_DFS_NFS is not set
|
||||
|
||||
#
|
||||
# Device Drivers
|
||||
|
@ -105,10 +114,13 @@ CONFIG_RT_USING_PIN=y
|
|||
# CONFIG_RT_USING_USB_DEVICE is not set
|
||||
|
||||
#
|
||||
# libc
|
||||
# POSIX layer and C standard library
|
||||
#
|
||||
CONFIG_RT_USING_LIBC=y
|
||||
CONFIG_RT_USING_PTHREADS=y
|
||||
CONFIG_RT_USING_POSIX=y
|
||||
# CONFIG_RT_USING_POSIX_MMAP is not set
|
||||
CONFIG_RT_USING_POSIX_TERMIOS=y
|
||||
|
||||
#
|
||||
# Network stack
|
||||
|
@ -124,17 +136,61 @@ CONFIG_RT_USING_PTHREADS=y
|
|||
#
|
||||
# CONFIG_RT_USING_MODBUS is not set
|
||||
|
||||
#
|
||||
# RT-Thread UI Engine
|
||||
#
|
||||
CONFIG_RT_USING_GUIENGINE=y
|
||||
CONFIG_RTGUI_NAME_MAX=16
|
||||
# CONFIG_RTGUI_USING_TTF is not set
|
||||
CONFIG_RTGUI_USING_FONT16=y
|
||||
CONFIG_RTGUI_USING_FONT12=y
|
||||
# CONFIG_RTGUI_USING_FONTHZ is not set
|
||||
# CONFIG_RTGUI_IMAGE_XPM is not set
|
||||
# CONFIG_RTGUI_IMAGE_JPEG is not set
|
||||
# CONFIG_RTGUI_IMAGE_TJPGD is not set
|
||||
# CONFIG_RTGUI_IMAGE_PNG is not set
|
||||
# CONFIG_RTGUI_IMAGE_LODEPNG is not set
|
||||
# CONFIG_RTGUI_IMAGE_BMP is not set
|
||||
|
||||
#
|
||||
# RT-Thread online packages
|
||||
#
|
||||
|
||||
#
|
||||
# system packages
|
||||
#
|
||||
# CONFIG_PKG_USING_PARTITION is not set
|
||||
# CONFIG_PKG_USING_SQLITE is not set
|
||||
|
||||
#
|
||||
# IoT - internet of things
|
||||
#
|
||||
# CONFIG_PKG_USING_PAHOMQTT is not set
|
||||
# CONFIG_PKG_USING_WEBCLIENT is not set
|
||||
# CONFIG_PKG_USING_MONGOOSE is not set
|
||||
# CONFIG_PKG_USING_WEBTERMINAL is not set
|
||||
# CONFIG_PKG_USING_CJSON is not set
|
||||
# CONFIG_PKG_USING_EZXML is not set
|
||||
|
||||
#
|
||||
# security packages
|
||||
#
|
||||
# CONFIG_PKG_USING_MBEDTLS is not set
|
||||
|
||||
#
|
||||
# language packages
|
||||
#
|
||||
# CONFIG_PKG_USING_JERRYSCRIPT is not set
|
||||
|
||||
#
|
||||
# multimedia packages
|
||||
#
|
||||
|
||||
#
|
||||
# tools packages
|
||||
#
|
||||
# CONFIG_PKG_USING_CMBACKTRACE is not set
|
||||
# CONFIG_PKG_USING_EASYLOGGER is not set
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
|
@ -142,18 +198,6 @@ CONFIG_RT_USING_PTHREADS=y
|
|||
CONFIG_PKG_USING_HELLO=y
|
||||
CONFIG_PKG_HELLO_PATH="/packages/misc/hello"
|
||||
CONFIG_PKG_HELLO_VER="v1.0.0"
|
||||
|
||||
#
|
||||
# multimedia packages
|
||||
#
|
||||
|
||||
#
|
||||
# security packages
|
||||
#
|
||||
|
||||
#
|
||||
# system packages
|
||||
#
|
||||
# CONFIG_PKG_USING_CMBACKTRACE is not set
|
||||
CONFIG_RT_USING_UART0=y
|
||||
CONFIG_RT_USING_UART1=y
|
||||
CONFIG_BSP_DRV_CLCD=y
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#include <rtthread.h>
|
||||
|
||||
#if defined(RT_USING_RTGUI) || defined(RT_USING_GUIENGINE)
|
||||
|
||||
#include <rtgui/driver.h>
|
||||
int lcd_init(void)
|
||||
{
|
||||
struct rt_device *device;
|
||||
device = rt_device_find("lcd");
|
||||
if (device)
|
||||
{
|
||||
rtgui_graphic_set_device(device);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_APP_EXPORT(lcd_init);
|
||||
|
||||
#endif
|
|
@ -1,7 +1,17 @@
|
|||
config RT_USING_UART0
|
||||
bool "Enable UART0"
|
||||
default y
|
||||
default n
|
||||
|
||||
config RT_USING_UART1
|
||||
bool "Enable UART1"
|
||||
default y
|
||||
|
||||
config BSP_DRV_CLCD
|
||||
bool "CLCD driver"
|
||||
depends on RT_USING_GUIENGINE
|
||||
default y
|
||||
|
||||
config BSP_DRV_EMAC
|
||||
bool "EMAC driver"
|
||||
depends on RT_USING_LWIP
|
||||
default y
|
||||
|
|
|
@ -4,6 +4,12 @@ cwd = GetCurrentDir()
|
|||
src = Glob('*.c')
|
||||
CPPPATH = [cwd]
|
||||
|
||||
if not GetDepend('BSP_DRV_EMAC'):
|
||||
SrcRemove(src, ['drv_lan9118.c'])
|
||||
|
||||
if not GetDepend('BSP_DRV_CLCD'):
|
||||
SrcRemove(src, ['drv_clcd.c'])
|
||||
|
||||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
|
||||
|
||||
Return('group')
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <rtthread.h>
|
||||
#include "drv_clcd.h"
|
||||
|
||||
#define CLCD_WIDTH 480
|
||||
#define CLCD_HEIGHT 320
|
||||
|
||||
#define CLCD_DEVICE(dev) (struct drv_clcd_device*)(dev)
|
||||
|
||||
#define PL111_CR_EN 0x001
|
||||
#define PL111_CR_PWR 0x800
|
||||
#define PL111_IOBASE 0x10020000
|
||||
#define PL111_PALBASE (PL111_IOBASE + 0x200)
|
||||
|
||||
typedef struct _PL111MMIO
|
||||
{
|
||||
uint32_t volatile tim0; //0
|
||||
uint32_t volatile tim1; //4
|
||||
uint32_t volatile tim2; //8
|
||||
uint32_t volatile tim3; //c
|
||||
uint32_t volatile upbase; //10
|
||||
uint32_t volatile f; //14
|
||||
uint32_t volatile control; //18
|
||||
uint32_t volatile g; //1c
|
||||
} PL111MMIO;
|
||||
|
||||
struct drv_clcd_device
|
||||
{
|
||||
struct rt_device parent;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
|
||||
uint8_t *fb;
|
||||
};
|
||||
struct drv_clcd_device _lcd;
|
||||
|
||||
static rt_err_t drv_clcd_init(struct rt_device *device)
|
||||
{
|
||||
struct drv_clcd_device *lcd = CLCD_DEVICE(device);
|
||||
|
||||
lcd = lcd; /* nothing, right now */
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_err_t drv_clcd_control(struct rt_device *device, int cmd, void *args)
|
||||
{
|
||||
struct drv_clcd_device *lcd = CLCD_DEVICE(device);
|
||||
|
||||
switch (cmd)
|
||||
{
|
||||
case RTGRAPHIC_CTRL_RECT_UPDATE:
|
||||
{
|
||||
struct rt_device_rect_info *info = (struct rt_device_rect_info*)args;
|
||||
|
||||
info = info; /* nothing, right now */
|
||||
}
|
||||
break;
|
||||
|
||||
case RTGRAPHIC_CTRL_GET_INFO:
|
||||
{
|
||||
struct rt_device_graphic_info* info = (struct rt_device_graphic_info*)args;
|
||||
|
||||
RT_ASSERT(info != RT_NULL);
|
||||
info->pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565;
|
||||
// info->pixel_format = RTGRAPHIC_PIXEL_FORMAT_ARGB888;
|
||||
info->bits_per_pixel= 16;
|
||||
info->width = lcd->width;
|
||||
info->height = lcd->height;
|
||||
info->framebuffer = lcd->fb;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
int drv_clcd_hw_init(void)
|
||||
{
|
||||
PL111MMIO *plio;
|
||||
struct rt_device *device = &_lcd.parent;
|
||||
|
||||
/* memset _lcd to zero */
|
||||
memset(&_lcd, 0x0, sizeof(_lcd));
|
||||
|
||||
_lcd.width = CLCD_WIDTH;
|
||||
_lcd.height = CLCD_HEIGHT;
|
||||
_lcd.fb = rt_malloc (_lcd.width * _lcd.height * 2);
|
||||
if (_lcd.fb == NULL)
|
||||
{
|
||||
rt_kprintf("initialize frame buffer failed!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(_lcd.fb, 0xff, _lcd.width * _lcd.height * 2);
|
||||
|
||||
plio = (PL111MMIO*)PL111_IOBASE;
|
||||
|
||||
plio->tim0 = 0x3F1F3C00 | ((CLCD_WIDTH/16 - 1) << 2);
|
||||
plio->tim1 = 0x080B6000 | (CLCD_HEIGHT - 1);
|
||||
|
||||
plio->upbase = _lcd.fb;
|
||||
/* 16-bit 565 color */
|
||||
plio->control = 0x1921 | (0x6 << 1);
|
||||
|
||||
device->type = RT_Device_Class_Graphic;
|
||||
device->init = drv_clcd_init;
|
||||
device->control = drv_clcd_control;
|
||||
rt_device_register(device, "lcd", RT_DEVICE_FLAG_RDWR);
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_DEVICE_EXPORT(drv_clcd_hw_init);
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef DRV_CLCD_H__
|
||||
#define DRV_CLCD_H__
|
||||
|
||||
int drv_clcd_hw_init(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1 @@
|
|||
qemu-system-arm -M vexpress-a9 -kernel rtthread.elf -serial vc -serial vc -S -s
|
|
@ -12,9 +12,10 @@
|
|||
#define RT_TICK_PER_SECOND 100
|
||||
#define RT_DEBUG
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
/* RT_DEBUG_INIT is not set */
|
||||
#define RT_DEBUG_INIT 1
|
||||
/* RT_DEBUG_THREAD is not set */
|
||||
#define RT_USING_HOOK
|
||||
#define IDLE_THREAD_STACK_SIZE 256
|
||||
/* RT_USING_TIMER_SOFT is not set */
|
||||
|
||||
/* Inter-Thread communication */
|
||||
|
@ -24,6 +25,7 @@
|
|||
#define RT_USING_EVENT
|
||||
#define RT_USING_MAILBOX
|
||||
#define RT_USING_MESSAGEQUEUE
|
||||
/* RT_USING_SIGNALS is not set */
|
||||
|
||||
/* Memory Management */
|
||||
|
||||
|
@ -53,11 +55,13 @@
|
|||
/* Command shell */
|
||||
|
||||
#define RT_USING_FINSH
|
||||
#define FINSH_USING_HISTORY
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
#define FINSH_THREAD_PRIORITY 20
|
||||
#define FINSH_THREAD_STACK_SIZE 4096
|
||||
#define FINSH_CMD_SIZE 80
|
||||
/* FINSH_USING_AUTH is not set */
|
||||
#define FINSH_DEFAULT_PASSWORD "rtthread"
|
||||
#define FINSH_USING_MSH
|
||||
#define FINSH_USING_MSH_DEFAULT
|
||||
/* FINSH_USING_MSH_ONLY is not set */
|
||||
|
@ -70,14 +74,19 @@
|
|||
#define DFS_FD_MAX 4
|
||||
#define RT_USING_DFS_ELMFAT
|
||||
#define RT_DFS_ELM_CODE_PAGE 437
|
||||
#define RT_DFS_ELM_MAX_LFN 256
|
||||
#define RT_DFS_ELM_WORD_ACCESS
|
||||
#define RT_DFS_ELM_USE_LFN_0
|
||||
/* RT_DFS_ELM_USE_LFN_1 is not set */
|
||||
/* RT_DFS_ELM_USE_LFN_2 is not set */
|
||||
/* RT_DFS_ELM_USE_LFN_3 is not set */
|
||||
#define RT_DFS_ELM_USE_LFN 0
|
||||
#define RT_DFS_ELM_MAX_LFN 255
|
||||
#define RT_DFS_ELM_DRIVES 2
|
||||
#define RT_DFS_ELM_MAX_SECTOR_SIZE 512
|
||||
/* RT_DFS_ELM_USE_ERASE is not set */
|
||||
#define RT_DFS_ELM_REENTRANT
|
||||
#define RT_USING_DFS_DEVFS
|
||||
/* RT_USING_DFS_NET is not set */
|
||||
/* RT_USING_DFS_NFS is not set */
|
||||
|
||||
/* Device Drivers */
|
||||
|
||||
|
@ -96,10 +105,13 @@
|
|||
/* RT_USING_USB_HOST is not set */
|
||||
/* RT_USING_USB_DEVICE is not set */
|
||||
|
||||
/* libc */
|
||||
/* POSIX layer and C standard library */
|
||||
|
||||
#define RT_USING_LIBC
|
||||
#define RT_USING_PTHREADS
|
||||
#define RT_USING_POSIX
|
||||
/* RT_USING_POSIX_MMAP is not set */
|
||||
#define RT_USING_POSIX_TERMIOS
|
||||
|
||||
/* Network stack */
|
||||
|
||||
|
@ -111,24 +123,57 @@
|
|||
|
||||
/* RT_USING_MODBUS is not set */
|
||||
|
||||
/* RT-Thread UI Engine */
|
||||
|
||||
#define RT_USING_GUIENGINE
|
||||
#define RTGUI_NAME_MAX 16
|
||||
/* RTGUI_USING_TTF is not set */
|
||||
#define RTGUI_USING_FONT16
|
||||
#define RTGUI_USING_FONT12
|
||||
/* RTGUI_USING_FONTHZ is not set */
|
||||
/* RTGUI_IMAGE_XPM is not set */
|
||||
/* RTGUI_IMAGE_JPEG is not set */
|
||||
/* RTGUI_IMAGE_TJPGD is not set */
|
||||
/* RTGUI_IMAGE_PNG is not set */
|
||||
/* RTGUI_IMAGE_LODEPNG is not set */
|
||||
/* RTGUI_IMAGE_BMP is not set */
|
||||
|
||||
/* RT-Thread online packages */
|
||||
|
||||
/* system packages */
|
||||
|
||||
/* PKG_USING_PARTITION is not set */
|
||||
/* PKG_USING_SQLITE is not set */
|
||||
|
||||
/* IoT - internet of things */
|
||||
|
||||
/* PKG_USING_PAHOMQTT is not set */
|
||||
/* PKG_USING_WEBCLIENT is not set */
|
||||
/* PKG_USING_MONGOOSE is not set */
|
||||
/* PKG_USING_WEBTERMINAL is not set */
|
||||
/* PKG_USING_CJSON is not set */
|
||||
/* PKG_USING_EZXML is not set */
|
||||
|
||||
/* security packages */
|
||||
|
||||
/* PKG_USING_MBEDTLS is not set */
|
||||
|
||||
/* language packages */
|
||||
|
||||
/* PKG_USING_JERRYSCRIPT is not set */
|
||||
|
||||
/* multimedia packages */
|
||||
|
||||
/* tools packages */
|
||||
|
||||
/* PKG_USING_CMBACKTRACE is not set */
|
||||
/* PKG_USING_EASYLOGGER is not set */
|
||||
|
||||
/* miscellaneous packages */
|
||||
|
||||
#define PKG_USING_HELLO
|
||||
|
||||
/* multimedia packages */
|
||||
|
||||
/* security packages */
|
||||
|
||||
/* system packages */
|
||||
|
||||
/* PKG_USING_CMBACKTRACE is not set */
|
||||
#define RT_USING_UART0
|
||||
#define RT_USING_UART1
|
||||
#define BSP_DRV_CLCD
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue