53 lines
1.1 KiB
C
53 lines
1.1 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"
|
|
|
|
extern uart_if_t uart_if[];
|
|
|
|
#define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
|
|
|
|
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();
|
|
}
|
|
|