Changeset 8b1e15ac in mainline for uspace/lib/c/generic/devman.c
- Timestamp:
- 2011-02-11T22:26:36Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 68414f4a
- Parents:
- 1b367b4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/devman.c
r1b367b4 r8b1e15ac 158 158 } 159 159 160 int devman_child_device_register(const char *name, match_id_list_t *match_ids, 161 devman_handle_t parent_handle, devman_handle_t *handle) 160 /** Add function to a device. 161 * 162 * Request devman to add a new function to the specified device owned by 163 * this driver task. 164 * 165 * @param name Name of the new function 166 * @param ftype Function type, fun_inner or fun_exposed 167 * @param match_ids Match IDs (should be empty for fun_exposed) 168 * @param devh Devman handle of the device 169 * @param funh Place to store handle of the new function 170 * 171 * @return EOK on success or negative error code. 172 */ 173 int devman_add_function(const char *name, fun_type_t ftype, 174 match_id_list_t *match_ids, devman_handle_t devh, devman_handle_t *funh) 162 175 { 163 176 int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING); 177 int fun_handle; 164 178 165 179 if (phone < 0) … … 168 182 async_serialize_start(); 169 183 170 int match_count = list_count(&match_ids->ids); 171 ipc_call_t answer; 172 aid_t req = async_send_2(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, match_count, 173 &answer); 184 int match_count = list_count(&match_ids->ids); 185 ipc_call_t answer; 186 187 aid_t req = async_send_3(phone, DEVMAN_ADD_FUNCTION, (sysarg_t) ftype, 188 devh, match_count, &answer); 174 189 175 190 sysarg_t retval = async_data_write_start(phone, name, str_size(name)); … … 186 201 async_serialize_end(); 187 202 188 if (retval != EOK) { 189 if (handle != NULL) 190 *handle = -1; 191 192 return retval; 193 } 194 195 if (handle != NULL) 196 *handle = (int) IPC_GET_ARG1(answer); 197 203 if (retval == EOK) 204 fun_handle = (int) IPC_GET_ARG1(answer); 205 else 206 fun_handle = -1; 207 208 *funh = fun_handle; 209 198 210 return retval; 199 211 }
Note:
See TracChangeset
for help on using the changeset viewer.