Lines Matching +full:half +full:- +full:cycle
2 * Copyright (c) 2016-2021 Nordic Semiconductor ASA
5 * SPDX-License-Identifier: Apache-2.0
29 #define CHAN_COUNT_MAX (RTC1_CC_NUM - (RTC_PRETICK ? 1 : 0))
38 #define COUNTER_MAX (COUNTER_SPAN - 1U)
42 #define MAX_TICKS ((COUNTER_HALF_SPAN - CYC_PER_TICK) / CYC_PER_TICK)
70 return (a - b) & COUNTER_MAX; in counter_sub()
214 -EINVAL : (curr_time + t.ticks); in z_nrf_rtc_timer_get_ticks()
218 result = abs_ticks - curr_tick; in z_nrf_rtc_timer_get_ticks()
221 return -EINVAL; in z_nrf_rtc_timer_get_ticks()
242 * fail with -EINVAL result if @p req_cc is too close to the
246 * @retval -EINVAL The requested CC value could not be reliably set.
261 * occurs in the second half of the RTC clock cycle (such situation can in set_alarm()
303 (COUNTER_HALF_SPAN - MIN_CYCLES_FROM_NOW)) { in set_alarm()
319 ret = -EINVAL; in set_alarm()
326 ret = -EINVAL; in set_alarm()
349 if (target_time - curr_time > COUNTER_HALF_SPAN) { in compare_set_nolocks()
351 return -EINVAL; in compare_set_nolocks()
364 ret = -EINVAL; in compare_set_nolocks()
438 * of incorrect `anchor` value caused by non-atomic read of 64-bit `anchor`. in z_nrf_rtc_timer_read()
463 * Write of 64-bit `anchor` is non atomic. However it happens in anchor_update()
476 uint32_t dticks = (uint32_t)(expire_time - last_count) / CYC_PER_TICK; in sys_clock_timeout_handler()
584 chan = alloc_mask ? 31 - __builtin_clz(alloc_mask) : -1; in z_nrf_rtc_timer_chan_alloc()
586 return -ENOMEM; in z_nrf_rtc_timer_chan_alloc()
609 return -ENOTSUP; in z_nrf_rtc_timer_trigger_overflow()
614 err = -EBUSY; in z_nrf_rtc_timer_trigger_overflow()
618 if (counter() >= (COUNTER_SPAN - 100)) { in z_nrf_rtc_timer_trigger_overflow()
619 err = -EAGAIN; in z_nrf_rtc_timer_trigger_overflow()
658 uint32_t unannounced = z_nrf_rtc_timer_read() - last_count; in sys_clock_set_timeout()
660 /* If we haven't announced for more than half the 24-bit wrap in sys_clock_set_timeout()
695 return (z_nrf_rtc_timer_read() - last_count) / CYC_PER_TICK; in sys_clock_elapsed()