1 /*
2  * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /******************************************************************************
17  * @file     ck_rtc.h
18  * @brief    header file for rtc driver
19  * @version  V1.0
20  * @date     02. June 2017
21  ******************************************************************************/
22 #ifndef __CK_RTC_H
23 #define __CK_RTC_H
24 
25 #include <stdio.h>
26 #include "soc.h"
27 
28 #define SEC_PER_MIN  ((time_t)60)
29 #define SEC_PER_HOUR ((time_t)60 * SEC_PER_MIN)
30 #define SEC_PER_DAY  ((time_t)24 * SEC_PER_HOUR)
31 
32 typedef struct {
33     __IM  uint32_t    RTC_CCVR;         /* Offset: 0x000 (R/ )  current count value register */
34     __IOM uint32_t    RTC_CMR;          /* Offset: 0x004 (R/W)  count match register */
35     __IOM uint32_t    RTC_CLR;          /* Offset: 0x008 (R/W)  count load register */
36     __IOM uint32_t    RTC_CCR;          /* Offset: 0x00c (R/W)  count control register */
37     __IM  uint32_t    RTC_STAT;         /* Offset: 0x010 (R/ )  interrupt status register */
38     __IM  uint32_t    RTC_RSTAT;        /* Offset: 0x014 (R/ )  interrupt raw status register */
39     __IM  uint32_t    RTC_EOI;          /* Offset: 0x018 (R/ )  end of interrupt register */
40     __IM  uint32_t    RTC_COMP_VERSION; /* Offset: 0x01c (R/ )  component version register */
41 } ck_rtc_reg_t;
42 
43 #endif /* __CK_RTC_H */
44 
45