Hi there,
I am trying to use a timer for profiling my bare-metal code on P4080DS but I couldn't find much info on it.
The e500mc Core reference manual says that there are timers like TB which can be configured and used. However, it does not have much info on using them. There is a small code snippet but it is in assembly language:
It will be helpful if I can get either of the two:
1) A code snippet (in C) which shows how to configure and read/write the timer registers.
2) A code snippet on how to embed the above assembly code in my C code.
TIA,
- Rahul
Your processor core timer facilities are fully described in EREF_RM, Chapter 6. As of reference code, see how it is
implemented in Linux kernel, function get_tb():
Linux/arch/powerpc/include/asm/time.h - Linux Cross Reference - Free Electrons
Have a great day,
Platon
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Platon,
In get_tb(), the value seems to be read from the location 0x3dd:
asm volatile("mfspr %0, 0x3dd" : "=r" (tbl));
Where is it specified that TBL register is mapped to 0x3dd? The programmers manual does say that TBL is SPR268 but I am unable to locate the mapping to 0x3dd.
It will be really helpful if you can point me to the a document which clarifies this.
Regards,
Rahul