Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
923594c7
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
923594c7
编写于
5月 20, 2016
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[BSP] Enable VFP.
committed by FH.
上级
bb1cb89b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
0 addition
and
178 deletion
+0
-178
libcpu/arm/armv6/arm_entry_gcc.S
libcpu/arm/armv6/arm_entry_gcc.S
+0
-5
libcpu/arm/armv6/context_gcc.S
libcpu/arm/armv6/context_gcc.S
+0
-12
libcpu/arm/armv6/vfp.c
libcpu/arm/armv6/vfp.c
+0
-161
未找到文件。
libcpu/arm/armv6/arm_entry_gcc.S
浏览文件 @
923594c7
...
...
@@ -130,13 +130,8 @@ __check_vfp_instruction:
mov
pc
,
lr
@
CP7
mov
pc
,
lr
@
CP8
mov
pc
,
lr
@
CP9
#ifdef RT_USING_VFP
b
vfp_entry
@
CP10
VFP
b
vfp_entry
@
CP11
VFP
#else
mov
pc
,
lr
@
CP10
VFP
mov
pc
,
lr
@
CP11
VFP
#endif
mov
pc
,
lr
@
CP12
mov
pc
,
lr
@
CP13
mov
pc
,
lr
@
CP14
DEBUG
...
...
libcpu/arm/armv6/context_gcc.S
浏览文件 @
923594c7
...
...
@@ -70,12 +70,6 @@ rt_hw_context_switch:
ldmfd
sp
!,
{
r4
}
@
pop
new
task
cpsr
to
spsr
msr
spsr_cxsf
,
r4
#ifdef RT_USING_VFP
vmrs
r0
,
fpexc
bic
r0
,
r0
,
#
FPEXC_EN
@
always
disable
VFP
so
we
can
@
lazily
save
/
restore
the
old
state
.
vmsr
fpexc
,
r0
#endif
_do_switch
:
ldmfd
sp
!,
{
r0
-
r12
,
lr
,
pc
}^
@
pop
new
task
r0
-
r12
,
lr
&
pc
,
copy
spsr
to
cpsr
...
...
@@ -92,12 +86,6 @@ rt_hw_context_switch_to:
bic
r4
,
r4
,
#
0x20
@
must
be
ARM
mode
msr
cpsr_cxsf
,
r4
#ifdef RT_USING_VFP
vmrs
r0
,
fpexc
bic
r0
,
r0
,
#
FPEXC_EN
@
always
disable
VFP
so
we
can
@
lazily
save
/
restore
the
old
state
.
vmsr
fpexc
,
r0
#endif
ldmfd
sp
!,
{
r0
-
r12
,
lr
,
pc
}^
@
pop
new
task
r0
-
r12
,
lr
&
pc
/*
...
...
libcpu/arm/armv6/vfp.c
已删除
100644 → 0
浏览文件 @
bb1cb89b
/*
* File : vfp.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Develop Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2014-11-07 weety first version
*/
#include <rthw.h>
#include <rtthread.h>
#include "vfp.h"
#ifdef RT_USING_VFP
rt_uint32_t
vfpregs_offset
=
offsetof
(
struct
rt_thread
,
vfpregs
);
struct
vfp_context
*
last_vfp_context
=
RT_NULL
;
int
vfp_switch
(
rt_uint32_t
cmd
,
struct
rt_thread
*
thread
)
{
rt_uint32_t
fpexc
;
//rt_kprintf("%s:%d, %x\n", __func__, cmd, thread);
switch
(
cmd
)
{
case
THREAD_INIT
:
{
struct
vfp_context
*
vfp
=
&
thread
->
vfpregs
;
rt_memset
(
vfp
,
0
,
sizeof
(
struct
vfp_context
));
vfp
->
fpexc
=
FPEXC_EN
;
vfp
->
fpscr
=
FPSCR_RN
;
if
(
last_vfp_context
==
vfp
)
last_vfp_context
=
RT_NULL
;
vmsr
(
FPEXC
,
vmrs
(
FPEXC
)
&
~
FPEXC_EN
);
break
;
}
case
THREAD_EXIT
:
{
/* release case: Per-thread VFP cleanup. */
struct
vfp_context
*
vfp
=
&
thread
->
vfpregs
;
if
(
last_vfp_context
==
vfp
)
last_vfp_context
=
RT_NULL
;
break
;
}
default:
break
;
}
return
0
;
}
int
vfp_thread_init
(
struct
rt_thread
*
thread
)
{
return
vfp_switch
(
THREAD_INIT
,
thread
);
}
int
vfp_thread_exit
(
struct
rt_thread
*
thread
)
{
return
vfp_switch
(
THREAD_EXIT
,
thread
);
}
rt_uint32_t
read_vfp_regs
(
rt_uint32_t
*
buf
)
{
rt_uint32_t
value
;
rt_uint32_t
length
;
asm
volatile
(
"vldmia %0!, {d0-d15}"
:
:
"r"
(
buf
)
:
"cc"
);
length
=
32
;
#ifdef RT_USING_VFPv3
asm
volatile
(
"vmrs %0, mvfr0"
:
"=r"
(
value
)
:
);
if
((
value
&
MVFR0_A_SIMD_MASK
)
==
2
)
{
asm
volatile
(
"vldmia %0!, {d16-d31}"
:
:
"r"
(
buf
)
:
"cc"
);
length
=
64
;
}
else
{
length
=
32
;
}
#endif
return
length
;
}
void
vfp_exception
(
rt_uint32_t
instruction
,
rt_uint32_t
fpexc
)
{
int
i
=
0
;
int
length
=
0
;
rt_uint32_t
fpscr
,
fpsid
;
#ifdef RT_USING_VFPv3
unsigned
long
long
vfp_regs
[
32
];
#else
unsigned
long
long
vfp_regs
[
16
];
#endif
rt_kprintf
(
"VFP: exception: instruction %08x fpexc %08x
\n
"
,
instruction
,
fpexc
);
fpsid
=
vmrs
(
FPSID
);
fpscr
=
vmrs
(
FPSCR
);
rt_kprintf
(
"VFP: exception: fpsid %08x fpscr %08x
\n
"
,
fpsid
,
fpscr
);
length
=
read_vfp_regs
((
rt_uint32_t
*
)
vfp_regs
);
rt_kprintf
(
"VFP: exception registers: {s0~s%d}
\n
"
,
length
-
1
);
for
(
i
=
0
;
i
<
length
;
i
++
)
{
if
(
i
&&
!
(
i
&
0x3
))
rt_kprintf
(
"
\n
"
);
rt_kprintf
(
"0x%08x "
,
((
rt_uint32_t
*
)
vfp_regs
)[
i
]);
}
rt_kprintf
(
"
\n
"
);
}
void
vfp_init
(
void
)
{
int
ret
=
0
;
unsigned
int
value
;
asm
volatile
(
"mrc p15, 0, %0, c1, c0, 2"
:
"=r"
(
value
)
:
);
value
|=
0xf00000
;
/*enable CP10, CP11 user access*/
asm
volatile
(
"mcr p15, 0, %0, c1, c0, 2"
:
:
"r"
(
value
));
#if 0
asm volatile("fmrx %0, fpexc"
:"=r"(value));
value |=(1<<30);
asm volatile("fmxr fpexc, %0"
:
:"r"(value));
#endif
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录