source: rtems/c/src/libchip/rtc/rtc.h @ b0f45d8

4.104.115
Last change on this file since b0f45d8 was 31c14d9, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 09/22/08 at 11:45:25

Include required header files. Some internal functions have now static linkage type. Added constant qualifier to operations table and read-only function parameters.

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