Changeset 917797f in mainline
- 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
- Location:
- uspace
- Files:
-
- 3 added
- 5 edited
- 1 moved
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 * -
uspace/lib/c/Makefile
r0d911ee r917797f 72 72 generic/device/char_dev.c \ 73 73 generic/device/clock_dev.c \ 74 generic/device/battery_dev.c \ 74 75 generic/device/graph_dev.c \ 75 76 generic/device/nic.c \ -
uspace/lib/c/include/ipc/dev_iface.h
r0d911ee r917797f 56 56 /** Interface provided by Real Time Clock devices */ 57 57 CLOCK_DEV_IFACE, 58 /** Interface provided by battery powered devices */ 59 BATTERY_DEV_IFACE, 58 60 /** Interface provided by AHCI devices. */ 59 61 AHCI_DEV_IFACE, -
uspace/lib/drv/Makefile
r0d911ee r917797f 47 47 generic/remote_usbhid.c \ 48 48 generic/remote_clock_dev.c \ 49 generic/remote_battery_dev.c \ 49 50 generic/remote_ahci.c 50 51 -
uspace/lib/drv/generic/remote_clock_dev.c
r0d911ee r917797f 104 104 } 105 105 106 /** Process the writerequest from the remote client106 /** Process the time_set() request from the remote client 107 107 * 108 108 * @param fun The function to which the data are written -
uspace/lib/drv/include/remote_battery_dev.h
r0d911ee r917797f 27 27 */ 28 28 29 #ifndef LIBC_IPC_CLOCK_CTL_H_ 30 #define LIBC_IPC_CLOCK_CTL_H_ 29 /** @addtogroup libdrv 30 * @{ 31 */ 32 /** @file 33 */ 31 34 32 #include <ipc/dev_iface.h> 35 #ifndef LIBDRV_REMOTE_BATTERY_DEV_H_ 36 #define LIBDRV_REMOTE_BATTERY_DEV_H_ 33 37 34 typedef enum { 35 CLOCK_GET_BATTERY_STATUS = DEV_FIRST_CUSTOM_METHOD, 36 } clock_ctl_t; 38 extern remote_iface_t remote_battery_dev_iface; 37 39 38 40 #endif 39 41 42 /** 43 * @} 44 */ 45
Note:
See TracChangeset
for help on using the changeset viewer.