Changeset c99d470 in mainline
- Timestamp:
- 2012-09-23T16:27:53Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f3b97d1
- Parents:
- 0d8322da (diff), 0a586f4c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
r0d8322da rc99d470 99 99 static void rtc_register_write(rtc_t *rtc, int reg, int data); 100 100 static time_t uptime_get(void); 101 static bool is_battery_ok(rtc_t *rtc); 101 102 102 103 static ddf_dev_ops_t rtc_dev_ops; … … 334 335 } 335 336 337 /* Check if the RTC battery is OK */ 338 if (!is_battery_ok(rtc)) { 339 fibril_mutex_unlock(&rtc->mutex); 340 return EIO; 341 } 342 336 343 /* now read the registers */ 337 344 do { … … 436 443 437 444 fibril_mutex_lock(&rtc->mutex); 445 446 if (!is_battery_ok(rtc)) { 447 fibril_mutex_unlock(&rtc->mutex); 448 return EIO; 449 } 438 450 439 451 /* boottime must be recomputed */ … … 516 528 { 517 529 rtc_t *rtc = fun_rtc(fun); 518 const bool batt_ok = rtc_register_read(rtc, RTC_STATUS_D) & 519 RTC_D_BATTERY_OK; 530 531 fibril_mutex_lock(&rtc->mutex); 532 const bool batt_ok = is_battery_ok(rtc); 533 fibril_mutex_unlock(&rtc->mutex); 520 534 521 535 *status = batt_ok ? BATTERY_OK : BATTERY_LOW; 522 536 523 537 return EOK; 538 } 539 540 /** Check if the battery is working properly or not. 541 * The caller already holds the rtc->mutex lock. 542 * 543 * @param rtc The RTC instance. 544 * 545 * @return true if the battery is ok, false otherwise. 546 */ 547 static bool 548 is_battery_ok(rtc_t *rtc) 549 { 550 return rtc_register_read(rtc, RTC_STATUS_D) & RTC_D_BATTERY_OK; 524 551 } 525 552
Note:
See TracChangeset
for help on using the changeset viewer.