Lines Matching +full:fixed +full:- +full:top

5  * SPDX-License-Identifier: Apache-2.0
57 * @brief Flag preventing counter reset when top value is changed.
59 * If flags is set then counter is free running while top value is updated,
65 * @brief Flag instructing counter to reset itself if changing top value
66 * results in counter going out of new top value bound.
138 * values can be any value between zero and the current top value (see
168 /** @brief Top value configuration structure.
172 * Top value.
193 * Maximal (default) top value on which counter is reset (cleared or reloaded).
262 (const struct counter_config_info *)dev->config; in z_impl_counter_is_counting_up()
264 return config->flags & COUNTER_CONFIG_INFO_COUNT_UP; in z_impl_counter_is_counting_up()
279 (const struct counter_config_info *)dev->config; in z_impl_counter_get_num_of_channels()
281 return config->channels; in z_impl_counter_get_num_of_channels()
290 * not have a fixed frequency.
297 (const struct counter_config_info *)dev->config; in z_impl_counter_get_frequency()
299 (struct counter_driver_api *)dev->api; in z_impl_counter_get_frequency()
301 return api->get_freq ? api->get_freq(dev) : config->freq; in z_impl_counter_get_frequency()
339 * @brief Function to retrieve maximum top value that can be set.
343 * @return Max top value.
350 (const struct counter_config_info *)dev->config; in z_impl_counter_get_max_top_value()
352 return config->max_top_value; in z_impl_counter_get_max_top_value()
368 (struct counter_driver_api *)dev->api; in z_impl_counter_start()
370 return api->start(dev); in z_impl_counter_start()
379 * @retval -ENOTSUP if the device doesn't support stopping the
387 (struct counter_driver_api *)dev->api; in z_impl_counter_stop()
389 return api->stop(dev); in z_impl_counter_stop()
406 (struct counter_driver_api *)dev->api; in z_impl_counter_get_value()
408 return api->get_value(dev, ticks); in z_impl_counter_get_value()
412 * @brief Get current counter 64-bit value.
425 (struct counter_driver_api *)dev->api; in z_impl_counter_get_value_64()
427 if (!api->get_value_64) { in z_impl_counter_get_value_64()
428 return -ENOTSUP; in z_impl_counter_get_value_64()
431 return api->get_value_64(dev, ticks); in z_impl_counter_get_value_64()
448 * @retval -ENOTSUP if request is not supported (device does not support
450 * @retval -EINVAL if alarm settings are invalid.
451 * @retval -ETIME if absolute alarm was set too late.
452 * @retval -EBUSY if alarm is already active.
463 (struct counter_driver_api *)dev->api; in z_impl_counter_set_channel_alarm()
466 return -ENOTSUP; in z_impl_counter_set_channel_alarm()
469 return api->set_alarm(dev, chan_id, alarm_cfg); in z_impl_counter_set_channel_alarm()
481 * @retval -ENOTSUP if request is not supported or the counter was not started
491 (struct counter_driver_api *)dev->api; in z_impl_counter_cancel_channel_alarm()
494 return -ENOTSUP; in z_impl_counter_cancel_channel_alarm()
497 return api->cancel_alarm(dev, chan_id); in z_impl_counter_cancel_channel_alarm()
501 * @brief Set counter top value.
503 * Function sets top value and optionally resets the counter to 0 or top value
505 * optional callback is periodically called. Top value can only be changed when
509 * running while top value is updated, it is possible that counter progresses
510 * outside the new top value. In that case, error is returned and optionally
517 * @retval -ENOTSUP if request is not supported (e.g. top value cannot be
518 * changed or counter cannot/must be reset during top value
520 * @retval -EBUSY if any alarm is active.
521 * @retval -ETIME if @ref COUNTER_TOP_CFG_DONT_RESET was set and new top value
532 (struct counter_driver_api *)dev->api; in z_impl_counter_set_top_value()
534 if (cfg->ticks > counter_get_max_top_value(dev)) { in z_impl_counter_set_top_value()
535 return -EINVAL; in z_impl_counter_set_top_value()
538 return api->set_top_value(dev, cfg); in z_impl_counter_set_top_value()
559 (struct counter_driver_api *)dev->api; in z_impl_counter_get_pending_int()
561 return api->get_pending_int(dev); in z_impl_counter_get_pending_int()
565 * @brief Function to retrieve current top value.
569 * @return Top value.
576 (struct counter_driver_api *)dev->api; in z_impl_counter_get_top_value()
578 return api->get_top_value(dev); in z_impl_counter_get_top_value()
606 * - When counting upwards (see @ref COUNTER_CONFIG_INFO_COUNT_UP) the given
609 * - When counting downwards, the given absolute tick value must be less than
610 * (now + top_value - guard_period) % top_value to be accepted.
614 * - counting upwards, now = 4950, top value = 5000, guard period = 100:
616 * - counting downwards, now = 50, top value = 5000, guard period = 100:
617 * absolute tick value <= (50 + 5000 - * 100) % 5000 = 4950
620 * (e.g. half of the counter top value) which will make it highly unlikely that
630 * @retval -ENOTSUP if function or flags are not supported.
631 * @retval -EINVAL if ticks value is invalid.
641 (struct counter_driver_api *)dev->api; in z_impl_counter_set_guard_period()
643 if (!api->set_guard_period) { in z_impl_counter_set_guard_period()
644 return -ENOTSUP; in z_impl_counter_set_guard_period()
647 return api->set_guard_period(dev, ticks, flags); in z_impl_counter_set_guard_period()
668 (struct counter_driver_api *)dev->api; in z_impl_counter_get_guard_period()
670 return (api->get_guard_period) ? api->get_guard_period(dev, flags) : 0; in z_impl_counter_get_guard_period()