Changeset 4c61e60 in mainline
- Timestamp:
- 2006-03-19T19:42:38Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 06b0d112
- Parents:
- 7048773
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
init/init.c
r7048773 r4c61e60 113 113 int retval; 114 114 115 printf("Pinging\n"); 115 116 retval = ipc_call_sync(PHONE_NS, NS_PING, 0xbeef,&result); 116 117 printf("Retval: %d - received: %P\n", retval, result); 117 118 } 118 119 119 static void got_answer(void *private, int retval, ipc_ data_t *data)120 static void got_answer(void *private, int retval, ipc_call_t *data) 120 121 { 121 122 printf("Retval: %d...%s...%zX, %zX\n", retval, private, … … 149 150 150 151 151 static void got_answer_2(void *private, int retval, ipc_ data_t *data)152 static void got_answer_2(void *private, int retval, ipc_call_t *data) 152 153 { 153 154 printf("Pong\n"); … … 156 157 { 157 158 int res; 158 unsigned long long taskid;159 ipcarg_t phonead; 159 160 ipc_callid_t callid; 160 161 ipc_call_t data; … … 162 163 163 164 printf("Asking 0 to connect to me...\n"); 164 res = ipc_connect_to_me(0, 1, 2, & taskid);165 printf("Result: %d - taskid: %llu\n", res, taskid);165 res = ipc_connect_to_me(0, 1, 2, &phonead); 166 printf("Result: %d - phonead: %llu\n", res, phonead); 166 167 for (i=0; i < 100; i++) { 167 168 printf("----------------\n"); … … 179 180 int res; 180 181 ipcarg_t result; 182 int phoneid; 181 183 182 184 printf("Starting connect...\n"); … … 253 255 // test_connection_ipc(); 254 256 // test_hangup(); 255 test_slam();256 257 //if ((tid = thread_create(utest, NULL, "utest") != -1)) {258 //printf("Created thread tid=%d\n", tid);259 //}257 // test_slam(); 258 259 if ((tid = thread_create(utest, NULL, "utest") != -1)) { 260 printf("Created thread tid=%d\n", tid); 261 } 260 262 return 0; 261 263 } -
libipc/generic/ipc.c
r7048773 r4c61e60 47 47 ipc_callid_t callid; 48 48 struct { 49 ipc_call_t data; 49 50 int phoneid; 50 ipc_data_t data;51 51 } msg; 52 52 }u; … … 59 59 ipcarg_t *result) 60 60 { 61 ipc_ data_t resdata;61 ipc_call_t resdata; 62 62 int callres; 63 63 … … 75 75 ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3) 76 76 { 77 ipc_ data_t data;77 ipc_call_t data; 78 78 int callres; 79 79 … … 98 98 99 99 /** Syscall to send asynchronous message */ 100 static ipc_callid_t _ipc_call_async(int phoneid, ipc_ data_t *data)100 static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data) 101 101 { 102 102 return __SYSCALL2(SYS_IPC_CALL_ASYNC, phoneid, (sysarg_t)data); … … 153 153 { 154 154 __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2); 155 }156 157 158 /** Call syscall function sys_ipc_wait_for_call */159 static inline ipc_callid_t _ipc_wait_for_call(ipc_call_t *call, int flags)160 {161 return __SYSCALL3(SYS_IPC_WAIT, (sysarg_t)&call->data,162 (sysarg_t)&call->taskid, flags);163 155 } 164 156 … … 194 186 * @param callid Callid (with first bit set) of the answered call 195 187 */ 196 static void handle_answer(ipc_callid_t callid, ipc_ data_t *data)188 static void handle_answer(ipc_callid_t callid, ipc_call_t *data) 197 189 { 198 190 link_t *item; … … 230 222 try_dispatch_queued_calls(); 231 223 232 callid = _ ipc_wait_for_call(call, flags);224 callid = __SYSCALL2(SYS_IPC_WAIT, (sysarg_t)call, flags); 233 225 /* Handle received answers */ 234 226 if (callid & IPC_CALLID_ANSWERED) 235 handle_answer(callid, &call->data);227 handle_answer(callid, call); 236 228 } while (callid & IPC_CALLID_ANSWERED); 237 229 … … 239 231 } 240 232 241 /** Ask destination to do a callback connection */ 242 int ipc_connect_to_me(int phoneid, int arg1, int arg2, 243 unsigned long long *taskid) 244 { 245 return __SYSCALL4(SYS_IPC_CONNECT_TO_ME, phoneid, arg1, arg2, 246 (sysarg_t) taskid); 247 } 248 249 /** Ask through phone for a new connection to some service */ 233 /** Ask destination to do a callback connection 234 * 235 * @return 0 - OK, error code 236 */ 237 int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone) 238 { 239 return ipc_call_sync_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, 240 arg2, 0, 0, 0, phone); 241 } 242 243 /** Ask through phone for a new connection to some service 244 * 245 * @return new phoneid - OK, error code 246 */ 250 247 int ipc_connect_me_to(int phoneid, int arg1, int arg2) 251 248 { 252 return __SYSCALL3(SYS_IPC_CONNECT_ME_TO, phoneid, arg1, arg2); 249 int newphid; 250 int res; 251 252 res = ipc_call_sync_3(phoneid, IPC_M_CONNECT_ME_TO, arg1, 253 arg2, 0, 0, 0, &newphid); 254 if (res) 255 return res; 256 return newphid; 253 257 } 254 258 -
libipc/include/ipc.h
r7048773 r4c61e60 36 36 typedef sysarg_t ipcarg_t; 37 37 typedef struct { 38 sysarg_t args[IPC_CALL_LEN]; 39 sysarg_t phoneid; 40 } ipc_data_t ; 41 typedef struct { 42 unsigned long long taskid; 43 ipc_data_t data; 44 }ipc_call_t; 38 ipcarg_t args[IPC_CALL_LEN]; 39 ipcarg_t phoneid; 40 } ipc_call_t ; 45 41 typedef sysarg_t ipc_callid_t; 46 42 47 typedef void (* ipc_async_callback_t)(void *private, 48 int retval, 49 ipc_data_t *data); 43 typedef void (* ipc_async_callback_t)(void *private, int retval, 44 ipc_call_t *data); 50 45 51 46 #define ipc_call_sync_2(phoneid, method, arg1, arg2, res1, res2) ipc_call_sync_3((phoneid), (method), (arg1), (arg2), 0, (res1), (res2), 0) … … 66 61 ipcarg_t arg2, void *private, 67 62 ipc_async_callback_t callback); 68 int ipc_connect_to_me(int phoneid, int arg1, int arg2, 69 unsigned long long *taskid); 63 int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone); 70 64 int ipc_connect_me_to(int phoneid, int arg1, int arg2); 71 65 int ipc_hangup(int phoneid); -
ns/ns.c
r7048773 r4c61e60 17 17 printf("NS:Name service started.\n"); 18 18 while (1) { 19 call.taskid = -1;20 19 callid = ipc_wait_for_call(&call, 0); 21 printf("NS:Call task=%llX,phone=%lX..", 22 call.taskid,call.data.phoneid); 23 switch (IPC_GET_METHOD(call.data)) { 20 printf("NS:Call phone=%lX..", call.phoneid); 21 switch (IPC_GET_METHOD(call)) { 24 22 case IPC_M_PHONE_HUNGUP: 25 23 printf("Phone hung up.\n"); … … 27 25 break; 28 26 case IPC_M_CONNECT_TO_ME: 29 printf("Somebody connecting phid=%zd.\n", IPC_GET_ARG3(call .data));30 service = IPC_GET_ARG3(call .data);27 printf("Somebody connecting phid=%zd.\n", IPC_GET_ARG3(call)); 28 service = IPC_GET_ARG3(call); 31 29 retval = 0; 32 30 break; 33 31 case IPC_M_CONNECT_ME_TO: 34 printf("Connectme to: %zd\n",35 IPC_GET_ARG 1(call.data));32 printf("Connectme(%P)to: %zd\n", 33 IPC_GET_ARG3(call), IPC_GET_ARG1(call)); 36 34 retval = 0; 37 35 break; 38 36 case NS_PING: 39 printf("Ping...%P %P\n", IPC_GET_ARG1(call .data),40 IPC_GET_ARG2(call .data));37 printf("Ping...%P %P\n", IPC_GET_ARG1(call), 38 IPC_GET_ARG2(call)); 41 39 retval = 0; 42 40 arg1 = 0xdead; … … 53 51 break; 54 52 default: 55 printf("Unknown method: %zd\n", IPC_GET_METHOD(call .data));53 printf("Unknown method: %zd\n", IPC_GET_METHOD(call)); 56 54 retval = ENOENT; 57 55 break;
Note:
See TracChangeset
for help on using the changeset viewer.