OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-armnommu/] [arch-ebsa110/] [time.h] - Blame information for rev 1765

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
/*
2
 * linux/include/asm-arm/arch-a5k/time.h
3
 *
4
 * Copyright (c) 1996 Russell King.
5
 *
6
 * No real time clock on the evaluation board!
7
 *
8
 * Changelog:
9
 *  10-Oct-1996 RMK     Created
10
 *  04-Dec-1997 RMK     Updated for new arch/arm/time.c
11
 */
12
 
13
#define MCLK_47_8
14
 
15
#if defined(MCLK_42_3)
16
#define PIT1_COUNT 0xecbe
17
#elif defined(MCLK_47_8)
18
/*
19
 * This should be 0x10AE1, but that doesn't exactly fit.
20
 * We run the timer interrupt at 5ms, and then divide it by
21
 * two in software...  This is so that the user processes
22
 * see exactly the same model whichever ARM processor they're
23
 * running on.
24
 */
25
#define PIT1_COUNT 0x85b8
26
#define DIVISOR 2
27
#endif
28
 
29
extern __inline__ unsigned long gettimeoffset (void)
30
{
31
        return 0;
32
}
33
 
34
#ifndef DIVISOR
35
extern __inline__ int reset_timer (void)
36
{
37
        *PIT_T1 = (PIT1_COUNT) & 0xff;
38
        *PIT_T1 = (PIT1_COUNT) >> 8;
39
        return 1;
40
}
41
#else
42
extern __inline__ int reset_timer (void)
43
{
44
        static unsigned int divisor;
45
        static int count = 50;
46
 
47
        *PIT_T1 = (PIT1_COUNT) & 0xff;
48
        *PIT_T1 = (PIT1_COUNT) >> 8;
49
 
50
        if (--count == 0) {
51
                count = 50;
52
                *(volatile unsigned char *)0xf2400000 ^= 128;
53
        }
54
 
55
        if (divisor == 0) {
56
                divisor = DIVISOR - 1;
57
                return 1;
58
        }
59
        divisor -= 1;
60
        return 0;
61
}
62
#endif
63
 
64
/*
65
 * We don't have a RTC to update!
66
 */
67
#define update_rtc()
68
 
69
/*
70
 * Set up timer interrupt, and return the current time in seconds.
71
 */
72
extern __inline__ unsigned long setup_timer (void)
73
{
74
        /*
75
         * Timer 1, mode 0, 16-bit, autoreload
76
         */
77
        *PIT_CTRL = 0x70;
78
        /*
79
         * Refresh counter clocked at 47.8MHz/7 = 146.4ns
80
         * We want centi-second interrupts
81
         */
82
        reset_timer ();
83
        /*
84
         * Default the date to 1 Jan 1970 0:0:0
85
         * You will have to run a time daemon to set the
86
         * clock correctly at bootup
87
         */
88
        return mktime(1970, 1, 1, 0, 0, 0);
89
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.