Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76519099
rt-thread
提交
b6a0d722
R
rt-thread
项目概览
2301_76519099
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
3
Star
1
Fork
1
代码
文件
提交
分支
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b6a0d722
编写于
7月 04, 2019
作者:
B
Bernard Xiong
提交者:
GitHub
7月 04, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2828 from zhaohengbo/master
[libcpu][c28x]Add __rt_ffs support
上级
6da69f65
d68220d8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
0 deletion
+37
-0
libcpu/ti-dsp/c28x/context.s
libcpu/ti-dsp/c28x/context.s
+22
-0
libcpu/ti-dsp/c28x/cpuport.c
libcpu/ti-dsp/c28x/cpuport.c
+15
-0
未找到文件。
libcpu/ti-dsp/c28x/context.s
浏览文件 @
b6a0d722
...
...
@@ -6,6 +6,8 @@
; Change Logs:
; Date Author Notes
; 2018-09-01 xuzhuoyi the first version.
; 2019-06-17 zhaoxiaowei fix bugs of old c28x interrupt api.
; 2019-07-03 zhaoxiaowei add _rt_hw_calc_csb function to support __rt_ffs.
;
.
ref
_rt_interrupt_to_thread
...
...
@@ -15,6 +17,7 @@
.
def
_RTOSINT_Handler
.
def
_rt_hw_get_st0
.
def
_rt_hw_get_st1
.
def
_rt_hw_calc_csb
.
def
_rt_hw_context_switch_interrupt
.
def
_rt_hw_context_switch
.
def
_rt_hw_context_switch_to
...
...
@@ -229,6 +232,25 @@ _rt_hw_get_st1:
LRETR
.
endasmfunc
; C28x do not have a build-in "__ffs" func in its C compiler.
; We can use the "Count Sign Bits" (CSB) instruction to make one.
; CSB will return the number of 0's minus 1 above the highest set bit.
; The count is placed in T. For example:
; ACC T maxbit
; 0x00000001 30 0
; 0x00000010 26 4
; 0x000001FF 22 8
; 0x000001F0 22 8
.
asmfunc
_rt_hw_calc_csb
:
MOV
AH
,
#
0
CSB
ACC
; T = no. of sign bits - 1
MOVU
ACC
,
T
; ACC = no. of sign bits - 1
SUBB
ACC
,
#
30
; ACC = ACC - 30
ABS
ACC
; ACC = |ACC|
lretr
.
endasmfunc
;
; * void rt_hw_context_switch_to(rt_uint32 to);
; * r0 --> to
...
...
libcpu/ti-dsp/c28x/cpuport.c
浏览文件 @
b6a0d722
...
...
@@ -6,6 +6,7 @@
* Change Logs:
* Date Author Notes
* 2018-09-01 xuzhuoyi the first version.
* 2019-07-03 zhaoxiaowei add support for __rt_ffs.
*/
#include <rtthread.h>
...
...
@@ -19,6 +20,7 @@ static rt_err_t (*rt_exception_hook)(void *context) = RT_NULL;
extern
rt_uint16_t
rt_hw_get_st0
(
void
);
extern
rt_uint16_t
rt_hw_get_st1
(
void
);
extern
int
rt_hw_calc_csb
(
int
value
);
struct
exception_stack_frame
{
...
...
@@ -102,6 +104,19 @@ struct exception_info
struct
stack_frame
stack_frame
;
};
#ifdef RT_USING_CPU_FFS
/*
* This function called rt_hw_calc_csb to finds the first bit set in value.
* rt_hw_calc_csb is a native assembly program that use "CSB" instruction in C28x.
* When you use this function, remember that "int" is only 16-bit in C28x's C compiler.
* If value is a number bigger that 0xFFFF, trouble may be caused.
* Maybe change "int __rt_ffs(int value)" to "rt_int32_t __rt_ffs(rt_int32_t value)" will be better.
*/
int
__rt_ffs
(
int
value
)
{
return
rt_hw_calc_csb
(
value
);
}
#endif
/**
* shutdown CPU
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录