aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/hal_rtc.h
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-10-14 12:31:41 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-10-14 12:31:41 +0000
commitdbf616f8b33d53419b03d95197c5ceec0c3f0351 (patch)
tree0a0afb5db7681f7eac89026fc0770ddb80a6e62f /os/hal/include/hal_rtc.h
parent8ec0f1a75387fadd2b0179a02b9f7f81e37b2fe1 (diff)
downloadChibiOS-dbf616f8b33d53419b03d95197c5ceec0c3f0351.tar.gz
ChibiOS-dbf616f8b33d53419b03d95197c5ceec0c3f0351.tar.bz2
ChibiOS-dbf616f8b33d53419b03d95197c5ceec0c3f0351.zip
Changes to the RTC driver to use the persistent storage interface,
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12366 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/include/hal_rtc.h')
-rw-r--r--os/hal/include/hal_rtc.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/os/hal/include/hal_rtc.h b/os/hal/include/hal_rtc.h
index 63a916b22..342d61815 100644
--- a/os/hal/include/hal_rtc.h
+++ b/os/hal/include/hal_rtc.h
@@ -88,6 +88,11 @@
typedef struct RTCDriver RTCDriver;
/**
+ * @brief Type of an RTC alarm number.
+ */
+typedef unsigned int rtcalarm_t;
+
+/**
* @brief Type of a structure representing an RTC date/time stamp.
*/
typedef struct {
@@ -101,8 +106,56 @@ typedef struct {
/*lint -restore*/
} RTCDateTime;
+/**
+ * @brief BasePersistentStorage specific methods.
+ */
+#define _rtc_driver_methods \
+ _base_persistent_storage_methods
+
#include "hal_rtc_lld.h"
+/* Some more checks, must happen after inclusion of the LLD header, this is
+ why are placed here.*/
+#if !defined(RTC_SUPPORTS_CALLBACKS)
+#error "RTC LLD does not define the required RTC_SUPPORTS_CALLBACKS macro"
+#endif
+
+#if !defined(RTC_ALARMS)
+#error "RTC LLD does not define the required RTC_ALARMS macro"
+#endif
+
+#if !defined(RTC_HAS_STORAGE)
+#error "RTC LLD does not define the required RTC_HAS_STORAGE macro"
+#endif
+
+#if RTC_HAS_STORAGE || defined(__DOXYGEN__)
+/**
+ * @extends FileStream
+ *
+ * @brief @p RTCDriver virtual methods table.
+ */
+struct RTCDriverVMT {
+ _rtc_driver_methods
+};
+#endif
+
+/**
+ * @brief Structure representing an RTC driver.
+ */
+struct RTCDriver {
+#if RTC_HAS_STORAGE || defined(__DOXYGEN__)
+ /**
+ * @brief Virtual Methods Table.
+ */
+ const struct RTCDriverVMT *vmt;
+#endif
+#if defined(RTC_DRIVER_EXT_FIELDS)
+ RTC_DRIVER_EXT_FIELDS
+#endif
+ /* End of the mandatory fields.*/
+ _rtc_lld_driver_fields
+};
+
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
@@ -111,6 +164,13 @@ typedef struct {
/* External declarations. */
/*===========================================================================*/
+#if !defined(__DOXYGEN__)
+extern RTCDriver RTCD1;
+#if RTC_HAS_STORAGE == TRUE
+extern struct RTCDriverVMT _rtc_lld_vmt;
+#endif
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif