PebbleOS v4.44.0-199-g465b7d28c
Loading...
Searching...
No Matches
cal.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <pbl/drivers/clk.h>
#include <pbl/kernel/timer.h>
#include <pbl/util/freq_track.h>

Data Structures

struct  pbl_clk_cal_ops
 Gate operations, called from the tick interrupt or a thread, one gate at a time. More...
 
struct  pbl_clk_cal
 A calibrated clock. More...
 
struct  pbl_clk_cal_status
 Calibration state, for diagnostics. More...
 

Macros

#define PBL_CLK_CAL_INIT(_ops, _params, _clk, _gate_cycles, _period_ms)
 Initializer for a struct pbl_clk_cal.
 

Functions

void pbl_clk_cal_start (struct pbl_clk_cal *cal, double nominal_hz)
 Start the periodic gates, the first one now.
 
struct pbl_clk_cal * pbl_clk_cal_find (const char *name)
 Find a calibrated clock by the name of its controller.
 
int pbl_clk_cal_sample (struct pbl_clk_cal *cal, uint32_t cycles, double *hz)
 Take one raw gate, outside the periodic calibration, which waits meanwhile.
 
void pbl_clk_cal_hold (struct pbl_clk_cal *cal, uint64_t rate_mhz)
 Publish a fixed rate, or the tracked one again.
 
void pbl_clk_cal_get_status (const struct pbl_clk_cal *cal, struct pbl_clk_cal_status *status)
 Get the calibration state.
 
uint64_t pbl_clk_cal_get_rate (const struct pbl_clk_cal *cal)
 Get the current rate.