root / Whitix / branches / hybrid / include / i386 / cmos.h
| Revision 1, 1.5 kB (checked in by mtw07, 9 months ago) |
|---|
| Line | |
|---|---|
| 1 | /* cmos.h - definitions for the CMOS RAM found in PCs. |
| 2 | * =================================================== |
| 3 | * |
| 4 | * This file is part of Whitix. |
| 5 | * |
| 6 | * Whitix is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * Whitix is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with Whitix; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #ifndef CMOS_H |
| 23 | #define CMOS_H |
| 24 | |
| 25 | #include <i386/ioports.h> |
| 26 | #include <types.h> |
| 27 | #include <typedefs.h> |
| 28 | |
| 29 | /* CMOS registers */ |
| 30 | |
| 31 | #define CMOS_BASE 0x70 |
| 32 | |
| 33 | #define CMOS_SECONDS 0 |
| 34 | #define CMOS_MINUTES 2 |
| 35 | #define CMOS_HOURS 4 |
| 36 | #define CMOS_WEEK_DAY 6 |
| 37 | #define CMOS_DAY 7 |
| 38 | #define CMOS_MONTH 8 |
| 39 | #define CMOS_YEAR 9 |
| 40 | |
| 41 | #define CMOS_FREQ_SELECT 10 |
| 42 | |
| 43 | /* Register flags */ |
| 44 | |
| 45 | #define CMOS_UIP 0x80 |
| 46 | |
| 47 | static inline BYTE CmosRead(BYTE addr) |
| 48 | { |
| 49 | outb(CMOS_BASE,addr); |
| 50 | inb(0x80); /* Delay things */ |
| 51 | return inb(CMOS_BASE+1); |
| 52 | } |
| 53 | |
| 54 | static inline void CmosWrite(BYTE addr,BYTE val) |
| 55 | { |
| 56 | outb(CMOS_BASE,addr); |
| 57 | inb(0x80); |
| 58 | outb(CMOS_BASE+1,val); |
| 59 | } |
| 60 | |
| 61 | #endif |
Note: See TracBrowser
for help on using the browser.
