Question
I would like to read the LTSTAT/LRSTAT register in the C-code as follows:
"myreg = __builtin_sysreg_read(__LRSTAT0);"
When building the code, the following error is generated:
[Error EA3071] "C:\tmp\wimax\rapsdsp\nemo1tl4\INT_HWERR_64.s":989 TS201 silicon
anomaly number 03-00-0220: LTSTAT/LRSTAT should be read twice sequentially to
ensure correct value.
Do you have a piece of in-line Assembly code to work around this problem?
Answer
Details on this anomaly can be found at the following web page:
http://www.analog.com/processors/technicalSupport/toolsAnomalies.html
The anomaly number is 18730 and this explains the errata in more detail as
well as the correct workaround. Here is an extract from the web page above:
18730 : __builtin_sysreg_read does not work-around erratum 03-00-0220
A call to __builtin_sysreg_read with argument __LRSTAT0 produces an error from
the assembler, due to the ADSP-TS201 errata 03-00-0220. A workaround for this
issue is to use an inline asm statement, such as:
asm("%0 = LRSTAT0;; %0 = LRSTAT0;;" : "=x" (val) );
where val is the int you want to read the value into.