diff options
Diffstat (limited to '')
-rw-r--r-- | c/src/libchip/rtc/ds1375.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/c/src/libchip/rtc/ds1375.c b/c/src/libchip/rtc/ds1375.c index 2a63c47755..4946e9a9df 100644 --- a/c/src/libchip/rtc/ds1375.c +++ b/c/src/libchip/rtc/ds1375.c @@ -2,20 +2,20 @@ /* Driver for the Maxim 1375 i2c RTC (TOD only; very simple...) */ -/* +/* * Authorship * ---------- * This software was created by * * Till Straumann <strauman@slac.stanford.edu>, 2005-2007, * Stanford Linear Accelerator Center, Stanford University. - * + * * Acknowledgement of sponsorship * ------------------------------ * The software was produced by * the Stanford Linear Accelerator Center, Stanford University, * under Contract DE-AC03-76SFO0515 with the Department of Energy. - * + * * Government disclaimer of liability * ---------------------------------- * Neither the United States nor the United States Department of Energy, @@ -24,18 +24,18 @@ * completeness, or usefulness of any data, apparatus, product, or process * disclosed, or represents that its use would not infringe privately owned * rights. - * + * * Stanford disclaimer of liability * -------------------------------- * Stanford University makes no representations or warranties, express or * implied, nor assumes any liability for the use of this software. - * + * * Stanford disclaimer of copyright * -------------------------------- * Stanford University, owner of the copyright, hereby disclaims its * copyright and all other rights in this software. Hence, anyone may - * freely use it for any purpose without restriction. - * + * freely use it for any purpose without restriction. + * * Maintenance of notices * ---------------------- * In the interest of clarity regarding the origin and status of this @@ -44,9 +44,9 @@ * or distributed by the recipient and are to be affixed to any copy of * software made or distributed by the recipient that contains a copy or * derivative of this software. - * + * * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03 - */ + */ /* This driver uses the file-system interface to the i2c bus */ @@ -78,7 +78,7 @@ printk(fmt,args); \ } \ } while (0) - + STATIC uint8_t ds1375_bcd2bin(uint8_t x) { @@ -190,7 +190,7 @@ STATIC int wr_bytes( * the chip interprets the first byte after START as * the register pointer. */ - + d[0] = off; memcpy( d + 1, buf, len ); @@ -290,7 +290,7 @@ STATIC int ds1375_set_time( buf[DS1375_DAY_OFF] = tm.tm_wday + 1; buf[DS1375_DAT_OFF] = ds1375_bin2bcd( time->day ); buf[DS1375_MON_OFF] = ds1375_bin2bcd( time->month ); - + if ( time->year >= 2000 ) { buf[DS1375_YR_OFF] = ds1375_bin2bcd( time->year - 2000 ); buf[DS1375_MON_OFF] |= DS1375_MON_CTRY; @@ -323,7 +323,7 @@ STATIC int ds1375_set_time( goto cleanup; rval = 0; - + cleanup: if ( fd >= 0 ) { if ( ! ( DS1375_CR_ECLK & cr ) ) { @@ -352,8 +352,8 @@ ds1375_get_time_tst() { rtems_time_of_day rtod; time_t secs; - - ds1375_get_time( 0, &rtod ); + + ds1375_get_time( 0, &rtod ); secs = _TOD_To_seconds( &rtod ); printf( "%s\n", ctime( &secs ) ); return secs; @@ -374,7 +374,7 @@ rtems_time_of_day rt; if ( ! prt ) prt = &rt; - + secs = mktime( &tm ); /* convert to UTC */ @@ -417,7 +417,7 @@ rtc_ds1375_set_register( uint32_t port, uint8_t reg, uint32_t value ) { int fd; uint8_t v = value; - + if ( ( fd = open( (const char*)port, O_RDWR ) ) >= 0 ) { wr_bytes( fd, reg, &v, 1 ); close( fd ); |