Subversion Repositories HelenOS-historic

Rev

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

Rev 1596 Rev 1610
Line 35... Line 35...
35
#include <atomic.h>
35
#include <atomic.h>
36
 
36
 
37
typedef ipc_callid_t aid_t;
37
typedef ipc_callid_t aid_t;
38
typedef void (*async_client_conn_t)(ipc_callid_t callid, ipc_call_t *call);
38
typedef void (*async_client_conn_t)(ipc_callid_t callid, ipc_call_t *call);
39
 
39
 
40
int async_manager(void);
40
static inline void async_manager(void)
-
 
41
{
-
 
42
    psthread_schedule_next_adv(PS_TO_MANAGER);
-
 
43
}
-
 
44
 
41
ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs);
45
ipc_callid_t async_get_call_timeout(ipc_call_t *call, suseconds_t usecs);
42
static inline ipc_callid_t async_get_call(ipc_call_t *data)
46
static inline ipc_callid_t async_get_call(ipc_call_t *data)
43
{
47
{
44
    return async_get_call_timeout(data, 0);
48
    return async_get_call_timeout(data, 0);
45
}
49
}
Line 55... Line 59...
55
 *
59
 *
56
 * Send message through IPC, wait in the event loop, until it is received
60
 * Send message through IPC, wait in the event loop, until it is received
57
 *
61
 *
58
 * @return Return code of message
62
 * @return Return code of message
59
 */
63
 */
60
static inline ipcarg_t sync_send_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t *r1, ipcarg_t *r2)
64
static inline ipcarg_t async_req_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t *r1, ipcarg_t *r2)
61
{
65
{
62
    ipc_call_t result;
66
    ipc_call_t result;
63
    ipcarg_t rc;
67
    ipcarg_t rc;
64
 
68
 
65
    aid_t eid = async_send_2(phoneid, method, arg1, arg2, &result);
69
    aid_t eid = async_send_2(phoneid, method, arg1, arg2, &result);
Line 68... Line 72...
68
        *r1 = IPC_GET_ARG1(result);
72
        *r1 = IPC_GET_ARG1(result);
69
    if (r2)
73
    if (r2)
70
        *r2 = IPC_GET_ARG2(result);
74
        *r2 = IPC_GET_ARG2(result);
71
    return rc;
75
    return rc;
72
}
76
}
73
#define sync_send(phoneid, method, arg1, r1) sync_send_2(phoneid, method, arg1, 0, r1, 0)
77
#define async_req(phoneid, method, arg1, r1) async_req_2(phoneid, method, arg1, 0, r1, 0)
74
 
78
 
75
static inline ipcarg_t sync_send_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
79
static inline ipcarg_t async_req_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
76
                   ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *r1,
80
                   ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *r1,
77
                   ipcarg_t *r2, ipcarg_t *r3)
81
                   ipcarg_t *r2, ipcarg_t *r3)
78
{
82
{
79
    ipc_call_t result;
83
    ipc_call_t result;
80
    ipcarg_t rc;
84
    ipcarg_t rc;
Line 100... Line 104...
100
void async_set_client_connection(async_client_conn_t conn);
104
void async_set_client_connection(async_client_conn_t conn);
101
void async_set_interrupt_received(async_client_conn_t conn);
105
void async_set_interrupt_received(async_client_conn_t conn);
102
int _async_init(void);
106
int _async_init(void);
103
 
107
 
104
 
108
 
-
 
109
/* Primitve functions for IPC communication */
-
 
110
void async_msg_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
-
 
111
         ipcarg_t arg3);
-
 
112
void async_msg_2(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2);
-
 
113
#define async_msg(ph,m,a1) async_msg_2(ph,m,a1,0)
-
 
114
 
-
 
115
static inline void async_serialize_start(void)
-
 
116
{
105
extern atomic_t async_futex;
117
    psthread_inc_sercount();
-
 
118
}
-
 
119
static inline void async_serialize_end(void)
-
 
120
{
-
 
121
    psthread_dec_sercount();
-
 
122
}
106
 
123
 
-
 
124
extern atomic_t async_futex;
107
#endif
125
#endif