Changeset 917797f in mainline for uspace/drv/time/cmos-rtc/cmos-rtc.c
- Timestamp:
- 2012-09-15T14:58:48Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 69a13a4
- Parents:
- 0d911ee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/time/cmos-rtc/cmos-rtc.c
r0d911ee r917797f 46 46 #include <ddf/log.h> 47 47 #include <ops/clock_dev.h> 48 #include <ops/battery_dev.h> 48 49 #include <fibril_synch.h> 49 50 #include <device/hw_res.h> 50 51 #include <macros.h> 51 #include <ipc/clock_ctl.h>52 52 #include <time.h> 53 53 … … 94 94 static unsigned bcd2bin(unsigned bcd); 95 95 static unsigned bin2bcd(unsigned binary); 96 static void rtc_default_handler(ddf_fun_t *fun,97 ipc_callid_t callid, ipc_call_t *call);98 96 static int rtc_dev_remove(ddf_dev_t *dev); 99 97 static void rtc_register_write(rtc_t *rtc, int reg, int data); … … 120 118 }; 121 119 120 /** Battery powered device interface */ 121 static battery_dev_ops_t rtc_battery_dev_ops = { 122 .battery_status_get = NULL, 123 .battery_charge_level_get = NULL, 124 }; 125 122 126 /** Obtain soft state structure from device node */ 123 127 static rtc_t * … … 144 148 145 149 rtc_dev_ops.interfaces[CLOCK_DEV_IFACE] = &rtc_clock_dev_ops; 146 rtc_dev_ops.default_handler = &rtc_default_handler; 150 rtc_dev_ops.interfaces[BATTERY_DEV_IFACE] = &rtc_battery_dev_ops; 151 rtc_dev_ops.default_handler = NULL; 147 152 } 148 153 … … 597 602 } 598 603 599 /** Default handler for client requests not handled600 * by the standard interface601 */602 static void603 rtc_default_handler(ddf_fun_t *fun, ipc_callid_t callid, ipc_call_t *call)604 {605 sysarg_t method = IPC_GET_IMETHOD(*call);606 rtc_t *rtc = fun_rtc(fun);607 bool batt_ok;608 609 switch (method) {610 case CLOCK_GET_BATTERY_STATUS:611 /* Get the RTC battery status */612 batt_ok = rtc_register_read(rtc, RTC_STATUS_D) &613 RTC_D_BATTERY_OK;614 async_answer_1(callid, EOK, batt_ok);615 break;616 default:617 async_answer_0(callid, ENOTSUP);618 }619 }620 621 604 /** Open the device 622 605 *
Note:
See TracChangeset
for help on using the changeset viewer.