/* * In the routines that deal directly with the ds1672 hardware, we use * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch * Time is set to UTC.
*/ staticint ds1672_read_time(struct device *dev, struct rtc_time *tm)
{ struct i2c_client *client = to_i2c_client(dev); unsignedlong time; unsignedchar addr = DS1672_REG_CONTROL; unsignedchar buf[4];
/* read control register */ if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) {
dev_warn(&client->dev, "Unable to read the control register\n"); return -EIO;
}
if (buf[0] & DS1672_REG_CONTROL_EOSC) {
dev_warn(&client->dev, "Oscillator not enabled. Set time to enable.\n"); return -EINVAL;
}
addr = DS1672_REG_CNT_BASE;
msgs[1].len = 4;
/* read date registers */ if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) {
dev_err(&client->dev, "%s: read error\n", __func__); return -EIO;
}
dev_dbg(&client->dev, "%s: raw read data - counters=%02x,%02x,%02x,%02x\n",
__func__, buf[0], buf[1], buf[2], buf[3]);
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.