Changeset 2e51969 in mainline for uspace/lib/libc/generic/ipc.c
- Timestamp:
- 2007-11-19T12:20:10Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0c09f2b
- Parents:
- e0bc7fc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/ipc.c
re0bc7fc r2e51969 85 85 /** Make a fast synchronous call. 86 86 * 87 * Only one payload argument can be passed using this function. However, this 88 * function is faster than the generic ipc_call_sync_3(). 89 * 90 * @param phoneid Phone handle for the call. 91 * @param method Requested method. 92 * @param arg1 Service-defined payload argument. 93 * @param result If non-NULL, the return ARG1 will be stored there. 94 * 95 * @return Negative values represent errors returned by IPC. 96 * Otherwise the RETVAL of the answer is returned. 97 */ 98 int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t *result) 99 { 100 ipc_call_t resdata; 101 int callres; 102 103 callres = __SYSCALL4(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1, 104 (sysarg_t) &resdata); 105 if (callres) 106 return callres; 107 if (result) 108 *result = IPC_GET_ARG1(resdata); 109 return IPC_GET_RETVAL(resdata); 110 } 111 112 /** Make a synchronous call transmitting 3 arguments of payload. 87 * Only three payload arguments can be passed using this function. However, this 88 * function is faster than the generic ipc_call_sync_slow() because the payload 89 * is passed directly in registers. 113 90 * 114 91 * @param phoneid Phone handle for the call. … … 117 94 * @param arg2 Service-defined payload argument. 118 95 * @param arg3 Service-defined payload argument. 96 * @param result1 If non-NULL, the return ARG1 will be stored there. 97 * @param result2 If non-NULL, the return ARG2 will be stored there. 98 * @param result3 If non-NULL, the return ARG3 will be stored there. 99 * @param result4 If non-NULL, the return ARG4 will be stored there. 100 * @param result5 If non-NULL, the return ARG5 will be stored there. 101 * 102 * @return Negative values represent errors returned by IPC. 103 * Otherwise the RETVAL of the answer is returned. 104 */ 105 int 106 ipc_call_sync_fast(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 107 ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3, 108 ipcarg_t *result4, ipcarg_t *result5) 109 { 110 ipc_call_t resdata; 111 int callres; 112 113 callres = __SYSCALL6(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1, 114 arg2, arg3, (sysarg_t) &resdata); 115 if (callres) 116 return callres; 117 if (result1) 118 *result1 = IPC_GET_ARG1(resdata); 119 if (result2) 120 *result2 = IPC_GET_ARG2(resdata); 121 if (result3) 122 *result3 = IPC_GET_ARG3(resdata); 123 if (result4) 124 *result4 = IPC_GET_ARG4(resdata); 125 if (result5) 126 *result5 = IPC_GET_ARG5(resdata); 127 128 return IPC_GET_RETVAL(resdata); 129 } 130 131 /** Make a synchronous call transmitting 5 arguments of payload. 132 * 133 * @param phoneid Phone handle for the call. 134 * @param method Requested method. 135 * @param arg1 Service-defined payload argument. 136 * @param arg2 Service-defined payload argument. 137 * @param arg3 Service-defined payload argument. 138 * @param arg4 Service-defined payload argument. 139 * @param arg5 Service-defined payload argument. 119 140 * @param result1 If non-NULL, storage for the first return argument. 120 141 * @param result2 If non-NULL, storage for the second return argument. 121 142 * @param result3 If non-NULL, storage for the third return argument. 143 * @param result4 If non-NULL, storage for the fourth return argument. 144 * @param result5 If non-NULL, storage for the fifth return argument. 122 145 * 123 146 * @return Negative value means IPC error. 124 147 * Otherwise the RETVAL of the answer. 125 148 */ 126 int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 127 ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3) 149 int 150 ipc_call_sync_slow(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, 151 ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t *result1, 152 ipcarg_t *result2, ipcarg_t *result3, ipcarg_t *result4, ipcarg_t *result5) 128 153 { 129 154 ipc_call_t data; … … 134 159 IPC_SET_ARG2(data, arg2); 135 160 IPC_SET_ARG3(data, arg3); 136 137 callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t) &data, 161 IPC_SET_ARG4(data, arg4); 162 IPC_SET_ARG5(data, arg5); 163 164 callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid, (sysarg_t) &data, 138 165 (sysarg_t) &data); 139 166 if (callres) … … 146 173 if (result3) 147 174 *result3 = IPC_GET_ARG3(data); 175 if (result4) 176 *result4 = IPC_GET_ARG4(data); 177 if (result5) 178 *result5 = IPC_GET_ARG5(data); 179 148 180 return IPC_GET_RETVAL(data); 149 181 } … … 516 548 int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phonehash) 517 549 { 518 return ipc_call_sync_ 3(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2, 0, 0,519 0, phonehash);550 return ipc_call_sync_2_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2, 551 NULL, NULL, phonehash); 520 552 } 521 553 … … 533 565 int res; 534 566 535 res = ipc_call_sync_ 3(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, 0, 0, 0,536 &newphid);567 res = ipc_call_sync_2_3(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, NULL, 568 NULL, &newphid); 537 569 if (res) 538 570 return res; … … 606 638 int ipc_data_send(int phoneid, void *src, size_t size) 607 639 { 608 return ipc_call_sync_3 (phoneid, IPC_M_DATA_SEND, 0, (ipcarg_t) src,609 (ipcarg_t) size , NULL, NULL, NULL);640 return ipc_call_sync_3_0(phoneid, IPC_M_DATA_SEND, 0, (ipcarg_t) src, 641 (ipcarg_t) size); 610 642 } 611 643
Note:
See TracChangeset
for help on using the changeset viewer.