Changeset ffa2c8ef in mainline for uspace/lib/drv
- Timestamp:
- 2011-01-29T11:36:08Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 46b881c
- Parents:
- 64d2b10
- Location:
- uspace/lib/drv
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
r64d2b10 rffa2c8ef 186 186 pseudocode = &default_pseudocode; 187 187 188 int res = ipc_register_irq(irq, dev->handle, ctx->id, pseudocode);188 int res = register_irq(irq, dev->handle, ctx->id, pseudocode); 189 189 if (res != EOK) { 190 190 remove_interrupt_context(&interrupt_contexts, ctx); … … 199 199 interrupt_context_t *ctx = find_interrupt_context(&interrupt_contexts, 200 200 dev, irq); 201 int res = ipc_unregister_irq(irq, dev->handle);201 int res = unregister_irq(irq, dev->handle); 202 202 203 203 if (ctx != NULL) { … … 272 272 } 273 273 274 ipc_answer_0(iid, res);274 async_answer_0(iid, res); 275 275 } 276 276 … … 278 278 { 279 279 /* Accept connection */ 280 ipc_answer_0(iid, EOK);280 async_answer_0(iid, EOK); 281 281 282 282 bool cont = true; … … 293 293 break; 294 294 default: 295 ipc_answer_0(callid, ENOENT);295 async_answer_0(callid, ENOENT); 296 296 } 297 297 } … … 316 316 printf("%s: driver_connection_gen error - no device with handle" 317 317 " %" PRIun " was found.\n", driver->name, handle); 318 ipc_answer_0(iid, ENOENT);318 async_answer_0(iid, ENOENT); 319 319 return; 320 320 } … … 331 331 ret = (*dev->ops->open)(dev); 332 332 333 ipc_answer_0(iid, ret);333 async_answer_0(iid, ret); 334 334 if (ret != EOK) 335 335 return; … … 347 347 if (dev->ops != NULL && dev->ops->close != NULL) 348 348 (*dev->ops->close)(dev); 349 ipc_answer_0(callid, EOK);349 async_answer_0(callid, EOK); 350 350 return; 351 351 default: … … 368 368 "invalid interface id %d.", 369 369 driver->name, iface_idx); 370 ipc_answer_0(callid, ENOTSUP);370 async_answer_0(callid, ENOTSUP); 371 371 break; 372 372 } … … 381 381 printf("device with handle %" PRIun " has no interface " 382 382 "with id %d.\n", handle, iface_idx); 383 ipc_answer_0(callid, ENOTSUP);383 async_answer_0(callid, ENOTSUP); 384 384 break; 385 385 } … … 400 400 printf("%s: driver_connection_gen error - " 401 401 "invalid interface method.", driver->name); 402 ipc_answer_0(callid, ENOTSUP);402 async_answer_0(callid, ENOTSUP); 403 403 break; 404 404 } … … 446 446 default: 447 447 /* No such interface */ 448 ipc_answer_0(iid, ENOENT);448 async_answer_0(iid, ENOENT); 449 449 } 450 450 } -
uspace/lib/drv/generic/remote_char_dev.c
r64d2b10 rffa2c8ef 33 33 */ 34 34 35 #include <ipc/ipc.h>36 35 #include <async.h> 37 36 #include <errno.h> … … 81 80 if (!async_data_read_receive(&cid, &len)) { 82 81 /* TODO handle protocol error. */ 83 ipc_answer_0(callid, EINVAL);82 async_answer_0(callid, EINVAL); 84 83 return; 85 84 } … … 87 86 if (!char_dev_ops->read) { 88 87 async_data_read_finalize(cid, NULL, 0); 89 ipc_answer_0(callid, ENOTSUP);88 async_answer_0(callid, ENOTSUP); 90 89 return; 91 90 } … … 100 99 /* Some error occured. */ 101 100 async_data_read_finalize(cid, buf, 0); 102 ipc_answer_0(callid, ret);101 async_answer_0(callid, ret); 103 102 return; 104 103 } … … 106 105 /* The operation was successful, return the number of data read. */ 107 106 async_data_read_finalize(cid, buf, ret); 108 ipc_answer_1(callid, EOK, ret);107 async_answer_1(callid, EOK, ret); 109 108 } 110 109 … … 128 127 if (!async_data_write_receive(&cid, &len)) { 129 128 /* TODO handle protocol error. */ 130 ipc_answer_0(callid, EINVAL);129 async_answer_0(callid, EINVAL); 131 130 return; 132 131 } … … 134 133 if (!char_dev_ops->write) { 135 134 async_data_write_finalize(cid, NULL, 0); 136 ipc_answer_0(callid, ENOTSUP);135 async_answer_0(callid, ENOTSUP); 137 136 return; 138 137 } … … 148 147 if (ret < 0) { 149 148 /* Some error occured. */ 150 ipc_answer_0(callid, ret);149 async_answer_0(callid, ret); 151 150 } else { 152 151 /* … … 154 153 * written. 155 154 */ 156 ipc_answer_1(callid, EOK, ret);155 async_answer_1(callid, EOK, ret); 157 156 } 158 157 } -
uspace/lib/drv/generic/remote_hw_res.c
r64d2b10 rffa2c8ef 33 33 */ 34 34 35 #include <ipc/ipc.h>36 35 #include <async.h> 37 36 #include <errno.h> … … 62 61 63 62 if (hw_res_ops->enable_interrupt == NULL) 64 ipc_answer_0(callid, ENOTSUP);63 async_answer_0(callid, ENOTSUP); 65 64 else if (hw_res_ops->enable_interrupt(dev)) 66 ipc_answer_0(callid, EOK);65 async_answer_0(callid, EOK); 67 66 else 68 ipc_answer_0(callid, EREFUSED);67 async_answer_0(callid, EREFUSED); 69 68 } 70 69 … … 75 74 76 75 if (hw_res_ops->get_resource_list == NULL) { 77 ipc_answer_0(callid, ENOTSUP);76 async_answer_0(callid, ENOTSUP); 78 77 return; 79 78 } … … 81 80 hw_resource_list_t *hw_resources = hw_res_ops->get_resource_list(dev); 82 81 if (hw_resources == NULL){ 83 ipc_answer_0(callid, ENOENT);82 async_answer_0(callid, ENOENT); 84 83 return; 85 84 } 86 85 87 ipc_answer_1(callid, EOK, hw_resources->count);86 async_answer_1(callid, EOK, hw_resources->count); 88 87 89 88 size_t len; -
uspace/lib/drv/include/dev_iface.h
r64d2b10 rffa2c8ef 36 36 #define LIBDRV_DEV_IFACE_H_ 37 37 38 #include <ipc/common.h> 38 39 #include <ipc/dev_iface.h> 39 40 -
uspace/lib/drv/include/driver.h
r64d2b10 rffa2c8ef 36 36 #define LIBDRV_DRIVER_H_ 37 37 38 #include <kernel/ddi/irq.h> 38 39 #include <adt/list.h> 39 #include <ipc/ipc.h>40 40 #include <devman.h> 41 41 #include <ipc/devman.h>
Note:
See TracChangeset
for help on using the changeset viewer.