00001 /***************************************************************************** 00002 * rtc.h: Header file for NXP LPC23xx/24xx Family Microprocessors 00003 * 00004 * Copyright(C) 2006, NXP Semiconductor 00005 * All rights reserved. 00006 * 00007 * History 00008 * 2006.07.13 ver 1.00 Prelimnary version, first Release 00009 * 00010 ******************************************************************************/ 00011 #ifndef __RTC_H__ 00012 #define __RTC_H__ 00013 00014 typedef int DWORD; 00015 00016 typedef struct { 00017 DWORD RTC_Sec; /* Second value - [0,59] */ 00018 DWORD RTC_Min; /* Minute value - [0,59] */ 00019 DWORD RTC_Hour; /* Hour value - [0,23] */ 00020 DWORD RTC_Mday; /* Day of the month value - [1,31] */ 00021 DWORD RTC_Mon; /* Month value - [1,12] */ 00022 DWORD RTC_Year; /* Year value - [0,4095] */ 00023 DWORD RTC_Wday; /* Day of week value - [0,6] */ 00024 DWORD RTC_Yday; /* Day of year value - [1,365] */ 00025 } RTCTime; 00026 00027 #define IMSEC 0x00000001 00028 #define IMMIN 0x00000002 00029 #define IMHOUR 0x00000004 00030 #define IMDOM 0x00000008 00031 #define IMDOW 0x00000010 00032 #define IMDOY 0x00000020 00033 #define IMMON 0x00000040 00034 #define IMYEAR 0x00000080 00035 00036 #define AMRSEC 0x00000001 /* Alarm mask for Seconds */ 00037 #define AMRMIN 0x00000002 /* Alarm mask for Minutes */ 00038 #define AMRHOUR 0x00000004 /* Alarm mask for Hours */ 00039 #define AMRDOM 0x00000008 /* Alarm mask for Day of Month */ 00040 #define AMRDOW 0x00000010 /* Alarm mask for Day of Week */ 00041 #define AMRDOY 0x00000020 /* Alarm mask for Day of Year */ 00042 #define AMRMON 0x00000040 /* Alarm mask for Month */ 00043 #define AMRYEAR 0x00000080 /* Alarm mask for Year */ 00044 00045 #define PREINT_RTC 0x000001C8 /* Prescaler value, integer portion, 00046 PCLK = 15Mhz */ 00047 #define PREFRAC_RTC 0x000061C0 /* Prescaler value, fraction portion, 00048 PCLK = 15Mhz */ 00049 #define ILR_RTCCIF 0x01 00050 #define ILR_RTCALF 0x02 00051 00052 #define CCR_CLKEN 0x01 00053 #define CCR_CTCRST 0x02 00054 #define CCR_CLKSRC 0x10 00055 00056 //void RTCHandler (void); 00057 void RTCInit( void ); 00058 void RTCStart( void ); 00059 void RTCStop( void ); 00060 void RTC_CTCReset( void ); 00061 void RTCSetTime( RTCTime ); 00062 RTCTime RTCGetTime( void ); 00063 void RTCSetAlarm( RTCTime ); 00064 void RTCSetAlarmMask( DWORD AlarmMask ); 00065 void RTCClearTime(); 00066 00067 #endif /* end __RTC_H */ 00068 /***************************************************************************** 00069 ** End Of File 00070 ******************************************************************************/