configs/makerlisp: Add VGA initialization logic.

This commit is contained in:
Gregory Nutt 2019-06-04 16:35:56 -06:00
parent 7d99b79c8f
commit fe0ab650bb
4 changed files with 90 additions and 10 deletions

View File

@ -5,4 +5,11 @@
if ARCH_BOARD_MAKERLISP
config MAKERLISP_VGA
bool "VGA Controller attached?"
default n
---help---
Select this option if you have an I/O Controller and a VGA vide card
connected.
endif # ARCH_BOARD_MAKERLISP

View File

@ -160,8 +160,9 @@ Serial Keyboard and VGA Display
expansion board GPIO PB1.
e. Transmit 'TX' pin on VGA board to USB keyboard controller 'R'
TBD: Beyond the simple UART interface, what additional support for the
ready pin 'C' is required.
To use the VGA display controller with stdout and stderr, you also
need to selection CONFIG_MAKERLISP_VGA=y in your configuration. This
enables a required VGA initialization sequence.
2. USB keyboard controller (UART0 RX)
@ -289,7 +290,9 @@ Configuration Subdirectories
The default baud setting is 57600N1.
TBD: Although the UART0 is the same with the VGA and Keyboard
controller boards, this configuration may not compatible with
those accessories. Those may require additional support for
the VGA data ready pin. A BAUD mismatch is also likely.
To use the VGA display controller with stdout and stderr, you also
need to selection CONFIG_MAKERLISP_VGA=y in your configuration. This
enables a required VGA initialization sequence.
TBD: What is the UART configuration when used with the VGA and
Keyboard controllers?

View File

@ -68,11 +68,10 @@ int ez80_bringup(void)
#ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */
ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
ret = mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0)
{
serr("ERROR: Failed to mount procfs at %s: %d\n",
STM32_PROCFS_MOUNTPOINT, ret);
serr("ERROR: Failed to mount procfs at /proc: %d\n", ret);
}
#endif

View File

@ -4,7 +4,8 @@
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Based upon sample code included with the Zilog ZDS-II toolchain.
* Parts of this file are based on MakerLisp sample code by Luther Johnson
* which has a compatible MIT license
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -47,6 +48,7 @@
#include <arch/chip/io.h>
#include "chip.h"
#include "up_internal.h"
#include "makerlisp.h"
/****************************************************************************
@ -55,6 +57,66 @@
bool g_ebpresent = false; /* True: I/O Expansion board is present */
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define VGA_MAX_DELAY 2000000
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: ez80_vga_initialize
*
* Description:
* If CONFIG_MAKERLISP_VGA is defined and the I/O controller is attached,
* then initialize the VGA interface.
*
****************************************************************************/
#ifdef CONFIG_MAKERLISP_VGA
static void ez80_vga_initialize(void)
{
/* I/O Expansion board attached? */
if (g_ebpresent)
{
bool vgapresent = false;
int delay;
/* Wait for VGA ready */
for (delay = 0; delay < VGA_MAX_DELAY; delay++)
{
if *(inp(EZ80_PB_DR) & EZ80_GPIOD1) != 0)
{
vgapresent = true;
break;
}
}
/* Is VGA ready (and, hence, present)? */
if (vgapresent)
{
/* Yes.. set newline mode, graphic attributes:
*
* \033 = ESCAPE character
* Assumption: VGA is on the console UART.
*/
up_puts("\033[20h\033[0m");
/* Clear, home cursor, beep */
up_puts("\033[2J\033[H\a");
}
}
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -136,6 +198,15 @@ void ez80_lowinit(void)
/* Wait for the SD card to power up */
up_udelay(750);
#ifdef CONFIG_MAKERLISP_VGA
/* Initialize the VGA interface. We want to do this as early as possible
* in the boot-up sequence. Debug output prior initializing VGA will be
* lost.
*/
ez80_vga_initialize();
#endif
}
/****************************************************************************