Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
宁楠萍
rt-thread
提交
c1f4d6c6
R
rt-thread
项目概览
宁楠萍
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c1f4d6c6
编写于
10月 20, 2020
作者:
G
GFWisshit
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改license header,修改driver目录下的SConscript。
上级
7f330c7b
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
420 addition
and
285 deletion
+420
-285
bsp/bm3803/applications/board.c
bsp/bm3803/applications/board.c
+30
-24
bsp/bm3803/applications/board.h
bsp/bm3803/applications/board.h
+18
-12
bsp/bm3803/applications/main.c
bsp/bm3803/applications/main.c
+20
-0
bsp/bm3803/drivers/SConscript
bsp/bm3803/drivers/SConscript
+1
-12
bsp/bm3803/drivers/uart.c
bsp/bm3803/drivers/uart.c
+42
-36
bsp/bm3803/drivers/uart.h
bsp/bm3803/drivers/uart.h
+18
-12
bsp/bm3803/drivers/uart_reg.h
bsp/bm3803/drivers/uart_reg.h
+24
-4
libcpu/sparc-v8/bm3803/bm3803.h
libcpu/sparc-v8/bm3803/bm3803.h
+95
-84
libcpu/sparc-v8/bm3803/context_gcc.S
libcpu/sparc-v8/bm3803/context_gcc.S
+18
-8
libcpu/sparc-v8/bm3803/interrupt.c
libcpu/sparc-v8/bm3803/interrupt.c
+27
-17
libcpu/sparc-v8/bm3803/interrupt.h
libcpu/sparc-v8/bm3803/interrupt.h
+18
-8
libcpu/sparc-v8/bm3803/stack.c
libcpu/sparc-v8/bm3803/stack.c
+47
-36
libcpu/sparc-v8/bm3803/start_gcc.S
libcpu/sparc-v8/bm3803/start_gcc.S
+18
-8
libcpu/sparc-v8/bm3803/trap.c
libcpu/sparc-v8/bm3803/trap.c
+26
-16
libcpu/sparc-v8/bm3803/vector_gcc.S
libcpu/sparc-v8/bm3803/vector_gcc.S
+18
-8
未找到文件。
bsp/bm3803/applications/board.c
浏览文件 @
c1f4d6c6
/*
* File : board.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2020, Shenzhen Academy of Aerospace Technology
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#include <rthw.h>
#include <rtthread.h>
...
...
@@ -21,27 +27,27 @@
extern
int
__bss_end
;
static
void
rt_hw_timer_isr
(
int
vector
,
void
*
param
)
static
void
rt_hw_timer_isr
(
int
vector
,
void
*
param
)
{
rt_tick_increase
();
/* timer interrupt cleared by hardware */
rt_tick_increase
();
/* timer interrupt cleared by hardware */
}
int
rt_hw_timer_init
(
void
)
{
unsigned
int
counter
=
1000000
/
RT_TICK_PER_SECOND
;
volatile
struct
lregs
*
regs
=
(
struct
lregs
*
)
PREGS
;
unsigned
int
counter
=
1000000
/
RT_TICK_PER_SECOND
;
volatile
struct
lregs
*
regs
=
(
struct
lregs
*
)
PREGS
;
regs
->
scalercnt
=
CPU_FREQ
/
1000000
-
1
;
regs
->
scalerload
=
CPU_FREQ
/
1000000
-
1
;
regs
->
timercnt2
=
counter
-
1
;
regs
->
timerload2
=
counter
-
1
;
rt_hw_interrupt_install
(
TIMER2_TT
,
rt_hw_timer_isr
,
RT_NULL
,
"tick"
);
rt_hw_interrupt_umask
(
TIMER2_TT
);
rt_hw_interrupt_install
(
TIMER2_TT
,
rt_hw_timer_isr
,
RT_NULL
,
"tick"
);
rt_hw_interrupt_umask
(
TIMER2_TT
);
/* start timer */
regs
->
timerctrl2
=
0x7
;
/* start timer */
regs
->
timerctrl2
=
0x7
;
return
0
;
}
...
...
@@ -52,7 +58,7 @@ INIT_BOARD_EXPORT(rt_hw_timer_init);
*/
void
rt_hw_board_init
(
void
)
{
rt_system_heap_init
((
void
*
)
&
__bss_end
,
(
void
*
)
&
__bss_end
+
0x01000000
);
rt_system_heap_init
((
void
*
)
&
__bss_end
,
(
void
*
)
&
__bss_end
+
0x01000000
);
rt_components_board_init
();
rt_console_set_device
(
RT_CONSOLE_DEVICE_NAME
);
rt_console_set_device
(
RT_CONSOLE_DEVICE_NAME
);
}
bsp/bm3803/applications/board.h
浏览文件 @
c1f4d6c6
/*
* File : board.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2020, Shenzhen Academy of Aerospace Technology
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#ifndef __BOARD_H__
#define __BOARD_H__
...
...
bsp/bm3803/applications/main.c
浏览文件 @
c1f4d6c6
/*
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
...
...
bsp/bm3803/drivers/SConscript
浏览文件 @
c1f4d6c6
...
...
@@ -3,20 +3,9 @@ Import('RTT_ROOT')
Import
(
'rtconfig'
)
from
building
import
*
cwd
=
GetCurrentDir
()
cwd
=
GetCurrentDir
()
src
=
Glob
(
'*.c'
)
# remove no need file.
if
GetDepend
(
'RT_USING_LWIP'
)
==
False
:
src_need_remove
=
[
'dm9000.c'
]
# need remove file list.
SrcRemove
(
src
,
src_need_remove
)
if
GetDepend
(
'RT_USING_DFS'
)
==
False
:
src_need_remove
=
[
'sd.c'
]
# need remove file list.
SrcRemove
(
src
,
src_need_remove
)
CPPPATH
=
[
cwd
]
group
=
DefineGroup
(
'Drivers'
,
src
,
depend
=
[
''
],
CPPPATH
=
CPPPATH
)
Return
(
'group'
)
bsp/bm3803/drivers/uart.c
浏览文件 @
c1f4d6c6
/*
* File : serial.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2020, Shenzhen Academy of Aerospace Technology
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#include <rthw.h>
#include <rtthread.h>
...
...
@@ -27,16 +33,16 @@ struct bm3803_uart
int
irq
;
};
static
void
bm3803_uart_isr
(
int
tt
,
void
*
param
)
static
void
bm3803_uart_isr
(
int
tt
,
void
*
param
)
{
struct
bm3803_uart
*
uart
;
struct
bm3803_uart
*
uart
;
struct
rt_serial_device
*
serial
;
struct
uart_reg
*
uart_base
;
struct
uart_reg
*
uart_base
;
serial
=
(
struct
rt_serial_device
*
)
param
;
serial
=
(
struct
rt_serial_device
*
)
param
;
uart
=
(
struct
bm3803_uart
*
)
serial
->
parent
.
user_data
;
uart_base
=
uart
->
uart_base
;
if
(
uart_base
->
uartstatus
&
0x1
)
{
rt_hw_serial_isr
(
serial
,
RT_SERIAL_EVENT_RX_IND
);
...
...
@@ -47,8 +53,8 @@ static void bm3803_uart_isr(int tt, void* param)
static
rt_err_t
bm3803_configure
(
struct
rt_serial_device
*
serial
,
struct
serial_configure
*
cfg
)
{
struct
bm3803_uart
*
uart
;
struct
uart_reg
*
uart_base
;
struct
bm3803_uart
*
uart
;
struct
uart_reg
*
uart_base
;
RT_ASSERT
(
serial
!=
RT_NULL
);
uart
=
(
struct
bm3803_uart
*
)
serial
->
parent
.
user_data
;
...
...
@@ -57,17 +63,17 @@ static rt_err_t bm3803_configure(struct rt_serial_device *serial, struct serial_
if
(
cfg
->
baud_rate
==
BAUD_RATE_115200
)
{
uart_base
->
uartscaler
=
((((
CPU_FREQ
*
10
)
/
(
8
*
115200
))
-
5
)
/
10
);
uart_base
->
uartscaler
=
((((
CPU_FREQ
*
10
)
/
(
8
*
115200
))
-
5
)
/
10
);
}
else
if
(
cfg
->
baud_rate
==
BAUD_RATE_9600
)
{
uart_base
->
uartscaler
=
((((
CPU_FREQ
*
10
)
/
(
8
*
9600
))
-
5
)
/
10
);
uart_base
->
uartscaler
=
((((
CPU_FREQ
*
10
)
/
(
8
*
9600
))
-
5
)
/
10
);
}
else
{
NOT_IMPLEMENTED
();
}
uart_base
->
uartctrl
|=
0x3
;
return
RT_EOK
;
...
...
@@ -75,7 +81,7 @@ static rt_err_t bm3803_configure(struct rt_serial_device *serial, struct serial_
static
rt_err_t
bm3803_control
(
struct
rt_serial_device
*
serial
,
int
cmd
,
void
*
arg
)
{
struct
bm3803_uart
*
uart
;
struct
bm3803_uart
*
uart
;
RT_ASSERT
(
serial
!=
RT_NULL
);
uart
=
(
struct
bm3803_uart
*
)
serial
->
parent
.
user_data
;
...
...
@@ -97,13 +103,13 @@ static rt_err_t bm3803_control(struct rt_serial_device *serial, int cmd, void *a
static
int
bm3803_putc
(
struct
rt_serial_device
*
serial
,
char
c
)
{
struct
bm3803_uart
*
uart
;
struct
uart_reg
*
uart_base
;
struct
bm3803_uart
*
uart
;
struct
uart_reg
*
uart_base
;
RT_ASSERT
(
serial
!=
RT_NULL
);
uart
=
(
struct
bm3803_uart
*
)
serial
->
parent
.
user_data
;
uart_base
=
uart
->
uart_base
;
while
(
!
(
uart_base
->
uartstatus
&
0x4
));
uart_base
->
uartdata
=
c
;
...
...
@@ -113,13 +119,13 @@ static int bm3803_putc(struct rt_serial_device *serial, char c)
static
int
bm3803_getc
(
struct
rt_serial_device
*
serial
)
{
int
ch
;
struct
bm3803_uart
*
uart
;
struct
uart_reg
*
uart_base
;
struct
bm3803_uart
*
uart
;
struct
uart_reg
*
uart_base
;
RT_ASSERT
(
serial
!=
RT_NULL
);
uart
=
(
struct
bm3803_uart
*
)
serial
->
parent
.
user_data
;
uart_base
=
uart
->
uart_base
;
uart_base
=
uart
->
uart_base
;
ch
=
-
1
;
if
(
uart_base
->
uartstatus
&
0x1
)
{
...
...
@@ -131,7 +137,7 @@ static int bm3803_getc(struct rt_serial_device *serial)
static
const
struct
rt_uart_ops
bm3803_uart_ops
=
{
bm3803_configure
,
bm3803_configure
,
bm3803_control
,
bm3803_putc
,
bm3803_getc
,
...
...
@@ -141,7 +147,7 @@ static const struct rt_uart_ops bm3803_uart_ops =
#ifdef RT_USING_UART1
struct
bm3803_uart
uart1
=
{
(
void
*
)
UART1_BASE
,
(
void
*
)
UART1_BASE
,
UART1_TT
,
};
struct
rt_serial_device
serial1
;
...
...
@@ -152,7 +158,7 @@ int rt_hw_serial_init(void)
struct
serial_configure
config
=
RT_SERIAL_CONFIG_DEFAULT
;
#ifdef RT_USING_UART1
volatile
struct
lregs
*
regs
=
(
struct
lregs
*
)
PREGS
;
volatile
struct
lregs
*
regs
=
(
struct
lregs
*
)
PREGS
;
serial1
.
ops
=
&
bm3803_uart_ops
;
serial1
.
config
=
config
;
/* configure gpio direction */
...
...
@@ -166,8 +172,8 @@ int rt_hw_serial_init(void)
rt_hw_interrupt_mask
(
uart1
.
irq
);
/* register UART1 device */
rt_hw_serial_register
(
&
serial1
,
"uart1"
,
RT_DEVICE_FLAG_RDWR
|
RT_DEVICE_FLAG_INT_RX
,
&
uart1
);
RT_DEVICE_FLAG_RDWR
|
RT_DEVICE_FLAG_INT_RX
,
&
uart1
);
#endif
return
0
;
}
...
...
bsp/bm3803/drivers/uart.h
浏览文件 @
c1f4d6c6
/*
* File : serial.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2020, Shenzhen Academy of Aerospace Technology
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#ifndef __SERIAL_H__
#define __SERIAL_H__
...
...
bsp/bm3803/drivers/uart_reg.h
浏览文件 @
c1f4d6c6
/*
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#ifndef SERIAL_REG_H
#define SERIAL_REG_H
struct
uart_reg
{
unsigned
int
uartdata
;
unsigned
int
uartstatus
;
unsigned
int
uartctrl
;
unsigned
int
uartscaler
;
unsigned
int
uartdata
;
unsigned
int
uartstatus
;
unsigned
int
uartctrl
;
unsigned
int
uartscaler
;
};
#endif
/* end of include guard: SERIAL_REG_H */
libcpu/sparc-v8/bm3803/bm3803.h
浏览文件 @
c1f4d6c6
/*
* Copyright (c) 2020, Shenzhen Academy of Aerospace Technology
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#ifndef __BM3803_H__
#define __BM3803_H__
struct
lregs
{
/* address = 0x80000000 */
unsigned
int
memcfg1
;
/* 0x00 */
unsigned
int
memcfg2
;
unsigned
int
memcfg3
;
unsigned
int
failaddr
;
unsigned
int
memstatus
;
/* 0x10 */
unsigned
int
cachectrl
;
unsigned
int
powerdown
;
unsigned
int
writeprot1
;
unsigned
int
writeprot2
;
/* 0x20 */
unsigned
int
pcr
;
unsigned
int
dummy2
;
unsigned
int
dummy3
;
unsigned
int
dummy4
;
/* 0x30 */
unsigned
int
dummy5
;
unsigned
int
dummy6
;
unsigned
int
dummy7
;
unsigned
int
timercnt1
;
/* 0x40 */
unsigned
int
timerload1
;
unsigned
int
timerctrl1
;
unsigned
int
wdog
;
unsigned
int
timercnt2
;
/* 0x50 */
unsigned
int
timerload2
;
unsigned
int
timerctrl2
;
unsigned
int
dummy8
;
unsigned
int
scalercnt
;
/* 0x60 */
unsigned
int
scalerload
;
unsigned
int
dummy9
;
unsigned
int
dummy10
;
unsigned
int
uartdata1
;
/* 0x70 */
unsigned
int
uartstatus1
;
unsigned
int
uartctrl1
;
unsigned
int
uartscaler1
;
unsigned
int
uartdata2
;
/* 0x80 */
unsigned
int
uartstatus2
;
unsigned
int
uartctrl2
;
unsigned
int
uartscaler2
;
unsigned
int
irqmask
;
/* 0x90 */
unsigned
int
irqpend
;
unsigned
int
irqforce
;
unsigned
int
irqclear
;
unsigned
int
piodata
;
/* 0xA0 */
unsigned
int
piodir
;
unsigned
int
pioirq
;
unsigned
int
dummy11
;
unsigned
int
imask2
;
/* 0xB0 */
unsigned
int
ipend2
;
unsigned
int
istat2
;
unsigned
int
dummy12
;
unsigned
int
dummy13
;
/* 0xC0 */
unsigned
int
dcomstatus
;
unsigned
int
dcomctrl
;
unsigned
int
dcomscaler
;
unsigned
int
dummy14
;
/* 0xD0 */
unsigned
int
dummy15
;
unsigned
int
dummy16
;
unsigned
int
dummy17
;
unsigned
int
uartdata3
;
/* 0xE0 */
unsigned
int
uartstatus3
;
unsigned
int
uartctrl3
;
unsigned
int
uartscaler3
;
/* address = 0x80000000 */
unsigned
int
memcfg1
;
/* 0x00 */
unsigned
int
memcfg2
;
unsigned
int
memcfg3
;
unsigned
int
failaddr
;
unsigned
int
memstatus
;
/* 0x10 */
unsigned
int
cachectrl
;
unsigned
int
powerdown
;
unsigned
int
writeprot1
;
unsigned
int
writeprot2
;
/* 0x20 */
unsigned
int
pcr
;
unsigned
int
dummy2
;
unsigned
int
dummy3
;
unsigned
int
dummy4
;
/* 0x30 */
unsigned
int
dummy5
;
unsigned
int
dummy6
;
unsigned
int
dummy7
;
unsigned
int
timercnt1
;
/* 0x40 */
unsigned
int
timerload1
;
unsigned
int
timerctrl1
;
unsigned
int
wdog
;
unsigned
int
timercnt2
;
/* 0x50 */
unsigned
int
timerload2
;
unsigned
int
timerctrl2
;
unsigned
int
dummy8
;
unsigned
int
scalercnt
;
/* 0x60 */
unsigned
int
scalerload
;
unsigned
int
dummy9
;
unsigned
int
dummy10
;
unsigned
int
uartdata1
;
/* 0x70 */
unsigned
int
uartstatus1
;
unsigned
int
uartctrl1
;
unsigned
int
uartscaler1
;
unsigned
int
uartdata2
;
/* 0x80 */
unsigned
int
uartstatus2
;
unsigned
int
uartctrl2
;
unsigned
int
uartscaler2
;
unsigned
int
irqmask
;
/* 0x90 */
unsigned
int
irqpend
;
unsigned
int
irqforce
;
unsigned
int
irqclear
;
unsigned
int
piodata
;
/* 0xA0 */
unsigned
int
piodir
;
unsigned
int
pioirq
;
unsigned
int
dummy11
;
unsigned
int
imask2
;
/* 0xB0 */
unsigned
int
ipend2
;
unsigned
int
istat2
;
unsigned
int
dummy12
;
unsigned
int
dummy13
;
/* 0xC0 */
unsigned
int
dcomstatus
;
unsigned
int
dcomctrl
;
unsigned
int
dcomscaler
;
unsigned
int
dummy14
;
/* 0xD0 */
unsigned
int
dummy15
;
unsigned
int
dummy16
;
unsigned
int
dummy17
;
unsigned
int
uartdata3
;
/* 0xE0 */
unsigned
int
uartstatus3
;
unsigned
int
uartctrl3
;
unsigned
int
uartscaler3
;
};
#define
PREGS 0x80000000
#define
PREGS 0x80000000
#define UART1_BASE (PREGS + 0x70)
...
...
libcpu/sparc-v8/bm3803/context_gcc.S
浏览文件 @
c1f4d6c6
/*
*
Copyright
(
c
)
2020
,
Shenzhen
Academy
of
Aerospace
Technology
*
*
SPDX
-
License
-
Identifier
:
Apache
-
2
.0
*
*
Change
Logs
:
*
Date
Author
Notes
*
2020
-
10
-
16
Dystopia
the
first
version
*/
Copyright
2020
Shenzhen
Academy
of
Aerospace
Technology
Licensed
under
the
Apache
License
,
Version
2
.0
(
the
"License"
)
;
you
may
not
use
this
file
except
in
compliance
with
the
License
.
You
may
obtain
a
copy
of
the
License
at
http
://
www.apache.org
/
licenses
/
LICENSE
-2.0
Unless
required
by
applicable
law
or
agreed
to
in
writing
,
software
distributed
under
the
License
is
distributed
on
an
"AS IS"
BASIS
,
WITHOUT
WARRANTIES
OR
CONDITIONS
OF
ANY
KIND
,
either
express
or
implied
.
See
the
License
for
the
specific
language
governing
permissions
and
limitations
under
the
License
.
Change
Logs
:
Date
Author
Notes
2020
-
10
-
16
Dystopia
the
first
version
*/
#define SPARC_PSR_PIL_MASK 0x00000F00
#define SPARC_PSR_ET_MASK 0x00000020
...
...
libcpu/sparc-v8/bm3803/interrupt.c
浏览文件 @
c1f4d6c6
/*
* Copyright (c) 2020, Shenzhen Academy of Aerospace Technology
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#include <rthw.h>
#include <rtthread.h>
...
...
@@ -43,10 +53,10 @@ void rt_hw_interrupt_init(void)
*/
void
rt_hw_interrupt_mask
(
int
vector
)
{
if
(
vector
>
0x1F
||
vector
<
0x11
)
return
;
volatile
struct
lregs
*
regs
=
(
struct
lregs
*
)
PREGS
;
regs
->
irqmask
&=
~
(
1
<<
(
vector
-
0x10
));
if
(
vector
>
0x1F
||
vector
<
0x11
)
return
;
volatile
struct
lregs
*
regs
=
(
struct
lregs
*
)
PREGS
;
regs
->
irqmask
&=
~
(
1
<<
(
vector
-
0x10
));
}
/**
...
...
@@ -55,10 +65,10 @@ void rt_hw_interrupt_mask(int vector)
*/
void
rt_hw_interrupt_umask
(
int
vector
)
{
if
(
vector
>
0x1F
||
vector
<
0x11
)
return
;
volatile
struct
lregs
*
regs
=
(
struct
lregs
*
)
PREGS
;
regs
->
irqmask
|=
1
<<
(
vector
-
0x10
);
if
(
vector
>
0x1F
||
vector
<
0x11
)
return
;
volatile
struct
lregs
*
regs
=
(
struct
lregs
*
)
PREGS
;
regs
->
irqmask
|=
1
<<
(
vector
-
0x10
);
}
/**
...
...
@@ -72,7 +82,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
{
rt_isr_handler_t
old_handler
=
RT_NULL
;
if
(
vector
<
MAX_HANDLERS
||
vector
>=
0
)
if
(
vector
<
MAX_HANDLERS
||
vector
>=
0
)
{
old_handler
=
isr_table
[
vector
].
handler
;
...
...
libcpu/sparc-v8/bm3803/interrupt.h
浏览文件 @
c1f4d6c6
/*
* Copyright (c) 2020, Shenzhen Academy of Aerospace Technology
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#ifndef __INTERRUPT_H__
#define __INTERRUPT_H__
...
...
libcpu/sparc-v8/bm3803/stack.c
浏览文件 @
c1f4d6c6
/*
* Copyright (c) 2020, Shenzhen Academy of Aerospace Technology
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#include <rtthread.h>
/**
...
...
@@ -29,34 +40,34 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter,
stack_addr
+=
sizeof
(
rt_uint32_t
);
stack_addr
=
(
rt_uint8_t
*
)
RT_ALIGN_DOWN
((
rt_uint32_t
)
stack_addr
,
8
);
stk
=
(
rt_uint32_t
*
)
stack_addr
;
stk
-=
24
;
stk
-=
8
;
for
(
register_index
=
0
;
register_index
!=
8
;
register_index
++
)
stk
[
register_index
]
=
0xdeadbeef
;
for
(
window_index
=
0
;
window_index
!=
8
;
window_index
++
)
{
stk
-=
16
;
for
(
register_index
=
0
;
register_index
!=
16
;
register_index
++
)
stk
[
register_index
]
=
0xdeadbeef
;
if
(
window_index
==
0
)
{
stk
[
8
]
=
(
rt_uint32_t
)
parameter
;
stk
[
15
]
=
(
rt_uint32_t
)
texit
-
8
;
}
}
stk
-=
34
;
for
(
register_index
=
0
;
register_index
!=
34
;
register_index
++
)
stk
[
register_index
]
=
0
;
stk
-=
4
;
stk
[
0
]
=
(
rt_uint32_t
)
tentry
;
//pc
stk
[
1
]
=
(
rt_uint32_t
)
tentry
+
4
;
//npc
stk
[
2
]
=
0x10C7
;
//psr
stk
[
3
]
=
0x2
;
//wim
stk
-=
24
;
stk
-=
8
;
for
(
register_index
=
0
;
register_index
!=
8
;
register_index
++
)
stk
[
register_index
]
=
0xdeadbeef
;
for
(
window_index
=
0
;
window_index
!=
8
;
window_index
++
)
{
stk
-=
16
;
for
(
register_index
=
0
;
register_index
!=
16
;
register_index
++
)
stk
[
register_index
]
=
0xdeadbeef
;
if
(
window_index
==
0
)
{
stk
[
8
]
=
(
rt_uint32_t
)
parameter
;
stk
[
15
]
=
(
rt_uint32_t
)
texit
-
8
;
}
}
stk
-=
34
;
for
(
register_index
=
0
;
register_index
!=
34
;
register_index
++
)
stk
[
register_index
]
=
0
;
stk
-=
4
;
stk
[
0
]
=
(
rt_uint32_t
)
tentry
;
//pc
stk
[
1
]
=
(
rt_uint32_t
)
tentry
+
4
;
//npc
stk
[
2
]
=
0x10C7
;
//psr
stk
[
3
]
=
0x2
;
//wim
/* return task's current stack address */
return
(
rt_uint8_t
*
)
stk
;
...
...
libcpu/sparc-v8/bm3803/start_gcc.S
浏览文件 @
c1f4d6c6
/*
*
Copyright
(
c
)
2020
,
Shenzhen
Academy
of
Aerospace
Technology
*
*
SPDX
-
License
-
Identifier
:
Apache
-
2
.0
*
*
Change
Logs
:
*
Date
Author
Notes
*
2020
-
10
-
16
Dystopia
the
first
version
*/
Copyright
2020
Shenzhen
Academy
of
Aerospace
Technology
Licensed
under
the
Apache
License
,
Version
2
.0
(
the
"License"
)
;
you
may
not
use
this
file
except
in
compliance
with
the
License
.
You
may
obtain
a
copy
of
the
License
at
http
://
www.apache.org
/
licenses
/
LICENSE
-2.0
Unless
required
by
applicable
law
or
agreed
to
in
writing
,
software
distributed
under
the
License
is
distributed
on
an
"AS IS"
BASIS
,
WITHOUT
WARRANTIES
OR
CONDITIONS
OF
ANY
KIND
,
either
express
or
implied
.
See
the
License
for
the
specific
language
governing
permissions
and
limitations
under
the
License
.
Change
Logs
:
Date
Author
Notes
2020
-
10
-
16
Dystopia
the
first
version
*/
#define PSR_INIT 0x10C0
#define PREGS 0x80000000
...
...
libcpu/sparc-v8/bm3803/trap.c
浏览文件 @
c1f4d6c6
/*
* Copyright (c) 2020, Shenzhen Academy of Aerospace Technology
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-10-16 Dystopia the first version
*/
Copyright 2020 Shenzhen Academy of Aerospace Technology
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Change Logs:
Date Author Notes
2020-10-16 Dystopia the first version
*/
#include <rtthread.h>
#include <rthw.h>
...
...
@@ -15,14 +25,14 @@ extern struct rt_irq_desc isr_table[];
void
rt_hw_trap
(
int
tt
,
unsigned
int
*
sp
)
{
void
*
param
;
rt_isr_handler_t
isr_func
;
/* get interrupt service routine */
isr_func
=
isr_table
[
tt
].
handler
;
param
=
isr_table
[
tt
].
param
;
/* turn to interrupt service routine */
void
*
param
;
rt_isr_handler_t
isr_func
;
/* get interrupt service routine */
isr_func
=
isr_table
[
tt
].
handler
;
param
=
isr_table
[
tt
].
param
;
/* turn to interrupt service routine */
if
(
isr_func
!=
RT_NULL
)
isr_func
(
tt
,
param
);
}
libcpu/sparc-v8/bm3803/vector_gcc.S
浏览文件 @
c1f4d6c6
/*
*
Copyright
(
c
)
2020
,
Shenzhen
Academy
of
Aerospace
Technology
*
*
SPDX
-
License
-
Identifier
:
Apache
-
2
.0
*
*
Change
Logs
:
*
Date
Author
Notes
*
2020
-
10
-
16
Dystopia
the
first
version
*/
Copyright
2020
Shenzhen
Academy
of
Aerospace
Technology
Licensed
under
the
Apache
License
,
Version
2
.0
(
the
"License"
)
;
you
may
not
use
this
file
except
in
compliance
with
the
License
.
You
may
obtain
a
copy
of
the
License
at
http
://
www.apache.org
/
licenses
/
LICENSE
-2.0
Unless
required
by
applicable
law
or
agreed
to
in
writing
,
software
distributed
under
the
License
is
distributed
on
an
"AS IS"
BASIS
,
WITHOUT
WARRANTIES
OR
CONDITIONS
OF
ANY
KIND
,
either
express
or
implied
.
See
the
License
for
the
specific
language
governing
permissions
and
limitations
under
the
License
.
Change
Logs
:
Date
Author
Notes
2020
-
10
-
16
Dystopia
the
first
version
*/
#define TRAPL(H) mov %g0, %l0; sethi %hi(H), %l4; jmp %l4 + %lo(H); nop;
#define TRAP(H) mov %psr, %l0; sethi %hi(H), %l4; jmp %l4 + %lo(H); nop;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录