Accessing timer registers in P4080DS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Accessing timer registers in P4080DS

763 Views
rahul011189
Contributor I

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:

12825319_1300544763295660_617552403_n.jpg

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

Labels (1)
0 Kudos
Reply
2 Replies

532 Views
bpe
NXP Employee
NXP Employee

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

532 Views
rahul011189
Contributor I

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

0 Kudos
Reply