[rtems commit] atsam: Add atsam_rtc_get_time()

Sebastian Huber sebh at rtems.org
Mon Aug 8 07:36:13 UTC 2016


Module:    rtems
Branch:    master
Commit:    e5fd901141062dce6f372dd391ed11cc676d1d19
Changeset: http://git.rtems.org/rtems/commit/?id=e5fd901141062dce6f372dd391ed11cc676d1d19

Author:    Alexander Krutwig <alexander.krutwig at embedded-brains.de>
Date:      Thu Jul 28 12:01:58 2016 +0200

atsam: Add atsam_rtc_get_time()

---

 c/src/lib/libbsp/arm/atsam/include/bsp.h    |  2 ++
 c/src/lib/libbsp/arm/atsam/rtc/rtc-config.c | 37 ++++++++++++++++-------------
 2 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/c/src/lib/libbsp/arm/atsam/include/bsp.h b/c/src/lib/libbsp/arm/atsam/include/bsp.h
index cee20b7..2c1992d 100644
--- a/c/src/lib/libbsp/arm/atsam/include/bsp.h
+++ b/c/src/lib/libbsp/arm/atsam/include/bsp.h
@@ -87,6 +87,8 @@ extern char atsam_memory_sdram_begin[];
 extern char atsam_memory_sdram_end[];
 extern char atsam_memory_sdram_size[];
 
+void atsam_rtc_get_time(rtems_time_of_day *tod);
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/c/src/lib/libbsp/arm/atsam/rtc/rtc-config.c b/c/src/lib/libbsp/arm/atsam/rtc/rtc-config.c
index 0ea8d48..dca3366 100644
--- a/c/src/lib/libbsp/arm/atsam/rtc/rtc-config.c
+++ b/c/src/lib/libbsp/arm/atsam/rtc/rtc-config.c
@@ -19,14 +19,7 @@
 
 #define ARBITRARY_DAY_OF_WEEK 1
 
-static void atsam_rtc_initialize(int minor)
-{
-  Rtc *rtc = RTC;
-
-  RTC_DisableIt(rtc, 0x1F);
-}
-
-static int atsam_rtc_get_time(int minor, rtems_time_of_day *tod)
+void atsam_rtc_get_time(rtems_time_of_day *tod)
 {
   Rtc *rtc = RTC;
   uint8_t hour;
@@ -47,11 +40,23 @@ static int atsam_rtc_get_time(int minor, rtems_time_of_day *tod)
   tod->day = day;
   tod->month = month;
   tod->year = year;
+}
+
+static void atsam_rtc_device_initialize(int minor)
+{
+  Rtc *rtc = RTC;
+
+  RTC_DisableIt(rtc, 0x1F);
+}
+
+static int atsam_rtc_device_get_time(int minor, rtems_time_of_day *tod)
+{
+  atsam_rtc_get_time(tod);
 
   return 0;
 }
 
-static int atsam_rtc_set_time(int minor, const rtems_time_of_day *tod)
+static int atsam_rtc_device_set_time(int minor, const rtems_time_of_day *tod)
 {
   Rtc *rtc = RTC;
   uint8_t hour;
@@ -76,23 +81,23 @@ static int atsam_rtc_set_time(int minor, const rtems_time_of_day *tod)
   return 0;
 }
 
-static bool atsam_rtc_probe(int minor)
+static bool atsam_rtc_device_probe(int minor)
 {
   return true;
 }
 
-const rtc_fns atsam_rtc_ops = {
-  .deviceInitialize = atsam_rtc_initialize,
-  .deviceGetTime = atsam_rtc_get_time,
-  .deviceSetTime = atsam_rtc_set_time
+const rtc_fns atsam_rtc_device_ops = {
+  .deviceInitialize = atsam_rtc_device_initialize,
+  .deviceGetTime = atsam_rtc_device_get_time,
+  .deviceSetTime = atsam_rtc_device_set_time
 };
 
 rtc_tbl RTC_Table[] = {
   {
     .sDeviceName = "/dev/rtc",
     .deviceType = RTC_CUSTOM,
-    .pDeviceFns = &atsam_rtc_ops,
-    .deviceProbe = atsam_rtc_probe
+    .pDeviceFns = &atsam_rtc_device_ops,
+    .deviceProbe = atsam_rtc_device_probe
   }
 };
 




More information about the vc mailing list