source: rtems/c/src/libchip/rtc/m48t08_reg.c @ 8d6e7120

4.104.114.84.9
Last change on this file since 8d6e7120 was 8d6e7120, checked in by Joel Sherrill <joel.sherrill@…>, on Jul 29, 1998 at 12:01:56 AM

New files.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 *  This file contains a typical set of register access routines which may be
3 *  used with the m48t08 chip if accesses to the chip are as follows:
4 *
5 *    + registers are accessed as bytes
6 *    + registers are only byte-aligned (no address gaps)
7 *
8 *  COPYRIGHT (c) 1989-1997.
9 *  On-Line Applications Research Corporation (OAR).
10 *  Copyright assigned to U.S. Government, 1994.
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.OARcorp.com/rtems/license.html.
15 *
16 *  $Id$
17 */
18
19#include <rtems.h>
20
21#ifndef _M48T08_MULTIPLIER
22#define _M48T08_MULTIPLIER 1
23#define _M48T08_NAME(_X) _X
24#define _M48T08_TYPE unsigned8
25#endif
26
27#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \
28  (_M48T08_TYPE *)((_base) + ((_reg) * _M48T08_MULTIPLIER ))
29
30/*
31 *  M48T08 Get Register Routine
32 */
33
34unsigned8 _M48T08_NAME(m48t08_get_register)(
35  unsigned32  ulCtrlPort,
36  unsigned8   ucRegNum
37)
38{
39  _M48T08_TYPE *port;
40
41  port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
42
43  return *port;
44}
45
46/*
47 *  M48T08 Set Register Routine
48 */
49
50void  _M48T08_NAME(m48t08_set_register)(
51  unsigned32  ulCtrlPort,
52  unsigned8   ucRegNum,
53  unsigned8   ucData
54)
55{
56  _M48T08_TYPE *port;
57
58  port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum );
59
60  *port = ucData;
61}
Note: See TracBrowser for help on using the repository browser.