Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
clock_monitor.h File Reference

Public Clock Monitor driver API. More...

#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/util.h>
#include <zephyr/syscalls/clock_monitor.h>

Go to the source code of this file.

Data Structures

struct  clock_monitor_window_cfg
 Configuration for CLOCK_MONITOR_MODE_WINDOW. More...
struct  clock_monitor_measure_cfg
 Configuration for CLOCK_MONITOR_MODE_MEASURE. More...
struct  clock_monitor_event_data
 Event payload delivered to the user callback. More...
struct  clock_monitor_config
 Top-level configuration handed to clock_monitor_configure. More...
struct  clock_monitor_driver_api
  Driver Operations CLOCK_MONITOR driver operations More...

Typedefs

typedef void(* clock_monitor_callback_t) (const struct device *dev, const struct clock_monitor_event_data *evt, void *user_data)
 Callback invoked on clock monitor events.
typedef int(* clock_monitor_api_configure) (const struct device *dev, const struct clock_monitor_config *cfg)
 Callback API for configuring a clock monitor.
typedef int(* clock_monitor_api_start) (const struct device *dev)
 Callback API for starting the configured mode.
typedef int(* clock_monitor_api_stop) (const struct device *dev)
 Callback API for stopping the clock monitor (ISR-safe).
typedef int(* clock_monitor_api_get_rate) (const struct device *dev, uint32_t *rate_hz)
 Callback API for polling the most recent measured rate.
typedef int(* clock_monitor_api_set_source) (const struct device *dev, uint32_t reference, uint32_t target)
 Callback API for switching the reference / target clock inputs.

Enumerations

enum  clock_monitor_mode { CLOCK_MONITOR_MODE_WINDOW = 1 , CLOCK_MONITOR_MODE_MEASURE }
 Operating mode of a clock monitor instance. More...
enum  { CLOCK_MONITOR_EVT_FREQ_HIGH = BIT(0) , CLOCK_MONITOR_EVT_FREQ_LOW = BIT(1) , CLOCK_MONITOR_EVT_CLOCK_LOST = BIT(2) , CLOCK_MONITOR_EVT_MEASURE_DONE = BIT(3) }
 Clock monitor event flags, OR-combined into uint32_t masks. More...

Functions

int clock_monitor_configure (const struct device *dev, const struct clock_monitor_config *cfg)
 Apply a monitor configuration.
int clock_monitor_start (const struct device *dev)
 Start operation of the configured mode.
int clock_monitor_stop (const struct device *dev)
 Stop the monitor.
int clock_monitor_get_rate (const struct device *dev, uint32_t *rate_hz)
 Poll the most recent completed measurement.
int clock_monitor_set_source (const struct device *dev, uint32_t reference, uint32_t target)
 Switch the reference / target clock inputs at runtime.

Detailed Description

Public Clock Monitor driver API.