Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Precision clock output provider extension. More...

Data Structures

struct  precision_clock_output_provider
 Scheduled clock output provider extension. More...

Typedefs

typedef int(* precision_clock_output_get_caps_t) (const struct device *dev, struct precision_clock_output_caps *caps)
 Query capabilities of all output channels.
typedef 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.
typedef int(* precision_clock_output_stop_t) (const struct device *dev, uint32_t channel)
 Stop a scheduled output channel.
typedef int(* precision_clock_output_get_status_t) (const struct device *dev, uint32_t channel, struct precision_clock_output_status *status)
 Query output channel status.

Detailed Description

Precision clock output provider extension.

Since
4.6
Version
0.1.0

Driver-facing contract that lets a device expose scheduled clock outputs to a protocol-neutral precision clock adapter. All times are raw values in the owning clock's timescale, so the extension carries no protocol-specific prefix. An adapter such as the PTP clock adapter bridges it onto the public API in Precision Clock Output.

Providers share the public capability, configuration, and status types from Precision Clock Output. No timescale conversion is needed at this boundary. The configuration kind selects the output operation; periodic waveforms use the limits and width policies supported by the channel.

Channel indices are provider-defined and zero-based. A channel need not be dedicated to output: it may share hardware with another device function, such as input capture, or be reserved by the driver.

Hardware-active status reports whether the generator is armed or running for the accepted configuration, including while waiting for a future first edge. Providers must not report the pin level or absence of an edge as an inactive generator. If this state cannot be observed, leave precision_clock_output_status.hardware_active_valid false rather than inferring activity from the stored configuration.

Provider operations are called only from thread context and may block. Operations on different channels of the same device may run concurrently, including during a device-wide capability query. The driver must protect shared registers and state against concurrent access. A provider may document additional, more restrictive context requirements.

Typedef Documentation

◆ precision_clock_output_get_caps_t

typedef int(* precision_clock_output_get_caps_t) (const struct device *dev, struct precision_clock_output_caps *caps)

#include <zephyr/precision_timing/precision_clock_output.h>

Query capabilities of all output channels.

The provider must return valid capabilities and a read-only channel table whose address and contents remain unchanged for the initialized device's lifetime. See precision_clock_output_caps.

Parameters
devDevice that owns the output channels.
capsDestination for the channel count and read-only channel table.
Returns
0 on success or a negative error code on failure.

◆ precision_clock_output_get_status_t

typedef int(* precision_clock_output_get_status_t) (const struct device *dev, uint32_t channel, struct precision_clock_output_status *status)

#include <zephyr/precision_timing/precision_clock_output.h>

Query output channel status.

The provider must validate the channel index and return a status consistent with its capabilities. The accepted configuration describes the original request; its first rising edge may already be in the past.

Parameters
devDevice that owns the output channel.
channelZero-based output channel index.
statusDestination for the channel status.
Returns
0 on success or a negative error code on failure.

◆ precision_clock_output_start_t

typedef int(* precision_clock_output_start_t) (const struct device *dev, uint32_t channel, const struct precision_clock_output_config *config)

#include <zephyr/precision_timing/precision_clock_output.h>

Start a scheduled output in the device clock's timescale.

The provider must validate hardware-specific constraints and arbitrate channel ownership before programming the output. Generic capability checks do not replace this validation: the clock can advance or be stepped between a subsystem check and the provider operation. In particular, the provider must check that the first edge still meets its programming lead time.

If programming fails and the provider cannot safely release the channel, it must retain the attempted configuration, report it as configured, and return -EINPROGRESS. This is a failure requiring a successful stop, not asynchronous completion. All other errors leave the caller without ownership and must not alter another user's configuration.

Parameters
devDevice that owns the output channel.
channelZero-based output channel index.
configOutput kind and its configuration.
Return values
0on success.
-EBUSYif the channel is already configured for output, is in use by another device function, or is reserved by the driver.
-ETIMEif the first edge no longer meets the programming lead time and this attempt did not retain the channel.
-EINPROGRESSif programming failed and this attempt retained the channel.
Returns
A provider-specific negative error code on failure.

◆ precision_clock_output_stop_t

typedef int(* precision_clock_output_stop_t) (const struct device *dev, uint32_t channel)

#include <zephyr/precision_timing/precision_clock_output.h>

Stop a scheduled output channel.

Stopping a channel that is already unconfigured is idempotent. The provider must validate the channel index.

Parameters
devDevice that owns the output channel.
channelZero-based output channel index.
Returns
0 on success or a negative error code on failure.