Subversion Repositories HelenOS-historic

Rev

Rev 1418 | Rev 1462 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1418 Rev 1435
Line 38... Line 38...
38
#include <stdlib.h>
38
#include <stdlib.h>
39
#include <errno.h>
39
#include <errno.h>
40
#include <assert.h>
40
#include <assert.h>
41
#include <libadt/list.h>
41
#include <libadt/list.h>
42
#include <libadt/hash_table.h>
42
#include <libadt/hash_table.h>
-
 
43
#include <sysinfo.h>
-
 
44
#include <ddi.h>
-
 
45
#include <as.h>
43
 
46
 
44
#define NAME    "NS"
47
#define NAME    "NS"
45
 
48
 
46
#define NS_HASH_TABLE_CHAINS    20
49
#define NS_HASH_TABLE_CHAINS    20
47
 
50
 
Line 71... Line 74...
71
    ipcarg_t in_phone_hash;     /**< Incoming phone hash. */
74
    ipcarg_t in_phone_hash;     /**< Incoming phone hash. */
72
} hashed_service_t;
75
} hashed_service_t;
73
 
76
 
74
int static ping_phone;
77
int static ping_phone;
75
 
78
 
-
 
79
static void get_realtime_as(ipc_callid_t callid, ipc_call_t *call)
-
 
80
{
-
 
81
    static void *addr = NULL;
-
 
82
    void *ph_addr;
-
 
83
 
-
 
84
    if (IPC_GET_ARG3(*call) != (AS_AREA_READ | AS_AREA_CACHEABLE)) {
-
 
85
        ipc_answer_fast(callid, EPERM, 0, 0);
-
 
86
        return;
-
 
87
    }
-
 
88
    if (!addr) {
-
 
89
        ph_addr = (void *)sysinfo_value("clock.faddr");
-
 
90
        if (!ph_addr) {
-
 
91
            ipc_answer_fast(callid, ENOENT, 0, 0);
-
 
92
            return;
-
 
93
        }
-
 
94
        addr = (void *)(200*1024*1024); /* TODO: intelligent freemem space */
-
 
95
        map_physmem(task_get_id(), ph_addr, addr, 1,
-
 
96
                AS_AREA_READ | AS_AREA_CACHEABLE);
-
 
97
    }
-
 
98
    ipc_answer_fast(callid, 0, (ipcarg_t)addr, 0);
-
 
99
}
-
 
100
 
76
int main(int argc, char **argv)
101
int main(int argc, char **argv)
77
{
102
{
78
    ipc_call_t call;
103
    ipc_call_t call;
79
    ipc_callid_t callid;
104
    ipc_callid_t callid;
80
    char *as_area;
105
    char *as_area;
Line 100... Line 125...
100
//              printf("Reading shared memory...");
125
//              printf("Reading shared memory...");
101
//              printf("Text: %s", as_area);
126
//              printf("Text: %s", as_area);
102
            } else
127
            } else
103
//              printf("Failed answer: %d\n", retval);
128
//              printf("Failed answer: %d\n", retval);
104
            continue;
129
            continue;
-
 
130
        case IPC_M_AS_AREA_RECV:
-
 
131
            get_realtime_as(callid, &call);
105
            break;
132
            continue;
106
        case IPC_M_INTERRUPT:
133
        case IPC_M_INTERRUPT:
107
//          printf("GOT INTERRUPT: %c\n", IPC_GET_ARG2(call));
-
 
108
            break;
134
            break;
109
        case IPC_M_PHONE_HUNGUP:
135
        case IPC_M_PHONE_HUNGUP:
110
//          printf("Phone hung up.\n");
-
 
111
            retval = 0;
136
            retval = 0;
112
            break;
137
            break;
113
        case IPC_M_CONNECT_TO_ME:
138
        case IPC_M_CONNECT_TO_ME:
114
            /*
139
            /*
115
             * Server requests service registration.
140
             * Server requests service registration.