4.104.114.84.95
Last change
on this file since d4d624e2 was
d4d624e2,
checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/21/04 at 13:26:58
|
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
|
Rev | Line | |
---|
[29322a8d] | 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 | |
---|
[d4d624e2] | 22 | uint32_t mc146818a_get_register( |
---|
| 23 | uint32_t ulCtrlPort, |
---|
| 24 | uint8_t ucRegNum |
---|
[29322a8d] | 25 | ) |
---|
| 26 | { |
---|
[d4d624e2] | 27 | uint8_t val; |
---|
| 28 | uint8_t tmp; |
---|
[29322a8d] | 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 | |
---|
| 37 | void mc146818a_set_register( |
---|
[d4d624e2] | 38 | uint32_t ulCtrlPort, |
---|
| 39 | uint8_t ucRegNum, |
---|
| 40 | uint32_t ucData |
---|
[29322a8d] | 41 | ) |
---|
| 42 | { |
---|
| 43 | outport_byte( ulCtrlPort, ucRegNum ); |
---|
[d4d624e2] | 44 | outport_byte( ulCtrlPort+1, (uint8_t)ucData ); |
---|
[29322a8d] | 45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.