projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* Fixed svn:eol-style and svn:keywords properties
[fw/sdcc]
/
device
/
lib
/
ds390
/
rtc390.c
diff --git
a/device/lib/ds390/rtc390.c
b/device/lib/ds390/rtc390.c
old mode 100755
(executable)
new mode 100644
(file)
index
8ed64d6
..
ec07e98
--- a/
device/lib/ds390/rtc390.c
+++ b/
device/lib/ds390/rtc390.c
@@
-32,10
+32,10
@@
range since the chip only uses CE3*
*/
range since the chip only uses CE3*
*/
-
xdata at 0x310000
static volatile unsigned char rtc;
+
__xdata __at (0x310000)
static volatile unsigned char rtc;
// this is the 64bit pattern that has to be recognized by the ds1315
// this is the 64bit pattern that has to be recognized by the ds1315
-code unsigned char rtcMagic[8]={0xc5,0x3a,0xa3,0x5c,0xc5,0x3a,0xa3,0x5c};
+
__
code unsigned char rtcMagic[8]={0xc5,0x3a,0xa3,0x5c,0xc5,0x3a,0xa3,0x5c};
#define BCDtoINT(x) (((x)&0x0f)+((x)>>4)*10)
#define INTtoBCD(x) (((x)%10)+(((x)/10)<<4))
#define BCDtoINT(x) (((x)&0x0f)+((x)>>4)*10)
#define INTtoBCD(x) (((x)%10)+(((x)/10)<<4))
@@
-68,7
+68,7
@@
unsigned char RtcRead(struct tm *rtcDate) {
}
}
}
}
}
}
- rtcDate->tm_year=BCDtoINT(rtcBytes[7]
+100)
; // year since 1900
+ rtcDate->tm_year=BCDtoINT(rtcBytes[7]
)+100
; // year since 1900
rtcDate->tm_mon=BCDtoINT(rtcBytes[6])-1; // jan=0
rtcDate->tm_mday=BCDtoINT(rtcBytes[5]);
rtcDate->tm_wday=(rtcBytes[4]&0x07)-1; // monday=0?
rtcDate->tm_mon=BCDtoINT(rtcBytes[6])-1; // jan=0
rtcDate->tm_mday=BCDtoINT(rtcBytes[5]);
rtcDate->tm_wday=(rtcBytes[4]&0x07)-1; // monday=0?
@@
-87,7
+87,7
@@
void RtcWrite(struct tm *rtcDate) {
unsigned char rtcBytes[8];
unsigned char byte,bitMask;
unsigned char rtcBytes[8];
unsigned char byte,bitMask;
- rtcBytes[7]=INTtoBCD(rtcDate->tm_year
-
100);
+ rtcBytes[7]=INTtoBCD(rtcDate->tm_year
%
100);
rtcBytes[6]=INTtoBCD(rtcDate->tm_mon)+1;
rtcBytes[5]=INTtoBCD(rtcDate->tm_mday);
rtcBytes[4]=(INTtoBCD(rtcDate->tm_wday)+1)&0x07; //set 24h mode
rtcBytes[6]=INTtoBCD(rtcDate->tm_mon)+1;
rtcBytes[5]=INTtoBCD(rtcDate->tm_mday);
rtcBytes[4]=(INTtoBCD(rtcDate->tm_wday)+1)&0x07; //set 24h mode