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.

How to read the TSCH on DM648



Hi, everyone.I want to read the TSCH:TSCL registers to get the CPU cycles. Below is my codes of the .asm and .c files.

the TSC_h.asm file:
 .global _TSC_enable
_TSC_enable:
 RETNOP B3, 4
 MVC B4, TSCL

 .global _TSC_read
_TSC_read:
 RETNOP B3, 2
 DINT
|| MVC TSCL, B4
 MVC TSCH, B5
|| RINT
|| MV B4, A4
 MV B5, A5


the read_time.c file

long long readCpuCycles()
{
 long long cpuCycles = 0;
 TSC_enable();
 
 ...
 
 cpuCycles = TSC_read();

Label:
}

 

However,  when the program run to Label, the low 32 bits of cpuCycles equals to the TSCL, the high 32 bits of cpuCycles() always iequals to 0xFFFFFFFF, But watch the TSCH register, its value is not 0xFFFFFFFF. What's the problem of the program above, and if I want to read TSCH:TSCL, how to do? Thank you! By the way, I use ccs3.3, bios5.31.08, cgt6.1.10