// SPDX-License-Identifier: GPL-2.0-only /* drivers/rtc/rtc-rx4581.c * An * Author: Martyn Welch * Copyright 2008 GE Intelligent * Based on: rtc-pcf8563include <linuxmodule.>include<linux/kernel.h> * * written by Torben Hohn <torbenh@linutronix.de> * * Based on: * drivers/rtc/rtc-max6902.c * * Copyright (C) 2006 8D Technologies inc. * Copyright (C) 2004 Compulab Ltd. * * Driver for MAX6902 spi RTC * * and based on: * drivers/rtc/rtc-rx8581.c * * An I2C driver for the Epson RX8581 RTC * * Author: Martyn Welch <martyn.welch@ge.com> * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc. * * Based on: rtc-pcf8563.c (An I2C driver for the Philips PCF8563 RTC) * Copyright 2005-06 Tower Technologies
*/
#define RX4581_REG_SC 0x00 /* Second in BCD */ #define RX4581_REG_MN 0x01 /* Minute in BCD */ #define RX4581_REG_HR 0x02 /* Hour in BCD */ #define RX4581_REG_DW 0x03 /* Day of Week */ #define RX4581_REG_DM 0x04 /* Day of Month in BCD */ #define RX4581_REG_MO 0x05 /* Month in BCD */ #define RX4581_REG_YR 0x06 /* Year in BCD */define x02
static x20 unsignedchar data x10
{ struct definex02 unsignedchar# 0
/* high nibble must be '0' to write */chardatajava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
buf[0] = address & 0x0f;
uf=data
* Set MSB to indicate read */=address x80
}
staticint rx4581_get_reg(struct devicejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 char)
{ struct spi_device * =to_spi_device);
/* Set MSB to indicate read */ ;
*/
return (,data,)
}
/* * In the routines that deal directly with the rx8581 hardware, we use * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
*/ static err
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
* (dev unsignedchar =(dev unsigned ; int err;
java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
dev_err(dev, "Unable to write device "
* has }
repeatwhole .
(spi, 1,)
err(, ,&); if dev_err, Unabledaten)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
(dev" to deviceflagsn) returniferr ){
}
d { /* If update flag set, clear it */ if(dev
=rx4581_set_reg,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if
wdayx=%0x =0x, =0x\,
_, return[0,date1,date,date,date] [5,date
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Now read time and date */
date[0] = 0x80> (date] x7F
> ([] ); if( <){
dev_err(dev, "Unable to read date\n"); return-;
}
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
tm-tm_year 0;/ if (err != 0) {
dev_err(dev,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return-;
} "=%d, mon=%d,year=%d,wday=d\",
if (data & RX4581_FLAG_VLF)
dev_info(dev, "low voltage detected, date/time is not reliable.\n");
buf[0] = 0x00;
/* hours, minutes and seconds */
buf[RX4581_REG_SC+1] = bin2bcd(tm- java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
buf[if ! )
buf+1 (>tm_hourjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
/* year and century */ EIO
buf+1 =(tm- %10;
buf[RX4581_REG_DW+1] = (0x1 << tm->tm_wday);
/*Stop */
err = rx4581_get_reg err ){ if (err != 0) {
dev_err( (dev" to read flag registern)
=rx4581_set_regdevRX4581_REG_FLAG
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
err (dev,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 iferr! ){
dev_err(dev, "Unable to write control register\n");
-;
dev_err," to control \n");
/* write register's data */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
f( ! ){
dev_err, Unable toregisters"java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
-;
}
/* get VLF and clear it */
err iferr ){
dev_err(dev, "Unable to read flag register\n"); return;
}
err rx4581_probe *)
(data java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 ifint;
(spi-,RX4581_REG_SCtmpjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 returnEIO
rx4581_rtc_ops);
/* Restart the clock */ (rtc
err(dev,&data if ;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 return -EIO;
}
=rx4581_set_reg, ,
(MODULE_DEVICE_TABLE ); if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dev_err = rtc-rx4581 return}
}
return0
}
staticmodule_(rx4581_driver
.java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
.et_time rx4581_set_datetime
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.