summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-05-20 17:06:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-05-20 17:06:57 +0000
commit2efdd08b402f42579548349e62c73c9fe999bc98 (patch)
tree28856228b02ded770e9e81a935e13ec7cb6bf07c /c/src/lib/libbsp
parentSome patches in place from Brian Stevens which help the Solaris port (diff)
downloadrtems-2efdd08b402f42579548349e62c73c9fe999bc98.tar.bz2
Patch from Ralf Corseipus to fix latent configure problems suddenly triggered:
The breakdown: * CC_FOR_TARGET and CXX_FOR_TARGET were not correctly re-read from autoconf's configuration cache (config.cache) * If <target>-[gcc|g++] was not found while running configure, the config macros tried to use other (wrong) compilers (e.g. cc). Changes: * New RTEMS_PROG_CC macro (aclocal/prog-cc.m4). * New RTEMS_PROG_CXX macro (aclocal/prog-cxx.m4) * Moved a shell script fragment from configure.in to a new m4-autoconf macro (New file: aclocal/tool-prefix.m4) * Minor changes to configure.in I tested it with linux/posix (native gcc/primary libc) and sh-rtems/gensh1 on a linux host and didn't notice any bugs related to the problems mentioned above. There seem to be more bugs with the posix bsp, but I consider them minor as the build run completed successfully. It is just too late for me to attempt to fix them now.
Diffstat (limited to 'c/src/lib/libbsp')
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/Makefile.in7
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/outch.c388
-rw-r--r--c/src/lib/libbsp/i386/pc386/include/Makefile.in2
-rw-r--r--c/src/lib/libbsp/i386/pc386/include/bsp.h35
-rw-r--r--c/src/lib/libbsp/i386/pc386/start/start.s43
-rw-r--r--c/src/lib/libbsp/i386/pc386/startup/exit.c7
6 files changed, 209 insertions, 273 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/console/Makefile.in b/c/src/lib/libbsp/i386/pc386/console/Makefile.in
index 2d22757c7c..bcfd781dd9 100644
--- a/c/src/lib/libbsp/i386/pc386/console/Makefile.in
+++ b/c/src/lib/libbsp/i386/pc386/console/Makefile.in
@@ -17,8 +17,13 @@ C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
H_FILES=
+# Assembly source names, if any, go here -- minus the .s
+S_PIECES=videoAsm
+S_FILES=$(S_PIECES:%=%.s)
+S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
+
SRCS=$(C_FILES) $(H_FILES)
-OBJS=$(C_O_FILES)
+OBJS=$(C_O_FILES) $(S_O_FILES)
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
include $(RTEMS_ROOT)/make/leaf.cfg
diff --git a/c/src/lib/libbsp/i386/pc386/console/outch.c b/c/src/lib/libbsp/i386/pc386/console/outch.c
index 6073ee4fb9..4b56bb7ca4 100644
--- a/c/src/lib/libbsp/i386/pc386/console/outch.c
+++ b/c/src/lib/libbsp/i386/pc386/console/outch.c
@@ -1,33 +1,28 @@
-/*-------------------------------------------------------------------------+
-| outch.c v1.1 - PC386 BSP - 1997/08/07
-+--------------------------------------------------------------------------+
-| (C) Copyright 1997 -
-| - NavIST Group - Real-Time Distributed Systems and Industrial Automation
-|
-| http://pandora.ist.utl.pt
-|
-| Instituto Superior Tecnico * Lisboa * PORTUGAL
-+--------------------------------------------------------------------------+
-| Disclaimer:
-|
-| This file is provided "AS IS" without warranty of any kind, either
-| expressed or implied.
-+--------------------------------------------------------------------------+
-| This code is based on:
-| outch.c,v 1.4 1995/12/19 20:07:27 joel Exp - go32 BSP
-| With the following copyright notice:
-| **************************************************************************
-| * COPYRIGHT (c) 1989-1998.
-| * On-Line Applications Research Corporation (OAR).
-| * Copyright assigned to U.S. Government, 1994.
-| *
-| * The license and distribution terms for this file may be
-| * found in found in the file LICENSE in this distribution or at
-| * http://www.OARcorp.com/rtems/license.html.
-| **************************************************************************
-|
-| $Id$
-+--------------------------------------------------------------------------*/
+/*
+ * outch.c - This file contains code for displaying characters
+ * on the console uisng information that should be
+ * maintained by the BIOS in its data Area.
+ *
+ * Copyright (C) 1998 valette@crf.canon.fr
+ *
+ * Canon Centre Recherche France.
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Header$
+ */
#include <bsp.h>
@@ -35,227 +30,117 @@
#include <stdlib.h>
#include <string.h>
-/*-------------------------------------------------------------------------+
-| Constants
-+--------------------------------------------------------------------------*/
-#define DISPLAY_CELL_COUNT (MAX_ROW * MAX_COL)
- /* Number of display cells. */
-#define TABSIZE 4 /* Number of spaces for TAB (\t) char. */
-#define WHITE 0x0700 /* White on Black background colour. */
-#define BLANK (WHITE | ' ') /* Blank character. */
-
-
-/*-------------------------------------------------------------------------+
-| Global Variables
-+--------------------------------------------------------------------------*/
-static rtems_unsigned16 *videoRam = TVRAM;
- /* Physical address of start of video text memory. */
-static rtems_unsigned16 *videoRamPtr = TVRAM;
- /* Pointer for current output position in display. */
-static rtems_unsigned8 videoRows = MAX_ROW; /* Number of rows in display. */
-static rtems_unsigned8 videoCols = MAX_COL; /* Number of columns in display. */
-static rtems_unsigned8 cursRow = 0; /* Current cursor row. */
-static rtems_unsigned8 cursCol = 0; /* Current cursor column. */
-
+#include <crt.h>
-/*-------------------------------------------------------------------------+
-| Function: setHardwareCursorPos
-| Description: Set hardware video cursor at given offset into video RAM.
-| Global Variables: None.
-| Arguments: videoCursor - Offset into video memory.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static inline void
-setHardwareCursorPos(rtems_unsigned16 videoCursor)
-{
- outport_byte(GDC_REG_PORT, 0xe);
- outport_byte(GDC_VAL_PORT, (videoCursor >> 8) & 0xff);
- outport_byte(GDC_REG_PORT, 0xf);
- outport_byte(GDC_VAL_PORT, videoCursor & 0xff);
-} /* setHardwareCursorPos */
+extern void wr_cursor(int, unsigned short);
+#define TAB_SPACE 4
+static unsigned short *bitMapBaseAddr;
+static unsigned short ioCrtBaseAddr;
+static unsigned short maxCol;
+static unsigned short maxRow;
+static unsigned char row;
+static unsigned char column;
+static unsigned short attribute;
+static unsigned int nLines;
-/*-------------------------------------------------------------------------+
-| Function: updateVideoRamPtr
-| Description: Updates value of global variable "videoRamPtr" based on
-| current window's cursor position.
-| Global Variables: videoRamPtr, cursRow, cursCol.
-| Arguments: None.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static inline void
-updateVideoRamPtr(void)
-{
- videoRamPtr = videoRam + cursRow * videoCols + cursCol;
-} /* updateVideoRamPtr */
-
-
-/*-------------------------------------------------------------------------+
-| Function: scrollUp
-| Description: Scrolls display up n lines.
-| Global Variables: None.
-| Arguments: lines - number of lines to scroll.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static void
-scrollUp(rtems_unsigned8 lines)
-{
- rtems_unsigned16 blankCount;
- /* Number of blank display cells on bottom of window. */
- rtems_unsigned16 *ptrDst, *ptrSrc;
- /* Source and destination pointers for memory copy operations. */
-
- if (lines < videoRows) /* Move window's contents up. */
- {
- rtems_unsigned16 nonBlankCount;
- /* Number of non-blank cells on upper part of display (total - blank). */
-
- blankCount = lines * videoCols;
- nonBlankCount = DISPLAY_CELL_COUNT - blankCount;
- ptrSrc = videoRam + blankCount;
- ptrDst = videoRam;
-
- while(nonBlankCount--)
- *ptrDst++ = *ptrSrc++;
- }
- else /* Clear the whole display. */
- {
- blankCount = DISPLAY_CELL_COUNT;
- ptrDst = videoRam;
- }
-
- /* Fill bottom with blanks. */
- while (blankCount-- > 0)
- *ptrDst++ = BLANK;
-} /* scrollUp */
-
-
-/*-------------------------------------------------------------------------+
-| Function: printCHAR
-| Description: Print printable character to display.
-| Global Variables: videoRamPtr, cursRow, cursCol.
-| Arguments: c - character to write to display.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static void
-printCHAR(char c)
+ static void
+scroll()
{
- *videoRamPtr++ = c | WHITE;
- cursCol++;
- if (cursCol == videoCols)
- {
- cursCol = 0;
- cursRow++;
- if (cursRow == videoRows)
- {
- cursRow--;
- scrollUp(1);
- videoRamPtr -= videoCols;
+ int i, j; /* Counters */
+ unsigned short *pt_scroll, *pt_bitmap; /* Pointers on the bit-map */
+
+ pt_bitmap = bitMapBaseAddr;
+ j = 0;
+ pt_bitmap = pt_bitmap + j;
+ pt_scroll = pt_bitmap + maxCol;
+ for (i = j; i < (maxRow - 1) * maxCol; i++) {
+ *pt_bitmap++ = *pt_scroll++;
}
- }
-} /* printCHAR */
-
+
+ /*
+ * Blank characters are displayed on the last line.
+ */
+ for (i = 0; i < maxCol; i++) {
+ *pt_bitmap++ = (short) (' ' | attribute);
+ }
+}
-/*-------------------------------------------------------------------------+
-| Function: printBS
-| Description: Print BS (BackSpace - '\b') character to display.
-| Global Variables: videoRamPtr, cursRow, cursCol.
-| Arguments: None.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static inline void
-printBS(void)
+ static void
+endColumn()
{
- /* Move cursor back one cell. */
- if (cursCol > 0)
- cursCol--;
- else if (cursRow > 0)
- {
- cursRow--;
- cursCol = videoCols - 1;
- }
- else
- return;
-
- /* Write a whitespace. */
- *(--videoRamPtr) = BLANK;
-} /* printBS */
-
+ if (++row == maxRow) {
+ scroll(); /* Scroll the screen now */
+ row = maxRow - 1;
+ }
+ column = 0;
+ nLines++;
+ /* Move cursor on the next location */
+ wr_cursor(row * maxCol + column, ioCrtBaseAddr);
+}
-/*-------------------------------------------------------------------------+
-| Function: printHT
-| Description: Print HT (Horizontal Tab - '\t') character to display.
-| Global Variables: cursCol.
-| Arguments: None.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static inline void
-printHT(void)
-{
- do
- printCHAR(' ');
- while (cursCol % TABSIZE);
-} /* printHT */
-/*-------------------------------------------------------------------------+
-| Function: printLF
-| Description: Print LF (Line Feed - '\n') character to display.
-| Global Variables: cursRow.
-| Arguments: None.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static inline void
-printLF(void)
+ static void
+videoPutChar(char car)
{
- cursRow++;
- if (cursRow == videoRows)
- {
- cursRow--;
- scrollUp(1);
- }
- updateVideoRamPtr();
-} /* printLF */
-
+ unsigned short *pt_bitmap = bitMapBaseAddr + row * maxCol;
+
+ switch (car) {
+ case '\b': {
+ if (column) column--;
+ /* Move cursor on the previous location */
+ wr_cursor(row * maxCol + column, ioCrtBaseAddr);
+ return;
+ }
+ case '\t': {
+ int i;
+
+ i = TAB_SPACE - (column & (TAB_SPACE - 1));
+ pt_bitmap += column;
+ column += i;
+ if (column >= maxCol) {
+ endColumn();
+ return;
+ }
+ while (i--) *pt_bitmap++ = ' ' | attribute;
+ wr_cursor(row * maxCol + column, ioCrtBaseAddr);
+ return;
+ }
+ case '\n': {
+ endColumn();
+ return;
+ }
+ case 7: { /* Bell code must be inserted here */
+ return;
+ }
+ case '\r' : { /* Already handled via \n */
+ return;
+ }
+ default: {
+ pt_bitmap += column;
+ *pt_bitmap = car | attribute;
+ if (++column == maxCol) endColumn();
+ else wr_cursor(row * maxCol + column,
+ ioCrtBaseAddr);
+ return;
+ }
+ }
+}
-/*-------------------------------------------------------------------------+
-| Function: printCR
-| Description: Print CR (Carriage Return - '\r') to display.
-| Global Variables: cursCol.
-| Arguments: None.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static inline void
-printCR(void)
+ void
+clear_screen()
{
- cursCol = 0;
- updateVideoRamPtr();
-} /* printCR */
-
-
-/*-------------------------------------------------------------------------+
-| Function: consPutc
-| Description: Print a character to display at current position.
-| Global Variables: videoRamPtr, videoRam.
-| Arguments: c - character to write to display.
-| Returns: Nothing.
-+--------------------------------------------------------------------------*/
-static void
-consPutc(char c)
-{
- switch (c)
- {
- case '\b': printBS(); break;
- case '\t': printHT(); break;
- case '\n': printLF(); break;
- case '\r': printCR(); break;
- default: printCHAR(c); break;
- } /* switch */
-
- setHardwareCursorPos(videoRamPtr - videoRam);
- /* At current offset into videoRam */
-} /* consPutc */
+ int i,j;
+ for (j = 0; j <= maxRow; j++) {
+ for (i = 0; i <= maxCol; i++) {
+ videoPutChar(' ');
+ }
+ }
+ column = 0;
+ row = 0;
+}
/*-------------------------------------------------------------------------+
| Function: _IBMPC_outch
@@ -267,20 +152,41 @@ consPutc(char c)
void
_IBMPC_outch(char c)
{
- consPutc(c);
+ videoPutChar(c);
} /* _IBMPC_outch */
/*-------------------------------------------------------------------------+
| Function: _IBMPC_initVideo
| Description: Video system initialization. Hook for any early setup.
-| Global Variables: videoRows.
+| Global Variables: bitMapBaseAddr, ioCrtBaseAddr, maxCol, maxRow, row
+| column, attribute, nLines;
| Arguments: None.
| Returns: Nothing.
+--------------------------------------------------------------------------*/
void
_IBMPC_initVideo(void)
{
- scrollUp(videoRows); /* Clear entire screen */
- setHardwareCursorPos(0); /* Cursor at upper left corner */
+ unsigned char* pt = (unsigned char*) (VIDEO_MODE_ADDR);
+
+ if (*pt == VGAMODE7) {
+ bitMapBaseAddr = (unsigned short*) V_MONO;
+ }
+ else {
+ bitMapBaseAddr = (unsigned short*) V_COLOR;
+ }
+ ioCrtBaseAddr = *(unsigned short*) DISPLAY_CRT_BASE_IO_ADDR;
+ maxCol = * (unsigned short*) NB_MAX_COL_ADDR;
+ maxRow = * (unsigned char*) NB_MAX_ROW_ADDR;
+ column = 0;
+ row = 0;
+ attribute = ((BLACK << 4) | WHITE)<<8;
+ nLines = 0;
+ clear_screen();
+#ifdef DEBUG_EARLY_STAGE
+ printk("bitMapBaseAddr = %X, display controller base IO = %X\n",
+ (unsigned) bitMapBaseAddr,
+ (unsigned) ioCrtBaseAddr);
+ videoPrintf("maxCol = %d, maxRow = %d\n", (unsigned) maxCol, (unsigned) maxRow);
+#endif
} /* _IBMPC_initVideo */
diff --git a/c/src/lib/libbsp/i386/pc386/include/Makefile.in b/c/src/lib/libbsp/i386/pc386/include/Makefile.in
index 09228bd496..8f02fc9b25 100644
--- a/c/src/lib/libbsp/i386/pc386/include/Makefile.in
+++ b/c/src/lib/libbsp/i386/pc386/include/Makefile.in
@@ -8,7 +8,7 @@ VPATH = @srcdir@
RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
-H_FILES = $(srcdir)/bsp.h $(srcdir)/coverhd.h $(srcdir)/irq.h
+H_FILES = $(srcdir)/bsp.h $(srcdir)/coverhd.h $(srcdir)/irq.h $(srcdir)/crt.h
#
# Equate files are for including from assembly preprocessed by
diff --git a/c/src/lib/libbsp/i386/pc386/include/bsp.h b/c/src/lib/libbsp/i386/pc386/include/bsp.h
index 09758020a1..fc998144fc 100644
--- a/c/src/lib/libbsp/i386/pc386/include/bsp.h
+++ b/c/src/lib/libbsp/i386/pc386/include/bsp.h
@@ -10,6 +10,14 @@
|
| Instituto Superior Tecnico * Lisboa * PORTUGAL
+--------------------------------------------------------------------------+
+| Modified by Eric Valette the 20/05/98 in order to add definitions used
+| to enhance video putchar capabilities.
+|
+| Copyright (C) 1998 valette@crf.canon.fr
+|
+| Canon Centre Recherche France.
+|
++--------------------------------------------------------------------------+
| Disclaimer:
|
| This file is provided "AS IS" without warranty of any kind, either
@@ -57,32 +65,9 @@ extern "C" {
/*-------------------------------------------------------------------------+
| Video (console) related constants.
+--------------------------------------------------------------------------*/
-#define COLOUR 1 /* Assume colour console */
-
-#if COLOUR
-
-# define GDC_REG_PORT 0x3D4
-# define GDC_VAL_PORT 0x3D5
-# define TVRAM ((rtems_unsigned16 *)0xB8000)
-
-#else
-
-# define GDC_REG_PORT 0x3B4
-# define GDC_VAL_PORT 0x3B5
-# define TVRAM ((rtems_unsigned16 *)0xB0000)
-
-#endif /* COLOUR */
-
-/* Number of Video Lines & Columns */
-
-#define MAX_COL 80
-
-#ifdef RTEMS_VIDEO_80x50
-#define MAX_ROW 50
-#else
-#define MAX_ROW 25
-#endif /* RTEMS_VIDEO_80x50 */
+#include <crt.h>
+
/*-------------------------------------------------------------------------+
| Constants relating to the 8254 (or 8253) programmable interval timers.
+--------------------------------------------------------------------------*/
diff --git a/c/src/lib/libbsp/i386/pc386/start/start.s b/c/src/lib/libbsp/i386/pc386/start/start.s
index 9501af12b8..3ed542c255 100644
--- a/c/src/lib/libbsp/i386/pc386/start/start.s
+++ b/c/src/lib/libbsp/i386/pc386/start/start.s
@@ -12,6 +12,11 @@
|
| Instituto Superior Tecnico * Lisboa * PORTUGAL
+--------------------------------------------------------------------------+
+|
+| Modified the 20/05/1998 by valette@crf.canon.fr in order to give a working
+| example of eraly stage debugging via the DEBUG_EARLY_START define.
+|
++--------------------------------------------------------------------------+
| Disclaimer:
|
| This file is provided "AS IS" without warranty of any kind, either
@@ -62,11 +67,39 @@ BEGIN_CODE
EXTERN (boot_card)
EXTERN (load_segments)
EXTERN (exit)
-
+ EXTERN (_IBMPC_initVideo)
+ EXTERN (debugPoolingGetChar)
+
+/*
+ * In case it crash on your machine and this is not due
+ * to video mode set by the loader, you may try to define
+ * the follwoing variable
+#define DEBUG_EARLY_START
+ */
+
SYM (start):
nop
cli # DISABLE INTERRUPTS!!!
+#ifdef DEBUG_EARLY_START
+ cld
+ /*
+ * Must get video attribute to have a working printk.
+ * Note that the following code assume we already have
+ * valid segments and a stack. It should be true for
+ * any loader starting RTEMS in protected mode (or
+ * at least I hope so : -)).
+ */
+ call _IBMPC_initVideo
+ /*
+ * try printk and a getchar in polling mode ASAP
+ */
+ pushl $welcome_msg
+ call printk
+ addl $4, esp
+
+ call debugPoolingGetChar
+#endif
/*----------------------------------------------------------------------------+
| Load the segment registers (this is done by the board's BSP) and perform any
@@ -265,6 +298,14 @@ SYM (start_frame):
SYM (stack_start):
.long 0
+#ifdef DEBUG_EARLY_START
+
+ PUBLIC (welcome_msg)
+SYM (welcome_msg) :
+ .string "Ready to debug RTEMS ?\nEnter <CR>\n"
+
+#endif
+
END_DATA
/*----------------------------------------------------------------------------+
diff --git a/c/src/lib/libbsp/i386/pc386/startup/exit.c b/c/src/lib/libbsp/i386/pc386/startup/exit.c
index 4946e3451f..ca95371c26 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/exit.c
+++ b/c/src/lib/libbsp/i386/pc386/startup/exit.c
@@ -39,15 +39,14 @@
/*-------------------------------------------------------------------------+
| External Prototypes
+--------------------------------------------------------------------------*/
-extern rtems_boolean _IBMPC_scankey(char *); /* define in 'inch.c' */
-
+extern rtems_boolean _IBMPC_scankey(char *); /* defined in 'inch.c' */
/*-------------------------------------------------------------------------+
| Function: rtemsReboot
-| Description: Reboot the PC.
+| Description: Reboot the PC.
| Global Variables: None.
| Arguments: None.
-| Returns: Nothing.
+| Returns: Nothing.
+--------------------------------------------------------------------------*/
inline void rtemsReboot(void)
{