RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
bsps
include
libchip
rtc.h
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
3
/*
4
* This file contains the Real-Time Clock definitions.
5
*
6
* COPYRIGHT (c) 1989-1999.
7
* On-Line Applications Research Corporation (OAR).
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
* 1. Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
* 2. Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in the
16
* documentation and/or other materials provided with the distribution.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
* POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
#ifndef __LIBCHIP_RTC_h
32
#define __LIBCHIP_RTC_h
33
34
#include <stdbool.h>
35
#include <stdint.h>
36
37
#include <
rtems.h
>
38
39
/*
40
* Types for get and set register routines
41
*/
42
43
typedef
uint32_t (*getRegister_f)(uintptr_t port, uint8_t reg);
44
typedef
void (*setRegister_f)(uintptr_t port, uint8_t reg, uint32_t value);
45
46
typedef
struct
_rtc_fns
{
47
void (*deviceInitialize)(
int
minor);
48
int (*deviceGetTime)(
int
minor,
rtems_time_of_day
*time);
49
int (*deviceSetTime)(
int
minor,
const
rtems_time_of_day
*time);
50
} rtc_fns;
51
52
typedef
enum
{
53
RTC_M48T08,
/* SGS-Thomsom M48T08 or M48T18 */
54
RTC_ICM7170,
/* Harris ICM-7170 */
55
RTC_CUSTOM,
/* BSP specific driver */
56
RTC_MC146818A
/* Motorola MC146818A */
57
} rtc_devs;
58
59
/*
60
* Each field is interpreted thus:
61
*
62
* sDeviceName This is the name of the device.
63
*
64
* deviceType This indicates the chip type.
65
*
66
* pDeviceFns This is a pointer to the set of driver routines to use.
67
*
68
* pDeviceParams This contains either device specific data or a pointer to a
69
* device specific information table.
70
*
71
* ulCtrlPort1 This is the primary control port number for the device.
72
*
73
* ulDataPort This is the port number for the data port of the device
74
*
75
* getRegister This is the routine used to read register values.
76
*
77
* setRegister This is the routine used to write register values.
78
*/
79
80
typedef
struct
_rtc_tbl
{
81
const
char
*sDeviceName;
82
rtc_devs deviceType;
83
const
rtc_fns *pDeviceFns;
84
bool (*deviceProbe)(
int
minor);
85
void
*pDeviceParams;
86
uintptr_t ulCtrlPort1;
87
uintptr_t ulDataPort;
88
getRegister_f getRegister;
89
setRegister_f setRegister;
90
} rtc_tbl;
91
92
extern
rtc_tbl RTC_Table[];
93
extern
size_t
RTC_Count;
94
95
96
extern
bool
rtc_probe(
int
minor );
97
98
#endif
99
/* end of include file */
rtems.h
This header file defines the RTEMS Classic API.
_rtc_fns
Definition
rtc.h:46
_rtc_tbl
Definition
rtc.h:80
rtems_time_of_day
This type represents Classic API calendar times.
Definition
types.h:266
Generated by
1.18.0