diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-10-14 12:31:41 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-10-14 12:31:41 +0000 |
commit | dbf616f8b33d53419b03d95197c5ceec0c3f0351 (patch) | |
tree | 0a0afb5db7681f7eac89026fc0770ddb80a6e62f /os/hal/include | |
parent | 8ec0f1a75387fadd2b0179a02b9f7f81e37b2fe1 (diff) | |
download | ChibiOS-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')
-rw-r--r-- | os/hal/include/hal_persistent.h | 2 | ||||
-rw-r--r-- | os/hal/include/hal_rtc.h | 60 |
2 files changed, 61 insertions, 1 deletions
diff --git a/os/hal/include/hal_persistent.h b/os/hal/include/hal_persistent.h index d0d6c4472..f0aed89b9 100644 --- a/os/hal/include/hal_persistent.h +++ b/os/hal/include/hal_persistent.h @@ -49,7 +49,7 @@ typedef enum {
PS_NO_ERROR = 0, /* No error. */
PS_ERROR_READ = 2, /* ECC or other error during read operation.*/
- PS_ERROR_PROGRAM = 3, /* Program operation failed. */
+ PS_ERROR_WRITE= 3, /* Program operation failed. */
PS_ERROR_VERIFY = 5, /* Verify operation failed. */
PS_ERROR_HW_FAILURE = 6 /* Controller or communication error. */
} ps_error_t;
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
|