Changeset 93b84b3 in mainline for arch/mips32


Ignore:
Timestamp:
2005-12-12T16:30:07Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ebbdb8f
Parents:
af9a7c5
Message:

Fixed weird simics panic.
Run kconsole, if we panic. This currently works in gxemul,
simics. In mips we need to modify the simulator.
On ia32 we need a function, that would speak directly to the chip
and fetch the character using polling.

Location:
arch/mips32/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • arch/mips32/src/drivers/msim.c

    raf9a7c5 r93b84b3  
    3838static void msim_enable(chardev_t *dev);
    3939static void msim_disable(chardev_t *dev);
     40static char msim_do_read(chardev_t *dev);
    4041
    4142static chardev_operations_t msim_ops = {
    4243        .resume = msim_enable,
    4344        .suspend = msim_disable,
    44         .write = msim_write
     45        .write = msim_write,
     46        .read = msim_do_read,
    4547};
    4648
     
    6466
    6567#include <print.h>
     68/** Read character using polling, assume interrupts disabled */
     69static char msim_do_read(chardev_t *dev)
     70{
     71        char ch;
     72
     73        while (1) {
     74                ch = *((volatile char *) MSIM_KBD_ADDRESS);
     75                if (ch) {
     76                        if (ch == '\r')
     77                                return '\n';
     78                        if (ch == 0x7f)
     79                                return '\b';
     80                        return ch;
     81                }
     82        }
     83}
     84
    6685/** Process keyboard interrupt. */
    6786static void msim_interrupt(int n, void *stack)
    6887{
    69         char ch;
     88        char ch = 0;
    7089
    7190        ch = *((char *) MSIM_KBD_ADDRESS);
  • arch/mips32/src/drivers/serial.c

    raf9a7c5 r93b84b3  
    7272}
    7373
    74 static chardev_operations_t serial_ops = {
    75         .resume = serial_enable,
    76         .suspend = serial_disable,
    77         .write = serial_write
    78 };
     74/** Read character from serial port, wait until available */
     75static char serial_do_read(chardev_t *dev)
     76{
     77        serial_t *sd = (serial_t *)dev->data;
     78        char ch;
     79
     80        while (!(SERIAL_READ_LSR(sd->port) & 1))
     81                ;
     82        ch = SERIAL_READ(sd->port);
     83
     84        if (ch =='\r')
     85                ch = '\n';
     86        return ch;
     87}
     88
    7989
    8090/** Process keyboard interrupt. Does not work in simics? */
     
    93103}
    94104
     105
     106
     107static chardev_operations_t serial_ops = {
     108        .resume = serial_enable,
     109        .suspend = serial_disable,
     110        .write = serial_write,
     111        .read = serial_do_read
     112};
    95113
    96114iroutine old_timer;
  • arch/mips32/src/panic.S

    raf9a7c5 r93b84b3  
    3939/* From printf return directly to halt() */     
    4040panic_printf:
    41         lui $ra, %hi(halt)
     41        jal printf
     42        nop
     43        j halt
     44        nop
     45/* This code does not work, god knows why */           
     46/*      lui $ra, %hi(halt)
    4247        j printf
    43         ori $ra, %lo(halt)
     48        ori $ra, %lo(halt) */
Note: See TracChangeset for help on using the changeset viewer.