Changeset 26c03dbd in mainline
- Timestamp:
- 2013-12-31T19:44:11Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7858acbf
- Parents:
- 7f620e8
- Location:
- uspace/lib
- Files:
-
- 1 deleted
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/Makefile
r7f620e8 r26c03dbd 71 71 generic/device/char_dev.c \ 72 72 generic/device/clock_dev.c \ 73 generic/device/battery_dev.c \74 73 generic/device/graph_dev.c \ 75 74 generic/device/nic.c \ -
uspace/lib/drv/generic/remote_battery_dev.c
r7f620e8 r26c03dbd 36 36 #include <errno.h> 37 37 #include <ops/battery_dev.h> 38 #include < device/battery_dev.h>38 #include <battery_iface.h> 39 39 #include <ddf/driver.h> 40 40 #include <macros.h> 41 42 /** Read the current battery status from the device 43 * 44 * @param sess Session of the device 45 * @param status Current status of the battery 46 * 47 * @return EOK on success or a negative error code 48 */ 49 int 50 battery_status_get(async_sess_t *sess, battery_status_t *batt_status) 51 { 52 sysarg_t status; 53 54 async_exch_t *exch = async_exchange_begin(sess); 55 56 int const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE), 57 BATTERY_STATUS_GET, &status); 58 59 async_exchange_end(exch); 60 61 if (rc == EOK) 62 *batt_status = (battery_status_t) status; 63 64 return rc; 65 } 66 67 /** Read the current battery charge level from the device 68 * 69 * @param sess Session of the device 70 * @param level Battery charge level (0 - 100) 71 * 72 * @return EOK on success or a negative error code 73 */ 74 int 75 battery_charge_level_get(async_sess_t *sess, int *level) 76 { 77 sysarg_t charge_level; 78 79 async_exch_t *exch = async_exchange_begin(sess); 80 81 int const rc = async_req_1_1(exch, DEV_IFACE_ID(BATTERY_DEV_IFACE), 82 BATTERY_CHARGE_LEVEL_GET, &charge_level); 83 84 async_exchange_end(exch); 85 86 if (rc == EOK) 87 *level = (int) charge_level; 88 89 return rc; 90 } 41 91 42 92 static void remote_battery_status_get(ddf_fun_t *, void *, ipc_callid_t, -
uspace/lib/drv/include/battery_iface.h
r7f620e8 r26c03dbd 33 33 */ 34 34 35 #ifndef LIB C_DEVICE_BATTERY_DEV_H_36 #define LIB C_DEVICE_BATTERY_DEV_H_35 #ifndef LIBDRV_BATTERY_IFACE_H_ 36 #define LIBDRV_BATTERY_IFACE_H_ 37 37 38 38 #include <async.h> -
uspace/lib/drv/include/ops/battery_dev.h
r7f620e8 r26c03dbd 37 37 38 38 #include "../ddf/driver.h" 39 #include " device/battery_dev.h"39 #include "battery_iface.h" 40 40 41 41 typedef struct {
Note:
See TracChangeset
for help on using the changeset viewer.