RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Macros | Functions | Variables
i2c-rtc.c File Reference

This file provides the implementation of Shared_tod_i2c_rtc. More...

#include <dev/i2c/i2c.h>
#include <libchip/i2c-rtc.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/todimpl.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>

Macros

#define RTCSEC_SECBCD_SHIFT   0u
 
#define RTCSEC_SECBCD_MASK   (0x7fu << RTCSEC_SECBCD_SHIFT)
 
#define RTCSEC_SECBCD(x)   (((x) << RTCSEC_SECBCD_SHIFT) & RTCSEC_SECBCD_MASK)
 
#define RTCSEC_SECBCD_GET(x)   (((x) & RTCSEC_SECBCD_MASK) >> RTCSEC_SECBCD_SHIFT)
 
#define RTCMIN_MINBCD_SHIFT   0u
 
#define RTCMIN_MINBCD_MASK   (0x7fu << RTCMIN_MINBCD_SHIFT)
 
#define RTCMIN_MINBCD(x)   (((x) << RTCMIN_MINBCD_SHIFT) & RTCMIN_MINBCD_MASK)
 
#define RTCMIN_MINBCD_GET(x)   (((x) & RTCMIN_MINBCD_MASK) >> RTCMIN_MINBCD_SHIFT)
 
#define RTCHOUR_HRBCD12_SHIFT   0u
 
#define RTCHOUR_HRBCD12_MASK   (0x1fu << RTCHOUR_HRBCD12_SHIFT)
 
#define RTCHOUR_HRBCD12(x)   (((x) << RTCHOUR_HRBCD12_SHIFT) & RTCHOUR_HRBCD12_MASK)
 
#define RTCHOUR_HRBCD12_GET(x)   (((x) & RTCHOUR_HRBCD12_MASK) >> RTCHOUR_HRBCD12_SHIFT)
 
#define RTCHOUR_HRBCD24_SHIFT   0u
 
#define RTCHOUR_HRBCD24_MASK   (0x3fu << RTCHOUR_HRBCD24_SHIFT)
 
#define RTCHOUR_HRBCD24(x)   (((x) << RTCHOUR_HRBCD24_SHIFT) & RTCHOUR_HRBCD24_MASK)
 
#define RTCHOUR_HRBCD24_GET(x)   (((x) & RTCHOUR_HRBCD24_MASK) >> RTCHOUR_HRBCD24_SHIFT)
 
#define RTCHOUR_AMPM   (0x01u << 5)
 
#define RTCHOUR_1224   (0x01u << 6)
 
#define RTCWKDAY_WKDAY_SHIFT   0u
 
#define RTCWKDAY_WKDAY_MASK   (0x7u << RTCWKDAY_WKDAY_SHIFT)
 
#define RTCWKDAY_WKDAY(x)   (((x) << RTCWKDAY_WKDAY_SHIFT) & RTCWKDAY_WKDAY_MASK)
 
#define RTCWKDAY_WKDAY_GET(x)   (((x) & RTCWKDAY_WKDAY_MASK) >> RTCWKDAY_WKDAY_SHIFT)
 
#define RTCDATE_DATEBCD_SHIFT   0u
 
#define RTCDATE_DATEBCD_MASK   (0x3fu << RTCDATE_DATEBCD_SHIFT)
 
#define RTCDATE_DATEBCD(x)   (((x) << RTCDATE_DATEBCD_SHIFT) & RTCDATE_DATEBCD_MASK)
 
#define RTCDATE_DATEBCD_GET(x)   (((x) & RTCDATE_DATEBCD_MASK) >> RTCDATE_DATEBCD_SHIFT)
 
#define RTCMTH_MTHBCD_SHIFT   0u
 
#define RTCMTH_MTHBCD_MASK   (0x1fu << RTCMTH_MTHBCD_SHIFT)
 
#define RTCMTH_MTHBCD(x)   (((x) << RTCMTH_MTHBCD_SHIFT) & RTCMTH_MTHBCD_MASK)
 
#define RTCMTH_MTHBCD_GET(x)   (((x) & RTCMTH_MTHBCD_MASK) >> RTCMTH_MTHBCD_SHIFT)
 
#define RTCYEAR_YRBCD_SHIFT   0u
 
#define RTCYEAR_YRBCD_MASK   (0xffu << RTCYEAR_YRBCD_SHIFT)
 
#define RTCYEAR_YRBCD(x)   (((x) << RTCYEAR_YRBCD_SHIFT) & RTCYEAR_YRBCD_MASK)
 
#define RTCYEAR_YRBCD_GET(x)   (((x) & RTCYEAR_YRBCD_MASK) >> RTCYEAR_YRBCD_SHIFT)
 
#define NR_RTC_REGISTERS   0x07u
 

Functions

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)
 
bool i2c_rtc_probe (int minor)
 

Variables

const rtc_fns i2c_rtc_fns
 

Detailed Description

This file provides the implementation of Shared_tod_i2c_rtc.