summaryrefslogtreecommitdiffstats
path: root/rtc
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-27 21:31:46 +0000
committerwdenk <wdenk>2003-06-27 21:31:46 +0000
commit8bde7f776c77b343aca29b8c7b58464d915ac245 (patch)
tree20f1fd99975215e7c658454a15cdb4ed4694e2d4 /rtc
parent993cad9364c6b87ae429d1ed1130d8153f6f027e (diff)
downloadu-boot-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.gz
u-boot-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.xz
u-boot-8bde7f776c77b343aca29b8c7b58464d915ac245.zip
* Code cleanup:LABEL_2003_06_27_2340
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
Diffstat (limited to 'rtc')
-rw-r--r--rtc/ds12887.c10
-rw-r--r--rtc/ds1307.c8
-rw-r--r--rtc/ds164x.c2
-rw-r--r--rtc/m41t11.c96
4 files changed, 58 insertions, 58 deletions
diff --git a/rtc/ds12887.c b/rtc/ds12887.c
index cf572ccdb4..8b12893ce2 100644
--- a/rtc/ds12887.c
+++ b/rtc/ds12887.c
@@ -56,7 +56,7 @@ static uchar rtc_read (uchar reg)
{
uchar val;
- *(volatile unsigned char*)(RTC_PORT_ADDR) = reg;
+ *(volatile unsigned char*)(RTC_PORT_ADDR) = reg;
__asm__ __volatile__ ("sync");
val = *(volatile unsigned char*)(RTC_PORT_DATA);
@@ -65,7 +65,7 @@ static uchar rtc_read (uchar reg)
static void rtc_write (uchar reg, uchar val)
{
- *(volatile unsigned char*)(RTC_PORT_ADDR) = reg;
+ *(volatile unsigned char*)(RTC_PORT_ADDR) = reg;
__asm__ __volatile__ ("sync");
*(volatile unsigned char*)(RTC_PORT_DATA) = val;
@@ -218,14 +218,14 @@ void rtc_reset (void)
tmp.tm_sec = 0;
#ifdef RTC_DEBUG
- printf ( "RTC: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
- tmp.tm_year, tmp.tm_mon, tmp.tm_mday,
+ printf ( "RTC: %4d-%02d-%02d %2d:%02d:%02d UTC\n",
+ tmp.tm_year, tmp.tm_mon, tmp.tm_mday,
tmp.tm_hour, tmp.tm_min, tmp.tm_sec);
#endif
ctrl_rg = RTC_CB_SET | RTC_CB_24_12 | RTC_CB_DM;
rtc_write(RTC_CONTROL_B,ctrl_rg);
- rtc_set(&tmp);
+ rtc_set(&tmp);
rtc_write(RTC_HOURS_ALARM, 0),
rtc_write(RTC_MINUTES_ALARM, 0),
diff --git a/rtc/ds1307.c b/rtc/ds1307.c
index d2b6bbe82e..4b6d8acbfa 100644
--- a/rtc/ds1307.c
+++ b/rtc/ds1307.c
@@ -105,7 +105,7 @@ void rtc_get (struct rtc_time *tmp)
rtc_write (RTC_SEC_REG_ADDR,
rtc_read (RTC_SEC_REG_ADDR) & ~RTC_SEC_BIT_CH);
}
-
+
tmp->tm_sec = bcd2bin (sec & 0x7F);
tmp->tm_min = bcd2bin (min & 0x7F);
tmp->tm_hour = bcd2bin (hour & 0x3F);
@@ -133,7 +133,7 @@ void rtc_set (struct rtc_time *tmp)
if (tmp->tm_year < 1970 || tmp->tm_year > 2069)
printf("WARNING: year should be between 1970 and 2069!\n");
-
+
rtc_write (RTC_YR_REG_ADDR, bin2bcd (tmp->tm_year % 100));
rtc_write (RTC_MON_REG_ADDR, bin2bcd (tmp->tm_mon));
rtc_write (RTC_DAY_REG_ADDR, bin2bcd (tmp->tm_wday + 1));
@@ -145,8 +145,8 @@ void rtc_set (struct rtc_time *tmp)
/*
- * Reset the RTC. We setting the date back to 1970-01-01.
- * We also enable the oscillator output on the SQW/OUT pin and program
+ * Reset the RTC. We setting the date back to 1970-01-01.
+ * We also enable the oscillator output on the SQW/OUT pin and program
* it for 32,768 Hz output. Note that according to the datasheet, turning
* on the square wave output increases the current drain on the backup
* battery to something between 480nA and 800nA.
diff --git a/rtc/ds164x.c b/rtc/ds164x.c
index 3f329c73cc..3cc76aba00 100644
--- a/rtc/ds164x.c
+++ b/rtc/ds164x.c
@@ -1,7 +1,7 @@
/*
* (C) Copyright 2002
* ARIO Data Networks, Inc. dchiu@ariodata.com
- *
+ *
* modified for DS164x:
* The LEOX team <team@leox.org>, http://www.leox.org
*
diff --git a/rtc/m41t11.c b/rtc/m41t11.c
index 30a101c34d..11a1b086ad 100644
--- a/rtc/m41t11.c
+++ b/rtc/m41t11.c
@@ -98,36 +98,36 @@ static unsigned char bin2bcd (unsigned int n)
void rtc_get (struct rtc_time *tmp)
{
- uchar data[RTC_REG_CNT];
+ uchar data[RTC_REG_CNT];
- i2c_read(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, data, RTC_REG_CNT);
+ i2c_read(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, data, RTC_REG_CNT);
- if( data[RTC_SEC_ADDR] & 0x80 ){
- printf( "m41t11 RTC Clock stopped!!!\n" );
- }
+ if( data[RTC_SEC_ADDR] & 0x80 ){
+ printf( "m41t11 RTC Clock stopped!!!\n" );
+ }
tmp->tm_sec = bcd2bin (data[RTC_SEC_ADDR] & 0x7F);
tmp->tm_min = bcd2bin (data[RTC_MIN_ADDR] & 0x7F);
tmp->tm_hour = bcd2bin (data[RTC_HOUR_ADDR] & 0x3F);
tmp->tm_mday = bcd2bin (data[RTC_DATE_ADDR] & 0x3F);
tmp->tm_mon = bcd2bin (data[RTC_MONTH_ADDR]& 0x1F);
#ifndef CFG_M41T11_EXT_CENTURY_DATA
- tmp->tm_year = CFG_M41T11_BASE_YEAR
- + bcd2bin(data[RTC_YEARS_ADDR])
- + ((data[RTC_HOUR_ADDR]&0x40) ? 100 : 0);
+ tmp->tm_year = CFG_M41T11_BASE_YEAR
+ + bcd2bin(data[RTC_YEARS_ADDR])
+ + ((data[RTC_HOUR_ADDR]&0x40) ? 100 : 0);
#else
- {
- unsigned char cent;
- i2c_read(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
- if( !(data[RTC_HOUR_ADDR] & 0x80) ){
- printf( "m41t11 RTC: cann't keep track of years without CEB set\n" );
- }
- if( (cent & 0x1) != ((data[RTC_HOUR_ADDR]&0x40)>>7) ){
- /*century flip store off new year*/
- cent += 1;
- i2c_write(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
- }
- tmp->tm_year =((int)cent*100)+bcd2bin(data[RTC_YEARS_ADDR]);
- }
+ {
+ unsigned char cent;
+ i2c_read(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
+ if( !(data[RTC_HOUR_ADDR] & 0x80) ){
+ printf( "m41t11 RTC: cann't keep track of years without CEB set\n" );
+ }
+ if( (cent & 0x1) != ((data[RTC_HOUR_ADDR]&0x40)>>7) ){
+ /*century flip store off new year*/
+ cent += 1;
+ i2c_write(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
+ }
+ tmp->tm_year =((int)cent*100)+bcd2bin(data[RTC_YEARS_ADDR]);
+ }
#endif
tmp->tm_wday = bcd2bin (data[RTC_DAY_ADDR] & 0x07);
tmp->tm_yday = 0;
@@ -140,7 +140,7 @@ void rtc_get (struct rtc_time *tmp)
void rtc_set (struct rtc_time *tmp)
{
- uchar data[RTC_REG_CNT];
+ uchar data[RTC_REG_CNT];
debug ( "Set DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n",
tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
@@ -153,50 +153,50 @@ void rtc_set (struct rtc_time *tmp)
data[RTC_MONTH_ADDR] = bin2bcd(tmp->tm_mon);
data[RTC_DAY_ADDR] = bin2bcd(tmp->tm_wday) & 0x07;
- data[RTC_HOUR_ADDR] |= 0x80;/*we will always use CEB*/
+ data[RTC_HOUR_ADDR] |= 0x80;/*we will always use CEB*/
- data[RTC_YEARS_ADDR] = bin2bcd(tmp->tm_year%100);/*same thing either way*/
+ data[RTC_YEARS_ADDR] = bin2bcd(tmp->tm_year%100);/*same thing either way*/
#ifndef CFG_M41T11_EXT_CENTURY_DATA
- if( ((tmp->tm_year - CFG_M41T11_BASE_YEAR) > 200) ||
- (tmp->tm_year < CFG_M41T11_BASE_YEAR) ){
- printf( "m41t11 RTC setting year out of range!!need recompile\n" );
- }
- data[RTC_HOUR_ADDR] |= (tmp->tm_year - CFG_M41T11_BASE_YEAR) > 100 ? 0x40 : 0;
+ if( ((tmp->tm_year - CFG_M41T11_BASE_YEAR) > 200) ||
+ (tmp->tm_year < CFG_M41T11_BASE_YEAR) ){
+ printf( "m41t11 RTC setting year out of range!!need recompile\n" );
+ }
+ data[RTC_HOUR_ADDR] |= (tmp->tm_year - CFG_M41T11_BASE_YEAR) > 100 ? 0x40 : 0;
#else
- {
- unsigned char cent;
- cent = tmp->tm_year ? tmp->tm_year / 100 : 0;
- data[RTC_HOUR_ADDR] |= (cent & 0x1) ? 0x40 : 0;
- i2c_write(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
- }
+ {
+ unsigned char cent;
+ cent = tmp->tm_year ? tmp->tm_year / 100 : 0;
+ data[RTC_HOUR_ADDR] |= (cent & 0x1) ? 0x40 : 0;
+ i2c_write(CFG_I2C_RTC_ADDR, M41T11_YEAR_DATA, 1, &cent, M41T11_YEAR_SIZE);
+ }
#endif
- i2c_write(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, data, RTC_REG_CNT);
+ i2c_write(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, data, RTC_REG_CNT);
}
void rtc_reset (void)
{
- unsigned char val;
+ unsigned char val;
/* clear all control & status registers */
- i2c_read(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, &val, 1);
- val = val & 0x7F;/*make sure we are running*/
- i2c_write(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, &val, RTC_REG_CNT);
+ i2c_read(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, &val, 1);
+ val = val & 0x7F;/*make sure we are running*/
+ i2c_write(CFG_I2C_RTC_ADDR, RTC_SEC_ADDR, 1, &val, RTC_REG_CNT);
- i2c_read(CFG_I2C_RTC_ADDR, RTC_CONTROL_ADDR, 1, &val, 1);
- val = val & 0x3F;/*turn off freq test keep calibration*/
- i2c_write(CFG_I2C_RTC_ADDR, RTC_CONTROL_ADDR, 1, &val, 1);
+ i2c_read(CFG_I2C_RTC_ADDR, RTC_CONTROL_ADDR, 1, &val, 1);
+ val = val & 0x3F;/*turn off freq test keep calibration*/
+ i2c_write(CFG_I2C_RTC_ADDR, RTC_CONTROL_ADDR, 1, &val, 1);
}
int rtc_store(int addr, unsigned char* data, int size)
{
- /*don't let things wrap onto the time on a write*/
- if( (addr+size) >= M41T11_STORAGE_SZ )
- return 1;
- return i2c_write( CFG_I2C_RTC_ADDR, REG_CNT+addr, 1, data, size );
+ /*don't let things wrap onto the time on a write*/
+ if( (addr+size) >= M41T11_STORAGE_SZ )
+ return 1;
+ return i2c_write( CFG_I2C_RTC_ADDR, REG_CNT+addr, 1, data, size );
}
int rtc_recall(int addr, unsigned char* data, int size)
{
- return i2c_read( CFG_I2C_RTC_ADDR, REG_CNT+addr, 1, data, size );
+ return i2c_read( CFG_I2C_RTC_ADDR, REG_CNT+addr, 1, data, size );
}
#endif /* CONFIG_RTC_M41T11 && CFG_I2C_RTC_ADDR && CFG_CMD_DATE */