Lines Matching full:top
103 static uint32_t ticks_add(uint32_t val1, uint32_t val2, uint32_t top) in ticks_add() argument
107 if (likely(IS_BIT_MASK(top))) { in ticks_add()
108 return (val1 + val2) & top; in ticks_add()
111 to_top = top - val1; in ticks_add()
116 static uint32_t ticks_sub(uint32_t val, uint32_t old, uint32_t top) in ticks_sub() argument
118 if (likely(IS_BIT_MASK(top))) { in ticks_sub()
119 return (val - old) & top; in ticks_sub()
122 /* if top is not 2^n-1 */ in ticks_sub()
123 return (val >= old) ? (val - old) : val + top + 1 - old; in ticks_sub()
147 uint32_t top = get_top_value(dev); in set_cc() local
169 max_rel_val = top - data->guard_period; in set_cc()
181 irq_on_late = val < (top / 2); in set_cc()
183 max_rel_val = irq_on_late ? top / 2 : top; in set_cc()
184 val = ticks_add(now, val, top); in set_cc()
192 diff = ticks_sub(val - 1, read(dev), top); in set_cc()
344 __ASSERT(cb != NULL, "top event enabled - expecting callback"); in top_irq_handle()