Lines Matching full:top
56 uint32_t top; member
118 uint32_t old, uint32_t top) in ticks_sub() argument
122 } else if (likely(IS_BIT_MASK(top))) { in ticks_sub()
123 return (val - old) & top; in ticks_sub()
126 /* if top is not 2^n-1 */ in ticks_sub()
127 return (val >= old) ? (val - old) : val + top + 1 - old; in ticks_sub()
131 static uint32_t skip_zero_on_custom_top(uint32_t val, uint32_t top) in skip_zero_on_custom_top() argument
136 if (unlikely(val == 0) && (top != NRF_RTC_COUNTER_MAX)) { in skip_zero_on_custom_top()
144 uint32_t val2, uint32_t top) in ticks_add() argument
149 ARG_UNUSED(top); in ticks_add()
152 if (likely(IS_BIT_MASK(top))) { in ticks_add()
153 sum = sum & top; in ticks_add()
155 sum = sum > top ? sum - (top + 1) : sum; in ticks_add()
158 return skip_zero_on_custom_top(sum, top); in ticks_add()
189 val = ticks_add(dev, val, 1, data->top); in handle_next_tick_case()
215 * it won't be further in future than <top> - <guard_period> from now.
233 __ASSERT_NO_MSG(data->guard_period < data->top); in set_cc()
237 uint32_t top; in set_cc() local
250 top = data->top; in set_cc()
264 if (ticks_sub(dev, prev_val, now, top) == 1) { in set_cc()
272 val = skip_zero_on_custom_top(val, top); in set_cc()
274 max_rel_val = top - data->guard_period; in set_cc()
285 irq_on_late = val < (top / 2); in set_cc()
287 max_rel_val = irq_on_late ? top / 2 : top; in set_cc()
288 val = ticks_add(dev, now, val, top); in set_cc()
291 diff = ticks_sub(dev, val, now, top); in set_cc()
306 diff = ticks_sub(dev, val - 1, now, top); in set_cc()
342 if (alarm_cfg->ticks > data->top) { in set_channel_alarm()
448 * automatically in case of max top value or PPI usage.
454 return (data->top != NRF_RTC_COUNTER_MAX) && !IS_PPI_WRAP(dev); in sw_wrap_required()
509 if ((dev_data->top == NRF_RTC_COUNTER_MAX) && in set_top_value()
512 } else if (((dev_data->top != NRF_RTC_COUNTER_MAX) && in set_top_value()
520 dev_data->top = cfg->ticks; in set_top_value()
571 data->top = NRF_RTC_COUNTER_MAX; in init_rtc()
582 return data->top; in get_top_value()
617 /* Perform manual clear if custom top value is used and PPI in top_irq_handle()
658 cc = ticks_sub(dev, cc, 1, data->top); in alarm_irq_handle()