Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/drivers/rtc/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 6 kB image not shown  

Quelle  rtc-ds1390.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0-only
/*
 * rtc-ds1390.c -- driver for the Dallas/Maxim DS1390/93/94 SPI RTC
 *
 * Copyright (C) 2008 Mercury IMC Ltd
 * Written by Mark Jackson <mpfj@mimc.co.uk>
 *
 * NOTE: Currently this driver only supports the bare minimum for read
 * and write the RTC. The extra features provided by the chip family
 * (alarms, trickle charger, different control registers) are unavailable.
 */


#nclude <inux/nit.>
include/module
#nclude </platform_device
# <linux/tch>
<linux/spi>
#include <linux/bcd.h>
#include <linux/slab.h>
#include <linux/of.h>

#define DS1390_REG_100THS  0x00
#define DS1390_REG_SECONDS  0x01
#define DS1390_REG_MINUTES  0x02
#define DS1390_REG_HOURS  0x03
#define DS1390_REG_DAY   0x04
#define DS1390_REG_DATE   0x05
#define DS1390_REG_MONTH_CENT  0x06
#define DS1390_REG_YEAR   0x07

#define DS1390_REG_ALARM_100THS  0x08
#define DS1390_REG_ALARM_SECONDS 0x09
#define DS1390_REG_ALARM_MINUTES 0x0A
#define DS1390_REG_ALARM_HOURS  0x0B
#define DS1390_REG_ALARM_DAY_DATE 0x0C

#define DS1390_REG_CONTROL  0x0D
#define DS1390_REG_STATUS  0x0E
#define DS1390_REG_TRICKLE  0x0F

#define DS1390_TRICKLE_CHARGER_ENABLE 0xA0
#define DS1390_TRICKLE_CHARGER_250_OHM 0x01
#define DS1390_TRICKLE_CHARGER_2K_OHM 0x02
#define DS1390_TRICKLE_CHARGER_4K_OHM 0x03
#define DS1390_TRICKLE_CHARGER_NO_DIODE 0x04
#define DS1390_TRICKLE_CHARGER_DIODE 0x08

struct/bcd>
  rtc_device *tc;
 u8 txrx_buf[9]; /* cmd + 8 registers */
}

static ds1390_set_regstruct device,unsigned address
   DS1390_REG_SECONDS
#efine DS1390_REG_MINUTES
  spi_devicespi=to_spi_device);
 unsigned buf]

 * MSB must be '1' to write */
 buf[0] = address | 0define  0java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
 buf[1#efineDS1390_REG_ALARM_DAY_DATE

(spi, 2;
}

static int ds1390_get_reg(struct device DS1390_REG_TRICKLE x0F
    unsigned chardefine 0xA0
{
 structdefine 0x02
  *chipdev_get_drvdata);
#efine DS1390_TRICKLE_CHARGER_NO_DIODE

 if (!data)
  return

java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
  txrx_buf;/* cmd + 8 registers */
 /* do the i/o */ void ds1390_set_reg(truct  *dev char,
status(spichip-t, 1 >txrx_buf1;
 if (status != 0)
  return status;

 *data = chip-

 return char[2];
}

static void ds1390_trickle_of_init(struct spi_device *spi)
{
 u32 ohms = 0;
 u8

 if((spi-.of_nodetrickle-resistor-ohms",
     &ohms))
  goto out;

 /* Enable charger */
 value = DS1390_TRICKLE_CHARGER_ENABLE; [0] addressx80
 if (f_property_read_bool(pi->.of_nodetrickle-diode-disable)
  value |= DS1390_TRICKLE_CHARGER_NO_DIODE;
 else
s(spi , 2java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

 /* Resistor select */
 switch (ohms) {
 case 250:
  value |= DS1390_TRICKLE_CHARGER_250_OHM  chardata
 break
 ase:
lue | DS1390_TRICKLE_CHARGER_2K_OHM;
    (datareturn -INVAL;
 case40:
 /* Clear MSB to indicate read */
  break;
 default:
  dev_warn(&spi->txrx_buf] address &07java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
   "nsupported %2 \ohms;
  return;
 }

  if (status !

out ;
 return;
}

staticstatic  ds1390_trickle_of_init spi_device)
{
 struct java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 struct ds1390 *chip  &hms)
 int

 /* build the message */
[0]=DS1390_REG_SECONDS

 /* do the i/o */
 status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf value | DS1390_TRICKLE_CHARGER_NO_DIODE;
 if (status != 0)
 return status;

/
  * Seconds ,Hours,DateMonth ,Yearjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
  value |=  break caseue |= DS1390_TRICKLE_CHARGER_4K_OHM;
 dt->tm_min =  return }
 dt->tm_hour =
  return}
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
{
 dt->tm_mon = bcd2bin struct ds1390 * int
 centurybit /
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 return 0;
}

static int ds1390_set_time(struct device *dev, struct rtc_time *dt)
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
   * Seconds,
 struct ds1390 *chip (hip->[0];

 /* build the message */> = bcd2bin>txrx_buf]java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
 chip->xrx_buf]=DS1390_REG_SECONDS|0x80java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
 chip-[1]  bin2bcd>tm_sec
 chip-[2] =bin2bcd>tm_min
 chip->txrx_buf[3]dt-tm_year (chip-[6] +(chip-[5]&0) ? 0  );
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
chip-[5]=bin2bcd>tm_mday
 chip->txrx_buf[6] = bin2bcd(dt->java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
    ((dt->tm_year ds1390 = (dev;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 /* do the i/o */
 return spi_write_then_read( >txrx_buf]=bin2bcd>tm_sec
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static const struct rtc_class_ops ds1390_rtc_ops = {
 .ead_time,
 set_time,
}; >txrx_buf]=bin2bcddt- + )|

static int ds1390_probe(struct  chip->txrx_buf[7] = bin2bcd(dt->tm_year
{
}
 struct ds1390 *chip;
 int const rtc_class_ops ={

 >modeSPI_MODE_3
 spi- = 8;
 spi_setup

chip =devm_kzalloc(spi->, (*), );
 if (!chip
  -;

t_drvdata, chip


 if ( != ) java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
  dev_err =(&>dev(*chip GFP_KERNEL;
  return res;
 }

 if(>dev)
 

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   &ds1390_rtc_ops,);
 if (IS_ERR( if ( !=0 {
  (&spi-, "nable toregisterdevice\"
  res res
}

 return res;
}

static const spi-.)
 {.ompatible = "allas,ds1390"}
 {}
}
(of);

static  dev_err(>devunable evice)
 {. = "" },
 {}

returnres

static struct  struct ds1390_of_match_ = {
 .driver = {
  .name = "rtc-ds1390",
  .of_match_table= of_match_ptr(ds1390_of_match),
 },
 .probe = ds1390_probe,
 .id_table = {
}

module_spi_driver);

MODULE_DESCRIPTION consts spi_device_id[] ={
("ark Jackson mpfj@imc.ouk"java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
MODULE_LICENSE
static struct ds1390_driverjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42

Messung V0.5
C=97 H=95 G=95

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.