|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
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. | |
Precision clock output provider extension.
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 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.
| dev | Device that owns the output channels. |
| caps | Destination for the channel count and read-only channel table. |
| 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.
| dev | Device that owns the output channel. |
| channel | Zero-based output channel index. |
| status | Destination for the channel status. |
| 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.
| dev | Device that owns the output channel. |
| channel | Zero-based output channel index. |
| config | Output kind and its configuration. |
| 0 | on success. |
| -EBUSY | if the channel is already configured for output, is in use by another device function, or is reserved by the driver. |
| -ETIME | if the first edge no longer meets the programming lead time and this attempt did not retain the channel. |
| -EINPROGRESS | if programming failed and this attempt retained the 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.
| dev | Device that owns the output channel. |
| channel | Zero-based output channel index. |