boards/qemu-i486: Add support to QEMU VGA framebuffer

This commits initializes the VGA LCD interface as a framebuffer to
use with fb command.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
This commit is contained in:
Alan Carvalho de Assis
2026-04-29 17:13:56 -03:00
committed by Xiang Xiao
parent 163dcd0438
commit 09cda8404d
4 changed files with 181 additions and 0 deletions
@@ -0,0 +1,57 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_16550_ADDRWIDTH=16
CONFIG_16550_SUPRESS_CONFIG=y
CONFIG_16550_UART0=y
CONFIG_16550_UART0_BASE=0x3f8
CONFIG_16550_UART0_BAUD=57600
CONFIG_16550_UART0_CLOCK=16000000
CONFIG_16550_UART0_IRQ=36
CONFIG_16550_UART0_SERIAL_CONSOLE=y
CONFIG_16550_UART=y
CONFIG_ARCH="x86"
CONFIG_ARCH_BOARD="qemu-i486"
CONFIG_ARCH_BOARD_QEMU_I486=y
CONFIG_ARCH_CHIP="qemu"
CONFIG_ARCH_CHIP_QEMU_I486=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_X86=y
CONFIG_ARCH_X86_M32=y
CONFIG_BOARD_LOOPSPERMSEC=999
CONFIG_BOOT_RUNFROMEXTSRAM=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DRIVERS_VIDEO=y
CONFIG_EXAMPLES_FB=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_FS_FAT=y
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_LCD=y
CONFIG_LCD_FRAMEBUFFER=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_DISABLE_IFUPDOWN=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_QEMU_VGA=y
CONFIG_RAM_SIZE=1048576
CONFIG_RAM_START=0x00100000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_SCHED_WAITPID=y
CONFIG_START_DAY=3
CONFIG_START_MONTH=3
CONFIG_START_YEAR=2011
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_OSTEST=y
CONFIG_VIDEO_FB=y
+3
View File
@@ -27,5 +27,8 @@ CSRCS = qemu_boot.c
ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += qemu_appinit.c
endif
ifeq ($(CONFIG_QEMU_VGA),y)
CSRCS += qemu_vga_lcd.c
endif
include $(TOPDIR)/boards/Board.mk
@@ -30,8 +30,10 @@
#include <stdio.h>
#include <nuttx/debug.h>
#include <nuttx/video/fb.h>
#include "x86_internal.h"
#include "qemu_vga.h"
/****************************************************************************
* Public Functions
@@ -77,6 +79,24 @@ int board_app_initialize(uintptr_t arg)
}
#endif
#ifdef CONFIG_QEMU_VGA
ret = qemu_vga();
if (ret < 0)
{
serr("ERROR: Failed to initialize QEMU VGA: %d\n", ret);
}
#endif
#ifdef CONFIG_VIDEO_FB
/* Initialize and register the framebuffer driver */
ret = fb_register(0, 0);
if (ret < 0)
{
serr("ERROR: fb_register() failed: %d\n", ret);
}
#endif
return ret;
}
#endif /* CONFIG_BOARDCTL */
@@ -0,0 +1,101 @@
/****************************************************************************
* boards/x86/qemu/qemu-i486/src/qemu_vga_lcd.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <stdbool.h>
#include <nuttx/debug.h>
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/lcd/lcd.h>
#include "qemu_vga.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
struct lcd_dev_s *g_lcddev;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
****************************************************************************/
int board_lcd_initialize(void)
{
g_lcddev = qemu_vga_initialize();
if (!g_lcddev)
{
lcderr("ERROR: Failed to get the VGA LCD device\n");
}
else
{
lcdinfo("VGA LCD Initialized\n");
}
return OK;
}
/****************************************************************************
* Name: board_lcd_getdev
****************************************************************************/
struct lcd_dev_s *board_lcd_getdev(int lcddev)
{
if (!g_lcddev)
{
lcderr("ERROR: VGA LCD was not initialized\n");
}
else
{
lcdinfo("Returning the lcd_dev\n");
return g_lcddev;
}
return NULL;
}
/****************************************************************************
* Name: board_lcd_uninitialize
****************************************************************************/
void board_lcd_uninitialize(void)
{
/* TO-FIX */
}