File tree 2 files changed +6
-3
lines changed
include/zephyr/drivers/timer
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -319,18 +319,21 @@ uint64_t z_nrf_grtc_timer_get_ticks(k_timeout_t t)
319
319
int64_t curr_tick ;
320
320
int64_t result ;
321
321
int64_t abs_ticks ;
322
+ int64_t grtc_ticks ;
322
323
323
324
curr_time = counter ();
324
325
curr_tick = sys_clock_tick_get ();
325
326
327
+ grtc_ticks = t .ticks * CYC_PER_TICK ;
326
328
abs_ticks = Z_TICK_ABS (t .ticks );
327
329
if (abs_ticks < 0 ) {
328
330
/* relative timeout */
329
- return (t .ticks > (int64_t )COUNTER_SPAN ) ? - EINVAL : (curr_time + t .ticks );
331
+ return (grtc_ticks > (int64_t )COUNTER_SPAN ) ?
332
+ - EINVAL : (curr_time + grtc_ticks );
330
333
}
331
334
332
335
/* absolute timeout */
333
- result = abs_ticks - curr_tick ;
336
+ result = ( abs_ticks - curr_tick ) * CYC_PER_TICK ;
334
337
335
338
if (result > (int64_t )COUNTER_SPAN ) {
336
339
return - EINVAL ;
Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ uint64_t z_nrf_grtc_timer_compare_read(int32_t chan);
111
111
*
112
112
* @param chan Channel ID.
113
113
*
114
- * @param target_time Absolute target time in ticks.
114
+ * @param target_time Absolute target time in GRTC ticks.
115
115
*
116
116
* @param handler User function called in the context of the GRTC interrupt.
117
117
*
You can’t perform that action at this time.
0 commit comments