source: rtems/c/src/libchip/rtc/rtc.h @ 29322a8d

4.104.114.84.9
Last change on this file since 29322a8d was 29322a8d, checked in by Eric Norum <WENorum@…>, on Oct 11, 2004 at 3:00:23 PM

Add libchip driver for Motorola MC146818A time-of-day clock chip.
Modify i386/pc386 BSP to use this driver.

  • Property mode set to 100644
File size: 2.2 KB
Line 
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.com/license/LICENSE.
10 *
11 *
12 *  $Id$
13 */
14
15#ifndef __LIBCHIP_RTC_h
16#define __LIBCHIP_RTC_h
17
18/*
19 *  Types for get and set register routines
20 */
21
22typedef uint32_t   (*getRegister_f)(uint32_t   port, uint8_t   register);
23typedef void       (*setRegister_f)(
24                            uint32_t   port, uint8_t   reg, uint32_t   value);
25
26typedef struct _rtc_fns {
27  void    (*deviceInitialize)(int minor);
28  int     (*deviceGetTime)(int minor, rtems_time_of_day *time);
29  int     (*deviceSetTime)(int minor, rtems_time_of_day *time);
30} rtc_fns;
31
32typedef enum {
33  RTC_M48T08,                  /* SGS-Thomsom M48T08 or M48T18 */
34  RTC_ICM7170,                 /* Harris ICM-7170 */
35  RTC_CUSTOM,                  /* BSP specific driver */
36  RTC_MC146818A                /* Motorola MC146818A */
37} rtc_devs;
38
39/*
40 * Each field is interpreted thus:
41 *
42 * sDeviceName  This is the name of the device.
43 *
44 * deviceType   This indicates the chip type.
45 *
46 * pDeviceFns   This is a pointer to the set of driver routines to use.
47 *
48 * pDeviceParams This contains either device specific data or a pointer to a
49 *              device specific information table.
50 *
51 * ulCtrlPort1  This is the primary control port number for the device.
52 *
53 * ulCtrlPort2  This is the secondary control port number.
54 *
55 * ulDataPort   This is the port number for the data port of the device
56 *
57 * getRegister  This is the routine used to read register values.
58 *
59 * setRegister  This is the routine used to write register values.
60 */
61
62typedef struct _rtc_tbl {
63  char          *sDeviceName;
64  rtc_devs       deviceType;
65  rtc_fns       *pDeviceFns;
66  boolean      (*deviceProbe)(int minor);
67  void          *pDeviceParams;
68  uint32_t       ulCtrlPort1;
69  uint32_t       ulDataPort;
70  getRegister_f  getRegister;
71  setRegister_f  setRegister;
72} rtc_tbl;
73
74extern rtc_tbl        RTC_Table[];
75extern unsigned long  RTC_Count;
76
77
78boolean rtc_probe( int minor );
79
80#endif
81/* end of include file */
Note: See TracBrowser for help on using the repository browser.