- 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:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#include "../../irq.h"
|
||||
#include "../../uart.h"
|
||||
#include "../../console.h"
|
||||
|
||||
@@ -17,8 +18,10 @@ extern uart_if_t uart_if[];
|
||||
|
||||
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}
|
||||
{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, "UART1", &uart_if[1], NULL, NULL, UART_readchar, UART_writechar}
|
||||
};
|
||||
|
||||
con_if_t con_if =
|
||||
@@ -43,4 +46,14 @@ void board_init(void)
|
||||
dbg_init();
|
||||
|
||||
// Do some initializations here
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_putchar(char c)
|
||||
{
|
||||
writechar(3, c);
|
||||
}
|
||||
|
||||
char dbg_getchar()
|
||||
{
|
||||
return (char)readchar(3);
|
||||
}
|
||||
|
||||
@@ -89,9 +89,9 @@
|
||||
#define SYS_UART0_DATA (SYS_IO_BASE + 0x10000)
|
||||
#define SYS_UART0_STAT (SYS_IO_BASE + 0x10004)
|
||||
#define SYS_UART0_BAUD (SYS_IO_BASE + 0x10008)
|
||||
#define SYS_UART1_DATA (SYS_IO_BASE + 0x10100)
|
||||
#define SYS_UART1_STAT (SYS_IO_BASE + 0x10104)
|
||||
#define SYS_UART1_BAUD (SYS_IO_BASE + 0x10108)
|
||||
#define SYS_UART1_DATA (SYS_IO_BASE + 0x30000)
|
||||
#define SYS_UART1_STAT (SYS_IO_BASE + 0x30004)
|
||||
#define SYS_UART1_BAUD (SYS_IO_BASE + 0x30008)
|
||||
|
||||
// SPI
|
||||
#define SYS_SPI_STAT (SYS_IO_BASE + 0x20000)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user