summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/pc80/mc146818rtc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h
index effc03d2ae..66d5edb4b9 100644
--- a/src/include/pc80/mc146818rtc.h
+++ b/src/include/pc80/mc146818rtc.h
@@ -112,6 +112,16 @@ static inline unsigned char cmos_read(unsigned char addr)
return inb(RTC_BASE_PORT + offs + 1);
}
+/* Upon return the caller is guaranteed 244 microseconds to complete any
+ * RTC operations. wait_uip may be called a single time prior to multiple
+ * accesses, but sequences requiring more time should call wait_uip again.
+ */
+static inline void wait_uip(void)
+{
+ while (cmos_read(RTC_REG_A) & RTC_UIP)
+ ;
+}
+
static inline void cmos_write_inner(unsigned char val, unsigned char addr)
{
int offs = 0;