1 /******************************************************************************
2 ** File Name: rtc_drvapi.h *
3 ** Author: Xueliang.Wang *
5 ** Copyright: 2002 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: This file defines the basic operation interfaces of *
7 ** Real Timer Counter and Alarm. *
8 ******************************************************************************
10 ******************************************************************************
12 ** ------------------------------------------------------------------------- *
13 ** DATE NAME DESCRIPTION *
14 ** 10/10/2002 Xueliang.Wang Create. *
15 ** 08/29/2005 Weihua.wang Modify.
16 ******************************************************************************/
17 #ifndef _RTC_DRVAPI_H_
18 #define _RTC_DRVAPI_H_
19 /**---------------------------------------------------------------------------*
21 **---------------------------------------------------------------------------*/
22 /**---------------------------------------------------------------------------*
24 **---------------------------------------------------------------------------*/
25 /**---------------------------------------------------------------------------*
27 **---------------------------------------------------------------------------*/
33 /**---------------------------------------------------------------------------*
35 **---------------------------------------------------------------------------*/
36 /**---------------------------------------------------------------------------*
37 ** Constant Variables *
38 **---------------------------------------------------------------------------*/
40 // Real Time Counter constant.
41 #define TB_RTC_CONST_BASE 0x70
42 #define TB_RTC_TIME_RANGE_ERROR (TB_RTC_CONST_BASE + 1)
43 #define TB_RTC_INT_ALARM (TB_RTC_CONST_BASE + 2)
44 #define TB_RTC_INT_DAY (TB_RTC_CONST_BASE + 3)
45 #define TB_RTC_INT_MIN (TB_RTC_CONST_BASE + 4)
46 #define TB_RTC_INT_HOUR (TB_RTC_CONST_BASE + 5)
48 /**---------------------------------------------------------------------------*
50 **---------------------------------------------------------------------------*/
54 RTC_INT_SEC = RTC_INT_START,
63 typedef struct TB_RTC_TIME_tag
72 /**---------------------------------------------------------------------------*
73 ** Function Prototypes *
74 **---------------------------------------------------------------------------*/
76 /*****************************************************************************/
77 // Description: Init RTC device. All interrupts of RTC was disabled.
79 // Note: If initialize successfully, return TB_SUCCESS;
80 // else return error code.
81 /*****************************************************************************/
82 PUBLIC uint32 RTC_Init (void);
83 /*****************************************************************************/
84 // Description: Set RTC value.
85 // This function check the parameter first.
86 // If it is valid, set the time value to RTC register;
87 // Else return error code.
88 // Author: Xueliang.Wang
90 /*****************************************************************************/
91 PUBLIC uint32 RTC_Set ( // If set successfully, return TB_SUCCESS;
92 // else return error code.
93 TB_RTC_TIME_T time // Time value to be set to RTC register.
95 /*****************************************************************************/
96 // Description: Set RTC's day value.
97 // This function check the parameter first.
98 // If it is valid, set the time value to RTC register;
99 // Else return error code.
102 /*****************************************************************************/
103 PUBLIC uint32 RTC_SetDay ( // If set successfully, return TB_SUCCESS;
104 // else return error code.
107 /*****************************************************************************/
108 // Description: Get RTC value.
109 // Author: Xueliang.Wang
111 /*****************************************************************************/
112 PUBLIC void RTC_Get (
113 TB_RTC_TIME_T *time_ptr // Pointer to a TB_RTC_TIME_T struct,
114 // used to save RTC value.
117 /*****************************************************************************/
118 // Description: Set ALARM time.
119 // This function check the parameter first.
120 // If it is valid, set the time value to alarm register;
121 // Else return error code.
122 // Author: Xueliang.Wang
124 /*****************************************************************************/
125 PUBLIC uint32 RTC_SetAlarm (// If set successfully, return TB_SUCCESS;
126 // else return error code.
127 TB_RTC_TIME_T time // Time value to be set to alarm register.
130 /*****************************************************************************/
131 // Description: Get Alarm time.
132 // Author: Xueliang.Wang
134 /*****************************************************************************/
135 PUBLIC void RTC_GetAlarm (
136 TB_RTC_TIME_T *time_ptr // Pointer to a TB_RTC_TIME_T struct,
137 // used to save Alarm time value.
141 /*****************************************************************************/
142 // Description: Disable Alarm.
143 // Author: Xueliang.Wang
145 /*****************************************************************************/
146 PUBLIC void RTC_DisableAlarm (void);
148 /*****************************************************************************/
149 // Description: Set Rtc Int disable/enable
150 // Author: Xueliang.Wang
152 /*****************************************************************************/
153 PUBLIC uint32 RTC_SetRtcInt (RTC_INTTYPE_E type, BOOLEAN value);
156 /*******************************************************************************/
157 // Description: This function used to clear alarm int status value
158 // Global resource dependence: none
161 /********************************************************************************/
162 PUBLIC void RTC_ClearAlarmInt (void);
165 /*below are removed from driver_export.c, wait clean up*/
166 PUBLIC uint32 CheckRTCState (void);
167 /**---------------------------------------------------------------------------*
169 **---------------------------------------------------------------------------*/
174 #endif //_RTC_DRVAPI_H_