1 #ifndef HWCLOCK_CLOCK_H
2 #define HWCLOCK_CLOCK_H
14 #define HWCLOCK_DEBUG_INIT (1 << 0)
15 #define HWCLOCK_DEBUG_RANDOM_SLEEP (1 << 1)
16 #define HWCLOCK_DEBUG_DELTA_VS_TARGET (1 << 2)
17 #define HWCLOCK_DEBUG_ALL 0xFFFF
19 UL_DEBUG_DECLARE_MASK(hwclock
);
20 #define DBG(m, x) __UL_DBG(hwclock, HWCLOCK_DEBUG_, m, x)
21 #define ON_DBG(m, x) __UL_DBG_CALL(hwclock, HWCLOCK_DEBUG_, m, x)
23 struct hwclock_control
{
26 double rtc_delay
; /* --delay <seconds> */
27 #if defined(__linux__) && defined(__alpha__)
33 char *param_get_option
;
34 char *param_set_option
;
42 #if defined(__linux__) && defined(__alpha__)
55 universal
:1, /* will store hw_clock_is_utc() return value */
63 int (*get_permissions
) (void);
64 int (*read_hardware_clock
) (const struct hwclock_control
*ctl
, struct tm
* tm
);
65 int (*set_hardware_clock
) (const struct hwclock_control
*ctl
, const struct tm
* tm
);
66 int (*synchronize_to_clock_tick
) (const struct hwclock_control
*ctl
);
67 const char *(*get_device_path
) (void);
70 extern const struct clock_ops
*probe_for_cmos_clock(void);
71 extern const struct clock_ops
*probe_for_rtc_clock(const struct hwclock_control
*ctl
);
74 extern double time_diff(struct timeval subtrahend
, struct timeval subtractor
);
77 #if defined(__linux__) && defined(__alpha__)
78 extern int get_epoch_rtc(const struct hwclock_control
*ctl
, unsigned long *epoch
);
79 extern int set_epoch_rtc(const struct hwclock_control
*ctl
);
82 struct hwclock_param
{
88 extern const struct hwclock_param
*get_hwclock_params(void);
89 extern int get_param_rtc(const struct hwclock_control
*ctl
,
90 const char *name
, uint64_t *id
, uint64_t *value
);
91 extern int set_param_rtc(const struct hwclock_control
*ctl
, const char *name
);
93 extern int rtc_vl_read(const struct hwclock_control
*ctl
);
94 extern int rtc_vl_clear(const struct hwclock_control
*ctl
);
96 extern void __attribute__((__noreturn__
))
97 hwclock_exit(const struct hwclock_control
*ctl
, int status
);
99 extern int parse_date(struct timespec
*, char const *, struct timespec
const *);
101 #endif /* HWCLOCK_CLOCK_H */