diff options
author | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-08-30 22:52:11 +0000 |
---|---|---|
committer | barthess <barthess@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-08-30 22:52:11 +0000 |
commit | 22d2162db773e677c900b8b397889b7087470248 (patch) | |
tree | a32274c84becb0fbca5d8ad28c5f82ac9588e884 /os/hal/include | |
parent | 2af45df545a58332d5f806d8763661fd556d7ba4 (diff) | |
download | ChibiOS-22d2162db773e677c900b8b397889b7087470248.tar.gz ChibiOS-22d2162db773e677c900b8b397889b7087470248.tar.bz2 ChibiOS-22d2162db773e677c900b8b397889b7087470248.zip |
RTC. Initial commit.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/rtc_dev@3269 35acf78f-673a-0410-8e92-d51de3d6d3f4
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_ */
+
+/** @} */
|