![]() |
|
||||||||||||||
| | 首页 | 新闻 | 文库 | 方案 | 技术 | 独家 | 座谈 | 下载 | 图库 | 开发板 | 仿真器 | 邮购 | VIP会员 | 芯片代购 | 客户评价 | | ||
|
||
|
|||||
| uclinux-2008R1-RC8(bf561)到VDSP5的移植(45):__delay | |||||
作者:快乐虾 文章来源:http://blog.csdn.net/lights_joy 点击数: 更新时间:2008-6-25 ![]() |
|||||
|
在include/asm/delay.h中有一个函数:
static inline void __delay(unsigned long loops)
{
if (ANOMALY_05000312) {
/* Interrupted loads to loop registers -> bad */
unsigned long tmp;
__asm__ __volatile__(
"[--SP] = LC0;"
"[--SP] = LT0;"
"[--SP] = LB0;"
"LSETUP (1f,1f) LC0 = %1;"
"1: NOP;"
/* We take advantage of the fact that LC0 is 0 at
* the end of the loop. Otherwise we'd need some
* NOPs after the CLI here.
*/
"CLI %0;"
"LB0 = [SP++];"
"LT0 = [SP++];"
"LC0 = [SP++];"
"STI %0;"
: "=d" (tmp)
: "a" (loops)
);
} else
__asm__ __volatile__ (
"LSETUP(1f, 1f) LC0 = %0;"
"1: NOP;"
:
: "a" (loops)
: "LT0", "LB0", "LC0"
);
}
这个函数用于做指定次数的空指令循环。但它在VDSP下编译时有问题:
[Error ea5004] "c:\temp\acc0d389ddc000\acc0d389ddc001.s":207 Syntax Error in :
[--SP] = LC0;[--SP] = LT0;[--SP] = LB0;LSETUP (1f,1f) LC0 = P1;1: NOP;CLI R0;LB0 = [SP++];LT0 = [SP++];LC0 = [SP++];STI R0;
syntax error is at or near text 'f'.
Attempting error recovery by ignoring text until the ';'
[Error ea5007] "c:\temp\acc0d389ddc000\acc0d389ddc001.s":207 The label "1:" is illegal because it begins with a digit. If this is GNU assembly source, rewrite to a local temporary name of your choosing. If the GNU assembly code was generated from a macro, the VisualDSP++ preprocessing label auto-generation feature ("?") can be used to generate a unique local label.
[Error ea5004] "c:\temp\acc0d389ddc000\acc0d389ddc001.s":334 Syntax Error in :
[--SP] = LC0;[--SP] = LT0;[--SP] = LB0;LSETUP (1f,1f) LC0 = P1;1: NOP;CLI R0;LB0 = [SP++];LT0 = [SP++];LC0 = [SP++];STI R0;
syntax error is at or near text 'f'.
Attempting error recovery by ignoring text until the ';'
[Error ea5007] "c:\temp\acc0d389ddc000\acc0d389ddc001.s":334 The label "1:" is illegal because it begins with a digit. If this is GNU assembly source, rewrite to a local temporary name of your choosing. If the GNU assembly code was generated from a macro, the VisualDSP++ preprocessing label auto-generation feature ("?") can be used to generate a unique local label.
Previous errors prevent assembly
主要是因为VDSP中的汇编不支持1f之类的跳转,因此这个函数应该改为:
static /*inline*/ void __delay(unsigned long loops)
{
if (ANOMALY_05000312) {
/* Interrupted loads to loop registers -> bad */
unsigned long tmp;
__asm__ __volatile__(
"[--SP] = LC0;"
"[--SP] = LT0;"
"[--SP] = LB0;"
"LSETUP (__delay_anomaly_1,__delay_anomaly_1) LC0 = %1;"
"__delay_anomaly_1: NOP;"
/* We take advantage of the fact that LC0 is 0 at
* the end of the loop. Otherwise we'd need some
* NOPs after the CLI here.
*/
"CLI %0;"
"LB0 = [SP++];"
"LT0 = [SP++];"
"LC0 = [SP++];"
"STI %0;"
: "=d" (tmp)
: "a" (loops)
);
} else
__asm__ __volatile__ (
"LSETUP(__delay_1, __delay_1) LC0 = %0;"
"__delay_1: NOP;"
:
: "a" (loops)
: "LT0", "LB0", "LC0"
);
}
之所以去掉了inline,是因为当在一个c文件中有超过一个地方调用__delay函数时,它将产生一个重复标签的错误。
|
|||||
| 文章录入:admin 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 最新热点 | 最新推荐 | 相关文章 | ||
| 前置放大器在移动医疗服务系 便携式多通道大容量生理信号 防腐监测仪的设计与应用 基于AD1674的酶标仪的设计 基于C/S模式的JRTPLIB库的测 ffmpeg与jrtplib相结合应用 blackfin模拟摄像头驱动中的 可编程逻辑在数字信号处理系 发现VDSP4.5一个BUG:单步调 VDSP5.0双核工程下sml3中的变 |
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 本站介绍 | 合作联络 | 欢迎投稿 | 广告业务 | 网站地图 | 设为首页 | 加入收藏 | 友情链接 | 网站公告 | 联系我们 | | |||
|