Files
mips/src/common/libsys/boards/sim/board.c
T
jens 015deb2ace - refactored libsys into common
git-svn-id: http://moon:8086/svn/mips@198 a8ebac50-d88d-4704-bea3-6648445a41b3
2021-11-23 18:09:11 +00:00

64 lines
1.7 KiB
C

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
#include <stddef.h>
#include "board.h"
#include "../../irq.h"
#include "../../uart.h"
#include "../../console.h"
#include "../../asm/regdef.h"
#include "../../syscalls.h"
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
// ---------------------------------------------------------------------------------
// Uart
// ---------------------------------------------------------------------------------
const uart_if_t uart_if[] =
{
{(uint32_t*)SYS_UART0_STAT, (uint32_t*)SYS_UART0_DATA, (uint32_t*)SYS_UART0_BAUD},
{(uint32_t*)SYS_UART1_STAT, (uint32_t*)SYS_UART1_DATA, (uint32_t*)SYS_UART1_BAUD}
};
// ---------------------------------------------------------------------------------
// Console
// ---------------------------------------------------------------------------------
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},
{2, "stderr", &uart_if[0], NULL, NULL, NULL, UART_writechar},
{3, "UART-0", &uart_if[0], NULL, NULL, UART_readchar, UART_writechar},
{4, "UART-1", &uart_if[1], NULL, NULL, UART_readchar, UART_writechar}
};
const con_if_t con_if =
{
con_if_entry, ARRAYSIZE(con_if_entry)
};
void board_init(void)
{
uint32_t volatile *pITIM_ctrl = (uint32_t*)SYS_ITIM_CTRL;
// Disable interrupts
interrupt_global_disable();
// Disable timers
*pITIM_ctrl = 0;
// Setup syscall support
syscalls_init();
// Setup interrupt support
interrupt_init();
// Enable interrupts
interrupt_global_enable();
}