Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
clocksource.c File Reference
#include <linux/device.h>
#include <linux/clocksource.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/tick.h>
#include <linux/kthread.h>

Go to the source code of this file.

Functions

void timecounter_init (struct timecounter *tc, const struct cyclecounter *cc, u64 start_tstamp)
 
 EXPORT_SYMBOL_GPL (timecounter_init)
 
u64 timecounter_read (struct timecounter *tc)
 
 EXPORT_SYMBOL_GPL (timecounter_read)
 
u64 timecounter_cyc2time (struct timecounter *tc, cycle_t cycle_tstamp)
 
 EXPORT_SYMBOL_GPL (timecounter_cyc2time)
 
void clocks_calc_mult_shift (u32 *mult, u32 *shift, u32 from, u32 to, u32 maxsec)
 
void clocksource_suspend (void)
 
void clocksource_resume (void)
 
void clocksource_touch_watchdog (void)
 
 fs_initcall (clocksource_done_booting)
 
void __clocksource_updatefreq_scale (struct clocksource *cs, u32 scale, u32 freq)
 
 EXPORT_SYMBOL_GPL (__clocksource_updatefreq_scale)
 
int __clocksource_register_scale (struct clocksource *cs, u32 scale, u32 freq)
 
 EXPORT_SYMBOL_GPL (__clocksource_register_scale)
 
int clocksource_register (struct clocksource *cs)
 
 EXPORT_SYMBOL (clocksource_register)
 
void clocksource_change_rating (struct clocksource *cs, int rating)
 
 EXPORT_SYMBOL (clocksource_change_rating)
 
void clocksource_unregister (struct clocksource *cs)
 
 EXPORT_SYMBOL (clocksource_unregister)
 
 __setup ("clocksource=", boot_override_clocksource)
 

Function Documentation

int __clocksource_register_scale ( struct clocksource cs,
u32  scale,
u32  freq 
)

__clocksource_register_scale - Used to install new clocksources : clocksource to be registered : Scale factor multiplied against freq to get clocksource hz : clocksource frequency (cycles per second) divided by scale

Returns -EBUSY if registration fails, zero otherwise.

This SHOULD NOT be called directly! Please use the clocksource_register_hz() or clocksource_register_khz helper functions.

Definition at line 711 of file clocksource.c.

void __clocksource_updatefreq_scale ( struct clocksource cs,
u32  scale,
u32  freq 
)

__clocksource_updatefreq_scale - Used update clocksource with new freq : clocksource to be registered : Scale factor multiplied against freq to get clocksource hz : clocksource frequency (cycles per second) divided by scale

This should only be called from the clocksource->enable() method.

This SHOULD NOT be called directly! Please use the clocksource_updatefreq_hz() or clocksource_updatefreq_khz helper functions.

Definition at line 659 of file clocksource.c.

__setup ( )
void clocks_calc_mult_shift ( u32 mult,
u32 shift,
u32  from,
u32  to,
u32  maxsec 
)

clocks_calc_mult_shift - calculate mult/shift factors for scaled math of clocks : pointer to mult variable : pointer to shift variable : frequency to convert from : frequency to convert to : guaranteed runtime conversion range in seconds

The function evaluates the shift/mult pair for the scaled math operations of clocksources and clockevents.

and are frequency values in HZ. For clock sources is NSEC_PER_SEC == 1GHz and is the counter frequency. For clock event is the counter frequency and is NSEC_PER_SEC.

The conversion range argument controls the time frame in seconds which must be covered by the runtime conversion with the calculated mult and shift factors. This guarantees that no 64bit overflow happens when the input value of the conversion is multiplied with the calculated mult factor. Larger ranges may reduce the conversion accuracy by chosing smaller mult and shift factors.

Definition at line 134 of file clocksource.c.

void clocksource_change_rating ( struct clocksource cs,
int  rating 
)

clocksource_change_rating - Change the rating of a registered clocksource : clocksource to be changed : new rating

Definition at line 767 of file clocksource.c.

int clocksource_register ( struct clocksource cs)

clocksource_register - Used to install new clocksources : clocksource to be registered

Returns -EBUSY if registration fails, zero otherwise.

Definition at line 734 of file clocksource.c.

void clocksource_resume ( void  )

clocksource_resume - resume the clocksource(s)

Definition at line 471 of file clocksource.c.

void clocksource_suspend ( void  )

clocksource_suspend - suspend the clocksource(s)

Definition at line 459 of file clocksource.c.

void clocksource_touch_watchdog ( void  )

clocksource_touch_watchdog - Update watchdog

Update the watchdog after exception contexts such as kgdb so as not to incorrectly trip the watchdog. This might fail when the kernel was stopped in code which holds watchdog_lock.

Definition at line 489 of file clocksource.c.

void clocksource_unregister ( struct clocksource cs)

clocksource_unregister - remove a registered clocksource : clocksource to be unregistered

Definition at line 779 of file clocksource.c.

EXPORT_SYMBOL ( clocksource_register  )
EXPORT_SYMBOL ( clocksource_change_rating  )
EXPORT_SYMBOL ( clocksource_unregister  )
EXPORT_SYMBOL_GPL ( timecounter_init  )
EXPORT_SYMBOL_GPL ( timecounter_read  )
EXPORT_SYMBOL_GPL ( timecounter_cyc2time  )
EXPORT_SYMBOL_GPL ( __clocksource_updatefreq_scale  )
EXPORT_SYMBOL_GPL ( __clocksource_register_scale  )
fs_initcall ( clocksource_done_booting  )
u64 timecounter_cyc2time ( struct timecounter tc,
cycle_t  cycle_tstamp 
)

timecounter_cyc2time - convert a cycle counter to same time base as values returned by timecounter_read() : Pointer to time counter. : a value returned by tc->cc->read()

Cycle counts that are converted correctly as long as they fall into the interval [-1/2 max cycle count, +1/2 max cycle count], with "max cycle count" == cs->mask+1.

This allows conversion of cycle counter values which were generated in the past.

Definition at line 88 of file clocksource.c.

void timecounter_init ( struct timecounter tc,
const struct cyclecounter cc,
u64  start_tstamp 
)

timecounter_init - initialize a time counter : Pointer to time counter which is to be initialized/reset : A cycle counter, ready to be used. : Arbitrary initial time stamp.

After this call the current cycle register (roughly) corresponds to the initial time stamp. Every call to timecounter_read() increments the time stamp counter by the number of elapsed nanoseconds.

Definition at line 34 of file clocksource.c.

u64 timecounter_read ( struct timecounter tc)

timecounter_read - return nanoseconds elapsed since timecounter_init() plus the initial time stamp : Pointer to time counter.

In other words, keeps track of time since the same epoch as the function which generated the initial time stamp.

Definition at line 75 of file clocksource.c.