tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8830 / rtc_drvapi.h
1 /******************************************************************************
2  ** File Name:      rtc_drvapi.h                                                 *
3  ** Author:         Xueliang.Wang                                             *
4  ** DATE:           10/10/2002                                                *
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  ******************************************************************************
9
10  ******************************************************************************
11  **                        Edit History                                       *
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 /**---------------------------------------------------------------------------*
20  **                         Dependencies                                      *
21  **---------------------------------------------------------------------------*/
22 /**---------------------------------------------------------------------------*
23  **                         Debugging Flag                                    *
24  **---------------------------------------------------------------------------*/
25 /**---------------------------------------------------------------------------*
26  **                         Compiler Flag                                     *
27  **---------------------------------------------------------------------------*/
28 #ifdef   __cplusplus
29 extern   "C"
30 {
31 #endif
32
33 /**---------------------------------------------------------------------------*
34  **                         Global Variables                                  *
35  **---------------------------------------------------------------------------*/
36 /**---------------------------------------------------------------------------*
37  **                         Constant Variables                                *
38  **---------------------------------------------------------------------------*/
39
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)
47
48 /**---------------------------------------------------------------------------*
49  **                         Data Structures                                   *
50  **---------------------------------------------------------------------------*/
51 typedef enum
52 {
53     RTC_INT_START = 0,
54     RTC_INT_SEC = RTC_INT_START,
55     RTC_INT_MIN ,
56     RTC_INT_HOUR,
57     RTC_INT_DAY ,
58     RTC_INT_ALARM,
59     RTC_INT_MAX
60 }
61 RTC_INTTYPE_E;
62
63 typedef struct TB_RTC_TIME_tag
64 {
65     uint8   sec;
66     uint8   min;
67     uint8   hour;
68     uint16  day;
69 } TB_RTC_TIME_T;
70
71
72 /**---------------------------------------------------------------------------*
73  **                         Function Prototypes                               *
74  **---------------------------------------------------------------------------*/
75
76 /*****************************************************************************/
77 //  Description:    Init RTC device. All interrupts of RTC was disabled.
78 //  Author:         Lin.Liu
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
89 //  Note:
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.
94 );
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.
100 //  Author:         Eric.zhou
101 //  Note:
102 /*****************************************************************************/
103 PUBLIC uint32 RTC_SetDay ( // If set successfully, return TB_SUCCESS;
104     // else return error code.
105     uint32  day
106 );
107 /*****************************************************************************/
108 //  Description:    Get RTC value.
109 //  Author:         Xueliang.Wang
110 //  Note:
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.
115 );
116
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
123 //  Note:
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.
128 );
129
130 /*****************************************************************************/
131 //  Description:    Get Alarm time.
132 //  Author:         Xueliang.Wang
133 //  Note:
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.
138 );
139
140
141 /*****************************************************************************/
142 //  Description:    Disable Alarm.
143 //  Author:         Xueliang.Wang
144 //  Note:
145 /*****************************************************************************/
146 PUBLIC void RTC_DisableAlarm (void);
147
148 /*****************************************************************************/
149 //  Description:    Set Rtc Int disable/enable
150 //  Author:         Xueliang.Wang
151 //  Note:
152 /*****************************************************************************/
153 PUBLIC uint32 RTC_SetRtcInt (RTC_INTTYPE_E type, BOOLEAN value);
154
155
156 /*******************************************************************************/
157 // Description: This function used to clear alarm int status value
158 // Global resource dependence: none
159 // Author: yuhua.shi
160 // Note:
161 /********************************************************************************/
162 PUBLIC void RTC_ClearAlarmInt (void);
163
164
165 /*below are removed from driver_export.c, wait clean up*/
166 PUBLIC uint32 CheckRTCState (void);
167 /**---------------------------------------------------------------------------*
168  **                         Compiler Flag                                     *
169  **---------------------------------------------------------------------------*/
170 #ifdef   __cplusplus
171 }
172 #endif
173
174 #endif //_RTC_DRVAPI_H_
175