diff options
Diffstat (limited to 'os/hal/include')
-rw-r--r-- | os/hal/include/hal.h | 1 | ||||
-rw-r--r-- | os/hal/include/rtc.h | 77 |
2 files changed, 78 insertions, 0 deletions
diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h index 1ed893aab..b92789b02 100644 --- a/os/hal/include/hal.h +++ b/os/hal/include/hal.h @@ -49,6 +49,7 @@ #include "usb.h"
#include "mmc_spi.h"
#include "serial_usb.h"
+#include "rtc.h"
/*===========================================================================*/
/* External declarations. */
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_ */
+
+/** @} */
|