Rev 1089 | Rev 1111 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1089 | Rev 1091 | ||
---|---|---|---|
Line 110... | Line 110... | ||
110 | static void test_ping(void) |
110 | static void test_ping(void) |
111 | { |
111 | { |
112 | ipcarg_t result; |
112 | ipcarg_t result; |
113 | int retval; |
113 | int retval; |
114 | 114 | ||
- | 115 | printf("Pinging\n"); |
|
115 | retval = ipc_call_sync(PHONE_NS, NS_PING, 0xbeef,&result); |
116 | retval = ipc_call_sync(PHONE_NS, NS_PING, 0xbeef,&result); |
116 | printf("Retval: %d - received: %P\n", retval, result); |
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 | printf("Retval: %d...%s...%zX, %zX\n", retval, private, |
122 | printf("Retval: %d...%s...%zX, %zX\n", retval, private, |
122 | IPC_GET_ARG1(*data), IPC_GET_ARG2(*data)); |
123 | IPC_GET_ARG1(*data), IPC_GET_ARG2(*data)); |
123 | } |
124 | } |
124 | static void test_async_ipc(void) |
125 | static void test_async_ipc(void) |
Line 146... | Line 147... | ||
146 | ipc_wait_for_call(&data, NULL); |
147 | ipc_wait_for_call(&data, NULL); |
147 | printf("Received call???\n"); |
148 | printf("Received call???\n"); |
148 | } |
149 | } |
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 | printf("Pong\n"); |
154 | printf("Pong\n"); |
154 | } |
155 | } |
155 | static void test_advanced_ipc(void) |
156 | static void test_advanced_ipc(void) |
156 | { |
157 | { |
157 | int res; |
158 | int res; |
158 | unsigned long long taskid; |
159 | ipcarg_t phonead; |
159 | ipc_callid_t callid; |
160 | ipc_callid_t callid; |
160 | ipc_call_t data; |
161 | ipc_call_t data; |
161 | int i; |
162 | int i; |
162 | 163 | ||
163 | printf("Asking 0 to connect to me...\n"); |
164 | printf("Asking 0 to connect to me...\n"); |
164 | res = ipc_connect_to_me(0, 1, 2, &taskid); |
165 | res = ipc_connect_to_me(0, 1, 2, &phonead); |
165 | printf("Result: %d - taskid: %llu\n", res, taskid); |
166 | printf("Result: %d - phonead: %llu\n", res, phonead); |
166 | for (i=0; i < 100; i++) { |
167 | for (i=0; i < 100; i++) { |
167 | printf("----------------\n"); |
168 | printf("----------------\n"); |
168 | ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov", |
169 | ipc_call_async(PHONE_NS, NS_PING_SVC, 0, "prov", |
169 | got_answer_2); |
170 | got_answer_2); |
170 | callid = ipc_wait_for_call(&data, NULL); |
171 | callid = ipc_wait_for_call(&data, NULL); |
Line 176... | Line 177... | ||
176 | 177 | ||
177 | static void test_connection_ipc(void) |
178 | static void test_connection_ipc(void) |
178 | { |
179 | { |
179 | int res; |
180 | int res; |
180 | ipcarg_t result; |
181 | ipcarg_t result; |
- | 182 | int phoneid; |
|
181 | 183 | ||
182 | printf("Starting connect...\n"); |
184 | printf("Starting connect...\n"); |
183 | res = ipc_connect_me_to(PHONE_NS, 10, 20); |
185 | res = ipc_connect_me_to(PHONE_NS, 10, 20); |
184 | printf("Connected: %d\n", res); |
186 | printf("Connected: %d\n", res); |
185 | printf("pinging.\n"); |
187 | printf("pinging.\n"); |
Line 250... | Line 252... | ||
250 | // test_ping(); |
252 | // test_ping(); |
251 | // test_async_ipc(); |
253 | // test_async_ipc(); |
252 | // test_advanced_ipc(); |
254 | // test_advanced_ipc(); |
253 | // test_connection_ipc(); |
255 | // test_connection_ipc(); |
254 | // test_hangup(); |
256 | // test_hangup(); |
255 | test_slam(); |
257 | // test_slam(); |
256 | 258 | ||
257 | // if ((tid = thread_create(utest, NULL, "utest") != -1)) { |
259 | if ((tid = thread_create(utest, NULL, "utest") != -1)) { |
258 | // printf("Created thread tid=%d\n", tid); |
260 | printf("Created thread tid=%d\n", tid); |
259 | // } |
261 | } |
260 | return 0; |
262 | return 0; |
261 | } |
263 | } |