October 2017
Intermediate to advanced
354 pages
9h 28m
English
Every system has at least one clock counter. As with any hardware device in a machine, this counter too is represented and managed by a structure. Hardware abstraction is provided by struct clocksource, defined in the include/linux/clocksource.h header file. This structure provides callbacks to access and handle power management on the counter through the read, enable, disable, suspend, and resume routines:
struct clocksource { u64 (*read)(struct clocksource *cs); u64 mask; u32 mult; u32 shift; u64 max_idle_ns; u32 maxadj; #ifdef CONFIG_ARCH_CLOCKSOURCE_DATA struct arch_clocksource_data archdata; #endif u64 max_cycles; const char *name; struct list_head list; int rating; int (*enable)(struct clocksource *cs); void (