Changeset 5106e98 in mainline for init/init.c


Ignore:
Timestamp:
2006-03-16T00:26:33Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
69cdeec
Parents:
7e44122
Message:

Added simple testing skeleton for nameservice.
Added support for ipc_connect_to_me, some fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • init/init.c

    r7e44122 r5106e98  
    2929#include "version.h"
    3030#include <ipc.h>
    31 #include <ns.h>
    3231#include <stdio.h>
    3332#include <unistd.h>
    3433#include <stdlib.h>
     34#include <ns.h>
    3535
    3636/*
     
    4747*/
    4848
    49 /*
     49extern char _heap;
    5050static void test_mremap(void)
    5151{
     
    6262        printf("memory done\n");
    6363}
    64 */
    6564/*
    6665static void test_sbrk(void)
     
    9291*/
    9392
    94 /*
     93
     94static 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
    95103static void got_answer(void *private, int retval, ipc_data_t *data)
    96104{
     
    100108static void test_async_ipc(void)
    101109{
    102         ipc_data_t data;
     110        ipc_call_t data;
    103111        int i;
    104112
     
    123131        printf("Received call???\n");
    124132}
    125 */
     133
     134
     135static void got_answer_2(void *private, int retval, ipc_data_t *data)
     136{
     137        printf("Pong\n");
     138}
     139static 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}
    126159
    127160int main(int argc, char *argv[])
    128161{
    129         ipcarg_t arg1, arg2;
    130 
    131162        version_print();
    132163
    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();
    136167        return 0;
    137168}
Note: See TracChangeset for help on using the changeset viewer.