IPC
[generic]

HelenOS uspace IPC. More...


Files

file  ipc.h
file  ns.h
file  services.h
 List of all known services and their codes.
file  ipc.c

Data Structures

struct  ipc_call_t
struct  async_call_t

Defines

#define ipc_call_sync_2(phoneid, method, arg1, arg2, res1, res2)   ipc_call_sync_3((phoneid), (method), (arg1), (arg2), 0, (res1), (res2), 0)
#define ipc_call_async(phoneid, method, arg1, private, callback, can_preempt)   (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt))
#define SERVICE_PCI   1
#define SERVICE_KEYBOARD   2
#define SERVICE_VIDEO   3
#define SERVICE_CONSOLE   4
#define SERVICE_MEM_REALTIME   1
#define SERVICE_MEM_KLOG   2

Typedefs

typedef sysarg_t ipcarg_t
typedef sysarg_t ipc_callid_t
typedef void(* ipc_async_callback_t )(void *private, int retval, ipc_call_t *data)

Functions

int ipc_call_sync_3 (int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3)
int ipc_call_sync (int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t *result)
ipc_callid_t ipc_wait_cycle (ipc_call_t *call, uint32_t usec, int flags)
ipc_callid_t ipc_wait_for_call_timeout (ipc_call_t *data, uint32_t usec)
static ipc_callid_t ipc_wait_for_call (ipc_call_t *data)
ipc_callid_t ipc_trywait_for_call (ipc_call_t *data)
ipcarg_t ipc_answer_fast (ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, ipcarg_t arg2)
ipcarg_t ipc_answer (ipc_callid_t callid, ipc_call_t *call)
void ipc_call_async_2 (int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, void *private, ipc_async_callback_t callback, int can_preempt)
void ipc_call_async_3 (int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, void *private, ipc_async_callback_t callback, int can_preempt)
int ipc_connect_to_me (int phoneid, int arg1, int arg2, ipcarg_t *phone)
int ipc_connect_me_to (int phoneid, int arg1, int arg2)
int ipc_hangup (int phoneid)
int ipc_register_irq (int irq, irq_code_t *code)
int ipc_unregister_irq (int irq)
int ipc_forward_fast (ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1)
 LIST_INITIALIZE (dispatched_calls)
 LIST_INITIALIZE (queued_calls)
static ipc_callid_t _ipc_call_async (int phoneid, ipc_call_t *data)
static async_call_tipc_prepare_async (void *private, ipc_async_callback_t callback)
static void ipc_finish_async (ipc_callid_t callid, int phoneid, async_call_t *call, int can_preempt)
static void try_dispatch_queued_calls (void)
static void handle_answer (ipc_callid_t callid, ipc_call_t *data)

Variables

static atomic_t ipc_futex = FUTEX_INITIALIZER

Detailed Description


Define Documentation

#define ipc_call_sync_2 phoneid,
method,
arg1,
arg2,
res1,
res2   )     ipc_call_sync_3((phoneid), (method), (arg1), (arg2), 0, (res1), (res2), 0)
 

Definition at line 54 of file ipc.h.

Referenced by do_send_msg().

#define ipc_call_async phoneid,
method,
arg1,
private,
callback,
can_preempt   )     (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt))
 

Definition at line 75 of file ipc.h.

Referenced by do_send_msg().

#define SERVICE_PCI   1
 

Definition at line 40 of file services.h.

#define SERVICE_KEYBOARD   2
 

Definition at line 41 of file services.h.

Referenced by main().

#define SERVICE_VIDEO   3
 

Definition at line 42 of file services.h.

Referenced by main().

#define SERVICE_CONSOLE   4
 

Definition at line 43 of file services.h.

Referenced by main(), open_stdin(), and open_stdout().

#define SERVICE_MEM_REALTIME   1
 

Definition at line 46 of file services.h.

Referenced by gettimeofday(), and main().

#define SERVICE_MEM_KLOG   2
 

Definition at line 47 of file services.h.

Referenced by main().


Typedef Documentation

typedef sysarg_t ipcarg_t
 

Definition at line 44 of file ipc.h.

typedef sysarg_t ipc_callid_t
 

Definition at line 49 of file ipc.h.

typedef void(* ipc_async_callback_t)(void *private, int retval, ipc_call_t *data)
 

Definition at line 51 of file ipc.h.


Function Documentation

