Changeset 8b655705 in mainline for uspace/lib/drv/generic/remote_char_dev.c
- Timestamp:
- 2011-04-15T19:38:07Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9dd730d1
- Parents:
- 6b9e85b (diff), b2fb47f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_char_dev.c
r6b9e85b r8b655705 33 33 */ 34 34 35 #include <ipc/ipc.h>36 35 #include <async.h> 37 36 #include <errno.h> 38 37 39 38 #include "ops/char_dev.h" 40 #include "d river.h"39 #include "ddf/driver.h" 41 40 42 41 #define MAX_CHAR_RW_COUNT 256 43 42 44 static void remote_char_read(d evice_t *, void *, ipc_callid_t, ipc_call_t *);45 static void remote_char_write(d evice_t *, void *, ipc_callid_t, ipc_call_t *);43 static void remote_char_read(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 44 static void remote_char_write(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 46 45 47 46 /** Remote character interface operations. */ … … 68 67 * local interface to the remote client. 69 68 * 70 * @param dev The devicefrom which the data are read.69 * @param fun The function from which the data are read. 71 70 * @param ops The local ops structure. 72 71 */ 73 72 static void 74 remote_char_read(d evice_t *dev, void *ops, ipc_callid_t callid,73 remote_char_read(ddf_fun_t *fun, void *ops, ipc_callid_t callid, 75 74 ipc_call_t *call) 76 75 { … … 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 } … … 95 94 96 95 char buf[MAX_CHAR_RW_COUNT]; 97 int ret = (*char_dev_ops->read)( dev, buf, len);96 int ret = (*char_dev_ops->read)(fun, buf, len); 98 97 99 98 if (ret < 0) { 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 … … 115 114 * local interface to the remote client. 116 115 * 117 * @param dev The deviceto which the data are written.116 * @param fun The function to which the data are written. 118 117 * @param ops The local ops structure. 119 118 */ 120 119 static void 121 remote_char_write(d evice_t *dev, void *ops, ipc_callid_t callid,120 remote_char_write(ddf_fun_t *fun, void *ops, ipc_callid_t callid, 122 121 ipc_call_t *call) 123 122 { … … 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 } … … 145 144 async_data_write_finalize(cid, buf, len); 146 145 147 int ret = (*char_dev_ops->write)( dev, buf, len);146 int ret = (*char_dev_ops->write)(fun, buf, len); 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 }
Note:
See TracChangeset
for help on using the changeset viewer.