RTEMS 6.1-rc4
Loading...
Searching...
No Matches
mc146818a.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * This file contains the definitions for the following real-time clocks:
5 *
6 * + Motorola MC146818A
7 *
8 * COPYRIGHT (c) 1989-1999.
9 * On-Line Applications Research Corporation (OAR).
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef __LIBCHIP_MC146818A_h
34#define __LIBCHIP_MC146818A_h
35
36/*
37 * Register addresses within chip
38 */
39#define MC146818A_SEC 0x00 /* seconds */
40#define MC146818A_SECALRM 0x01 /* seconds alarm */
41#define MC146818A_MIN 0x02 /* minutes */
42#define MC146818A_MINALRM 0x03 /* minutes alarm */
43#define MC146818A_HRS 0x04 /* hours */
44#define MC146818A_HRSALRM 0x05 /* hours alarm */
45#define MC146818A_WDAY 0x06 /* week day */
46#define MC146818A_DAY 0x07 /* day of month */
47#define MC146818A_MONTH 0x08 /* month of year */
48#define MC146818A_YEAR 0x09 /* month of year */
49
50#define MC146818A_STATUSA 0x0a /* status register A */
51#define MC146818ASA_TUP 0x80 /* time update in progress */
52#define MC146818ASA_DIVIDER 0x20 /* divider for 32768 crystal */
53#define MC146818ASA_1024 0x06 /* divide to 1024 Hz */
54
55#define MC146818A_STATUSB 0x0b /* status register B */
56#define MC146818ASB_DST 0x01 /* Daylight Savings Time */
57#define MC146818ASB_24HR 0x02 /* 0 = 12 hours, 1 = 24 hours */
58#define MC146818ASB_HALT 0x80 /* stop clock updates */
59
60#define MC146818A_STATUSD 0x0d /* status register D */
61#define MC146818ASD_PWR 0x80 /* clock lost power */
62
63
64/*
65 * Driver function table
66 */
67extern rtc_fns mc146818a_fns;
68bool mc146818a_probe(
69 int minor
70);
71
72/*
73 * Default register access routines
74 */
75uint32_t mc146818a_get_register(
76 uintptr_t ulCtrlPort,
77 uint8_t ucRegNum
78);
79
80void mc146818a_set_register(
81 uintptr_t ulCtrlPort,
82 uint8_t ucRegNum,
83 uint32_t ucData
84);
85
86#endif
87/* end of include file */
Definition: rtc.h:46