This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于在 C/C++ 环境中 直接使用 DSP寄存器的问题



请教:

在  C/C++ 环境中,通过

extern __cregister volatile unsigned int AMR;

说明后,

就可以在 C 代码中,引用,比如:

int i;

i=AMR;

问题:

1、__cregister 关键字 ,我是从 C6X.H v7.4.2  抄来的,不知道 在哪个文档中 有正式说明?没有找到。

2、同样的方法,对于 A组B组寄存器 不适用,那么,我通过某种方法,是否能够在 C中 直接用 比如 B6 = 0;的类似代码?

 (通过 __asm 是可以插入汇编语言实现的)

  • 抱歉,第一个疑问 答案 找到了,

    spru187u-C6000 Optimizing Compiler v7.4 User's Guide.pdf —— 6.5.2 The cregister Keyword

    The compiler extends the C/C++ language by adding the cregister keyword to allow high level language
    access to control registers.

    extern cregister volatile unsigned int AMR;

    extern __cregister volatile unsigned int AMR;

    都有效果。


    第二个问题: 通过什么方法,才能够在 C中 直接用 比如 B6 = 0;的类似代码?


  • cregsiter不支持A,B的,只能用asm插入汇编了。

    Table 7-4. Control Registers for C64x+, C6740, and C6600
    http://www.ti.com/lit/ug/sprui04b/sprui04b.pdf

  • 谢谢答复!

    allow high level language access to control registers!

    确实是说,控制寄存器。