Changeset 38de8a5 in mainline for arch/mips/src/console.c


Ignore:
Timestamp:
2005-09-09T13:50:54Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b02e5d1
Parents:
b0edf3b2
Message:

MIPS architecture now works without any problems in

  • msim: compile as OUTPUT_FORMAT(binary)
  • gxemul: compile as OUTPUT_FORMAT(ecoff-littlemips), or create

configuration file for binary format (will be done later)

  • simics: compile as OUTPUT_FORMAT(elf32-little), might work with binary

format, didn't try yet.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • arch/mips/src/console.c

    rb0edf3b2 r38de8a5  
    11/*
    2  * Copyright (C) 2003-2004 Jakub Jermar
     2 * Copyright (C) 2005 Ondrej Palkovsky
    33 * All rights reserved.
    44 *
     
    3030#include <arch/types.h>
    3131#include <arch/cp0.h>
     32#include <arch/console.h>
    3233
    33 #define VIDEORAM        0xB0000000
     34static void (*putchar_func)(const char ch) = NULL;
     35
     36static void cons_putchar(const char ch)
     37{
     38        *((char *) VIDEORAM) = ch;
     39}
     40
     41
     42static void serial_putchar(const char ch)
     43{
     44        int i;
     45
     46        if (ch=='\n')
     47                putchar('\r');
     48
     49        /* Wait until transmit buffer empty */
     50        while (! ((*SERIAL_LSR) & (1<<TRANSMIT_EMPTY_BIT)))
     51                ;
     52        *(SERIAL_PORT_BASE) = ch;
     53}
     54
     55void console_init(void)
     56{
     57        /* The LSR on the start usually contains this value */
     58        if (*SERIAL_LSR == 0x60)
     59                putchar_func = serial_putchar;
     60        else
     61                putchar_func = cons_putchar;
     62}
    3463
    3564void putchar(const char ch)
    3665{
    37 //      __u32 status = cp0_status_read();
    38        
    39 //      cp0_status_write(cp0_status_read() | cp0_status_erl_error_bit);
    40         *((char *) VIDEORAM) = ch;
    41 //      cp0_status_write(status);
     66        putchar_func(ch);
    4267}
Note: See TracChangeset for help on using the changeset viewer.