Lines Matching refs:dev

122 typedef void (*counter_alarm_callback_t)(const struct device *dev,
165 typedef void (*counter_top_callback_t)(const struct device *dev,
212 typedef int (*counter_api_start)(const struct device *dev);
213 typedef int (*counter_api_stop)(const struct device *dev);
214 typedef int (*counter_api_get_value)(const struct device *dev,
216 typedef int (*counter_api_get_value_64)(const struct device *dev,
218 typedef int (*counter_api_set_alarm)(const struct device *dev,
221 typedef int (*counter_api_cancel_alarm)(const struct device *dev,
223 typedef int (*counter_api_set_top_value)(const struct device *dev,
225 typedef uint32_t (*counter_api_get_pending_int)(const struct device *dev);
226 typedef uint32_t (*counter_api_get_top_value)(const struct device *dev);
227 typedef uint32_t (*counter_api_get_guard_period)(const struct device *dev,
229 typedef int (*counter_api_set_guard_period)(const struct device *dev,
232 typedef uint32_t (*counter_api_get_freq)(const struct device *dev);
257 __syscall bool counter_is_counting_up(const struct device *dev);
259 static inline bool z_impl_counter_is_counting_up(const struct device *dev) in z_impl_counter_is_counting_up() argument
262 (const struct counter_config_info *)dev->config; in z_impl_counter_is_counting_up()
274 __syscall uint8_t counter_get_num_of_channels(const struct device *dev);
276 static inline uint8_t z_impl_counter_get_num_of_channels(const struct device *dev) in z_impl_counter_get_num_of_channels() argument
279 (const struct counter_config_info *)dev->config; in z_impl_counter_get_num_of_channels()
292 __syscall uint32_t counter_get_frequency(const struct device *dev);
294 static inline uint32_t z_impl_counter_get_frequency(const struct device *dev) in z_impl_counter_get_frequency() argument
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()
312 __syscall uint32_t counter_us_to_ticks(const struct device *dev, uint64_t us);
314 static inline uint32_t z_impl_counter_us_to_ticks(const struct device *dev, in z_impl_counter_us_to_ticks() argument
317 uint64_t ticks = (us * z_impl_counter_get_frequency(dev)) / USEC_PER_SEC; in z_impl_counter_us_to_ticks()
330 __syscall uint64_t counter_ticks_to_us(const struct device *dev, uint32_t ticks);
332 static inline uint64_t z_impl_counter_ticks_to_us(const struct device *dev, in z_impl_counter_ticks_to_us() argument
335 return ((uint64_t)ticks * USEC_PER_SEC) / z_impl_counter_get_frequency(dev); in z_impl_counter_ticks_to_us()
345 __syscall uint32_t counter_get_max_top_value(const struct device *dev);
347 static inline uint32_t z_impl_counter_get_max_top_value(const struct device *dev) in z_impl_counter_get_max_top_value() argument
350 (const struct counter_config_info *)dev->config; in z_impl_counter_get_max_top_value()
363 __syscall int counter_start(const struct device *dev);
365 static inline int z_impl_counter_start(const struct device *dev) in z_impl_counter_start() argument
368 (struct counter_driver_api *)dev->api; in z_impl_counter_start()
370 return api->start(dev); in z_impl_counter_start()
382 __syscall int counter_stop(const struct device *dev);
384 static inline int z_impl_counter_stop(const struct device *dev) in z_impl_counter_stop() argument
387 (struct counter_driver_api *)dev->api; in z_impl_counter_stop()
389 return api->stop(dev); in z_impl_counter_stop()
400 __syscall int counter_get_value(const struct device *dev, uint32_t *ticks);
402 static inline int z_impl_counter_get_value(const struct device *dev, in z_impl_counter_get_value() argument
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()
419 __syscall int counter_get_value_64(const struct device *dev, uint64_t *ticks);
421 static inline int z_impl_counter_get_value_64(const struct device *dev, in z_impl_counter_get_value_64() argument
425 (struct counter_driver_api *)dev->api; in z_impl_counter_get_value_64()
431 return api->get_value_64(dev, ticks); in z_impl_counter_get_value_64()
454 __syscall int counter_set_channel_alarm(const struct device *dev,
458 static inline int z_impl_counter_set_channel_alarm(const struct device *dev, in z_impl_counter_set_channel_alarm() argument
463 (struct counter_driver_api *)dev->api; in z_impl_counter_set_channel_alarm()
465 if (chan_id >= counter_get_num_of_channels(dev)) { in z_impl_counter_set_channel_alarm()
469 return api->set_alarm(dev, chan_id, alarm_cfg); in z_impl_counter_set_channel_alarm()
484 __syscall int counter_cancel_channel_alarm(const struct device *dev,
487 static inline int z_impl_counter_cancel_channel_alarm(const struct device *dev, in z_impl_counter_cancel_channel_alarm() argument
491 (struct counter_driver_api *)dev->api; in z_impl_counter_cancel_channel_alarm()
493 if (chan_id >= counter_get_num_of_channels(dev)) { in z_impl_counter_cancel_channel_alarm()
497 return api->cancel_alarm(dev, chan_id); in z_impl_counter_cancel_channel_alarm()
524 __syscall int counter_set_top_value(const struct device *dev,
527 static inline int z_impl_counter_set_top_value(const struct device *dev, in z_impl_counter_set_top_value() argument
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()
538 return api->set_top_value(dev, cfg); in z_impl_counter_set_top_value()
554 __syscall int counter_get_pending_int(const struct device *dev);
556 static inline int z_impl_counter_get_pending_int(const struct device *dev) in z_impl_counter_get_pending_int() argument
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()
571 __syscall uint32_t counter_get_top_value(const struct device *dev);
573 static inline uint32_t z_impl_counter_get_top_value(const struct device *dev) in z_impl_counter_get_top_value() argument
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()
633 __syscall int counter_set_guard_period(const struct device *dev,
637 static inline int z_impl_counter_set_guard_period(const struct device *dev, in z_impl_counter_set_guard_period() argument
641 (struct counter_driver_api *)dev->api; in z_impl_counter_set_guard_period()
647 return api->set_guard_period(dev, ticks, flags); in z_impl_counter_set_guard_period()
661 __syscall uint32_t counter_get_guard_period(const struct device *dev,
664 static inline uint32_t z_impl_counter_get_guard_period(const struct device *dev, in z_impl_counter_get_guard_period() argument
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()