board.c 1.7 KB
Newer Older
D
dzzxzz@gmail.com 已提交
1
/*
2
 * Copyright (c) 2006-2021, RT-Thread Development Team
D
dzzxzz@gmail.com 已提交
3
 *
4
 * SPDX-License-Identifier: Apache-2.0
D
dzzxzz@gmail.com 已提交
5 6 7 8 9
 *
 * Change Logs:
 * Date           Author       Notes
 * 2010-06-25     Bernard      first version
 * 2011-08-08     lgnq         modified for Loongson LS1B
10
 * 2019-12-04     Jiaxun Yang  Adapt new MIPS generic code
D
dzzxzz@gmail.com 已提交
11 12 13 14
 */

#include <rtthread.h>
#include <rthw.h>
D
duhuanpeng 已提交
15
#include <mips_fpu.h>
D
dzzxzz@gmail.com 已提交
16 17

#include "board.h"
18
#include "drv_uart.h"
D
dzzxzz@gmail.com 已提交
19 20
#include "ls1b.h"

21 22 23 24 25 26 27 28
#ifdef RT_USING_RTGUI
#include <rtgui/rtgui.h>
rt_device_t dc;
extern void rt_hw_dc_init(void);
#endif

extern unsigned char __bss_end;

D
dzzxzz@gmail.com 已提交
29 30 31
/**
 * @addtogroup Loongson LS1B
 */
32

D
dzzxzz@gmail.com 已提交
33 34 35 36 37 38 39
/*@{*/

/**
 * This function will initial sam7s64 board.
 */
void rt_hw_board_init(void)
{
40 41
    /* init hardware interrupt */
    rt_hw_exception_init();
42

43 44
    /* init hardware interrupt */
    rt_hw_interrupt_init();
45

46 47 48 49 50 51 52
#ifdef RT_USING_HEAP
    rt_system_heap_init((void*)&__bss_end, (void*)RT_HW_HEAP_END);
#endif

#ifdef RT_USING_SERIAL
    /* init hardware UART device */
    rt_hw_uart_init();
D
dzzxzz@gmail.com 已提交
53 54 55
#endif

#ifdef RT_USING_CONSOLE
56 57
    /* set console device */
    rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
D
dzzxzz@gmail.com 已提交
58
#endif
59 60
    /* init operating system timer */
    rt_hw_timer_init();
D
dzzxzz@gmail.com 已提交
61

62 63 64 65
#ifdef RT_USING_FPU
    /* init hardware fpu */
    rt_hw_fpu_init();
#endif
D
dzzxzz@gmail.com 已提交
66

67 68
#ifdef RT_USING_RTGUI
    rt_device_t dc;
D
dzzxzz@gmail.com 已提交
69

70 71
    /* init Display Controller */
    rt_hw_dc_init();
72

73 74 75 76 77
    /* find Display Controller device */
    dc = rt_device_find("dc");

    /* set Display Controller device as rtgui graphic driver */
    rtgui_graphic_set_device(dc);
78
#endif
D
dzzxzz@gmail.com 已提交
79

80 81 82
#ifdef RT_USING_COMPONENTS_INIT
    rt_components_board_init();
#endif
83
    rt_kprintf("current sr: 0x%08x\n", read_c0_status());
84
}
D
dzzxzz@gmail.com 已提交
85
/*@}*/