RTEMS 6.1-rc4
Loading...
Searching...
No Matches
Modules | Files | Data Structures | Macros | Functions | Variables
Shared_tod_i2c_rtc

Generic I2C RTC driver. More...

Modules

 Shared_tod_abeoz9_rtc
 RTC driver for the Abracon EOZ9 series.
 
 Shared_tod_mcp7940m_rtc
 RTC driver for the MCP7940M.
 

Files

file  i2c-rtc.h
 This file provides the interfaces of Shared_tod_i2c_rtc.
 
file  i2c-rtc.c
 This file provides the implementation of Shared_tod_i2c_rtc.
 

Data Structures

struct  i2c_rtc_base
 

Macros

#define I2C_RTC_ORDER_sec_min_hour_wkday_day_month_year    { .sec = 0, .min = 1, .hour = 2, .day = 4, .wkday = 3, .month = 5, .year = 6 }
 
#define I2C_RTC_ORDER_sec_min_hour_day_wkday_month_year    { .sec = 0, .min = 1, .hour = 2, .day = 3, .wkday = 4, .month = 5, .year = 6 }
 
#define I2C_RTC_INITIALIZER(i2c_path, i2c_address, offset, reg_order, driver_name, hwinit)
 
#define I2C_RTC_TBL_ENTRY(dev_name, i2c_rtc_ctx)
 

Functions

bool i2c_rtc_probe (int minor)
 
int i2c_rtc_read (struct i2c_rtc_base *ctx, uint8_t addr, uint8_t *buf, size_t len)
 
int i2c_rtc_write (struct i2c_rtc_base *ctx, uint8_t addr, const uint8_t *buf, size_t len)
 

Variables

const rtc_fns i2c_rtc_fns
 

Detailed Description

Generic I2C RTC driver.

Base functionality for I2C based RTC drivers. An additional, chip specific initialization is necessary.

Expects a register block with the following time format:

See abeoz9 or mcp7940m for how to use this base driver.

Macro Definition Documentation

◆ I2C_RTC_INITIALIZER

#define I2C_RTC_INITIALIZER (   i2c_path,
  i2c_address,
  offset,
  reg_order,
  driver_name,
  hwinit 
)
Value:
{ \
.mutex = RTEMS_MUTEX_INITIALIZER(driver_name), \
.i2c_bus_path = i2c_path, \
.i2c_addr = i2c_address, \
.initialized = false, \
.hw_init = hwinit, \
.clock_offset = offset, \
.order = reg_order, \
}

◆ I2C_RTC_TBL_ENTRY

#define I2C_RTC_TBL_ENTRY (   dev_name,
  i2c_rtc_ctx 
)
Value:
{ \
.sDeviceName = dev_name, \
.deviceType = RTC_CUSTOM, \
.pDeviceFns = &i2c_rtc_fns, \
.deviceProbe = i2c_rtc_probe, \
.pDeviceParams = (void *)i2c_rtc_ctx, \
.ulCtrlPort1 = 0, \
.ulDataPort = 0, \
.getRegister = NULL, \
.setRegister = NULL, \
}

Function Documentation

◆ i2c_rtc_read()

int i2c_rtc_read ( struct i2c_rtc_base ctx,
uint8_t  addr,
uint8_t *  buf,
size_t  len 
)

Read bytes from the I2C RTC. Can be used in derived drivers.

Returns 0 on success or anything else on error.

◆ i2c_rtc_write()

int i2c_rtc_write ( struct i2c_rtc_base ctx,
uint8_t  addr,
const uint8_t *  buf,
size_t  len 
)

Write bytes to the I2C RTC. Can be used in derived drivers.

Returns 0 on success or anything else on error.