Changeset 5106e98 in mainline
- Timestamp:
- 2006-03-16T00:26:33Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 69cdeec
- Parents:
- 7e44122
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r7e44122 r5106e98 38 38 libipc \ 39 39 libadt \ 40 init 40 init \ 41 ns 41 42 42 43 BUILDS := $(addsuffix .build,$(DIRS)) -
init/init.c
r7e44122 r5106e98 29 29 #include "version.h" 30 30 #include <ipc.h> 31 #include <ns.h>32 31 #include <stdio.h> 33 32 #include <unistd.h> 34 33 #include <stdlib.h> 34 #include <ns.h> 35 35 36 36 /* … … 47 47 */ 48 48 49 /* 49 extern char _heap; 50 50 static void test_mremap(void) 51 51 { … … 62 62 printf("memory done\n"); 63 63 } 64 */65 64 /* 66 65 static void test_sbrk(void) … … 92 91 */ 93 92 94 /* 93 94 static void test_ping(void) 95 { 96 ipcarg_t result; 97 int retval; 98 99 retval = ipc_call_sync(PHONE_NS, NS_PING, 0xbeef,&result); 100 printf("Retval: %d - received: %P\n", retval, result); 101 } 102 95 103 static void got_answer(void *private, int retval, ipc_data_t *data) 96 104 { … … 100 108 static void test_async_ipc(void) 101 109 { 102 ipc_ data_t data;110 ipc_call_t data; 103 111 int i; 104 112 … … 123 131 printf("Received call???\n"); 124 132 } 125 */ 133 134 135 static void got_answer_2(void *private, int retval, ipc_data_t *data) 136 { 137 printf("Pong\n"); 138 } 139 static void test_advanced_ipc(void) 140 { 141 int res; 142 unsigned long long taskid; 143 ipc_callid_t callid; 144 ipc_call_t data; 145 146 printf("Asking 0 to connect to me...\n"); 147 res = ipc_connect_to_me(0, 1, 2, &taskid); 148 printf("Result: %d - taskid: %Q\n", res, taskid); 149 // while (1) { 150 printf("----------------\n"); 151 ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov", 152 got_answer_2); 153 callid = ipc_wait_for_call(&data, NULL); 154 printf("Received ping\n"); 155 ipc_answer(callid, 0, 0, 0); 156 // } 157 callid = ipc_wait_for_call(&data, NULL); 158 } 126 159 127 160 int main(int argc, char *argv[]) 128 161 { 129 ipcarg_t arg1, arg2;130 131 162 version_print(); 132 163 133 ipc_call_sync_2(PHONE_NS, NS_PING, 0xaaaa, 0xbbbb, &arg1, &arg2);134 printf("Pong: %P %P\n", arg1, arg2);135 164 // test_ping(); 165 // test_async_ipc(); 166 test_advanced_ipc(); 136 167 return 0; 137 168 } -
libipc/generic/ipc.c
r7e44122 r5106e98 118 118 if (!call) { 119 119 callback(private, ENOMEM, NULL); 120 return; 120 121 } 121 122 … … 222 223 * IPC_WAIT_NONBLOCKING 223 224 */ 224 i nt ipc_wait_for_call(ipc_call_t *call, int flags)225 ipc_callid_t ipc_wait_for_call(ipc_call_t *call, int flags) 225 226 { 226 227 ipc_callid_t callid; … … 237 238 return callid; 238 239 } 240 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 } -
libipc/include/ipc.h
r7e44122 r5106e98 53 53 54 54 55 extern int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, 55 extern int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, 56 56 ipcarg_t *result); 57 extern i nt ipc_wait_for_call(ipc_call_t *data, int flags);57 extern ipc_callid_t ipc_wait_for_call(ipc_call_t *data, int flags); 58 58 extern void ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, 59 59 ipcarg_t arg2); … … 63 63 ipcarg_t arg2, void *private, 64 64 ipc_async_callback_t callback); 65 int ipc_connect_to_me(int phoneid, int arg1, int arg2, 66 unsigned long long *taskid); 65 67 66 68 #endif -
libipc/include/ns.h
r7e44122 r5106e98 30 30 #define __LIBIPC__NS_H__ 31 31 32 #include <kernel/ipc/ns.h> 32 #define NS_PING 1024 33 #define NS_PING_SVC 1025 33 34 34 35 #endif
Note:
See TracChangeset
for help on using the changeset viewer.