int ipc_call_sync_3 int  phoneid,
ipcarg_t  method,
ipcarg_t  arg1,
ipcarg_t  arg2,
ipcarg_t  arg3,
ipcarg_t result1,
ipcarg_t result2,
ipcarg_t result3
 

Definition at line 99 of file ipc.c.

References __SYSCALL3.

Referenced by gettimeofday(), ipc_connect_me_to(), ipc_connect_to_me(), and main().

int ipc_call_sync int  phoneid,
ipcarg_t  method,
ipcarg_t  arg1,
ipcarg_t result
 

Definition at line 84 of file ipc.c.

References __SYSCALL4.

ipc_callid_t ipc_wait_cycle ipc_call_t call,
uint32_t  usec,
int  flags
 

One cycle of ipc wait for call call

  • dispatch ASYNC reoutines in the background
    Parameters:
    call Space where the message is stored
    usec Timeout in microseconds
    flags Flags passed to SYS_IPC_WAIT (blocking, nonblocking)
    Returns:
    Callid of the answer.

Definition at line 357 of file ipc.c.

References __SYSCALL3, handle_answer(), and try_dispatch_queued_calls().

Referenced by async_manager_worker(), ipc_trywait_for_call(), and ipc_wait_for_call_timeout().

Here is the call graph for this function:

ipc_callid_t ipc_wait_for_call_timeout ipc_call_t call,
uint32_t  usec
 

Wait some time for an IPC call.

  • dispatch ASYNC reoutines in the background

Parameters:
call Space where the message is stored
usec Timeout in microseconds.
Returns:
Callid of the answer.

Definition at line 379 of file ipc.c.

References ipc_wait_cycle().

Referenced by ipc_wait_for_call().

Here is the call graph for this function:

static ipc_callid_t ipc_wait_for_call ipc_call_t data  )  [static]
 

Definition at line 65 of file ipc.h.

References ipc_wait_for_call_timeout().

Referenced by main().

Here is the call graph for this function:

ipc_callid_t ipc_trywait_for_call ipc_call_t call  ) 
 

Check if there is an IPC call waiting to be picked up.

  • dispatch ASYNC reoutines in the background

Parameters:
call Space where the message is stored
Returns:
Callid of the answer.

Definition at line 397 of file ipc.c.

References ipc_wait_cycle().

Here is the call graph for this function:

ipcarg_t ipc_answer_fast ipc_callid_t  callid,
ipcarg_t  retval,
ipcarg_t  arg1,
ipcarg_t  arg2
 

Send a fast answer to a received call.

The fast answer makes use of passing retval and first two arguments in registers. If you need to return more, use the ipc_answer() instead.

Parameters:
callid ID of the call being answered.
retval Return value.
arg1 First return argument.
arg2 Second return argument.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 256 of file ipc.c.

References __SYSCALL4.

Referenced by async_new_connection(), client_connection(), connection_thread(), console_connection(), default_client_connection(), get_as(), handle_call(), keyboard_events(), main(), receive_comm_area(), and sysio_client_connection().

ipcarg_t ipc_answer ipc_callid_t  callid,
ipc_call_t call
 

Send a full answer to a received call.

Parameters:
callid ID of the call being answered.
call Call data. Must be already initialized by the responder.
Returns:
Zero on success or a value from errno.h on failure.

Definition at line 269 of file ipc.c.

References __SYSCALL2.

void ipc_call_async_2 int  phoneid,
ipcarg_t  method,
ipcarg_t  arg1,
ipcarg_t  arg2,
void *  private,
ipc_async_callback_t  callback,
int  can_preempt
 

Send asynchronous message

  • if fatal error, call callback handler with proper error code
  • if message cannot be temporarily sent, add to queue

Definition at line 191 of file ipc.c.

References __SYSCALL4, futex_down(), ipc_finish_async(), ipc_futex, ipc_prepare_async(), async_call_t::msg, and async_call_t::u.

Referenced by async_msg_2(), and async_send_2().

Here is the call graph for this function:

void ipc_call_async_3 int  phoneid,
ipcarg_t  method,
ipcarg_t  arg1,
ipcarg_t  arg2,
ipcarg_t  arg3,
void *  private,
ipc_async_callback_t  callback,
int  can_preempt
 

Send asynchronous message

  • if fatal error, call callback handler with proper error code
  • if message cannot be temporarily sent, add to queue

Definition at line 220 of file ipc.c.

References _ipc_call_async(), futex_down(), ipc_finish_async(), ipc_futex, ipc_prepare_async(), async_call_t::msg, and async_call_t::u.

