diff options
author | Albin Tonnerre <albin.tonnerre@free-electrons.com> | 2009-08-13 15:31:11 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-08-25 12:57:55 +0200 |
commit | e84aba135ed7145299304ef550e92f08b2c99d7a (patch) | |
tree | a70c19d295abf01ca9f53f01fb008cab416a6b6e /board/rsdproto | |
parent | 5b53b29bc2e82b80b669f1d2402068c60d7fecd0 (diff) | |
download | u-boot-imx-e84aba135ed7145299304ef550e92f08b2c99d7a.zip u-boot-imx-e84aba135ed7145299304ef550e92f08b2c99d7a.tar.gz u-boot-imx-e84aba135ed7145299304ef550e92f08b2c99d7a.tar.bz2 |
Replace BCD2BIN and BIN2BCD macros with inline functions
In the process, also remove backward-compatiblity macros BIN_TO_BCD and
BCD_TO_BIN and update the sole board using them to use the new bin2bcd
and bcd2bin instead
Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Acked-by: Stefan Roese <sr@denx.de>
Acked-by: Detlev Zundel <dzu@denx.de>
Diffstat (limited to 'board/rsdproto')
-rw-r--r-- | board/rsdproto/rsdproto.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/board/rsdproto/rsdproto.c b/board/rsdproto/rsdproto.c index 26edb2e..10759b7 100644 --- a/board/rsdproto/rsdproto.c +++ b/board/rsdproto/rsdproto.c @@ -26,6 +26,7 @@ #include <ioports.h> #include <mpc8260.h> #include <i2c.h> +#include <bcd.h> /* 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)); |