123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- #ifndef _RTC_H_
- #define _RTC_H_
- #include <bcd.h>
- #include <rtc_def.h>
- #ifdef CONFIG_DM_RTC
- struct rtc_ops {
-
- int (*get)(struct udevice *dev, struct rtc_time *time);
-
- int (*set)(struct udevice *dev, const struct rtc_time *time);
-
- int (*reset)(struct udevice *dev);
-
- int (*read8)(struct udevice *dev, unsigned int reg);
-
- int (*write8)(struct udevice *dev, unsigned int reg, int val);
- };
- #define rtc_get_ops(dev) ((struct rtc_ops *)(dev)->driver->ops)
- int dm_rtc_get(struct udevice *dev, struct rtc_time *time);
- int dm_rtc_set(struct udevice *dev, struct rtc_time *time);
- int dm_rtc_reset(struct udevice *dev);
- int rtc_read8(struct udevice *dev, unsigned int reg);
- int rtc_write8(struct udevice *dev, unsigned int reg, int val);
- int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep);
- int rtc_write32(struct udevice *dev, unsigned int reg, u32 value);
- #else
- int rtc_get (struct rtc_time *);
- int rtc_set (struct rtc_time *);
- void rtc_reset (void);
- void rtc_enable_32khz_output(void);
- int rtc_read8(int reg);
- void rtc_write8(int reg, uchar val);
- u32 rtc_read32(int reg);
- void rtc_write32(int reg, u32 value);
- void rtc_init(void);
- #endif
- int rtc_calc_weekday(struct rtc_time *time);
- int rtc_to_tm(int time_t, struct rtc_time *time);
- unsigned long rtc_mktime(const struct rtc_time *time);
- #endif
|