打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
DSP 关于关键字cregister【转】

看源程序(TMS320F2812)的时候在main函数中看到这样一段:

 // Disable and clear all CPU interrupts:

 DINT;

 IER = 0x0000;

 IFR = 0x0000;

就想看看这个IER和IFR的地址,结果找来找去都找不到,只在Device.h中有这样两段:

extern cregister volatile unsigned int IFR;

extern cregister volatile unsigned int IER;

就感觉很奇怪呀,没有地址怎么操作呀?所以上网查了查,才知道答案了。

在官方资料中(TMS320C28x Optimizing C/C++ Compiler.pdf)中有这样的说明:

The compiler extends the C/C++ language by adding the cregister keyword to allow high level language access to control registers.When you use the cregister keyword on an object, the compiler compares the name of the object to a list of standard control registers for the C28x (see Table 6-2 ). If the name matches, the compiler generates the code to reference the control register. If the name does not match, the compiler issues an error.

Table 6-2. Valid Control Registers

------------------------------------

Register              Description

------------------------------------------

IER Interrupt         enable register

IFR Interrupt         flag register

To use the control registers in Table 6-2 , you must declare each register as follows. The c28x.h include file defines all the control registers through this syntax:

extern cregister volatile unsigned int register ;

原来这两个寄存器是可以用关键字cregister定义的寄存器,定义之后就可以直接调用了。

你可以先定义一个头文件,专门定义这个变量(实际就是相应的寄存器),

然后在相应的c源代码中直接引用这些变量了。

PS:貌似在DSP62XX系列中有更多这样的寄存器AMR,IAR,IER,ICR

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
DSP编程技巧之17
DSP C6000 keywords 关键字总结
深入剖析C语言关键字register(上):提升程序性能的绝佳武器
TI C6000 优化 startup guide
巧用FPGA中资源
作用域 全局变量 局部变量 静态变量 外部变量 常量 volatile变量_notepad...
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服