ck_rtc.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #include <stdio.h>
  25. #include "soc.h"
  26. #define SEC_PER_MIN ((time_t)60)
  27. #define SEC_PER_HOUR ((time_t)60 * SEC_PER_MIN)
  28. #define SEC_PER_DAY ((time_t)24 * SEC_PER_HOUR)
  29. typedef struct {
  30. __IM uint32_t RTC_CCVR; /* Offset: 0x000 (R/ ) current count value register */
  31. __IOM uint32_t RTC_CMR; /* Offset: 0x004 (R/W) count match register */
  32. __IOM uint32_t RTC_CLR; /* Offset: 0x008 (R/W) count load register */
  33. __IOM uint32_t RTC_CCR; /* Offset: 0x00c (R/W) count control register */
  34. __IM uint32_t RTC_STAT; /* Offset: 0x010 (R/ ) interrupt status register */
  35. __IM uint32_t RTC_RSTAT; /* Offset: 0x014 (R/ ) interrupt raw status register */
  36. __IM uint32_t RTC_EOI; /* Offset: 0x018 (R/ ) end of interrupt register */
  37. __IM uint32_t RTC_COMP_VERSION; /* Offset: 0x01c (R/ ) component version register */
  38. } ck_rtc_reg_t;
  39. #endif /* __CK_RTC_H */