/kernel/trunk/arch/mips32/src/panic.S |
---|
38,6 → 38,11 |
/* From printf return directly to halt() */ |
panic_printf: |
lui $ra, %hi(halt) |
jal printf |
nop |
j halt |
nop |
/* This code does not work, god knows why */ |
/* lui $ra, %hi(halt) |
j printf |
ori $ra, %lo(halt) |
ori $ra, %lo(halt) */ |
/kernel/trunk/arch/mips32/src/drivers/serial.c |
---|
71,12 → 71,22 |
return i; |
} |
static chardev_operations_t serial_ops = { |
.resume = serial_enable, |
.suspend = serial_disable, |
.write = serial_write |
}; |
/** Read character from serial port, wait until available */ |
static char serial_do_read(chardev_t *dev) |
{ |
serial_t *sd = (serial_t *)dev->data; |
char ch; |
while (!(SERIAL_READ_LSR(sd->port) & 1)) |
; |
ch = SERIAL_READ(sd->port); |
if (ch =='\r') |
ch = '\n'; |
return ch; |
} |
/** Process keyboard interrupt. Does not work in simics? */ |
static void serial_interrupt(int n, void *stack) |
{ |
93,6 → 103,14 |
} |
static chardev_operations_t serial_ops = { |
.resume = serial_enable, |
.suspend = serial_disable, |
.write = serial_write, |
.read = serial_do_read |
}; |
iroutine old_timer; |
/** Do polling on timer interrupt */ |
static void timer_replace(int n, void *stack) |
/kernel/trunk/arch/mips32/src/drivers/msim.c |
---|
37,11 → 37,13 |
static void msim_write(chardev_t *dev, const char ch); |
static void msim_enable(chardev_t *dev); |
static void msim_disable(chardev_t *dev); |
static char msim_do_read(chardev_t *dev); |
static chardev_operations_t msim_ops = { |
.resume = msim_enable, |
.suspend = msim_disable, |
.write = msim_write |
.write = msim_write, |
.read = msim_do_read, |
}; |
/** Putchar that works with MSIM & gxemul */ |
63,10 → 65,27 |
} |
#include <print.h> |
/** Read character using polling, assume interrupts disabled */ |
static char msim_do_read(chardev_t *dev) |
{ |
char ch; |
while (1) { |
ch = *((volatile char *) MSIM_KBD_ADDRESS); |
if (ch) { |
if (ch == '\r') |
return '\n'; |
if (ch == 0x7f) |
return '\b'; |
return ch; |
} |
} |
} |
/** Process keyboard interrupt. */ |
static void msim_interrupt(int n, void *stack) |
{ |
char ch; |
char ch = 0; |
ch = *((char *) MSIM_KBD_ADDRESS); |
if (ch =='\r') |