Which HW timer is associated to in timer_create()

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

Which HW timer is associated to in timer_create()

Jump to solution
1,203 Views
rans
Senior Contributor I

Hello,

I try to understand how to use HW timers from linux userspace.

Is  it by calling timer_create ? If yes - which timer number is associated to it ?

Thank you,

Ran

1 Solution
989 Views
JayTu
NXP Employee
NXP Employee

timer_create() used hrtimer that is high res timer. When the board starts, BSP will pass hw timer to kernel that will be used by hrtimer.

kernel_imx/kernel/time/posix-timers.c

static int common_timer_create(struct k_itimer *new_timer)
{
 hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0);
 return 0;
}

View solution in original post

3 Replies
990 Views
JayTu
NXP Employee
NXP Employee

timer_create() used hrtimer that is high res timer. When the board starts, BSP will pass hw timer to kernel that will be used by hrtimer.

kernel_imx/kernel/time/posix-timers.c

static int common_timer_create(struct k_itimer *new_timer)
{
 hrtimer_init(&new_timer->it.real.timer, new_timer->it_clock, 0);
 return 0;
}
989 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi rashalit,

you may find useful the following threadReg: Using Timers in IMX


Regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

989 Views
rans
Senior Contributor I

Hi Carlos,

I've checked the link but it did not help a lot.

I need one HW timer in userspace.

If linux timer_create() is actually using that HW timer than it is good enough.

What I asked before is if timer_create actually using a HW timer (and not just Linux' tick for example which has less precision).

Thank you,

Ran

0 Kudos