Changeset 7707954 in mainline
- Timestamp:
- 2010-03-18T21:20:17Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bda60d9
- Parents:
- 084ff99
- Location:
- uspace/lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/devman.c
r084ff99 r7707954 106 106 } 107 107 108 int devman_child_device_register(const char *name, long parent_handle, long *handle) 109 { 110 int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING); 111 112 if (phone < 0) 113 return phone; 114 115 async_serialize_start(); 116 117 ipc_call_t answer; 118 aid_t req = async_send_1(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, &answer); 119 120 ipcarg_t retval = async_data_write_start(phone, name, str_size(name)); 121 if (retval != EOK) { 122 async_wait_for(req, NULL); 123 async_serialize_end(); 124 return retval; 125 } 126 127 async_wait_for(req, &retval); 128 129 async_serialize_end(); 130 131 if (retval != EOK) { 132 if (handle != NULL) { 133 *handle = -1; 134 } 135 return retval; 136 } 137 138 if (handle != NULL) 139 *handle = (int) IPC_GET_ARG1(answer); 140 } 141 108 142 void devman_hangup_phone(devman_interface_t iface) 109 143 { -
uspace/lib/libc/include/devman.h
r084ff99 r7707954 41 41 #include <bool.h> 42 42 43 extern int devman_get_phone(devman_interface_t, unsigned int);44 extern void devman_hangup_phone(devman_interface_t iface);45 43 46 extern int devman_driver_register(const char *, async_client_conn_t); 44 int devman_get_phone(devman_interface_t, unsigned int); 45 void devman_hangup_phone(devman_interface_t iface); 46 47 int devman_driver_register(const char *, async_client_conn_t); 48 int devman_child_device_register(const char *name, long parent_handle, long *handle); 47 49 48 50 -
uspace/lib/libdrv/generic/driver.c
r084ff99 r7707954 129 129 static void driver_connection(ipc_callid_t iid, ipc_call_t *icall) 130 130 { 131 ipc_callid_t callid;132 131 /* Select interface */ 133 132 switch ((ipcarg_t) (IPC_GET_ARG1(*icall))) { … … 151 150 } 152 151 152 bool child_device_register(device_t *child, const char *child_name, device_t *parent) 153 { 154 if (devman_child_device_register(child_name, parent->handle, &child->handle)) { 155 // TODO initialize child device 156 return true; 157 } 158 return false; 159 } 160 153 161 int driver_main(driver_t *drv) 154 162 { -
uspace/lib/libdrv/include/driver.h
r084ff99 r7707954 38 38 #include <adt/list.h> 39 39 40 41 42 40 typedef struct device { 43 41 long handle; … … 61 59 int driver_main(driver_t *drv); 62 60 61 static inline device_t * create_device() 62 { 63 device_t *dev = malloc(sizeof(device_t)); 64 if (NULL != dev) { 65 memset(dev, 0, sizeof(device_t)); 66 } 67 68 return dev; 69 } 70 71 bool child_device_register(device_t *child, const char *child_name, device_t *parent); 72 73 74 63 75 #endif 64 76
Note:
See TracChangeset
for help on using the changeset viewer.