1 /*
2  * Copyright (c) 2006-2021, RT-Thread Development Team
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  * Change Logs:
7  * Date           Author       Notes
8  * 2010-06-25     Bernard      first version
9  * 2011-08-08     lgnq         modified for Loongson LS1B
10  * 2019-12-04     Jiaxun Yang  Adapt new MIPS generic code
11  */
12 
13 #include <rtthread.h>
14 #include <rthw.h>
15 #include <mips_fpu.h>
16 
17 #include "board.h"
18 #include "drv_uart.h"
19 #include "ls1b.h"
20 
21 #ifdef RT_USING_RTGUI
22 #include <rtgui/rtgui.h>
23 rt_device_t dc;
24 extern void rt_hw_dc_init(void);
25 #endif
26 
27 extern unsigned char __bss_end;
28 
29 /**
30  * @addtogroup Loongson LS1B
31  */
32 
33 /*@{*/
34 
35 /**
36  * This function will initial sam7s64 board.
37  */
rt_hw_board_init(void)38 void rt_hw_board_init(void)
39 {
40     /* init hardware interrupt */
41     rt_hw_exception_init();
42 
43     /* init hardware interrupt */
44     rt_hw_interrupt_init();
45 
46 #ifdef RT_USING_HEAP
47     rt_system_heap_init((void*)&__bss_end, (void*)RT_HW_HEAP_END);
48 #endif
49 
50 #ifdef RT_USING_SERIAL
51     /* init hardware UART device */
52     rt_hw_uart_init();
53 #endif
54 
55 #if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
56     /* set console device */
57     rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
58 #endif
59     /* init operating system timer */
60     rt_hw_timer_init();
61 
62 #ifdef RT_USING_FPU
63     /* init hardware fpu */
64     rt_hw_fpu_init();
65 #endif
66 
67 #ifdef RT_USING_RTGUI
68     rt_device_t dc;
69 
70     /* init Display Controller */
71     rt_hw_dc_init();
72 
73     /* find Display Controller device */
74     dc = rt_device_find("dc");
75 
76     /* set Display Controller device as rtgui graphic driver */
77     rtgui_graphic_set_device(dc);
78 #endif
79 
80 #ifdef RT_USING_COMPONENTS_INIT
81     rt_components_board_init();
82 #endif
83     rt_kprintf("current sr: 0x%08x\n", read_c0_status());
84 }
85 /*@}*/
86