// SPDX-License-Identifier: GPL-2.0-only /* * Copyright 2008 by Andreas Eversberg <[email protected]> * * Quick API description: * * A clock source registers using mISDN_register_clock: * name = text string to name clock source * priority = value to priorize clock sources (0 = default) * ctl = callback function to enable/disable clock source * priv = private pointer of clock source * return = pointer to clock source structure; * * Note: Callback 'ctl' can be called before mISDN_register_clock returns! * Also it can be called during mISDN_unregister_clock. * * A clock source calls mISDN_clock_update with given samples elapsed, if * enabled. If function call is delayed, tv must be set with the timestamp * of the actual event. * * A clock source unregisters using mISDN_unregister_clock. * * To get current clock, call mISDN_clock_get. The signed short value * counts the number of samples since. Time since last clock event is added. */ #include <linux/slab.h> #include <linux/types.h> #include <linux/stddef.h> #include <linux/spinlock.h> #include <linux/ktime.h> #include <linux/mISDNif.h> #include <linux/export.h> #include "core.h" static u_int *debug; static LIST_HEAD(iclock_list); static DEFINE_RWLOCK(iclock_lock); static u16 iclock_count; /* counter of last clock */ static ktime_t iclock_timestamp; /* time stamp of last clock */ static int iclock_timestamp_valid; /* already received one timestamp */ static struct mISDNclock *iclock_current; void mISDN_init_clock(u_int *dp) { … } static void select_iclock(void) { … } struct mISDNclock *mISDN_register_clock(char *name, int pri, clockctl_func_t *ctl, void *priv) { … } EXPORT_SYMBOL(…); void mISDN_unregister_clock(struct mISDNclock *iclock) { … } EXPORT_SYMBOL(…); void mISDN_clock_update(struct mISDNclock *iclock, int samples, ktime_t *timestamp) { … } EXPORT_SYMBOL(…); unsigned short mISDN_clock_get(void) { … } EXPORT_SYMBOL(…);