File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
targets/TARGET_Samsung/TARGET_SIDK_S1SBP6A Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 30
30
#include "mbed_debug.h"
31
31
32
32
#define BP6A_RTC_START_TIME 946684800
33
+ #define BP6A_MAX_REG 0x0FFFFFFF
33
34
static bool rtc_initialized = false;
34
35
static bool g_before2000 = false;
35
-
36
+ static time_t g_rtc_offset = 0 ;
36
37
void rtc_init (void )
37
38
{
38
39
if (!rtc_initialized ) {
@@ -73,6 +74,8 @@ time_t rtc_read(void)
73
74
return 0 ;
74
75
}
75
76
77
+ t += g_rtc_offset ;
78
+
76
79
if (g_before2000 ) {
77
80
t -= BP6A_RTC_START_TIME ;
78
81
}
@@ -84,6 +87,12 @@ void rtc_write(time_t t)
84
87
struct rtc_bcd_s rtc_val ;
85
88
struct tm timeinfo ;
86
89
90
+ if (t > BP6A_MAX_REG ) {
91
+ g_rtc_offset = t ;
92
+ t = 0 ;
93
+ } else
94
+ g_rtc_offset = 0 ;
95
+
87
96
/*BP6A : The implicit number of thousands place is 20.*/
88
97
if (t < BP6A_RTC_START_TIME ) {
89
98
g_before2000 = true;
You can’t perform that action at this time.
0 commit comments