source: rtems/c/src/libchip/rtc/mc146818a_ioreg.c @ 8eaa3ea

4.104.114.84.9
Last change on this file since 8eaa3ea was d4d624e2, checked in by Ralf Corsepius <ralf.corsepius@…>, on Oct 21, 2004 at 1:26:58 PM

2004-10-20 Ralf Corsepius <ralf_corsepius@…>

  • libchip/rtc/mc146818a.c, libchip/rtc/mc146818a.h, libchip/rtc/mc146818a_ioreg.c: Use POSIX fixed size types.
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  This file contains a typical set of register access routines which may be
3 *  used with the MC146818A chip if accesses to the chip are as follows:
4 *
5 *    + registers are in I/O space
6 *    + registers are accessed as bytes
7 *    + registers are only byte-aligned (no address gaps)
8 *
9 *  COPYRIGHT (c) 1989-1997.
10 *  On-Line Applications Research Corporation (OAR).
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.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#include <rtems.h>
20#include <bsp.h>
21
22uint32_t mc146818a_get_register(
23  uint32_t  ulCtrlPort,
24  uint8_t   ucRegNum
25)
26{
27  uint8_t   val;
28  uint8_t   tmp;
29
30  outport_byte( ulCtrlPort, ucRegNum );
31  inport_byte( 0x84, tmp );   /* Hack a delay to give chip time to settle */
32  inport_byte( ulCtrlPort+1, val );
33  inport_byte( 0x84, tmp );   /* Hack a delay to give chip time to settle */
34  return val;
35}
36
37void  mc146818a_set_register(
38  uint32_t  ulCtrlPort,
39  uint8_t   ucRegNum,
40  uint32_t  ucData
41)
42{
43  outport_byte( ulCtrlPort, ucRegNum );
44  outport_byte( ulCtrlPort+1, (uint8_t)ucData );
45}
Note: See TracBrowser for help on using the repository browser.