diff options
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r-- | firmware/drivers/fat.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index e3e1a755cb..e4e77627d0 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -31,6 +31,9 @@ | |||
31 | #include "rbunicode.h" | 31 | #include "rbunicode.h" |
32 | #include "logf.h" | 32 | #include "logf.h" |
33 | #include "atoi.h" | 33 | #include "atoi.h" |
34 | #ifdef CONFIG_RTC | ||
35 | #include "rtc.h" | ||
36 | #endif | ||
34 | 37 | ||
35 | #define BYTES2INT16(array,pos) \ | 38 | #define BYTES2INT16(array,pos) \ |
36 | (array[pos] | (array[pos+1] << 8 )) | 39 | (array[pos] | (array[pos+1] << 8 )) |
@@ -945,6 +948,10 @@ static void fat_time(unsigned short* date, | |||
945 | { | 948 | { |
946 | #ifdef CONFIG_RTC | 949 | #ifdef CONFIG_RTC |
947 | struct tm* tm = get_time(); | 950 | struct tm* tm = get_time(); |
951 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
952 | if(rtc_detected) | ||
953 | { | ||
954 | #endif /* CONFIG_RTC == RTC_DS1339_DS3231 */ | ||
948 | 955 | ||
949 | if (date) | 956 | if (date) |
950 | *date = ((tm->tm_year - 80) << 9) | | 957 | *date = ((tm->tm_year - 80) << 9) | |
@@ -958,7 +965,14 @@ static void fat_time(unsigned short* date, | |||
958 | 965 | ||
959 | if (tenth) | 966 | if (tenth) |
960 | *tenth = (tm->tm_sec & 1) * 100; | 967 | *tenth = (tm->tm_sec & 1) * 100; |
961 | #else | 968 | |
969 | #if CONFIG_RTC == RTC_DS1339_DS3231 | ||
970 | } | ||
971 | else | ||
972 | #endif /* CONFIG_RTC == RTC_DS1339_DS3231 */ | ||
973 | #endif /* CONFIG_RTC */ | ||
974 | #if !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231 | ||
975 | { | ||
962 | /* non-RTC version returns an increment from the supplied time, or a | 976 | /* non-RTC version returns an increment from the supplied time, or a |
963 | * fixed standard time/date if no time given as input */ | 977 | * fixed standard time/date if no time given as input */ |
964 | bool next_day = false; | 978 | bool next_day = false; |
@@ -1025,9 +1039,9 @@ static void fat_time(unsigned short* date, | |||
1025 | } | 1039 | } |
1026 | if (tenth) | 1040 | if (tenth) |
1027 | *tenth = 0; | 1041 | *tenth = 0; |
1028 | #endif /* CONFIG_RTC */ | 1042 | } |
1043 | #endif /* !defined(CONFIG_RTC) || CONFIG_RTC == RTC_DS1339_DS3231 */ | ||
1029 | } | 1044 | } |
1030 | |||
1031 | static int write_long_name(struct fat_file* file, | 1045 | static int write_long_name(struct fat_file* file, |
1032 | unsigned int firstentry, | 1046 | unsigned int firstentry, |
1033 | unsigned int numentries, | 1047 | unsigned int numentries, |