Skip to content

Commit c73c349

Browse files
authored
Merge pull request #3257 from FlyGoat/mips-refine-v1
MIPS Base Code Refine v1
2 parents 4e295d0 + c236e8c commit c73c349

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+4582
-9005
lines changed

bsp/ls1bdev/Kconfig

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
mainmenu "RT-Thread Configuration"
2+
3+
config BSP_DIR
4+
string
5+
option env="BSP_ROOT"
6+
default "."
7+
8+
config RTT_DIR
9+
string
10+
option env="RTT_ROOT"
11+
default "../.."
12+
13+
config PKGS_DIR
14+
string
15+
option env="PKGS_ROOT"
16+
default "packages"
17+
18+
source "$RTT_DIR/Kconfig"
19+
source "$RTT_DIR/libcpu/mips/common/Kconfig"
20+
source "$PKGS_DIR/Kconfig"
21+
22+
config SOC_LS1B
23+
bool
24+
select RT_USING_COMPONENTS_INIT
25+
select RT_USING_USER_MAIN
26+
default y
27+
28+
if RT_USING_SERIAL
29+
config RT_USING_UART0
30+
bool "Using RT_USING_UART0"
31+
default y
32+
config RT_USING_UART1
33+
bool "Using RT_USING_UART1"
34+
default n
35+
config RT_USING_UART3
36+
bool "Using RT_USING_UART3"
37+
default n
38+
39+
config RT_UART_RX_BUFFER_SIZE
40+
int "The rx buffer size"
41+
default 64 if RT_USING_SERIAL
42+
default 64
43+
endif
44+

bsp/ls1bdev/SConstruct

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ TARGET = 'rtthread.' + rtconfig.TARGET_EXT
1414

1515
DefaultEnvironment(tools=[])
1616
env = Environment(tools = ['mingw'],
17-
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
18-
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
19-
AR = rtconfig.AR, ARFLAGS = '-rc',
20-
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
17+
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
18+
CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
19+
AR = rtconfig.AR, ARFLAGS = '-rc',
20+
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
2121
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
2222

2323
Export('RTT_ROOT')

bsp/ls1bdev/applications/application.c

Lines changed: 0 additions & 59 deletions
This file was deleted.

bsp/ls1bdev/applications/main.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2006-2018, RT-Thread Development Team
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Change Logs:
7+
* Date Author Notes
8+
* 2018-05-10 zhuangwei first version
9+
*/
10+
11+
#include <rtthread.h>
12+
13+
int main(int argc, char** argv)
14+
{
15+
16+
return 0;
17+
}

bsp/ls1bdev/applications/startup.c

Lines changed: 0 additions & 92 deletions
This file was deleted.

bsp/ls1bdev/drivers/board.c

Lines changed: 44 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* Date Author Notes
1212
* 2010-06-25 Bernard first version
1313
* 2011-08-08 lgnq modified for Loongson LS1B
14+
* 2019-12-04 Jiaxun Yang Adapt new MIPS generic code
1415
*/
1516

1617
#include <rtthread.h>
@@ -20,92 +21,68 @@
2021
#include "uart.h"
2122
#include "ls1b.h"
2223

24+
#ifdef RT_USING_RTGUI
25+
#include <rtgui/rtgui.h>
26+
rt_device_t dc;
27+
extern void rt_hw_dc_init(void);
28+
#endif
29+
30+
extern unsigned char __bss_end;
31+
2332
/**
2433
* @addtogroup Loongson LS1B
2534
*/
2635

2736
/*@{*/
2837

29-
/**
30-
* This is the timer interrupt service routine.
31-
*/
32-
void rt_hw_timer_handler(void)
33-
{
34-
unsigned int count;
35-
36-
count = read_c0_compare();
37-
write_c0_compare(count);
38-
write_c0_count(0);
39-
40-
/* increase a OS tick */
41-
rt_tick_increase();
42-
}
43-
44-
/**
45-
* This function will initial OS timer
46-
*/
47-
void rt_hw_timer_init(void)
48-
{
49-
write_c0_compare(CPU_HZ/2/RT_TICK_PER_SECOND);
50-
write_c0_count(0);
51-
}
52-
5338
/**
5439
* This function will initial sam7s64 board.
5540
*/
5641
void rt_hw_board_init(void)
5742
{
58-
#ifdef RT_USING_UART
59-
/* init hardware UART device */
60-
rt_hw_uart_init();
43+
/* init hardware interrupt */
44+
rt_hw_exception_init();
45+
46+
/* init hardware interrupt */
47+
rt_hw_interrupt_init();
48+
49+
#ifdef RT_USING_HEAP
50+
rt_system_heap_init((void*)&__bss_end, (void*)RT_HW_HEAP_END);
51+
#endif
52+
53+
#ifdef RT_USING_SERIAL
54+
/* init hardware UART device */
55+
rt_hw_uart_init();
6156
#endif
6257

6358
#ifdef RT_USING_CONSOLE
64-
/* set console device */
65-
rt_console_set_device("uart0");
59+
/* set console device */
60+
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
6661
#endif
62+
/* init operating system timer */
63+
rt_hw_timer_init();
6764

68-
/* init operating system timer */
69-
rt_hw_timer_init();
65+
#ifdef RT_USING_FPU
66+
/* init hardware fpu */
67+
rt_hw_fpu_init();
68+
#endif
7069

71-
rt_kprintf("current sr: 0x%08x\n", read_c0_status());
72-
}
70+
#ifdef RT_USING_RTGUI
71+
rt_device_t dc;
7372

74-
#define __raw_out_put(unr) \
75-
while (*ptr) \
76-
{ \
77-
if (*ptr == '\n') \
78-
{ \
79-
/* FIFO status, contain valid data */ \
80-
while (!(UART_LSR(UART##unr##_BASE) & (UARTLSR_TE | UARTLSR_TFE))); \
81-
/* write data */ \
82-
UART_DAT(UART##unr##_BASE) = '\r'; \
83-
} \
84-
/* FIFO status, contain valid data */ \
85-
while (!(UART_LSR(UART##unr##_BASE) & (UARTLSR_TE | UARTLSR_TFE))); \
86-
/* write data */ \
87-
UART_DAT(UART##unr##_BASE) = *ptr; \
88-
ptr ++; \
89-
}
73+
/* init Display Controller */
74+
rt_hw_dc_init();
9075

91-
/* UART line status register value */
92-
#define UARTLSR_ERROR (1 << 7)
93-
#define UARTLSR_TE (1 << 6)
94-
#define UARTLSR_TFE (1 << 5)
95-
#define UARTLSR_BI (1 << 4)
96-
#define UARTLSR_FE (1 << 3)
97-
#define UARTLSR_PE (1 << 2)
98-
#define UARTLSR_OE (1 << 1)
99-
#define UARTLSR_DR (1 << 0)
100-
void rt_hw_console_output(const char *ptr)
101-
{
102-
#if defined(RT_USING_UART0)
103-
__raw_out_put(0);
104-
#elif defined(RT_USING_UART1)
105-
__raw_out_put(1);
106-
#elif defined(RT_USING_UART3)
107-
__raw_out_put(3);
76+
/* find Display Controller device */
77+
dc = rt_device_find("dc");
78+
79+
/* set Display Controller device as rtgui graphic driver */
80+
rtgui_graphic_set_device(dc);
10881
#endif
109-
}
11082

83+
#ifdef RT_USING_COMPONENTS_INIT
84+
rt_components_board_init();
85+
#endif
86+
87+
}
11188
/*@}*/

0 commit comments

Comments
 (0)