3#ifndef __LIBWW_SYS_TIMER_H__
4#define __LIBWW_SYS_TIMER_H__
12#define RTC_DAY_OF_WEEK 3
22#define TIMER_ONESHOT 0
23#define TIMER_AUTOPRESET 1
25#define rtc_set_year(value) rtc_set_datetime(RTC_YEAR, value)
26#define rtc_set_month(value) rtc_set_datetime(RTC_MONTH, value)
27#define rtc_set_date(value) rtc_set_datetime(RTC_DATE, value)
28#define rtc_set_day_of_week(value) rtc_set_datetime(RTC_DAY_OF_WEEK, value)
29#define rtc_set_hour(value) rtc_set_datetime(RTC_HOUR, value)
30#define rtc_set_min(value) rtc_set_datetime(RTC_MIN, value)
31#define rtc_set_sec(value) rtc_set_datetime(RTC_SEC, value)
33#define rtc_get_year() rtc_get_datetime(RTC_YEAR)
34#define rtc_get_month() rtc_get_datetime(RTC_MONTH)
35#define rtc_get_date() rtc_get_datetime(RTC_DATE)
36#define rtc_get_day_of_week() rtc_get_datetime(RTC_DAY_OF_WEEK)
37#define rtc_get_hour() rtc_get_datetime(RTC_HOUR)
38#define rtc_get_min() rtc_get_datetime(RTC_MIN)
39#define rtc_get_sec() rtc_get_datetime(RTC_SEC)
46 :
"Rah" ((uint8_t) 0x00)
56 :
"b" (field),
"c" (value),
"Rah" ((uint8_t) 0x01)
66 :
"b" (field),
"Rah" ((uint8_t) 0x02)
81 :
"b" (((minute << 8) | hour)),
"Rah" ((uint8_t) 0x05)
91 :
"Rah" ((uint8_t) 0x06)
96static inline void timer_enable(uint8_t type, uint16_t reload, uint16_t count) {
101 :
"a" ((uint16_t) (((0x07) << 8) | (type & 0xFF))),
"b" (reload),
"c" (count)
111 :
"a" ((uint16_t) (((0x08) << 8) | (type & 0xFF)))
121 :
"a" ((uint16_t) (((0x09) << 8) | (type & 0xFF)))
void rtc_get_datetime_struct(datetime_t __far *value)
static void rtc_disable_alarm(void)
static void rtc_set_datetime(uint16_t field, uint16_t value)
static void rtc_reset(void)
static void timer_enable(uint8_t type, uint16_t reload, uint16_t count)
static uint16_t rtc_get_datetime(uint16_t field)
static void rtc_enable_alarm(uint8_t hour, uint8_t minute)
static void timer_get_count(uint8_t type)
static void timer_disable(uint8_t type)
void rtc_set_datetime_struct(const datetime_t __far *value)