Changeset f30ee571 in mainline
- Timestamp:
- 2012-04-03T09:15:30Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3b79ba5
- Parents:
- 010341d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
r010341d rf30ee571 38 38 #include <errno.h> 39 39 #include <ddi.h> 40 #include <libarch/ddi.h> 40 41 #include <stdio.h> 41 42 #include <ddf/driver.h> … … 45 46 #include <device/hw_res.h> 46 47 #include <devman.h> 48 49 #include "cmos-regs.h" 47 50 48 51 #define NAME "cmos-rtc" … … 76 79 static int rtc_open(ddf_fun_t *fun); 77 80 static void rtc_close(ddf_fun_t *fun); 81 static bool rtc_update_in_progress(rtc_t *rtc); 78 82 79 83 … … 218 222 } 219 223 224 /** Check if an update is in progress 225 * 226 * @param rtc The rtc device 227 * 228 * @return true if an update is in progress, false otherwise 229 */ 230 static bool 231 rtc_update_in_progress(rtc_t *rtc) 232 { 233 pio_write_8(rtc->port, RTC_UPDATE); 234 return pio_read_8(rtc->port + 1) & RTC_MASK_UPDATE; 235 } 236 220 237 /** Read the current time from the CMOS 221 238 * … … 228 245 rtc_time_get(ddf_fun_t *fun, struct tm *t) 229 246 { 247 rtc_t *rtc = RTC_FROM_FNODE(fun); 248 249 fibril_mutex_lock(&rtc->mutex); 250 251 while (rtc_update_in_progress(rtc)); 252 253 fibril_mutex_unlock(&rtc->mutex); 230 254 return EOK; 231 255 }
Note:
See TracChangeset
for help on using the changeset viewer.