12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- /*
- * clock.h
- *
- * Copyright 2013 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef _CLOCK_H_
- #define _CLOCK_H_
- #include <common.h>
- #define CLOCK_IRQ 8
- #define CLOCK_PM_BIT (1 << 7)
- #define CLOCK_DAYLIGHT_SAVINGS (1 << 0)
- #define CLOCK_24HOUR_MODE (1 << 1)
- #define CLOCK_BINARY_MODE (1 << 2)
- #define CLOCK_SQUARE_WAVE (1 << 3)
- #define CLOCK_UPDATE_INT (1 << 4)
- #define CLOCK_ALARM_INT (1 << 5)
- #define CLOCK_PERIODIC_INT (1 << 6)
- #define CLOCK_DISABLE (1 << 7)
- #define CMOS_RTC_SECONDS_REG 0x00
- #define CMOS_RTC_MINUTES_REG 0x02
- #define CMOS_RTC_HOURS_REG 0x04
- #define CMOS_RTC_DAY_REG 0x07
- #define CMOS_RTC_MONTH_REG 0x08
- #define CMOS_RTC_YEAR_REG 0x09
- #define CMOS_RTC_STA_REG 0x0A
- #define CMOS_RTC_STB_REG 0x0B
- #define CMOS_RTC_STC_REG 0x0C
- typedef struct
- {
- word_t year;
- byte_t day, month, hours, minutes, seconds;
- } clock_time_t;
- void clock_init();
- dword_t clock_get_time(clock_time_t *time);
- bool_t clock_check_time(clock_time_t *time);
- dword_t clock_set_time(clock_time_t *time);
- #endif
|