/* TIME_REG & ALARM_TIME_REG */ #define SECONDS_UNITS (0xf<<0) /* seconds units position */ #define SECONDS_TENS (0x7<<4) /* seconds tens position */ #define MINUTES_UNITS (0xf<<8) /* minutes units position */ #define MINUTES_TENS (0x7<<12) /* minutes tens position */ #define HOURS_UNITS (0xf<<16) /* hours units position */ #define HOURS_TENS (0x3<<20) /* hours tens position */
/* DATE_REG & ALARM_DATE_REG */ #define DAYS_UNITS (0xf<<0) /* days units position */ #define DAYS_TENS (0x3<<4) /* days tens position */ #define MONTHS_UNITS (0xf<<8) /* months units position */ #define MONTHS_TENS (0x1<<12) /* months tens position */ #define YEARS_UNITS (0xf<<16) /* years units position */ #define YEARS_TENS (0xf<<20) /* years tens position */ #define YEARS_HUNDREDS (0xf<<24) /* years hundereds position */ #define YEARS_MILLENIUMS (0xf<<28) /* years millenium position */
/* MASK SHIFT TIME_REG & ALARM_TIME_REG*/ #define SECOND_SHIFT 0x00 /* seconds units */ #define MINUTE_SHIFT 0x08 /* minutes units position */ #define HOUR_SHIFT 0x10 /* hours units position */ #define MDAY_SHIFT 0x00 /* Month day shift */ #define MONTH_SHIFT 0x08 /* Month shift */ #define YEAR_SHIFT 0x10 /* Year shift */
/* * spear_rtc_read_time - set the time * @dev: rtc device in use * @tm: holds date and time * * This function read time and date. On success it will return 0 * otherwise -ve error is returned.
*/ staticint spear_rtc_read_time(struct device *dev, struct rtc_time *tm)
{ struct spear_rtc_config *config = dev_get_drvdata(dev); unsignedint time, date;
/* we don't report wday/yday/isdst ... */
rtc_wait_not_busy(config);
/* * spear_rtc_set_time - set the time * @dev: rtc device in use * @tm: holds date and time * * This function set time and date. On success it will return 0 * otherwise -ve error is returned.
*/ staticint spear_rtc_set_time(struct device *dev, struct rtc_time *tm)
{ struct spear_rtc_config *config = dev_get_drvdata(dev); unsignedint time, date;
/* * spear_rtc_read_alarm - read the alarm time * @dev: rtc device in use * @alm: holds alarm date and time * * This function read alarm time and date. On success it will return 0 * otherwise -ve error is returned.
*/ staticint spear_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
{ struct spear_rtc_config *config = dev_get_drvdata(dev); unsignedint time, date;
/* * spear_rtc_set_alarm - set the alarm time * @dev: rtc device in use * @alm: holds alarm date and time * * This function set alarm time and date. On success it will return 0 * otherwise -ve error is returned.
*/ staticint spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
{ struct spear_rtc_config *config = dev_get_drvdata(dev); unsignedint time, date; int err;
if (alm->enabled)
spear_rtc_enable_interrupt(config); else
spear_rtc_disable_interrupt(config);
return 0;
}
staticint spear_alarm_irq_enable(struct device *dev, unsignedint enabled)
{ struct spear_rtc_config *config = dev_get_drvdata(dev); int ret = 0;
spear_rtc_clear_interrupt(config);
switch (enabled) { case 0: /* alarm off */
spear_rtc_disable_interrupt(config); break; case 1: /* alarm on */
spear_rtc_enable_interrupt(config); break; default:
ret = -EINVAL; break;
}
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.