Referenced by async_msg_3(), and async_send_3().

Here is the call graph for this function:

int ipc_connect_to_me int  phoneid,
int  arg1,
int  arg2,
ipcarg_t phone
 

Ask destination to do a callback connection

Returns:
0 - OK, error code

Definition at line 412 of file ipc.c.

References ipc_call_sync_3().

Referenced by main().

Here is the call graph for this function:

int ipc_connect_me_to int  phoneid,
int  arg1,
int  arg2
 

Ask through phone for a new connection to some service

Returns:
new phoneid - OK, error code

Definition at line 422 of file ipc.c.

References ipc_call_sync_3().

Referenced by do_connect(), main(), open_stdin(), and open_stdout().

Here is the call graph for this function:

int ipc_hangup int  phoneid  ) 
 

Definition at line 435 of file ipc.c.

References __SYSCALL1.

Referenced by console_connection(), and do_hangup().

int ipc_register_irq int  irq,
irq_code_t *  code
 

Definition at line 440 of file ipc.c.

References __SYSCALL2.

Referenced by kbd_arch_init(), and main().

int ipc_unregister_irq int  irq  ) 
 

Definition at line 445 of file ipc.c.

References __SYSCALL1.

int ipc_forward_fast ipc_callid_t  callid,
int  phoneid,
int  method,
ipcarg_t  arg1
 

Definition at line 450 of file ipc.c.

References __SYSCALL4.

Referenced by connect_to_service().

LIST_INITIALIZE dispatched_calls   ) 
 

LIST_INITIALIZE queued_calls   ) 
 

List of async calls that were not accepted by kernel

static ipc_callid_t _ipc_call_async int  phoneid,
ipc_call_t data
[static]
 

Syscall to send asynchronous message

Definition at line 126 of file ipc.c.

References __SYSCALL2.

Referenced by ipc_call_async_3(), and try_dispatch_queued_calls().

static async_call_t* ipc_prepare_async void *  private,
ipc_async_callback_t  callback
[static]
 

Prolog to ipc_async_send functions

Definition at line 132 of file ipc.c.

References callback(), and NULL.

Referenced by ipc_call_async_2(), and ipc_call_async_3().

Here is the call graph for this function:

static void ipc_finish_async ipc_callid_t  callid,
int  phoneid,
async_call_t call,
int  can_preempt
[static]
 

Epilogue of ipc_async_send functions

Definition at line 149 of file ipc.c.

References async_futex, async_call_t::callback, async_call_t::callid, futex_down(), futex_up(), ipc_futex, async_call_t::list, list_append(), async_call_t::msg, NULL, async_call_t::private, PS_TO_MANAGER, psthread_get_id(), psthread_schedule_next_adv(), async_call_t::ptid, and async_call_t::u.

Referenced by ipc_call_async_2(), and ipc_call_async_3().

Here is the call graph for this function:

static void try_dispatch_queued_calls void   )  [static]
 

Try to dispatch queed calls from async queue

Definition at line 276 of file ipc.c.

References _ipc_call_async(), async_futex, async_call_t::callback, async_call_t::callid, futex_down(), futex_up(), ipc_futex, async_call_t::list, list_append(), list_empty(), list_get_instance, list_remove(), async_call_t::msg, NULL, async_call_t::private, psthread_add_ready(), async_call_t::ptid, and async_call_t::u.

Referenced by ipc_wait_cycle().

Here is the call graph for this function:

static void handle_answer ipc_callid_t  callid,
ipc_call_t data
[static]
 

Handle received answer

TODO: Make it use hash table

Parameters:
callid Callid (with first bit set) of the answered call

Definition at line 322 of file ipc.c.

References async_call_t::callback, async_call_t::callid, futex_down(), futex_up(), ipc_futex, async_call_t::list, list_get_instance, list_remove(), link::next, printf(), async_call_t::private, and async_call_t::u.

Referenced by ipc_wait_cycle().

Here is the call graph for this function:


Variable Documentation

atomic_t ipc_futex = FUTEX_INITIALIZER [static]
 

Definition at line 82 of file ipc.c.

Referenced by handle_answer(), ipc_call_async_2(), ipc_call_async_3(), ipc_finish_async(), and try_dispatch_queued_calls().


Generated on Sun Jun 18 18:04:41 2006 for HelenOS Userspace (ia64) by  doxygen 1.4.6