aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/rtc.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/include/rtc.h')
-rw-r--r--os/hal/include/rtc.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/os/hal/include/rtc.h b/os/hal/include/rtc.h
new file mode 100644
index 000000000..4a36f4317
--- /dev/null
+++ b/os/hal/include/rtc.h
@@ -0,0 +1,77 @@
+/**
+ * @file rtc.h
+ * @brief RTC Driver macros and structures.
+ *
+ * @addtogroup RTC
+ * @{
+ */
+
+
+#ifndef _RTC_H_
+#define _RTC_H_
+
+
+
+#if HAL_USE_RTC || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+/* TODO: move this to hal_lld_f103.h & mcuconf.h */
+#define STM32_LSECLK 32768 /**< Low speed external clock. */
+
+
+/* RCC_CFGR register bits definitions.*/
+#define STM32_RTC_NONE (0 << 8) /**< */
+#define STM32_RTC_LSE (1 << 8) /**< LSE oscillator clock used as RTC clock */
+#define STM32_RTC_LSI (2 << 8) /**< LSI oscillator clock used as RTC clock */
+#define STM32_RTC_HSE (3 << 8) /**< HSE oscillator clock divided by 128 used as RTC clock */
+
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+typedef struct RTCDriver RTCDriver;
+
+typedef void (*rtccb_t)(RTCDriver *rtcp);
+
+#include "rtc_lld.h"
+
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void rtcInit(void);
+#if RTC_SUPPORTS_CALLBACKS
+ void rtcStart(RTCDriver *rtcp, RTCConfig *rtccfgp);
+ void rtcStop(void);
+#endif /* RTC_SUPPORTS_CALLBACKS */
+ void rtcSetTime(uint32_t tv_sec);
+ uint32_t rtcGetSec(void);
+ uint16_t rtcGetMsec(void);
+ void rtcSetAlarm(uint32_t tv_alarm);
+ uint32_t rtcGetAlarm(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HAL_USE_RTC */
+#endif /* _RTC_H_ */
+
+/** @} */