- fixed file descriptor table

- abstract I/O to mips_dbg



git-svn-id: http://moon:8086/svn/mips@73 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-11 22:23:45 +00:00
parent f9eb889616
commit 06f7be107b
7 changed files with 230 additions and 103 deletions
+20 -6
View File
@@ -7,7 +7,7 @@
#include <stddef.h>
#include "board.h"
#include "../../irq.h"
#include "../../mips_ps2.h"
#include "../../screen.h"
#include "../../uart.h"
@@ -21,11 +21,13 @@ extern vga_if_t vga_if;
static const con_if_entry_t con_if_entry[] =
{
{"UART-0", &uart_if[0], NULL, NULL, UART_readchar, UART_writechar},
{"UART-1", &uart_if[1], NULL, NULL, UART_readchar, UART_writechar},
{"PS2-0", &ps2_if[0], PS2_open, PS2_close, PS2_readchar, NULL},
{"PS2-1", &ps2_if[1], PS2_open, PS2_close, PS2_readchar, NULL},
{"VGA-0", &vga_if, cg_open, cg_close, NULL, cg_writechar}
{0, "stdin", &uart_if[0], NULL, NULL, UART_readchar, NULL},
{1, "stdout", &uart_if[0], NULL, NULL, NULL, UART_writechar},
{2, "stderr", &uart_if[0], NULL, NULL, NULL, UART_writechar},
{3, "UART-1", &uart_if[1], NULL, NULL, UART_readchar, UART_writechar},
{4, "PS2-0", &ps2_if[0], PS2_open, PS2_close, PS2_readchar, NULL},
{5, "PS2-1", &ps2_if[1], PS2_open, PS2_close, PS2_readchar, NULL},
{6, "VGA-0", &vga_if, cg_open, cg_close, NULL, cg_writechar}
};
con_if_t con_if =
@@ -53,6 +55,8 @@ void board_init(void)
// Initalize debugger
dbg_init();
interrupt_register(2, debug_int);
interrupt_enable(2);
// flush stdin
// flush(con_getPort(0));
@@ -60,3 +64,13 @@ void board_init(void)
// Do some initializations here
}
void dbg_putchar(char c)
{
writechar(1, c);
}
char dbg_getchar()
{
return (char)readchar(0);
}