00001 #ifndef RTC_H 00002 #define RTC_H 00003 00004 #define RTC_ADDRESS_PORT 0x70 00005 #define RTC_DATA_PORT 0x71 00006 00007 // address definitions for address port 00008 #define RTC_CLOCK_SECOND 0x00 00009 #define RTC_ALARM_SECOND 0x01 00010 #define RTC_CLOCK_MINUTE 0x02 00011 #define RTC_ALARM_MINUTE 0x03 00012 #define RTC_CLOCK_HOUR 0x04 00013 #define RTC_ALARM_HOUR 0x05 00014 #define RTC_CLOCK_DAY 0x06 00015 #define RTC_CLOCK_DATE 0x07 00016 #define RTC_CLOCK_MONTH 0x08 00017 #define RTC_CLOCK_YEAR 0x09 00018 #define RTC_REG_A 0x0A 00019 #define RTC_REG_B 0x0B 00020 #define RTC_REG_C 0x0C 00021 #define RTC_REG_D 0x0D 00022 00023 #define RTC_PF 0x80 00024 #define RTC_PF 0x40 00025 #define RTC_AF 0x20 00026 #define RTC_UF 0x10 00027 00028 #define PERIODIC_DELAY_TIME 10 //10*0.5 sec= 5sec 00029 00030 typedef struct{ 00031 U8 HasUpdate; 00032 U8 HasAlarm; 00033 U8 HasPeriodic; 00034 U8 PeriodicCounter; 00035 U8 Second; 00036 U8 Minute; 00037 U8 Hour; 00038 U8 Day; 00039 U8 Date; 00040 U8 Month; 00041 U8 Year; 00042 U8 RegisterA; 00043 U8 RegisterB; 00044 U8 RegisterC; 00045 U8 RegisterD; 00046 OS_EVENT RtcEvent; 00047 }RTC_CONTROL; 00048 00049 extern RTC_CONTROL RtcCtrl; 00050 00051 void RtcInit(void); 00052 void RtcHandler(void); 00053 void RtcByteWrite(U8 Address,U8 Data); 00054 U8 RtcByteRead(U8 Address); 00055 00056 #endif
1.5.9