Ignore:
Timestamp:
May 20, 1998, 5:06:57 PM (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
27dccae
Parents:
17a8d603
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/pc386/console/outch.c

    r17a8d603 r2efdd08  
    1 /*-------------------------------------------------------------------------+
    2 | outch.c v1.1 - PC386 BSP - 1997/08/07
    3 +--------------------------------------------------------------------------+
    4 | (C) Copyright 1997 -
    5 | - NavIST Group - Real-Time Distributed Systems and Industrial Automation
    6 |
    7 | http://pandora.ist.utl.pt
    8 |
    9 | Instituto Superior Tecnico * Lisboa * PORTUGAL
    10 +--------------------------------------------------------------------------+
    11 | Disclaimer:
    12 |
    13 | This file is provided "AS IS" without warranty of any kind, either
    14 | expressed or implied.
    15 +--------------------------------------------------------------------------+
    16 | This code is based on:
    17 |   outch.c,v 1.4 1995/12/19 20:07:27 joel Exp - go32 BSP
    18 | With the following copyright notice:
    19 | **************************************************************************
    20 | *  COPYRIGHT (c) 1989-1998.
    21 | *  On-Line Applications Research Corporation (OAR).
    22 | *  Copyright assigned to U.S. Government, 1994.
    23 | *
    24 | *  The license and distribution terms for this file may be
    25 | *  found in found in the file LICENSE in this distribution or at
    26 | *  http://www.OARcorp.com/rtems/license.html.
    27 | **************************************************************************
    28 |
    29 |  $Id$
    30 +--------------------------------------------------------------------------*/
     1/*
     2 * outch.c  - This file contains code for displaying characters
     3 *            on the console uisng information that should be
     4 *            maintained by the BIOS in its data Area.
     5 *
     6 * Copyright (C) 1998  valette@crf.canon.fr
     7 *
     8 * Canon Centre Recherche France.
     9 *
     10 * This code is free software; you can redistribute it and/or
     11 * modify it under the terms of the GNU Library General Public
     12 * License as published by the Free Software Foundation; either
     13 * version 2 of the License, or (at your option) any later version.
     14 *
     15 * This code is distributed in the hope that it will be useful,
     16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     18 * Library General Public License for more details.
     19 *
     20 * You should have received a copy of the GNU Library General Public
     21 * License along with this file; if not, write to the Free Software
     22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     23 *
     24 * $Header$
     25 */
    3126
    3227
     
    3631#include <string.h>
    3732
    38 /*-------------------------------------------------------------------------+
    39 | Constants
    40 +--------------------------------------------------------------------------*/
    41 #define DISPLAY_CELL_COUNT (MAX_ROW * MAX_COL)
    42                                        /* Number of display cells.            */
    43 #define TABSIZE 4                      /* Number of spaces for TAB (\t) char. */
    44 #define WHITE   0x0700                 /* White on Black background colour.   */
    45 #define BLANK   (WHITE | ' ')          /* Blank character.                    */
     33#include <crt.h>
     34
     35extern void wr_cursor(int, unsigned short);
     36
     37#define TAB_SPACE 4
     38static unsigned short *bitMapBaseAddr;
     39static unsigned short ioCrtBaseAddr;
     40static unsigned short maxCol;
     41static unsigned short maxRow;
     42static unsigned char  row;
     43static unsigned char  column;
     44static unsigned short attribute;
     45static unsigned int   nLines;
     46
     47    static void
     48scroll()
     49{
     50    int i, j;                               /* Counters */
     51    unsigned short *pt_scroll, *pt_bitmap;  /* Pointers on the bit-map  */
     52     
     53    pt_bitmap = bitMapBaseAddr;
     54    j = 0;
     55    pt_bitmap = pt_bitmap + j;
     56    pt_scroll = pt_bitmap + maxCol;
     57    for (i = j; i < (maxRow - 1) * maxCol; i++) {
     58        *pt_bitmap++ = *pt_scroll++;
     59    }
     60   
     61    /*
     62     * Blank characters are displayed on the last line.
     63     */
     64    for (i = 0; i < maxCol; i++) {     
     65        *pt_bitmap++ = (short) (' ' | attribute);
     66    }
     67}
     68
     69    static void
     70endColumn()
     71{
     72    if (++row == maxRow) {
     73        scroll();       /* Scroll the screen now */
     74        row = maxRow - 1;
     75    }
     76    column = 0;
     77    nLines++;
     78    /* Move cursor on the next location  */
     79    wr_cursor(row * maxCol + column, ioCrtBaseAddr);
     80}
    4681
    4782
    48 /*-------------------------------------------------------------------------+
    49 | Global Variables
    50 +--------------------------------------------------------------------------*/
    51 static rtems_unsigned16 *videoRam    = TVRAM;
    52                            /* Physical address of start of video text memory. */
    53 static rtems_unsigned16 *videoRamPtr = TVRAM;
    54                            /* Pointer for current output position in display. */
    55 static rtems_unsigned8  videoRows = MAX_ROW; /* Number of rows in display.    */
    56 static rtems_unsigned8  videoCols = MAX_COL; /* Number of columns in display. */
    57 static rtems_unsigned8  cursRow   = 0;       /* Current cursor row.           */
    58 static rtems_unsigned8  cursCol   = 0;       /* Current cursor column.        */
    5983
     84    static void
     85videoPutChar(char car)
     86{
     87    unsigned short *pt_bitmap = bitMapBaseAddr + row * maxCol;
     88 
     89    switch (car) {
     90        case '\b': {
     91            if (column) column--;
     92            /* Move cursor on the previous location  */
     93            wr_cursor(row * maxCol + column, ioCrtBaseAddr);
     94            return;
     95        }
     96        case '\t': {
     97            int i;
    6098
    61 /*-------------------------------------------------------------------------+
    62 |         Function: setHardwareCursorPos
    63 |      Description: Set hardware video cursor at given offset into video RAM.
    64 | Global Variables: None.
    65 |        Arguments: videoCursor - Offset into video memory.
    66 |          Returns: Nothing.
    67 +--------------------------------------------------------------------------*/
    68 static inline void
    69 setHardwareCursorPos(rtems_unsigned16 videoCursor)
     99            i = TAB_SPACE - (column & (TAB_SPACE - 1));
     100            pt_bitmap += column;
     101            column += i;
     102            if (column >= maxCol) {
     103                endColumn();
     104                return;
     105            }
     106            while (i--) *pt_bitmap++ = ' ' | attribute;         
     107            wr_cursor(row * maxCol + column, ioCrtBaseAddr);
     108            return;
     109        }
     110        case '\n': {
     111            endColumn();
     112            return;
     113        }
     114        case 7: {       /* Bell code must be inserted here */
     115            return;
     116        }
     117        case '\r' : {   /* Already handled via \n */
     118            return;
     119        }
     120        default: {
     121            pt_bitmap += column;
     122            *pt_bitmap = car | attribute;
     123            if (++column == maxCol) endColumn();
     124            else wr_cursor(row * maxCol + column,
     125                          ioCrtBaseAddr);
     126            return;
     127        }
     128    }
     129}       
     130
     131    void
     132clear_screen()
    70133{
    71   outport_byte(GDC_REG_PORT, 0xe);
    72   outport_byte(GDC_VAL_PORT, (videoCursor >> 8) & 0xff);
    73   outport_byte(GDC_REG_PORT, 0xf);
    74   outport_byte(GDC_VAL_PORT, videoCursor & 0xff);
    75 } /* setHardwareCursorPos */
     134    int i,j;
    76135
    77 
    78 /*-------------------------------------------------------------------------+
    79 |         Function: updateVideoRamPtr
    80 |      Description: Updates value of global variable "videoRamPtr" based on
    81 |                   current window's cursor position.
    82 | Global Variables: videoRamPtr, cursRow, cursCol.
    83 |        Arguments: None.
    84 |          Returns: Nothing.
    85 +--------------------------------------------------------------------------*/
    86 static inline void
    87 updateVideoRamPtr(void)
    88 {
    89   videoRamPtr = videoRam + cursRow * videoCols + cursCol;
    90 } /* updateVideoRamPtr */
    91 
    92 
    93 /*-------------------------------------------------------------------------+
    94 |         Function: scrollUp
    95 |      Description: Scrolls display up n lines.
    96 | Global Variables: None.
    97 |        Arguments: lines - number of lines to scroll.
    98 |          Returns: Nothing.
    99 +--------------------------------------------------------------------------*/
    100 static void
    101 scrollUp(rtems_unsigned8 lines)
    102 {
    103   rtems_unsigned16 blankCount;
    104                         /* Number of blank display cells on bottom of window. */
    105   rtems_unsigned16 *ptrDst, *ptrSrc;
    106                /* Source and destination pointers for memory copy operations. */
    107 
    108   if (lines < videoRows)  /* Move window's contents up. */
    109   {
    110     rtems_unsigned16 nonBlankCount;
    111        /* Number of non-blank cells on upper part of display (total - blank). */
    112 
    113     blankCount = lines * videoCols;
    114     nonBlankCount = DISPLAY_CELL_COUNT - blankCount;
    115     ptrSrc = videoRam + blankCount;
    116     ptrDst = videoRam;
    117 
    118     while(nonBlankCount--)
    119       *ptrDst++ = *ptrSrc++;
    120   }
    121   else                    /* Clear the whole display.   */
    122   {
    123     blankCount = DISPLAY_CELL_COUNT;
    124     ptrDst = videoRam;
    125   }
    126 
    127   /* Fill bottom with blanks. */
    128   while (blankCount-- > 0)
    129     *ptrDst++ = BLANK;
    130 } /* scrollUp */
    131 
    132 
    133 /*-------------------------------------------------------------------------+
    134 |         Function: printCHAR
    135 |      Description: Print printable character to display.
    136 | Global Variables: videoRamPtr, cursRow, cursCol.
    137 |        Arguments: c - character to write to display.
    138 |          Returns: Nothing.
    139 +--------------------------------------------------------------------------*/
    140 static void
    141 printCHAR(char c)
    142 {
    143   *videoRamPtr++ = c | WHITE;
    144   cursCol++;
    145   if (cursCol == videoCols)
    146   {
    147     cursCol = 0;
    148     cursRow++;
    149     if (cursRow == videoRows)
    150     {
    151       cursRow--;
    152       scrollUp(1);
    153       videoRamPtr -= videoCols;
     136    for (j = 0; j <= maxRow; j++) {
     137      for (i = 0; i <= maxCol; i++) {
     138        videoPutChar(' ');
     139      }
    154140    }
    155   }
    156 } /* printCHAR */
    157 
    158 
    159 /*-------------------------------------------------------------------------+
    160 |         Function: printBS
    161 |      Description: Print BS (BackSpace - '\b') character to display.
    162 | Global Variables: videoRamPtr, cursRow, cursCol.
    163 |        Arguments: None.
    164 |          Returns: Nothing.
    165 +--------------------------------------------------------------------------*/
    166 static inline void
    167 printBS(void)
    168 {
    169   /* Move cursor back one cell. */
    170   if (cursCol > 0)
    171     cursCol--;
    172   else if (cursRow > 0)
    173   {
    174     cursRow--;
    175     cursCol = videoCols - 1;
    176   }
    177   else
    178     return;
    179 
    180   /* Write a whitespace. */
    181   *(--videoRamPtr) = BLANK;
    182 } /* printBS */
    183 
    184 
    185 /*-------------------------------------------------------------------------+
    186 |         Function: printHT
    187 |      Description: Print HT (Horizontal Tab - '\t') character to display.
    188 | Global Variables: cursCol.
    189 |        Arguments: None.
    190 |          Returns: Nothing.
    191 +--------------------------------------------------------------------------*/
    192 static inline void
    193 printHT(void)
    194 {
    195   do
    196     printCHAR(' ');
    197   while (cursCol % TABSIZE);
    198 } /* printHT */
    199 
    200 
    201 /*-------------------------------------------------------------------------+
    202 |         Function: printLF
    203 |      Description: Print LF (Line Feed  - '\n') character to display.
    204 | Global Variables: cursRow.
    205 |        Arguments: None.
    206 |          Returns: Nothing.
    207 +--------------------------------------------------------------------------*/
    208 static inline void
    209 printLF(void)
    210 {
    211   cursRow++;
    212   if (cursRow == videoRows)
    213   {
    214     cursRow--;
    215     scrollUp(1);
    216   }
    217   updateVideoRamPtr();
    218 } /* printLF */
    219 
    220 
    221 /*-------------------------------------------------------------------------+
    222 |         Function: printCR
    223 |      Description: Print CR (Carriage Return - '\r') to display.
    224 | Global Variables: cursCol.
    225 |        Arguments: None.
    226 |          Returns: Nothing.
    227 +--------------------------------------------------------------------------*/
    228 static inline void
    229 printCR(void)
    230 {
    231   cursCol = 0;
    232   updateVideoRamPtr();
    233 } /* printCR */
    234 
    235 
    236 /*-------------------------------------------------------------------------+
    237 |         Function: consPutc
    238 |      Description: Print a character to display at current position.
    239 | Global Variables: videoRamPtr, videoRam.
    240 |        Arguments: c - character to write to display.
    241 |          Returns: Nothing.
    242 +--------------------------------------------------------------------------*/
    243 static void
    244 consPutc(char c)
    245 {
    246   switch (c)
    247   {
    248     case '\b': printBS();    break;
    249     case '\t': printHT();    break;
    250     case '\n': printLF();    break;
    251     case '\r': printCR();    break;
    252     default:   printCHAR(c); break;
    253   } /* switch */
    254 
    255   setHardwareCursorPos(videoRamPtr - videoRam);
    256                                            /* At current offset into videoRam */
    257 } /* consPutc */
    258 
     141    column  = 0;
     142    row     = 0;
     143}
    259144
    260145/*-------------------------------------------------------------------------+
     
    268153_IBMPC_outch(char c)
    269154{
    270   consPutc(c);
     155  videoPutChar(c);
    271156} /* _IBMPC_outch */
    272157
     
    275160|         Function: _IBMPC_initVideo
    276161|      Description: Video system initialization. Hook for any early setup.
    277 | Global Variables: videoRows.
     162| Global Variables: bitMapBaseAddr, ioCrtBaseAddr, maxCol, maxRow, row
     163|                   column, attribute, nLines;
    278164|        Arguments: None.
    279165|          Returns: Nothing.
     
    282168_IBMPC_initVideo(void)
    283169{
    284   scrollUp(videoRows);     /* Clear entire screen         */
    285   setHardwareCursorPos(0); /* Cursor at upper left corner */
     170    unsigned char* pt = (unsigned char*) (VIDEO_MODE_ADDR);
     171
     172    if (*pt == VGAMODE7) {
     173      bitMapBaseAddr = (unsigned short*) V_MONO;
     174    }
     175    else {
     176      bitMapBaseAddr = (unsigned short*) V_COLOR;
     177    }
     178    ioCrtBaseAddr = *(unsigned short*) DISPLAY_CRT_BASE_IO_ADDR;
     179    maxCol  = * (unsigned short*) NB_MAX_COL_ADDR;
     180    maxRow  = * (unsigned char*)  NB_MAX_ROW_ADDR;
     181    column  = 0;
     182    row     = 0;
     183    attribute = ((BLACK << 4) | WHITE)<<8;
     184    nLines = 0;
     185    clear_screen();
     186#ifdef DEBUG_EARLY_STAGE   
     187    printk("bitMapBaseAddr = %X, display controller base IO = %X\n",
     188           (unsigned) bitMapBaseAddr,
     189           (unsigned) ioCrtBaseAddr);
     190    videoPrintf("maxCol = %d, maxRow = %d\n", (unsigned) maxCol, (unsigned) maxRow);
     191#endif
    286192} /* _IBMPC_initVideo */
Note: See TracChangeset for help on using the changeset viewer.