- fixed bootloader

- bootloader added board file
- refactored header files
- constify constants

git-svn-id: http://moon:8086/svn/mips@99 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-18 22:28:07 +00:00
parent 702cb814a1
commit cf233c4d81
21 changed files with 289 additions and 172 deletions
+28 -5
View File
@@ -6,10 +6,16 @@
#include <stddef.h>
#include "../../irq.h"
#include "../../mips_ps2.h"
#include "../../mips_gfx.h"
#include "../../screen.h"
#include "../../uart.h"
#include "../../console.h"
#include "board.h"
extern void dbg_init();
extern void dbg_handler(struct xcptcontext * xcp);
extern int dbg_handler(struct xcptcontext * xcp);
#define DEBUGGER dbg_handler
extern uart_if_t uart_if[];
extern ps2_if_t ps2_if[];
@@ -17,7 +23,7 @@ extern vga_if_t vga_if;
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
static const con_if_entry_t con_if_entry[] =
const con_if_entry_t con_if_entry[] =
{
{0, "stdin", &uart_if[0], NULL, NULL, UART_readchar, NULL},
{1, "stdout", &uart_if[0], NULL, NULL, NULL, UART_writechar},
@@ -29,11 +35,28 @@ static const con_if_entry_t con_if_entry[] =
{30, "VGA-0", &vga_if, cg_open, cg_close, NULL, cg_writechar}
};
con_if_t con_if =
const con_if_t con_if =
{
con_if_entry, ARRAYSIZE(con_if_entry)
};
void handle_debugger_int(struct xcptcontext * xcp)
{
dbg_handler(xcp);
}
void dbg_init()
{
xcpt_register(EXC_ADEL, DEBUGGER);
xcpt_register(EXC_ADES, DEBUGGER);
xcpt_register(EXC_IBE, DEBUGGER);
xcpt_register(EXC_DBE, DEBUGGER);
xcpt_register(EXC_BP, DEBUGGER);
xcpt_register(EXC_RI, DEBUGGER);
xcpt_register(EXC_CPU, DEBUGGER);
xcpt_register(EXC_OV, DEBUGGER);
}
void board_init(void)
{
uint32_t volatile *pITIM_ctrl = (uint32_t*)SYS_ITIM_CTRL;
@@ -54,7 +77,7 @@ void board_init(void)
// Initalize debugger
dbg_init();
interrupt_register(2, dbg_handler);
interrupt_register(2, handle_debugger_int);
interrupt_enable(2);
// flush stdin