Uclinux-2008r1-rc8 (bf561) to VDSP5 Transplantation (a): __delay

Source: Internet
Author: User

There is a function in the 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 are 0 at
* The end of the loop. Otherwise we ' d need some
* Nops on 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"
);
}

This function is used to do a specified number of empty instruction loops. But it has a problem compiling under 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 It is the GNU assembly source, rewrite to a local temporary name of your choosing. If The GNU assembly code is generated from a macro, the visualdsp++ preprocessing label auto-generation feature ("?") can Being used to generate a is 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 It is the GNU assembly source, rewrite to a local temporary name of your choosing. If The GNU assembly code is generated from a macro, the visualdsp++ preprocessing label auto-generation feature ("?") can Being used to generate a is a unique local label.
Previous Errors Prevent Assembly

The main reason is that the assembly in VDSP does not support jumps such as 1f, so this function should read:

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 are 0 at
* The end of the loop. Otherwise we ' d need some
* Nops on 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 is removed because when the __delay function is invoked in more than one place in a C file, it produces a duplicate label error.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.