Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
precision_clock_output.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors
3 * SPDX-FileCopyrightText: Copyright (c) 2026 Philipp Steiner
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
12
13#ifndef ZEPHYR_INCLUDE_ZEPHYR_PRECISION_TIMING_PRECISION_CLOCK_OUTPUT_H_
14#define ZEPHYR_INCLUDE_ZEPHYR_PRECISION_TIMING_PRECISION_CLOCK_OUTPUT_H_
15
16#include <stdbool.h>
17#include <stdint.h>
18
20#include <zephyr/sys/util.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
34
42
48
58
84
98
113
124
146
164int precision_clock_output_get_caps(const struct precision_clock *precision_clk,
165 struct precision_clock_output_caps *caps);
166
183 precision_time_t min_lead_time_ns,
184 precision_time_t *start_time);
185
228int precision_clock_output_start(const struct precision_clock *precision_clk, uint32_t channel,
229 const struct precision_clock_output_config *config);
230
248int precision_clock_output_stop(const struct precision_clock *precision_clk, uint32_t channel);
249
270int precision_clock_output_get_status(const struct precision_clock *precision_clk, uint32_t channel,
271 struct precision_clock_output_status *status);
272
274
311
312struct device;
313
326typedef int (*precision_clock_output_get_caps_t)(const struct device *dev,
327 struct precision_clock_output_caps *caps);
328
356typedef int (*precision_clock_output_start_t)(const struct device *dev, uint32_t channel,
357 const struct precision_clock_output_config *config);
358
370typedef int (*precision_clock_output_stop_t)(const struct device *dev, uint32_t channel);
371
385typedef int (*precision_clock_output_get_status_t)(const struct device *dev, uint32_t channel,
386 struct precision_clock_output_status *status);
387
406
408
409#ifdef __cplusplus
410}
411#endif
412
413#endif /* ZEPHYR_INCLUDE_ZEPHYR_PRECISION_TIMING_PRECISION_CLOCK_OUTPUT_H_ */
int(* precision_clock_output_stop_t)(const struct device *dev, uint32_t channel)
Stop a scheduled output channel.
Definition precision_clock_output.h:370
int(* precision_clock_output_get_caps_t)(const struct device *dev, struct precision_clock_output_caps *caps)
Query capabilities of all output channels.
Definition precision_clock_output.h:326
int(* precision_clock_output_start_t)(const struct device *dev, uint32_t channel, const struct precision_clock_output_config *config)
Start a scheduled output in the device clock's timescale.
Definition precision_clock_output.h:356
int(* precision_clock_output_get_status_t)(const struct device *dev, uint32_t channel, struct precision_clock_output_status *status)
Query output channel status.
Definition precision_clock_output.h:385
int precision_clock_output_get_status(const struct precision_clock *precision_clk, uint32_t channel, struct precision_clock_output_status *status)
Query scheduled clock output status.
int precision_clock_output_start(const struct precision_clock *precision_clk, uint32_t channel, const struct precision_clock_output_config *config)
Start a scheduled clock output.
int precision_clock_output_stop(const struct precision_clock *precision_clk, uint32_t channel)
Stop a scheduled clock output.
precision_clock_output_kind
Kind of scheduled output configured on a precision clock output channel.
Definition precision_clock_output.h:44
int precision_clock_output_get_caps(const struct precision_clock *precision_clk, struct precision_clock_output_caps *caps)
Query capabilities of all scheduled-output channels.
precision_clock_output_caps_flags
Precision clock output capability flags.
Definition precision_clock_output.h:50
int precision_clock_output_next_start_time(precision_time_t now, precision_time_t period_ns, precision_time_t min_lead_time_ns, precision_time_t *start_time)
Calculate the next aligned clock-output start time.
precision_clock_output_width_policy
Precision clock output high-pulse width policy for periodic waveforms.
Definition precision_clock_output.h:36
@ PRECISION_CLOCK_OUTPUT_KIND_WAVEFORM
Periodic waveform.
Definition precision_clock_output.h:46
@ PRECISION_CLOCK_OUTPUT_CAP_PROGRAMMABLE_WIDTH
Channel supports an exact programmable high-pulse width.
Definition precision_clock_output.h:54
@ PRECISION_CLOCK_OUTPUT_CAP_HARDWARE_ACTIVE
Channel can observe whether its hardware output generator is armed or running.
Definition precision_clock_output.h:56
@ PRECISION_CLOCK_OUTPUT_CAP_WAVEFORM
Channel can generate periodic output waveforms.
Definition precision_clock_output.h:52
@ PRECISION_CLOCK_OUTPUT_WIDTH_PROVIDER_DEFAULT
Use the provider's native default high-pulse width.
Definition precision_clock_output.h:38
@ PRECISION_CLOCK_OUTPUT_WIDTH_EXACT
Use the exact high-pulse width supplied in the configuration.
Definition precision_clock_output.h:40
int64_t precision_time_t
Signed precision time value expressed in nanoseconds.
Definition precision_time.h:40
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
Protocol-neutral precision clock operations.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
Runtime device structure (in ROM) per driver instance.
Definition device.h:607
Capabilities of all scheduled-output channels on a precision clock.
Definition precision_clock_output.h:92
const struct precision_clock_output_channel_caps * channels
Read-only channel table; may be null only when channel_count is zero.
Definition precision_clock_output.h:96
uint32_t channel_count
Number of entries in channels; zero when no channels are exposed.
Definition precision_clock_output.h:94
Capabilities and limits of a precision clock output channel.
Definition precision_clock_output.h:68
precision_time_t max_period_ns
Maximum supported waveform period in nanoseconds.
Definition precision_clock_output.h:78
precision_time_t resolution_ns
Smallest representable output time increment in nanoseconds.
Definition precision_clock_output.h:72
precision_time_t max_pulse_width_ns
Maximum supported programmable high-pulse width in nanoseconds.
Definition precision_clock_output.h:82
uint32_t flags
Combination of precision_clock_output_caps_flags.
Definition precision_clock_output.h:70
precision_time_t min_pulse_width_ns
Minimum supported programmable high-pulse width in nanoseconds.
Definition precision_clock_output.h:80
precision_time_t min_lead_time_ns
Minimum required delay from the current time to the first edge.
Definition precision_clock_output.h:74
precision_time_t min_period_ns
Minimum supported waveform period in nanoseconds.
Definition precision_clock_output.h:76
Requested or accepted configuration of a scheduled clock output channel.
Definition precision_clock_output.h:115
struct precision_clock_output_waveform_config waveform
Valid when kind is PRECISION_CLOCK_OUTPUT_KIND_WAVEFORM.
Definition precision_clock_output.h:121
enum precision_clock_output_kind kind
Kind of output selected by the configuration.
Definition precision_clock_output.h:117
Scheduled clock output provider extension.
Definition precision_clock_output.h:396
precision_clock_output_get_status_t get_status
Query channel status.
Definition precision_clock_output.h:404
precision_clock_output_start_t start
Start a scheduled output channel.
Definition precision_clock_output.h:400
precision_clock_output_stop_t stop
Stop a scheduled output channel.
Definition precision_clock_output.h:402
precision_clock_output_get_caps_t get_caps
Query capabilities of all output channels.
Definition precision_clock_output.h:398
Observable status of a precision clock output channel.
Definition precision_clock_output.h:126
bool hardware_active_valid
Whether hardware_active reflects an observed hardware generator state.
Definition precision_clock_output.h:136
struct precision_clock_output_config config
Accepted configuration.
Definition precision_clock_output.h:130
bool hardware_active
Whether the hardware output generator is armed or running for the accepted configuration.
Definition precision_clock_output.h:144
bool configured
Whether the provider currently holds a configuration for the channel.
Definition precision_clock_output.h:128
Configuration of a periodic clock output waveform.
Definition precision_clock_output.h:100
precision_time_t first_rising_time
Absolute time of the first rising edge in the owning clock's timescale.
Definition precision_clock_output.h:102
precision_time_t pulse_width_ns
High-pulse width in nanoseconds.
Definition precision_clock_output.h:111
enum precision_clock_output_width_policy width_policy
High-pulse width policy applied to each period.
Definition precision_clock_output.h:106
precision_time_t period_ns
Interval between rising edges in nanoseconds.
Definition precision_clock_output.h:104
Protocol-neutral precision clock instance.
Definition precision_clock.h:79
Misc utilities.