cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
1,461 Views
Registered: ‎06-15-2016

ARM9 reading the global timer register from inside a Linux application (ZYNQ)

Jump to solution

Hello,

 

I need to read the global timer register of CPU1 inside a Linux application. I see that something similar is done in bare-metal applications through the headers xparameters_ps.h and xtime_l.h which read 4 bytes from address 0xF8F00200. If I were to do the same in a Lunux application:

 - Would the SCU stop me and/or do I need to do some special configuration from the Zynq processing system panel?

 - Can I just mmap to read the register or do I need to include some xilinx libraries and headers inside the PetaLinux rootfs

 - Is there something equivalen to XPAR_CPU_CORTEXA9_1_CPU_CLK_FREQ_HZ that I can refer to inside my code? (i.e. the cpu configured frequency, with cpu_freq disabled I think it is constant)

 

Thank you for your help!

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Voyager
Voyager
1,896 Views
Registered: ‎06-24-2013

Hey @pogccfe,

 

Would the SCU stop me and/or do I need to do some special configuration from the Zynq processing system panel?

 

let's see ...

# devmem2 0xF8F00200 w
/dev/mem opened.
Memory mapped at address 0xa6f83000.
Value at address 0xF8F00200 (0xa6f83200): 0x59E84E25

# devmem2 0xF8F00200 w
/dev/mem opened.
Memory mapped at address 0xa6f71000.
Value at address 0xF8F00200 (0xa6f71200): 0x7552AF7B

... seems to work fine.

 

Can I just mmap to read the register or do I need to include some xilinx libraries and headers inside the PetaLinux rootfs

You need to map the physical address to a virtual to access it.

This can, for example, be done with mmap on /dev/mem.

 

Hope this helps,

Herbert

-------------- Yes, I do this for fun!

View solution in original post

0 Kudos
2 Replies
Highlighted
Voyager
Voyager
1,897 Views
Registered: ‎06-24-2013

Hey @pogccfe,

 

Would the SCU stop me and/or do I need to do some special configuration from the Zynq processing system panel?

 

let's see ...

# devmem2 0xF8F00200 w
/dev/mem opened.
Memory mapped at address 0xa6f83000.
Value at address 0xF8F00200 (0xa6f83200): 0x59E84E25

# devmem2 0xF8F00200 w
/dev/mem opened.
Memory mapped at address 0xa6f71000.
Value at address 0xF8F00200 (0xa6f71200): 0x7552AF7B

... seems to work fine.

 

Can I just mmap to read the register or do I need to include some xilinx libraries and headers inside the PetaLinux rootfs

You need to map the physical address to a virtual to access it.

This can, for example, be done with mmap on /dev/mem.

 

Hope this helps,

Herbert

-------------- Yes, I do this for fun!

View solution in original post

0 Kudos
Highlighted
Observer
Observer
859 Views
Registered: ‎09-06-2018

Hi,

I'm using petalinux 2018.

devmem is used instead of devmem2. Do you know some differences?

If I try to execute 

devmem 0xF8F00200

the board faults and I have to reboot it.

0 Kudos