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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-ppc/] [rtc.h] - Blame information for rev 1774

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

Line No. Rev Author Line
1 1276 phoenix
/*
2
 * inclue/asm-ppc/rtc.h
3
 *
4
 * Author: Tom Rini <trini@mvista.com>
5
 *
6
 * 2002 (c) MontaVista, Software, Inc.  This file is licensed under
7
 * the terms of the GNU General Public License version 2.  This program
8
 * is licensed "as is" without any warranty of any kind, whether express
9
 * or implied.
10
 *
11
 * Based on:
12
 * include/asm-m68k/rtc.h
13
 *
14
 * Copyright Richard Zidlicky
15
 * implementation details for genrtc/q40rtc driver
16
 *
17
 * And the old drivers/macintosh/rtc.c which was heavily based on:
18
 * Linux/SPARC Real Time Clock Driver
19
 * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
20
 *
21
 * With additional work by Paul Mackerras and Franz Sirl.
22
 */
23
 
24
#ifndef __ASM_RTC_H__
25
#define __ASM_RTC_H__
26
 
27
#ifdef __KERNEL__
28
 
29
#include <linux/rtc.h>
30
 
31
#include <asm/machdep.h>
32
#include <asm/time.h>
33
 
34
#define RTC_PIE 0x40            /* periodic interrupt enable */
35
#define RTC_AIE 0x20            /* alarm interrupt enable */
36
#define RTC_UIE 0x10            /* update-finished interrupt enable */
37
 
38
extern void gen_rtc_interrupt(unsigned long);
39
 
40
/* some dummy definitions */
41
#define RTC_BATT_BAD 0x100      /* battery bad */
42
#define RTC_SQWE 0x08           /* enable square-wave output */
43
#define RTC_DM_BINARY 0x04      /* all time/date values are BCD if clear */
44
#define RTC_24H 0x02            /* 24 hour mode - else hours bit 7 means pm */
45
#define RTC_DST_EN 0x01         /* auto switch DST - works f. USA only */
46
 
47
static inline unsigned int get_rtc_time(struct rtc_time *time)
48
{
49
        if (ppc_md.get_rtc_time) {
50
                unsigned long nowtime;
51
 
52
                nowtime = (ppc_md.get_rtc_time)();
53
 
54
                to_tm(nowtime, time);
55
 
56
                time->tm_year -= 1900;
57
                time->tm_mon -= 1; /* Make sure userland has a 0-based month */
58
        }
59
 
60
        return RTC_24H;
61
}
62
 
63
/* Set the current date and time in the real time clock. */
64
static inline int set_rtc_time(struct rtc_time *time)
65
{
66
        if (ppc_md.get_rtc_time) {
67
                unsigned long nowtime;
68
 
69
                nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
70
                                time->tm_mday, time->tm_hour, time->tm_min,
71
                                time->tm_sec);
72
 
73
                (ppc_md.set_rtc_time)(nowtime);
74
 
75
                return 0;
76
        } else
77
                return -EINVAL;
78
}
79
 
80
static inline unsigned int get_rtc_ss(void)
81
{
82
        struct rtc_time h;
83
 
84
        get_rtc_time(&h);
85
        return h.tm_sec;
86
}
87
 
88
static inline int get_rtc_pll(struct rtc_pll_info *pll)
89
{
90
        return -EINVAL;
91
}
92
static inline int set_rtc_pll(struct rtc_pll_info *pll)
93
{
94
        return -EINVAL;
95
}
96
 
97
#endif /* __KERNEL__ */
98
#endif /* __ASM_RTC_H__ */

powered by: WebSVN 2.1.0

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