FreeBSD kernel IICBUS device code
rtc8583.c File Reference
#include <sys/cdefs.h>
#include "opt_platform.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/clock.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <dev/iicbus/iiconf.h>
#include <dev/iicbus/iicbus.h>
#include "clock_if.h"
#include "iicbus_if.h"
Include dependency graph for rtc8583.c:

Go to the source code of this file.

Data Structures

struct  time_regs
 
struct  rtc8583_softc
 

Macros

#define RTC8583_SC_REG   0x01 /* RTC Seconds */
 
#define RTC8583_USERSRAM_REG   0x10 /* User SRAM register (first) */
 
#define MAX_TRANSFER   16
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void rtc8583_init (void *arg)
 
static int rtc8583_probe (device_t dev)
 
static int rtc8583_attach (device_t dev)
 
static int rtc8583_detach (device_t dev)
 
static int rtc8583_gettime (device_t dev, struct timespec *ts)
 
static int rtc8583_settime (device_t dev, struct timespec *ts)
 
static int rtc8583_writeto (device_t slavedev, uint8_t regaddr, void *buffer, uint16_t buflen, int waithow)
 
static int rtc8583_read1 (struct rtc8583_softc *sc, uint8_t reg, uint8_t *data)
 
static int rtc8583_write1 (struct rtc8583_softc *sc, uint8_t reg, uint8_t val)
 
 DRIVER_MODULE (rtc8583, iicbus, rtc8583_driver, rtc8583_devclass, NULL, NULL)
 
 MODULE_VERSION (rtc8583, 1)
 
 MODULE_DEPEND (rtc8583, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER)
 
 IICBUS_FDT_PNP_INFO (compat_data)
 

Variables

static device_method_t rtc8583_methods []
 
static driver_t rtc8583_driver
 
static devclass_t rtc8583_devclass
 

Macro Definition Documentation

◆ MAX_TRANSFER

#define MAX_TRANSFER   16

Definition at line 60 of file rtc8583.c.

◆ RTC8583_SC_REG

#define RTC8583_SC_REG   0x01 /* RTC Seconds */

Definition at line 58 of file rtc8583.c.

◆ RTC8583_USERSRAM_REG

#define RTC8583_USERSRAM_REG   0x10 /* User SRAM register (first) */

Definition at line 59 of file rtc8583.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( rtc8583  ,
iicbus  ,
rtc8583_driver  ,
rtc8583_devclass  ,
NULL  ,
NULL   
)

◆ IICBUS_FDT_PNP_INFO()

IICBUS_FDT_PNP_INFO ( compat_data  )

◆ MODULE_DEPEND()

MODULE_DEPEND ( rtc8583  ,
iicbus  ,
IICBUS_MINVER  ,
IICBUS_PREFVER  ,
IICBUS_MAXVER   
)

◆ MODULE_VERSION()

MODULE_VERSION ( rtc8583  ,
 
)

◆ rtc8583_attach()

static int rtc8583_attach ( device_t  dev)
static

Definition at line 163 of file rtc8583.c.

References rtc8583_softc::busdev, dev, rtc8583_softc::dev, rtc8583_softc::init_hook, and rtc8583_init().

Here is the call graph for this function:

◆ rtc8583_detach()

static int rtc8583_detach ( device_t  dev)
static

Definition at line 184 of file rtc8583.c.

References dev.

◆ rtc8583_gettime()

static int rtc8583_gettime ( device_t  dev,
struct timespec *  ts 
)
static

◆ rtc8583_init()

static void rtc8583_init ( void *  arg)
static

Definition at line 131 of file rtc8583.c.

References rtc8583_softc::dev, and rtc8583_softc::init_hook.

Referenced by rtc8583_attach().

Here is the caller graph for this function:

◆ rtc8583_probe()

static int rtc8583_probe ( device_t  dev)
static

Definition at line 147 of file rtc8583.c.

References compat_data, and dev.

◆ rtc8583_read1()

static int rtc8583_read1 ( struct rtc8583_softc sc,
uint8_t  reg,
uint8_t *  data 
)
inlinestatic

Definition at line 117 of file rtc8583.c.

References data, rtc8583_softc::dev, IIC_WAIT, and iicdev_readfrom().

Referenced by rtc8583_gettime().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rtc8583_settime()

static int rtc8583_settime ( device_t  dev,
struct timespec *  ts 
)
static

◆ rtc8583_write1()

static int rtc8583_write1 ( struct rtc8583_softc sc,
uint8_t  reg,
uint8_t  val 
)
inlinestatic

Definition at line 124 of file rtc8583.c.

References rtc8583_softc::dev, IIC_WAIT, rtc8583_writeto(), and val.

Referenced by rtc8583_gettime(), and rtc8583_settime().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rtc8583_writeto()

static int rtc8583_writeto ( device_t  slavedev,
uint8_t  regaddr,
void *  buffer,
uint16_t  buflen,
int  waithow 
)
static

Definition at line 97 of file rtc8583.c.

References iic_msg::buf, iic_msg::flags, IIC_M_WR, iicbus_transfer_excl(), iic_msg::len, MAX_TRANSFER, msgs, and iic_msg::slave.

Referenced by rtc8583_settime(), and rtc8583_write1().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ rtc8583_devclass

devclass_t rtc8583_devclass
static

Definition at line 300 of file rtc8583.c.

◆ rtc8583_driver

driver_t rtc8583_driver
static
Initial value:
= {
"rtc8583",
sizeof(struct rtc8583_softc),
}
static device_method_t rtc8583_methods[]
Definition: rtc8583.c:282

Definition at line 295 of file rtc8583.c.

◆ rtc8583_methods

device_method_t rtc8583_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, rtc8583_probe),
DEVMETHOD(device_attach, rtc8583_attach),
DEVMETHOD(device_detach, rtc8583_detach),
DEVMETHOD(clock_gettime, rtc8583_gettime),
DEVMETHOD(clock_settime, rtc8583_settime),
DEVMETHOD_END,
}
static int rtc8583_attach(device_t dev)
Definition: rtc8583.c:163
static int rtc8583_detach(device_t dev)
Definition: rtc8583.c:184
static int rtc8583_settime(device_t dev, struct timespec *ts)
Definition: rtc8583.c:249
static int rtc8583_gettime(device_t dev, struct timespec *ts)
Definition: rtc8583.c:192
static int rtc8583_probe(device_t dev)
Definition: rtc8583.c:147

Definition at line 282 of file rtc8583.c.