X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=board%2Frsdproto%2Frsdproto.c;h=10759b79ca398034d57bd499e61d788aa540f527;hb=be08abc2429c2e9cbce3d0abc1d315171d683520;hp=26edb2e4f8cfbf3696058f01365748f735bffc9c;hpb=cb5473205206c7f14cbb1e747f28ec75b48826e2;p=u-boot diff --git a/board/rsdproto/rsdproto.c b/board/rsdproto/rsdproto.c index 26edb2e4f8..10759b79ca 100644 --- a/board/rsdproto/rsdproto.c +++ b/board/rsdproto/rsdproto.c @@ -26,6 +26,7 @@ #include #include #include +#include /* define to initialise the SDRAM on the local bus */ #undef INIT_LOCAL_BUS_SDRAM @@ -208,16 +209,14 @@ void read_RS5C372_time (struct tm *timedate) { unsigned char buffer[8]; -#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) - if (! i2c_read (RS5C372_PPC_I2C_ADR, 0, 1, buffer, sizeof (buffer))) { - timedate->tm_sec = BCD_TO_BIN (buffer[0]); - timedate->tm_min = BCD_TO_BIN (buffer[1]); - timedate->tm_hour = BCD_TO_BIN (buffer[2]); - timedate->tm_wday = BCD_TO_BIN (buffer[3]); - timedate->tm_mday = BCD_TO_BIN (buffer[4]); - timedate->tm_mon = BCD_TO_BIN (buffer[5]); - timedate->tm_year = BCD_TO_BIN (buffer[6]) + 2000; + timedate->tm_sec = bcd2bin (buffer[0]); + timedate->tm_min = bcd2bin (buffer[1]); + timedate->tm_hour = bcd2bin (buffer[2]); + timedate->tm_wday = bcd2bin (buffer[3]); + timedate->tm_mday = bcd2bin (buffer[4]); + timedate->tm_mon = bcd2bin (buffer[5]); + timedate->tm_year = bcd2bin (buffer[6]) + 2000; } else { /*printf("i2c error %02x\n", rc); */ memset (timedate, 0, sizeof (struct tm));