~ubuntu-branches/ubuntu/precise/linux-lowlatency/precise

« back to all changes in this revision

Viewing changes to arch/h8300/kernel/time.c

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-tz023xykf0i6eosh
Tags: upstream-3.2.0
ImportĀ upstreamĀ versionĀ 3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  linux/arch/h8300/kernel/time.c
 
3
 *
 
4
 *  Yoshinori Sato <ysato@users.sourceforge.jp>
 
5
 *
 
6
 *  Copied/hacked from:
 
7
 *
 
8
 *  linux/arch/m68k/kernel/time.c
 
9
 *
 
10
 *  Copyright (C) 1991, 1992, 1995  Linus Torvalds
 
11
 *
 
12
 * This file contains the m68k-specific time handling details.
 
13
 * Most of the stuff is located in the machine specific files.
 
14
 *
 
15
 * 1997-09-10   Updated NTP code according to technical memorandum Jan '96
 
16
 *              "A Kernel Model for Precision Timekeeping" by Dave Mills
 
17
 */
 
18
 
 
19
#include <linux/errno.h>
 
20
#include <linux/module.h>
 
21
#include <linux/sched.h>
 
22
#include <linux/kernel.h>
 
23
#include <linux/param.h>
 
24
#include <linux/string.h>
 
25
#include <linux/mm.h>
 
26
#include <linux/timex.h>
 
27
#include <linux/profile.h>
 
28
 
 
29
#include <asm/io.h>
 
30
#include <asm/timer.h>
 
31
 
 
32
#define TICK_SIZE (tick_nsec / 1000)
 
33
 
 
34
void h8300_timer_tick(void)
 
35
{
 
36
        if (current->pid)
 
37
                profile_tick(CPU_PROFILING);
 
38
        xtime_update(1);
 
39
        update_process_times(user_mode(get_irq_regs()));
 
40
}
 
41
 
 
42
void read_persistent_clock(struct timespec *ts)
 
43
{
 
44
        unsigned int year, mon, day, hour, min, sec;
 
45
 
 
46
        /* FIX by dqg : Set to zero for platforms that don't have tod */
 
47
        /* without this time is undefined and can overflow time_t, causing  */
 
48
        /* very strange errors */
 
49
        year = 1980;
 
50
        mon = day = 1;
 
51
        hour = min = sec = 0;
 
52
#ifdef CONFIG_H8300_GETTOD
 
53
        h8300_gettod (&year, &mon, &day, &hour, &min, &sec);
 
54
#endif
 
55
        if ((year += 1900) < 1970)
 
56
                year += 100;
 
57
        ts->tv_sec = mktime(year, mon, day, hour, min, sec);
 
58
        ts->tv_nsec = 0;
 
59
}
 
60
 
 
61
void __init time_init(void)
 
62
{
 
63
 
 
64
        h8300_timer_setup();
 
65
}