RTEMS  5.1
rtc.h
1 /*
2  * This file contains the Real-Time Clock definitions.
3  *
4  * COPYRIGHT (c) 1989-1999.
5  * On-Line Applications Research Corporation (OAR).
6  *
7  * The license and distribution terms for this file may be
8  * found in the file LICENSE in this distribution or at
9  * http://www.rtems.org/license/LICENSE.
10  */
11 
12 #ifndef __LIBCHIP_RTC_h
13 #define __LIBCHIP_RTC_h
14 
15 #include <stdbool.h>
16 #include <stdint.h>
17 
18 #include <rtems.h>
19 
20 /*
21  * Types for get and set register routines
22  */
23 
24 typedef uint32_t (*getRegister_f)(uintptr_t port, uint8_t reg);
25 typedef void (*setRegister_f)(uintptr_t port, uint8_t reg, uint32_t value);
26 
27 typedef struct _rtc_fns {
28  void (*deviceInitialize)(int minor);
29  int (*deviceGetTime)(int minor, rtems_time_of_day *time);
30  int (*deviceSetTime)(int minor, const rtems_time_of_day *time);
31 } rtc_fns;
32 
33 typedef enum {
34  RTC_M48T08, /* SGS-Thomsom M48T08 or M48T18 */
35  RTC_ICM7170, /* Harris ICM-7170 */
36  RTC_CUSTOM, /* BSP specific driver */
37  RTC_MC146818A /* Motorola MC146818A */
38 } rtc_devs;
39 
40 /*
41  * Each field is interpreted thus:
42  *
43  * sDeviceName This is the name of the device.
44  *
45  * deviceType This indicates the chip type.
46  *
47  * pDeviceFns This is a pointer to the set of driver routines to use.
48  *
49  * pDeviceParams This contains either device specific data or a pointer to a
50  * device specific information table.
51  *
52  * ulCtrlPort1 This is the primary control port number for the device.
53  *
54  * ulDataPort This is the port number for the data port of the device
55  *
56  * getRegister This is the routine used to read register values.
57  *
58  * setRegister This is the routine used to write register values.
59  */
60 
61 typedef struct _rtc_tbl {
62  const char *sDeviceName;
63  rtc_devs deviceType;
64  const rtc_fns *pDeviceFns;
65  bool (*deviceProbe)(int minor);
66  void *pDeviceParams;
67  uintptr_t ulCtrlPort1;
68  uintptr_t ulDataPort;
69  getRegister_f getRegister;
70  setRegister_f setRegister;
71 } rtc_tbl;
72 
73 extern rtc_tbl RTC_Table[];
74 extern size_t RTC_Count;
75 
76 
77 extern bool rtc_probe( int minor );
78 
79 #endif
80 /* end of include file */
Definition: rtc.h:27
Definition: rtc.h:61
Data structure to manage and manipulate calendar time.
Definition: types.h:141